a flake module to ease creating and managing multiple hosts in your nix flake.
at main 66 lines 3.8 kB view raw view rendered
1# Easy Hosts 2 3This is a nix flake module, this means that it is intended to be used alongside [flake-parts](https://flake.parts). 4 5You can find some examples of how to use this module in the [examples](./examples) directory. 6 7## Why use this? 8 9We 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 10 11```diff 12- inputs.input-name.packages.${pkgs.system}.package-name 13+ inputs'.input-name.packages.package-name 14 15- self.packages.${pkgs.system}.package-name 16+ self'.packages.package-name 17``` 18 19We 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. 20 21## Explanation of the module 22 23> [!TIP] 24> You can find rendered documentation on the [flake.parts website](https://flake.parts/options/easy-hosts.html) 25 26- `easy-hosts.autoConstruct`: If set to true, the module will automatically construct the hosts for you from the directory structure of `easy-hosts.path`. 27 28- `easy-hosts.path`: The directory to where the hosts are stored, this *must* be set to use `easy-hosts.autoConstruct`. 29 30- `easy-hosts.onlySystem`: If you only have 1 system type like `aarch64-darwin` then you can use this setting to prevent nesting your directories. 31 32- `easy-hosts.shared`: The shared options for all the hosts. 33 - `modules`: A list of modules that will be included in all the hosts. 34 - `specialArgs`: A list of special arguments that will be passed to all the hosts. 35 36- `easy-hosts.perClass`: This provides you with the `class` argument such that you can specify what classes get which modules. 37 - `modules`: A list of modules that will be included in all the hosts of the given class. 38 - `specialArgs`: A list of special arguments that will be passed to all the hosts of the given class. 39 40- `easy-hosts.perArch`: This provides you with the `arch` argument such that you can specify what architectures get which modules. 41 - `modules`: A list of modules that will be included in all the hosts of the given arch. 42 - `specialArgs`: A list of special arguments that will be passed to all the hosts of the given arch. 43 44- `easy-hosts.perTag`: This provides you with the `tag` argument such that you can specify what tags get which modules. 45 - `modules`: A list of modules that will be included in all the hosts with the given tag. 46 - `specialArgs`: A list of special arguments that will be passed to all the hosts with the given tag. 47 48- `easy-hosts.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 because of this. 49 50- `easy-hosts.hosts.<host>`: The options for the given host. 51 - `path`: the path to the host, this is not strictly needed if you have a flat directory called `hosts` or `systems`. 52 - `arch`: The architecture of the host. 53 - `modules`: A list of modules that will be included in the host. 54 - `class`: the class of the host, this can be one of [ "nixos", "darwin", "iso" ] or anything defined by `easy-hosts.additionalClasses`. 55 - `tags`: tags that apply to the host, you can use this like `class`, but it allows for multiple of them to be present. 56 - `specialArgs`: A list of special arguments that will be passed to the host. 57 - `deployable`: this was added for people who may want to consume a deploy-rs or colmena flakeModule. 58 59## Similar projects 60 61- [ez-configs](https://github.com/ehllie/ez-configs) 62 63## Real world examples 64 65- [isabelroses/dotfiles](https://github.com/isabelroses/dotfiles) 66- [uncenter/flake](https://github.com/uncenter/flake)