-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdefault.nix
88 lines (82 loc) · 3 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#
#
# DONT EDIT ME; EDIT ./build_helper/default.nix
#
#
{
# local install command:
# nix-env -i -f ./
# or
# nix profile install ./
_core ? builtins,
system ? _core.currentSystem,
_pkgs ? (_core.import
(_core.fetchTarball
({
url="https://github.com/NixOS/nixpkgs/archive/ab7b6889ae9d484eed2876868209e33eb262511d.tar.gz";
sha256="sha256:0wl2rq7jxr7b0g0inxbh9jgiifamn9i45p7fgra8rhhnrmcdlqjz";
})
)
({
system = system;
overlays = [
];
})
),
_src ? ./build_helper,
deno ? _pkgs.deno,
bash ? _pkgs.bash,
coreutils ? _pkgs.coreutils,
unzip ? _pkgs.unzip,
}:
let
gotDeno2 = (builtins.compareVersions "2" deno.version) == -1;
deno_ = (if gotDeno2 then _pkgs.deno else deno);
in
_core.derivation {
system = system;
name = "nvs";
version = "1.4.31";
builder = "${bash}/bin/bash";
src = _src;
args = [
"-c"
''
export PATH="$PATH:${deno_}/bin/:${unzip}/bin:${coreutils}/bin"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
#
# commands
#
mkdir -p "$out/bin"
mkdir -p "$out/tmp"
# ls -la "$src/" &> "$out/log.txt"
# cat "$src/default.nix" &> "$out/log1.1.txt"
# ls -la "$src/" &> "$out/log1.txt"
# ls -la "$src/home" &> "$out/log2.txt"
# ls -la "$src/home/.cache/deno" &> "$out/log3.txt"
# ls -la $src/main.bundle.js &> "$out/surgon0.txt"
export TMP="$out/tmp"
export HOME="$src/home"
export DENO_NO_UPDATE_CHECK="true"
"${deno_}/bin/deno" compile --no-lock --allow-all --output "$out/bin/nvs" "$src/main.bundle.js" &> "$out/err.log"
rm -rf "$TMP"
rm -f "$out/readme.md"
rm -f "$out/cp.log"
rm -f "$out/unzip.log"
rm -f "$out/err.log"
elif [ "$(uname)" = "Darwin" ]
then
#
# commands
#
export HOME="$out/bin/home"
mkdir -p "$out/bin"
"${deno_}/bin/deno" compile --allow-all --quiet --output "$out/bin/nvs" "$src/main.bundle.js"
rm -rf "$HOME"
fi
rm -rf "$out/tmp"
rm -rf "$out/home"
rm -rf "$out/err.log"
''
];
}