diff options
author | gnidorah <gnidorah@users.noreply.github.com> | 2020-02-17 20:36:48 +0300 |
---|---|---|
committer | gnidorah <gnidorah@users.noreply.github.com> | 2020-02-17 21:35:35 +0300 |
commit | 1462612de1b9e102b8ce60eb3c99df693171c18e (patch) | |
tree | 6694d7468cee1284b20184f9196cf1e760903a5a /pkgs/applications/version-management/sourcehut | |
parent | 6befabd5599a1bd38c5a0eb28a40fe27c1824b80 (diff) | |
download | nixlib-1462612de1b9e102b8ce60eb3c99df693171c18e.tar nixlib-1462612de1b9e102b8ce60eb3c99df693171c18e.tar.gz nixlib-1462612de1b9e102b8ce60eb3c99df693171c18e.tar.bz2 nixlib-1462612de1b9e102b8ce60eb3c99df693171c18e.tar.lz nixlib-1462612de1b9e102b8ce60eb3c99df693171c18e.tar.xz nixlib-1462612de1b9e102b8ce60eb3c99df693171c18e.tar.zst nixlib-1462612de1b9e102b8ce60eb3c99df693171c18e.zip |
sourcehut: don't refer to rambox
Diffstat (limited to 'pkgs/applications/version-management/sourcehut')
-rw-r--r-- | pkgs/applications/version-management/sourcehut/default.nix | 2 | ||||
-rw-r--r-- | pkgs/applications/version-management/sourcehut/fetchNodeModules.nix | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/pkgs/applications/version-management/sourcehut/default.nix b/pkgs/applications/version-management/sourcehut/default.nix index 3fa5399c2b56..f6de0036afe0 100644 --- a/pkgs/applications/version-management/sourcehut/default.nix +++ b/pkgs/applications/version-management/sourcehut/default.nix @@ -6,7 +6,7 @@ # https://github.com/NixOS/nixpkgs/pull/54425#discussion_r250688781 let - fetchNodeModules = callPackage ../../networking/instant-messengers/rambox/fetchNodeModules.nix { }; + fetchNodeModules = callPackage ./fetchNodeModules.nix { }; python = python37.override { packageOverrides = self: super: { diff --git a/pkgs/applications/version-management/sourcehut/fetchNodeModules.nix b/pkgs/applications/version-management/sourcehut/fetchNodeModules.nix new file mode 100644 index 000000000000..047890a932ca --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/fetchNodeModules.nix @@ -0,0 +1,26 @@ +{ stdenv, jq }: { src, nodejs, sha256 }: + +# Only npm >= 5.4.2 is deterministic, see: +# https://github.com/npm/npm/issues/17979#issuecomment-332701215 +assert stdenv.lib.versionAtLeast nodejs.version "8.9.0"; + +stdenv.mkDerivation { + name = "node_modules"; + + outputHashAlgo = "sha256"; + outputHash = sha256; + outputHashMode = "recursive"; + + nativeBuildInputs = [ jq nodejs ]; + + buildCommand = '' + cp -r ${src}/* . + HOME=. npm install --force --ignore-scripts --only=production + for f in $(find node_modules -name package.json); do + # https://github.com/npm/npm/issues/10393 + jq -S 'delpaths(keys | map(select(startswith("_")) | [.]))' $f > $f.tmp + mv $f.tmp $f + done + mv node_modules $out + ''; +} |