a flake module to ease creating and managing multiple hosts in your nix flake.
Nix 100.0%
20 1 0

Clone this repository

https://tangled.org/tgirl.cloud/easy-hosts
git@tangled.org:tgirl.cloud/easy-hosts

For self-hosted knots, clone URLs may differ based on your setup.

README.md

Easy Hosts#

This is a nix flake module, this means that it is intended to be used alongside flake-parts.

You can find some examples of how to use this module in the examples directory.

Why use this?#

We provide you with the following attributes self' and inputs' that can be used to make your configuration shorter going from writing. See the below for usage

- inputs.input-name.packages.${pkgs.system}.package-name
+ inputs'.input-name.packages.package-name

- self.packages.${pkgs.system}.package-name
+ self'.packages.package-name

We also can auto construct your hosts based on your file structure. Whilst providing you with a nice api which will allow you to add more settings to your hosts at a later date or consume another flake-module that can work alongside this flake.

Explanation of the module#

TIP

You can find rendered documentation on the flake.parts website

  • easyHosts.autoConstruct: If set to true, the module will automatically construct the hosts for you from the directory structure of easyHosts.path.

  • easyHosts.path: The directory to where the hosts are stored, this must be set to use easyHosts.autoConstruct.

  • easyHosts.onlySystem: If you only have 1 system type like aarch64-darwin then you can use this setting to prevent nesting your directories.

  • easyHosts.shared: The shared options for all the hosts.

    • modules: A list of modules that will be included in all the hosts.
    • specialArgs: A list of special arguments that will be passed to all the hosts.
  • easyHosts.perClass: This provides you with the class argument such that you can specify what classes get which modules.

    • modules: A list of modules that will be included in all the hosts of the given class.
    • specialArgs: A list of special arguments that will be passed to all the hosts of the given class.
  • easyHosts.additionalClasses: This is an attrset of strings with mappings to any of [ "nixos", "darwin", "iso" ]. The intention here to provide a nicer api for perClass to operate, you may find yourself including wsl as a class beacuse of this.

  • easyHosts.hosts.<host>: The options for the given host.

    • path: the path to the host, this is not strictly needed if you have a flat directory called hosts or systems.
    • arch: The architecture of the host.
    • modules: A list of modules that will be included in the host.
    • class: the class of the host, this can be one of [ "nixos", "darwin", "iso" ] or anything defined by easyHosts.additonalClasses.
    • specialArgs: A list of special arguments that will be passed to the host.
    • deployable: this was added for people who may want to consume a deploy-rs or colmena flakeModule.

Similar projects#

Real world examples#