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.<input>.
This commit is contained in:
Timothy DeHerrera 2020-01-03 18:27:52 -07:00
parent 5b5d072851
commit e93ac2f790
No known key found for this signature in database
GPG key ID: 8985725DB5B0C122
2 changed files with 10 additions and 14 deletions

View file

@ -6,7 +6,7 @@
inputs.nixpkgs.url = "github:nrdxp/nixpkgs/fork"; inputs.nixpkgs.url = "github:nrdxp/nixpkgs/fork";
inputs.home.url = "github:nrdxp/home-manager/flakes"; inputs.home.url = "github:nrdxp/home-manager/flakes";
outputs = { self, home, nixpkgs }: let outputs = args@{ self, home, nixpkgs }: let
pkgs = import nixpkgs { pkgs = import nixpkgs {
system = "x86_64-linux"; system = "x86_64-linux";
overlays = self.overlays; overlays = self.overlays;
@ -14,11 +14,7 @@
in in
{ {
nixosConfigurations = let nixosConfigurations = let
configs = import ./hosts { configs = import ./hosts args;
inherit nixpkgs;
flake = self;
home = home.nixosModules.home-manager;
};
in in
configs; configs;

View file

@ -1,4 +1,4 @@
{ home, nixpkgs, flake, ... }: args@{ home, nixpkgs, self, ... }:
let let
utils = import ../lib/utils.nix { lib = nixpkgs.lib; }; utils = import ../lib/utils.nix { lib = nixpkgs.lib; };
@ -11,7 +11,7 @@ let
; ;
config = self: config = this:
nixpkgs.lib.nixosSystem rec { nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; system = "x86_64-linux";
@ -19,24 +19,24 @@ let
core = ../profiles/core.nix; core = ../profiles/core.nix;
global = { global = {
networking.hostName = self; networking.hostName = this;
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${nixpkgs}" "nixpkgs=${nixpkgs}"
"nixos-config=/etc/nixos/configuration.nix" "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 in
attrValues flake.nixosModules ++ [ attrValues self.nixosModules ++ [
core core
global global
local local
home home.nixosModules.home-manager
]; ];
}; };