spark-wallet: add flakes compatibility

Pure flakes can't use NIX_PATH.
This commit is contained in:
Erik Arvstedt 2021-03-16 12:45:21 +01:00
parent 81db927f66
commit d214605b32
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
3 changed files with 8 additions and 2 deletions

View File

@ -5,7 +5,7 @@
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-10_x"}:
let
nodeEnv = import ./node-env.nix {
nodeEnv = import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix" {
inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile;
inherit nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;

View File

@ -22,6 +22,13 @@ jq '.dependencies["qrcode-terminal"] = .optionalDependencies["qrcode-terminal"]'
cp pkg.json $TMPDIR/pkg.json
node2nix --nodejs-10 -i $TMPDIR/pkg.json -c composition.nix --no-copy-node-env
# Set node env import.
# The reason for not providing a custom node-env.nix file is the following:
# To be flakes-compatible, we have to locate the nixpgs source via `pkgs.path` instead of `<nixpkgs>`.
# This requires the `pkgs` variable which is available only in composition.nix, not in node-env.nix.
nodeEnvImport='import "${toString pkgs.path}/pkgs/development/node-packages/node-env.nix"'
sed -i "s|import ./node-env.nix|$nodeEnvImport|" composition.nix
# Use verified source in node-packages.nix
url="https://github.com/shesek/spark-wallet/releases/download/v$version/spark-wallet-$version-npm.tgz"
sed -i '/packageName = "spark-wallet";/!b;n;n;c\ src = fetchurl {\n url = "'$url'";\n sha256 = "'$shasum'";\n };' node-packages.nix

View File

@ -1 +0,0 @@
import <nixpkgs/pkgs/development/node-packages/node-env.nix>