diff --git a/default.nix b/default.nix index 4678056..2d6c28f 100644 --- a/default.nix +++ b/default.nix @@ -3,14 +3,12 @@ }, system ? builtins.currentSystem}: let - meta = import ./meta.nix; derivations = import ./node2nix.nix { inherit pkgs system; }; in derivations // { package = derivations.package.overrideAttrs (oldAttrs: rec { - src = pkgs.fetchgit { inherit (meta) url rev sha256; }; # Puppeteer (a dependency for testing) would try to download Chromium # during installation. Downloading Chromium would not work though because # Nix builds are sandboxed and cannot download arbitrary things. We diff --git a/generate.sh b/generate.sh index 994a336..c75e247 100644 --- a/generate.sh +++ b/generate.sh @@ -2,4 +2,8 @@ node2nix "-$FINCANCIER_NODE_VERSION" --development \ --input "$FINANCIER_SRC/package.json" \ --lock "$FINANCIER_SRC/package-lock.json" \ --supplement-input supplement.json \ - --composition node2nix.nix \ No newline at end of file + --composition node2nix.nix + +# Fix the src attribute for the financier package +pattern='\(\s*\).*'$(echo $FINANCIER_SRC | sed 's/\//\\\//g')'.*' +sed -i "s/$pattern/\1src = (import .\/helpers.nix).fetchFinancier { inherit fetchgit; };/" node-packages.nix \ No newline at end of file diff --git a/helpers.nix b/helpers.nix new file mode 100644 index 0000000..2b6030e --- /dev/null +++ b/helpers.nix @@ -0,0 +1,4 @@ +{ + fetchFinancier = { fetchgit, meta ? import ./meta.nix }: + fetchgit { inherit (meta) url rev sha256; }; +} \ No newline at end of file diff --git a/shell.nix b/shell.nix index c61e651..58e59c0 100644 --- a/shell.nix +++ b/shell.nix @@ -1,7 +1,7 @@ { pkgs ? import {} }: let meta = import ./meta.nix; - src = pkgs.fetchgit { inherit (meta) url rev sha256; }; + src = (import ./helpers.nix).fetchFinancier { inherit (pkgs) fetchgit; inherit meta; }; in pkgs.mkShell { shellHook = ''