feat(hosts): initial
This commit is contained in:
parent
e4f81f2e3f
commit
771306baec
3 changed files with 53 additions and 0 deletions
51
hosts/default.nix
Normal file
51
hosts/default.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# Hosts
|
||||
|
||||
/**
|
||||
Entry point for machines' configurations.
|
||||
|
||||
Each host forder must has the following structure:
|
||||
```
|
||||
└── {hostname}
|
||||
├── about.nix
|
||||
├── configuration.nix
|
||||
└── hardware.nix
|
||||
```
|
||||
|
||||
`configuration.nix` can be used to override default values, and `hardware.nix` is used to store hardware-related stuff.
|
||||
|
||||
# About file
|
||||
File which keep some info about host. It can have these fiels (may be extended in future):
|
||||
### `name`
|
||||
used as `networking.hostName` value
|
||||
### `users`
|
||||
sets machine users. Users must have their configuration defined at `users/`
|
||||
*/
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.nixosConfigurations = inputs.nixpkgs.lib.mkMerge (
|
||||
map
|
||||
(
|
||||
host:
|
||||
let
|
||||
cfg = import ./${host}/about.nix;
|
||||
in
|
||||
{
|
||||
${host} = inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit cfg;
|
||||
};
|
||||
modules = with inputs; [
|
||||
./${host}/configuration.nix
|
||||
./${host}/hardware.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
)
|
||||
(
|
||||
let
|
||||
hosts = builtins.readDir ./.;
|
||||
in
|
||||
builtins.filter (name: hosts.${name} == "directory") (builtins.attrNames hosts)
|
||||
)
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue