refactor 'nixosConfigurations'

This commit is contained in:
2025-11-23 23:16:37 +01:00
parent 6d5e6add02
commit f93eecfcb1
2 changed files with 16 additions and 13 deletions

View File

@@ -51,6 +51,9 @@
nvim, nvim,
}@inputs: }@inputs:
let let
lib = inputs.nixpkgs.lib;
utils = import ./utils { inherit lib; };
hostDirNames = utils.dirNames ./hosts;
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
@@ -59,20 +62,13 @@
in in
{ {
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # <https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md> nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # <https://github.com/nix-community/nixd/blob/main/nixd/docs/configuration.md>
nixosConfigurations = { nixosConfigurations = lib.genAttrs hostDirNames (
vm = nixpkgs.lib.nixosSystem { host:
modules = [ ./hosts/vm ]; nixpkgs.lib.nixosSystem {
modules = [ ./hosts/${host} ];
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
}; }
andromache = nixpkgs.lib.nixosSystem { );
modules = [ ./hosts/andromache ];
specialArgs = { inherit inputs; };
};
astyanax = nixpkgs.lib.nixosSystem {
modules = [ ./hosts/astyanax ];
specialArgs = { inherit inputs; };
};
};
homeConfigurations = { homeConfigurations = {
work = home-manager.lib.homeManagerConfiguration { work = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;

7
utils/default.nix Normal file
View File

@@ -0,0 +1,7 @@
{ lib }:
{
dirNames =
path:
builtins.attrNames (lib.filterAttrs (name: type: type == "directory") (builtins.readDir path));
}