feat(hosts): initial
This commit is contained in:
parent
e4f81f2e3f
commit
771306baec
3 changed files with 53 additions and 0 deletions
|
|
@ -54,6 +54,7 @@ stdenvNoCC.mkDerivation {
|
||||||
docs = 0;
|
docs = 0;
|
||||||
flake = 1;
|
flake = 1;
|
||||||
devShells = 2;
|
devShells = 2;
|
||||||
|
hosts = 3;
|
||||||
};
|
};
|
||||||
order = orderMap.${lib.head (lib.splitString "/" relPath)};
|
order = orderMap.${lib.head (lib.splitString "/" relPath)};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
inputs.flake-file.flakeModules.default
|
inputs.flake-file.flakeModules.default
|
||||||
../devShells
|
../devShells
|
||||||
../docs
|
../docs
|
||||||
|
../hosts
|
||||||
];
|
];
|
||||||
|
|
||||||
systems = [ "x86_64-linux" ];
|
systems = [ "x86_64-linux" ];
|
||||||
|
|
|
||||||
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