-
-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple versions of nixpkgs in one network #665
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,13 +39,42 @@ rec { | |
# Get the configuration of this machine from each network | ||
# expression, attaching _file attributes so the NixOS module | ||
# system can give sensible error messages. | ||
|
||
modules = | ||
concatMap (n: optional (hasAttr machineName n) | ||
{ imports = [(getAttr machineName n)]; inherit (n) _file; }) | ||
networks; | ||
in | ||
{ name = machineName; | ||
value = import <nixpkgs/nixos/lib/eval-config.nix> { | ||
|
||
machineConfs = | ||
concatMap (n: optional (hasAttr machineName n) | ||
(getAttr machineName n)) | ||
networks; | ||
|
||
nameToPath = attrs: name: { | ||
prefix = name; | ||
path = attrs."${name}"; | ||
}; | ||
|
||
attrsetToPaths = attrset: map (nameToPath attrset) | ||
(builtins.attrNames attrset); | ||
|
||
importSources = | ||
(concatMap (module: | ||
if (!builtins.isFunction module | ||
&& builtins.hasAttr "deployment" module) | ||
&& (builtins.hasAttr "nix_path" module.deployment) | ||
then attrsetToPaths module.deployment.nix_path | ||
else []) | ||
machineConfs) ++ builtins.nixPath; | ||
|
||
__nixPath = importSources; | ||
|
||
machineImport = builtins.scopedImport { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC, |
||
inherit __nixPath; | ||
}; | ||
in { | ||
name = machineName; | ||
value = machineImport <nixpkgs/nixos/lib/eval-config.nix> { | ||
modules = | ||
modules ++ | ||
defaults ++ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,13 @@ in | |
''; | ||
}; | ||
|
||
deployment.nix_path = mkOption { | ||
default = {}; | ||
type = types.attrsOf types.str; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be Arguably the type should be |
||
description = '' | ||
''; | ||
}; | ||
|
||
deployment.hasFastConnection = mkOption { | ||
default = false; | ||
type = types.bool; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't it be a function? Is
module
a "machine" definition? If yes, it usually a function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #665 (comment): we can't introspect a function in this way.