Skip to content

Commit

Permalink
pass channel info to hosts as channel specialArg
Browse files Browse the repository at this point in the history
  • Loading branch information
Pacman99 committed Apr 25, 2021
1 parent e7ae270 commit 77bb2b2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions systemFlake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,17 @@ let
selectedNixpkgs = getNixpkgs host;
host = evalHostArgs (mergeAny hostDefaults host');
patchedChannel = selectedNixpkgs.path;
channel = channels.${host.channelName} // { name = host.channelName; };

specialArgs = host.specialArgs // { inherit channel; };

/* nixos specific arguments */
# Use lib from patched nixpkgs
lib = selectedNixpkgs.lib;
# Use nixos modules from patched nixpkgs
baseModules = import (patchedChannel + "/nixos/modules/module-list.nix");
# Override `modulesPath` because otherwise imports from there will not use patched nixpkgs
specialArgs = { modulesPath = builtins.toString (patchedChannel + "/nixos/modules"); } // host.specialArgs;
nixosSpecialArgs = { modulesPath = builtins.toString (patchedChannel + "/nixos/modules"); };
# The only way to find out if a host has `nixpkgs.config` set to
# the non-default value is by evalling most of the config.
hostConfig = (lib.evalModules {
Expand Down Expand Up @@ -149,9 +154,10 @@ let
];
})
] ++ host.modules;
specialArgs = host.specialArgs;
inherit specialArgs;
} // (optionalAttrs (host.output == "nixosConfigurations") {
inherit lib baseModules specialArgs;
inherit lib baseModules;
specialArgs = nixosSpecialArgs // specialArgs;
}));
}
);
Expand Down

0 comments on commit 77bb2b2

Please sign in to comment.