Add meta section to nix package, fix nix update script writing to wrong variable in hashes.json

This commit is contained in:
Emma [it/its]@Rory& 2024-06-28 12:13:17 +02:00
parent 628b094865
commit 03e150fc26
4 changed files with 14 additions and 4 deletions

BIN
flake.lock generated

Binary file not shown.

View File

@ -13,11 +13,21 @@
inherit system; inherit system;
}; };
hashesFile = builtins.fromJSON (builtins.readFile ./hashes.json); hashesFile = builtins.fromJSON (builtins.readFile ./hashes.json);
lib = pkgs.lib;
in rec { in rec {
packages.default = pkgs.buildNpmPackage { packages.default = pkgs.buildNpmPackage {
pname = "spacebar-server-ts"; pname = "spacebar-server-ts";
src = ./.;
name = "spacebar-server-ts"; name = "spacebar-server-ts";
meta = with lib; {
description = "Spacebar server, a FOSS reimplementation of the Discord backend.";
homepage = "https://github.com/spacebarchat/server";
license = licenses.agpl3Plus;
platforms = platforms.all;
mainProgram = "start-bundle";
};
src = ./.;
nativeBuildInputs = with pkgs; [ python3 ]; nativeBuildInputs = with pkgs; [ python3 ];
npmDepsHash = hashesFile.npmDepsHash; npmDepsHash = hashesFile.npmDepsHash;
makeCacheWritable = true; makeCacheWritable = true;

View File

@ -1,3 +1,3 @@
{ {
"npmDepsHash": "sha256-fZNDN2/fNy6Nu7tbr0RhQ8j4BP7X1Yhrh/fSTH7hbJc=" "npmDepsHash": "sha256-RxGkjCU9qqqDMjhJ5aEq1w7c7lS4nAp0/3F0zASJQms="
} }

View File

@ -3,7 +3,7 @@
nix flake update nix flake update
DEPS_HASH=`prefetch-npm-deps package-lock.json` DEPS_HASH=`prefetch-npm-deps package-lock.json`
TMPFILE=$(mktemp) TMPFILE=$(mktemp)
jq '.npm_deps_hash = "'$DEPS_HASH'"' hashes.json > $TMPFILE jq '.npmDepsHash = "'$DEPS_HASH'"' hashes.json > $TMPFILE
mv -- "$TMPFILE" hashes.json mv -- "$TMPFILE" hashes.json
nom build .# || exit $? nom build .# || exit $?