feat(hosts): initial

This commit is contained in:
Sk7Str1p3 2026-04-30 19:34:12 +03:00
parent e4f81f2e3f
commit 771306baec
No known key found for this signature in database
GPG key ID: 4DD995933D06D43B
3 changed files with 53 additions and 0 deletions

View file

@ -54,6 +54,7 @@ stdenvNoCC.mkDerivation {
docs = 0;
flake = 1;
devShells = 2;
hosts = 3;
};
order = orderMap.${lib.head (lib.splitString "/" relPath)};

View file

@ -14,6 +14,7 @@
inputs.flake-file.flakeModules.default
../devShells
../docs
../hosts
];
systems = [ "x86_64-linux" ];

51
hosts/default.nix Normal file
View 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)
)
);
}