commit aa1906e73cdfeae6177d54f357ad9a7a34dd1e97
parent 3896037a5b404bb30eaa39e8fd9fa89cf5cbd717
Author: mtmn <miro@haravara.org>
Date: Sun, 12 Apr 2026 23:22:52 +0200
chore: fix nix build, remove dangling deps
Diffstat:
4 files changed, 39 insertions(+), 81 deletions(-)
diff --git a/flake.nix b/flake.nix
@@ -28,14 +28,14 @@
spagoRegistry = pkgs.fetchFromGitHub {
owner = "purescript";
repo = "registry";
- rev = "483aaf573663403afdabe20822ac88d565a65746";
- hash = "sha256-pFVxQzt0+o1+nsCgk+VcprPSmEd8CH3Mkbk0vUy4x3g=";
+ rev = "main"; # Use latest for rework
+ hash = "sha256-xC8+jSfKM/MmdmAqRQ44ccRFTAvpwAnnAVs4IRoDhL4=";
};
spagoRegistryIndex = pkgs.fetchFromGitHub {
owner = "purescript";
repo = "registry-index";
- rev = "77163eff5ea12e25d7391cf52fe5b9178145d843";
+ rev = "main"; # Use latest for rework
hash = "sha256-ez73ecGmzf5d7EkamNZ9KT8u7e4yR7jSvdiGu4bGAHs=";
};
@@ -43,19 +43,22 @@
spagoDeps = pkgs.stdenv.mkDerivation {
name = "scorpus-spago-deps";
- outputHashAlgo = "sha256";
- outputHashMode = "recursive";
- outputHash = "sha256-HCj4zn2E+UpeuMsmvvZe8d9nlkn1YF7vZ/j2I2Uoo20=";
+ # Rework: only rebuild when dependency specs change
+ src = pkgs.lib.cleanSourceWith {
+ src = self;
+ filter = name: type: let baseName = baseNameOf (toString name); in
+ pkgs.lib.elem baseName [ "package.json" "package-lock.json" "spago.yaml" "spago.lock" ];
+ };
- nativeBuildInputs = with pkgs; [nodejs git cacert purescript];
+ nativeBuildInputs = with pkgs; [ nodejs git cacert purescript ];
- dontUnpack = true;
- dontFixup = true;
+ outputHashAlgo = "sha256";
+ outputHashMode = "recursive";
+ outputHash = "sha256-zHJu96X0JNRndeGdRcTC0BGjtOI8AE4juJi6izIJJAE=";
buildPhase = ''
export HOME=$TMPDIR
export SSL_CERT_FILE="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
- export NODE_EXTRA_CA_CERTS="${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
# Pre-populate registry so spago doesn't clone from GitHub
mkdir -p $HOME/.cache/spago-nodejs
@@ -63,16 +66,14 @@
cp -r ${spagoRegistryIndex} $HOME/.cache/spago-nodejs/registry-index
chmod -R u+w $HOME/.cache/spago-nodejs
- cp ${self + "/package.json"} package.json
- cp ${self + "/package-lock.json"} package-lock.json
- cp ${self + "/spago.yaml"} spago.yaml
- cp ${self + "/spago.lock"} spago.lock
-
+ # We need the local spago version to ensure compatibility
npm ci --ignore-scripts
- mkdir -p node_modules/.bin node_modules/purescript/bin
- cp ${pkgs.purescript}/bin/purs node_modules/purescript/bin/purs
- ln -sf ../purescript/bin/purs node_modules/.bin/purs
patchShebangs node_modules
+
+ # Use the purs provided by Nix
+ mkdir -p node_modules/.bin
+ ln -sf ${pkgs.purescript}/bin/purs node_modules/.bin/purs
+
npx spago install
'';
@@ -82,12 +83,25 @@
'';
};
+ src = pkgs.lib.cleanSourceWith {
+ src = self;
+ filter = name: type: let baseName = baseNameOf (toString name); in !(
+ (type == "directory" && (baseName == "docs" || baseName == ".git")) ||
+ (type == "regular" && (
+ pkgs.lib.hasSuffix ".md" baseName ||
+ baseName == "justfile" ||
+ baseName == "flake.nix" ||
+ baseName == "flake.lock"
+ ))
+ );
+ };
+
scorpus = pkgs.buildNpmPackage {
pname = "scorpus";
version = "1.0.0";
- src = self;
+ inherit src;
- npmDepsHash = "sha256-L+9L3RY5CNLudmQL7EZwZO8x0kQ2MKCqSsn37ZIIKWE=";
+ npmDepsHash = "sha256-eDc4ckDWvMb3EaDf6GclXxglsd1ZYHhEkHggBG+vcaA=";
npmRebuildFlags = ["--ignore-scripts"];
nativeBuildInputs = with pkgs; [
diff --git a/justfile b/justfile
@@ -39,9 +39,9 @@ nix command:
# Run quality and security checks
check:
- npx spago build --purs-args "--fail-on-warnings"
+ npx spago build --strict
npx purs-tidy check "src/**/*.purs"
- npm audit
+ statix check .
# Manage the container image (build, load, push)
container command:
diff --git a/package-lock.json b/package-lock.json
@@ -9,10 +9,8 @@
"version": "1.0.0",
"dependencies": {
"@aws-sdk/client-s3": "^3.1029.0",
- "audit": "^0.0.6",
"dotenv": "^17.4.1",
- "duckdb": "^1.4.4",
- "fix": "^0.0.6"
+ "duckdb": "^1.4.4"
},
"devDependencies": {
"esbuild": "^0.28.0",
@@ -2295,14 +2293,6 @@
"node": ">=8"
}
},
- "node_modules/audit": {
- "version": "0.0.6",
- "resolved": "https://registry.npmjs.org/audit/-/audit-0.0.6.tgz",
- "integrity": "sha512-xgv3Y3RIYE00N2/xk10VLlwFd1kjc7FRaX1vC8+CsOfDRe53a06vOSkp91BOSNijZfddYum47a1Fvju/2+JPcw==",
- "engines": {
- "node": ">= 0.5.0"
- }
- },
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -3085,19 +3075,6 @@
"node": ">=8"
}
},
- "node_modules/fix": {
- "version": "0.0.6",
- "resolved": "https://registry.npmjs.org/fix/-/fix-0.0.6.tgz",
- "integrity": "sha512-UQ+8m0GnIakgpY+92a9y+pYoX3Y6eaW7WNTkPolQ7r58Fjzq7NhyRLMrZ6J6U1u4y7H7APugjRmZ+i6CAn4+Dg==",
- "dependencies": {
- "pipe": "0.0.2",
- "underscore": "1.1.6",
- "underscore.string": "1.1.4"
- },
- "engines": {
- "node": ">=0.4.8"
- }
- },
"node_modules/flush-write-stream": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz",
@@ -4393,14 +4370,6 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
- "node_modules/pipe": {
- "version": "0.0.2",
- "resolved": "https://registry.npmjs.org/pipe/-/pipe-0.0.2.tgz",
- "integrity": "sha512-67s0/X7rv2PX1sl64FQqC0qQuSpd1tv8Wh6c+U1lprj6Q7NxDYulCxZTbVbDvc/HSpZLYh7Oo821xReXSCZikQ==",
- "engines": {
- "node": ">=0.4.8"
- }
- },
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -5501,25 +5470,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/underscore": {
- "version": "1.1.6",
- "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.1.6.tgz",
- "integrity": "sha512-aqSzrO92Cjmeo8G7F49+ZHWBo3IJpjpsUZZaqfOHJGN61flbpLxQw/sP91p4kf/2+nkFrG6AG2WHlJh6RCf+/g==",
- "engines": {
- "node": "*"
- }
- },
- "node_modules/underscore.string": {
- "version": "1.1.4",
- "resolved": "https://registry.npmjs.org/underscore.string/-/underscore.string-1.1.4.tgz",
- "integrity": "sha512-WsF8NWzIbTvxUaSOpSLq+AiO0tzweXdWQZ4w9Op8S/1BT9Fh7hCS7bfrF17vZu9kJg3pcqO+8WXfQSr1ah0f2g==",
- "dependencies": {
- "underscore": "1.1.6"
- },
- "engines": {
- "node": "*"
- }
- },
"node_modules/unique-filename": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz",
diff --git a/package.json b/package.json
@@ -6,12 +6,8 @@
"type": "module",
"scripts": {
"build": "npx spago build && npx esbuild output/Main/index.js --bundle --platform=node --format=esm --footer:js='main();' --outfile=server.js --external:http --external:https --external:dotenv --external:url --external:duckdb --external:@aws-sdk/client-s3 && npx spago bundle --module Client --outfile client.js --platform browser",
- "build-client": "npx spago bundle --module Client --outfile client.js --platform browser",
- "build-server": "npx esbuild output/Main/index.js --bundle --platform=node --format=esm --footer:js='main();' --outfile=server.js --external:http --external:https --external:dotenv --external:url --external:duckdb --external:@aws-sdk/client-s3",
"test": "npx spago test",
- "tidy": "purs-tidy format-in-place src/**/*.purs",
- "serve": "node --no-deprecation server.js 2>&1 | tee server.log",
- "start": "node --no-deprecation server.js 2>&1 | tee server.log"
+ "tidy": "purs-tidy format-in-place src/**/*.purs"
},
"devDependencies": {
"esbuild": "^0.28.0",
@@ -23,9 +19,7 @@
},
"dependencies": {
"@aws-sdk/client-s3": "^3.1029.0",
- "audit": "^0.0.6",
"dotenv": "^17.4.1",
- "duckdb": "^1.4.4",
- "fix": "^0.0.6"
+ "duckdb": "^1.4.4"
}
}