From 13ea22656c2b74e58a871b1016e7d728047249b1 Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Thu, 15 Aug 2024 16:14:23 +0200 Subject: [PATCH] Refactor host entrypoints --- flake/hosts.nix | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/flake/hosts.nix b/flake/hosts.nix index c1d227b..d9b00a8 100644 --- a/flake/hosts.nix +++ b/flake/hosts.nix @@ -1,25 +1,23 @@ -{ - inputs, - self, - lib, - ... -}: +{ inputs, self, ... }: let - subdirsOf = - dir: builtins.attrNames (lib.filterAttrs (_: v: v == "directory") (builtins.readDir dir)); + specialArgs = { + inherit inputs self; + }; + modulesOf = hostname: [ + { networking.hostName = hostname; } + "${self}/hosts/${hostname}" + "${self}/users/seb/@${hostname}" + ]; in { - flake.nixosConfigurations = lib.genAttrs (subdirsOf "${self}/hosts") ( - name: - inputs.nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs self; - }; - modules = [ - { networking.hostName = name; } - "${self}/hosts/${name}" - "${self}/users/seb/@${name}" - ]; - } - ); + flake.nixosConfigurations = { + north = inputs.nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = modulesOf "north"; + }; + inspiron = inputs.nixpkgs.lib.nixosSystem { + inherit specialArgs; + modules = modulesOf "inspiron"; + }; + }; }