-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
89 lines (81 loc) · 2.12 KB
/
Copy pathflake.nix
File metadata and controls
89 lines (81 loc) · 2.12 KB
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
89
{
description = "Reproducible build shell for quarantine-camel-up";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
outputs = {
self,
nixpkgs,
...
}: let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (import nixpkgs {
inherit system;
}));
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
buildInputs = [
pkgs.nodejs_18
pkgs.nodePackages.npm
];
shellHook = ''
export NODE_OPTIONS="--openssl-legacy-provider"
'';
};
});
apps = forAllSystems (pkgs: {
build = let
buildScript = pkgs.writeShellScriptBin "quarantine-camel-up-build" ''
set -euo pipefail
WORKDIR=$(mktemp -d)
trap 'rm -rf "$WORKDIR"' EXIT
cp -r ${self}/. "$WORKDIR"/
chmod -R u+rwX "$WORKDIR"
cd "$WORKDIR"
export NODE_OPTIONS="--openssl-legacy-provider"
npm config set fund false
npm config set audit false
npm config set cache "$WORKDIR/.npm"
npm ci
npm run build
'';
in {
type = "app";
program = "${buildScript}/bin/quarantine-camel-up-build";
};
});
packages = forAllSystems (pkgs: {
default = pkgs.stdenv.mkDerivation {
pname = "quarantine-camel-up";
version = "0.0.0";
src = self;
nativeBuildInputs = [
pkgs.nodejs_18
pkgs.nodePackages.npm
];
buildPhase = ''
WORKDIR=$(mktemp -d)
trap 'rm -rf "$WORKDIR"' EXIT
cp -r . "$WORKDIR"/
chmod -R u+rwX "$WORKDIR"
cd "$WORKDIR"
export NODE_OPTIONS="--openssl-legacy-provider"
npm config set fund false
npm config set audit false
npm config set cache "$WORKDIR/.npm"
npm ci
npm run build
'';
installPhase = ''
mkdir -p "$out"
cp -r build/. "$out/"
'';
};
});
};
}