Skip to content

Commit

Permalink
nix/default.nix: make globals into a parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed Jul 28, 2021
1 parent a0bdd0c commit 08f5f6b
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{ system ? builtins.currentSystem
, crossSystem ? null
, config ? {}
, deploymentGlobalsFn ? ## :: Pkgs -> GlobalsOverlayOverDefaults
pkgs:
if builtins.pathExists ../globals.nix
then import ../globals.nix pkgs
else builtins.trace "globals.nix missing, please add symlink" {}
}:
let
defaultSourcePaths = import ./sources.nix { inherit pkgs; };
Expand Down Expand Up @@ -90,20 +95,20 @@ let
(import ./packages.nix)
];

globals =
if builtins.pathExists ../globals.nix
then [(pkgs: _: with pkgs.lib; let
buildGlobals =
specificGlobalsFn:

[(pkgs: _: with pkgs.lib; let
globalsDefault = import ../globals-defaults.nix pkgs;
globalsSpecific = import ../globals.nix pkgs;
globalsSpecific = specificGlobalsFn pkgs;
in {
globals = globalsDefault // (recursiveUpdate {
inherit (globalsDefault) ec2 libvirtd environmentVariables;
} globalsSpecific);
})]
else builtins.trace "globals.nix missing, please add symlink" [(pkgs: _: {
globals = import ../globals-defaults.nix pkgs;
})];

globals = buildGlobals deploymentGlobalsFn;

# merge upstream sources with our own:
upstream-overlay = self: super: {
inherit iohkNix;
Expand All @@ -126,8 +131,8 @@ let
varnish-overlay
];

pkgs = import nixpkgs {
inherit system crossSystem config overlays;
};
pkgs = import nixpkgs {
inherit system crossSystem config overlays;
};
in
pkgs

0 comments on commit 08f5f6b

Please sign in to comment.