From 98ab6e58f1b3222208c7f7b6291a3206a67d3792 Mon Sep 17 00:00:00 2001 From: Martin Puppe Date: Mon, 21 Sep 2020 10:42:34 +0200 Subject: [PATCH] Fix src for financier We accidentally used to rely on the src for financier not having been garbage-collected. --- default.nix | 2 -- generate.sh | 6 +++++- helpers.nix | 4 ++++ shell.nix | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 helpers.nix 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 = ''