Skip to content

Commit 4c46adc

Browse files
committed
nix/default.nix: make globals into a parameter
1 parent 7ef6519 commit 4c46adc

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

nix/default.nix

Lines changed: 15 additions & 10 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; };
@@ -89,20 +94,20 @@ let
8994
(import ./packages.nix)
9095
];
9196

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

109+
globals = buildGlobals deploymentGlobalsFn;
110+
106111
# merge upstream sources with our own:
107112
upstream-overlay = self: super: {
108113
inherit iohkNix;
@@ -125,8 +130,8 @@ let
125130
varnish-overlay
126131
];
127132

128-
pkgs = import nixpkgs {
129-
inherit system crossSystem config overlays;
130-
};
133+
pkgs = import nixpkgs {
134+
inherit system crossSystem config overlays;
135+
};
131136
in
132137
pkgs

0 commit comments

Comments
 (0)