From 05ba61cb4e140aa768a4d49917263a1b6c168940 Mon Sep 17 00:00:00 2001 From: Niten Date: Mon, 16 Aug 2021 18:15:42 -0700 Subject: [PATCH] Still working on the flakes... --- flake.lock | 22 ++-------------------- flake.nix | 39 ++++++++++++++++++--------------------- 2 files changed, 20 insertions(+), 41 deletions(-) diff --git a/flake.lock b/flake.lock index 365f95d..f16936b 100644 --- a/flake.lock +++ b/flake.lock @@ -22,11 +22,8 @@ } }, "hosts": { - "inputs": { - "nixpkgs": "nixpkgs" - }, "locked": { - "narHash": "sha256-28zT4n5SyxcE9KI4b6RowZyMuzlZ6FIw2KE6xX8OTnA=", + "narHash": "sha256-Zbuk45B7idsdhuKwCg7ci8kKM4ts9I4Fw6huDkVZh5c=", "path": "../fudo-hosts", "type": "path" }, @@ -50,26 +47,11 @@ "type": "indirect" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1629033443, - "narHash": "sha256-Vo3TvQvR5hsd3incx/xOt6GFgTm651CYVauHS/irOFo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "8ac785da9843aa110caeed6c912875e46a415a11", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-21.05", - "type": "indirect" - } - }, "root": { "inputs": { "home-manager": "home-manager", "hosts": "hosts", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" } } }, diff --git a/flake.nix b/flake.nix index 7fb4061..6165a38 100644 --- a/flake.nix +++ b/flake.nix @@ -10,26 +10,23 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { nixpkgs, hosts, home-manager, ... }: with builtins; - { - nixosConfigurations = listToAttrs (map (hostname: - let - hostOpts = hosts.host-configs.${hostname}; - pkgs = import nixpkgs { system = hostOpts.arch; }; + outputs = { nixpkgs, hosts, home-manager, ... }: with builtins; let + mapAttrs = f: m: listToAttrs + (map (k: { name = k; value = f k m.${k}; }) (attrNames m)); + in { + nixosConfigurations = mapAttrs (hostname: hostOpts: let + pkgs = import nixpkgs { system = hostOpts.arch; }; - in { - name = hostname; - value = pkgs.lib.nixosSystem { - system = hostOpts.arch; - modules = [ - (import ./initialize.nix { - hostname = hostname; - home-manager-package = home-manager; - pkgs = pkgs; - include-secrets = true; - }) - ]; - }; - }) (attrNames hosts.host-configs)); - }; + in pkgs.lib.nixosSystem { + system = hostOpts.arch; + modules = [ + (import ./initialize.nix { + hostname = hostname; + home-manager-package = home-manager; + pkgs = pkgs; + include-secrets = true; + }) + ]; + }) hosts.host-configs; + }; }