Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
57 lines (54 loc) · 1.96 KB
/
Copy pathflake.nix
File metadata and controls
57 lines (54 loc) · 1.96 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
{
description = "openxml-js — TypeScript port of openpyxl. Reproducible dev environment.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
# Pin to the same Node major used by CI / engines.node in package.json.
nodejs = pkgs.nodejs_22;
# Pin the pnpm major used by CI / package.json#packageManager.
pnpm = pkgs.pnpm_11;
in
{
devShells.default = pkgs.mkShell {
name = "openxml-js-dev";
packages = [
nodejs
pnpm
pkgs.git
# `python3` is needed by `pnpm install` for any node-gyp builds and
# for the openpyxl reference fixtures.
pkgs.python3
];
shellHook = ''
echo "openxml-js dev shell"
echo " node $(node --version)"
echo " pnpm $(pnpm --version)"
echo " python $(python3 --version)"
export NODE_OPTIONS="''${NODE_OPTIONS:-}"
# Use the in-repo node_modules instead of any global pnpm store
# paths; reproducibility wins over speed for CI parity.
export PNPM_HOME="$PWD/.pnpm"
export PATH="$PNPM_HOME:$PATH"
'';
};
# Convenience for `nix flake check` — does a fast typecheck + test run.
# Heavier checks (build, lint) are run in CI directly.
checks.default = pkgs.runCommand "openxml-js-check"
{ buildInputs = [ nodejs pnpm ]; }
''
cp -r ${self} src
cd src
chmod -R u+w .
pnpm install --frozen-lockfile --offline 2>/dev/null || pnpm install --frozen-lockfile
pnpm typecheck
pnpm test
mkdir -p $out
touch $out/ok
'';
});
}