Skip to content

Commit 22ed80c

Browse files
committed
nix/default.nix: make globals into a parameter
1 parent a0bdd0c commit 22ed80c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

nix/default.nix

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{ system ? builtins.currentSystem
22
, crossSystem ? null
33
, config ? {}
4+
, deploymentGlobalsFn ? ## :: Pkgs -> GlobalsOverlayOverDefaults
5+
pkgs:
6+
if builtins.pathExists ../globals.nix
7+
then import ../globals.nix pkgs
8+
else builtins.trace "globals.nix missing, please add symlink" {}
49
}:
510
let
611
defaultSourcePaths = import ./sources.nix { inherit pkgs; };
@@ -90,20 +95,20 @@ let
9095
(import ./packages.nix)
9196
];
9297

93-
globals =
94-
if builtins.pathExists ../globals.nix
95-
then [(pkgs: _: with pkgs.lib; let
98+
buildGlobals =
99+
specificGlobalsFn:
100+
101+
[(pkgs: _: with pkgs.lib; let
96102
globalsDefault = import ../globals-defaults.nix pkgs;
97-
globalsSpecific = import ../globals.nix pkgs;
103+
globalsSpecific = specificGlobalsFn pkgs;
98104
in {
99105
globals = globalsDefault // (recursiveUpdate {
100106
inherit (globalsDefault) ec2 libvirtd environmentVariables;
101107
} globalsSpecific);
102-
})]
103-
else builtins.trace "globals.nix missing, please add symlink" [(pkgs: _: {
104-
globals = import ../globals-defaults.nix pkgs;
105108
})];
106109

110+
globals = buildGlobals deploymentGlobalsFn;
111+
107112
# merge upstream sources with our own:
108113
upstream-overlay = self: super: {
109114
inherit iohkNix;

0 commit comments

Comments
 (0)