Nix: move patch-package to devDependencies, drop usage of npx, drop patchPhase

This commit is contained in:
Rory& 2025-11-21 14:18:14 +01:00
parent a2af0e934e
commit a1f4cf8eca
4 changed files with 9 additions and 13 deletions

View File

@ -43,22 +43,16 @@
license = licenses.agpl3Plus; license = licenses.agpl3Plus;
platforms = platforms.all; platforms = platforms.all;
mainProgram = "start-bundle"; mainProgram = "start-bundle";
maintainers = with maintainers; [ RorySys ]; # lol.
}; };
src = ./.; src = ./.;
nativeBuildInputs = with pkgs; [
python3
nodePackages.patch-package
jq
];
npmDepsHash = hashesFile.npmDepsHash; npmDepsHash = hashesFile.npmDepsHash;
npmBuildScript = "build:src"; npmBuildScript = "build:src";
makeCacheWritable = true; makeCacheWritable = true;
postPatch = '' nativeBuildInputs = with pkgs; [
echo "Patching postinstall to use OS-provided patch-package" python3
jq -r '.scripts["postinstall"] = "patch-package"' package.json > package.tmp.json ];
mv package.tmp.json package.json
'';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
# set -x # set -x
@ -118,7 +112,7 @@
containers.docker = pkgs.dockerTools.buildLayeredImage { containers.docker = pkgs.dockerTools.buildLayeredImage {
name = "spacebar-server-ts"; name = "spacebar-server-ts";
tag = "latest"; tag = self.packages.${system}.default.version;
contents = [ self.packages.${system}.default ]; contents = [ self.packages.${system}.default ];
config = { config = {
Cmd = [ "${self.outputs.packages.${system}.default}/bin/start-bundle" ]; Cmd = [ "${self.outputs.packages.${system}.default}/bin/start-bundle" ];
@ -145,6 +139,7 @@
pkgs.lib.recursiveUpdate (pkgs.lib.attrsets.unionOfDisjoint { } self.packages) { pkgs.lib.recursiveUpdate (pkgs.lib.attrsets.unionOfDisjoint { } self.packages) {
x86_64-linux = { x86_64-linux = {
spacebar-server-tests = self.packages.x86_64-linux.default.passthru.tests; spacebar-server-tests = self.packages.x86_64-linux.default.passthru.tests;
docker-image = self.containers.x86_64-linux.docker;
}; };
}; };
}; };

View File

@ -1,3 +1,3 @@
{ {
"npmDepsHash": "sha256-45XGoErD/Lm0QunatMHZnUtrlpcmYmlwUyUGhwjrBHU=" "npmDepsHash": "sha256-v3RAXTGnVkLK2KpQLHfT9BBh27L9f/N9F1MMAUghkV4="
} }

BIN
package-lock.json generated

Binary file not shown.

View File

@ -4,7 +4,7 @@
"description": "A Spacebar server written in Node.js", "description": "A Spacebar server written in Node.js",
"scripts": { "scripts": {
"prepare": "husky install", "prepare": "husky install",
"postinstall": "npx patch-package", "postinstall": "patch-package",
"start": "node --enable-source-maps dist/bundle/start.js", "start": "node --enable-source-maps dist/bundle/start.js",
"start:api": "node --enable-source-maps dist/api/start.js", "start:api": "node --enable-source-maps dist/api/start.js",
"start:cdn": "node --enable-source-maps dist/cdn/start.js", "start:cdn": "node --enable-source-maps dist/cdn/start.js",
@ -65,6 +65,7 @@
"eslint": "^9.39.1", "eslint": "^9.39.1",
"globals": "^16.5.0", "globals": "^16.5.0",
"husky": "^9.1.7", "husky": "^9.1.7",
"patch-package": "^8.0.1",
"prettier": "^3.6.2", "prettier": "^3.6.2",
"pretty-quick": "^4.2.2", "pretty-quick": "^4.2.2",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",