diff --git a/flake.nix b/flake.nix index b1ca029..309fc85 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ inputs.unstable.url = "nixpkgs/nixos-unstable"; inputs.impermanence.url = "github:nix-community/impermanence"; - outputs = { self, nixpkgs, impermanence, ... }@inputs: + outputs = { self, nixpkgs, unstable, impermanence, ... }: let mypkgs = pkgs: { @@ -42,7 +42,11 @@ nixpkgs.overlays = [ (_: mypkgs) ]; }; - nixosConfigurations = self.lib.getHosts inputs ./hosts; + nixosConfigurations = self.lib.getHosts { + path = ./hosts; + inherit nixpkgs unstable; + inherit (self) nixosModule; + }; lib = { getHosts = import lib/hosts.nix; diff --git a/lib/hosts.nix b/lib/hosts.nix index c8dce58..da4c6d2 100644 --- a/lib/hosts.nix +++ b/lib/hosts.nix @@ -1,9 +1,9 @@ -callerInputs: hostsPath: +{ path, nixosModule, unstable, ... }@inputs: let hostMetadata = builtins.mapAttrs - (name: _: import (hostsPath + "/${name}")) - (builtins.readDir hostsPath); + (name: _: import (path + "/${name}")) + (builtins.readDir path); hardwareModules = { @@ -19,17 +19,17 @@ let }; getHostConfig = hostName: hostMeta: - callerInputs.${hostMeta.pkgs}.lib.nixosSystem + inputs.${hostMeta.pkgs}.lib.nixosSystem { inherit (hostMeta) system; modules = [ - (callerInputs.self.nixosModule) + (nixosModule) (hostMeta.module) (hardwareModules.${hostMeta.hardware}) (_: { networking.hostName = hostName; }) (_: { nixpkgs.overlays = [ - (_: _: { unstable = callerInputs.unstable.legacyPackages.${hostMeta.system}; }) + (_: _: { unstable = unstable.legacyPackages.${hostMeta.system}; }) ]; }) ];