From e93ac2f7906fefcf1638ebb46856266fbe365301 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Fri, 3 Jan 2020 18:27:52 -0700 Subject: [PATCH] flake.nix: name flake inputs The flake inputs can now be arbitrarily referenced from hosts/default.nix as they are all passed into it. Any input not declared at the top of hosts/default.nix can still be referenced as args.. --- flake.nix | 8 ++------ hosts/default.nix | 16 ++++++++-------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/flake.nix b/flake.nix index 2434358b..c49f501b 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ inputs.nixpkgs.url = "github:nrdxp/nixpkgs/fork"; inputs.home.url = "github:nrdxp/home-manager/flakes"; - outputs = { self, home, nixpkgs }: let + outputs = args@{ self, home, nixpkgs }: let pkgs = import nixpkgs { system = "x86_64-linux"; overlays = self.overlays; @@ -14,11 +14,7 @@ in { nixosConfigurations = let - configs = import ./hosts { - inherit nixpkgs; - flake = self; - home = home.nixosModules.home-manager; - }; + configs = import ./hosts args; in configs; diff --git a/hosts/default.nix b/hosts/default.nix index e7d0e1ad..f076ecc2 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,4 +1,4 @@ -{ home, nixpkgs, flake, ... }: +args@{ home, nixpkgs, self, ... }: let utils = import ../lib/utils.nix { lib = nixpkgs.lib; }; @@ -11,7 +11,7 @@ let ; - config = self: + config = this: nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; @@ -19,24 +19,24 @@ let core = ../profiles/core.nix; global = { - networking.hostName = self; + networking.hostName = this; nix.nixPath = [ "nixpkgs=${nixpkgs}" "nixos-config=/etc/nixos/configuration.nix" ]; - system.configurationRevision = flake.rev; + system.configurationRevision = self.rev; - nixpkgs.overlays = flake.overlays; + nixpkgs.overlays = self.overlays; }; - local = import "${toString ./.}/${self}.nix"; + local = import "${toString ./.}/${this}.nix"; in - attrValues flake.nixosModules ++ [ + attrValues self.nixosModules ++ [ core global local - home + home.nixosModules.home-manager ]; };