-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
43 lines (38 loc) · 1.17 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Disclaimer: Although I am the author of OSCAL-deep-diff, this is not an
# official package endorsed by NIST.
{ pkgs ? let
lock = (builtins.fromJSON
(builtins.readFile ../../flake.lock)).nodes.nixpkgs.locked;
nixpkgs = fetchTarball {
url = "/~https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz";
sha256 = lock.narHash;
};
in import nixpkgs { }, ... }:
let
pname = "oscal-deep-diff";
version = (builtins.fromJSON
(builtins.readFile ./package.json)).dependencies."@oscal/oscal-deep-diff";
deps = pkgs.mkYarnModules {
inherit pname version;
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
# Prevent IFD nonsense causing "but I am a 'x86_64-linux'" errors
yarnNix = ./yarn.nix;
};
in pkgs.stdenv.mkDerivation {
inherit pname version;
nativeBuildInputs = with pkgs; [ ];
buildInputs = with pkgs; [ ];
configurePhase = ''
mkdir -p $out/bin
ln -s ${deps}/node_modules $out
'';
installPhase = ''
cat <<EOF > $out/bin/oscal-deep-diff
#!${pkgs.nodejs}/bin/node
require('$out/node_modules/@oscal/oscal-deep-diff/lib/cli/cli.js');
EOF
chmod a+x $out/bin/oscal-deep-diff
'';
dontUnpack = true;
}