nix: drop update scripts, drop hashes.json, dependency drvs

This commit is contained in:
Rory&
2025-12-17 04:52:59 +01:00
parent 2acfa098ce
commit 01d16bb5b8
5 changed files with 9 additions and 50 deletions

View File

@@ -19,11 +19,8 @@ jobs:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- name: Configure Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Update Hash
run: nix run .#update-nix
- name: Update Nix Flake
run: nix flake update --extra-experimental-features 'nix-command flakes'
- name: Set up Git Config
run: |

View File

@@ -11,15 +11,7 @@ if [ -x "$(/usr/bin/env which nix-shell 2>/dev/null)" ]; then
nix-shell $0
exit $?
else
nix flake update
# run ./nix-update.sh if package lock has changed and has no unstaged changes
if [ -n "$(git status --porcelain=v1 2>/dev/null | grep -E '^(MM| M) package-lock.json')" ]; then
echo "package-lock.json has unstaged changes. Skipping update of nix dependencies."
elif [ ! -n "$(git status --porcelain=v1 2>/dev/null | grep -E '^M package-lock.json')" ]; then
echo "package-lock.json has no changes. Skipping update of nix dependencies."
else
nix run .#nix-update-hashes || exit $?
fi
nix flake update --extra-experimental-features 'nix-command flakes'
fi
else
echo "You do not appear to have nix installed. Skipping update of nix dependencies."

BIN
flake.lock generated

Binary file not shown.

View File

@@ -15,7 +15,6 @@
nixpkgs.lib.recursiveUpdate
(
let
hashesFile = builtins.fromJSON (builtins.readFile ./hashes.json);
rVersion =
let
rev = self.sourceInfo.shortRev or self.sourceInfo.dirtyShortRev;
@@ -49,12 +48,15 @@
};
src = ./.;
npmDepsHash = hashesFile.npmDepsHash;
npmDeps = pkgs.importNpmLock { npmRoot = ./.; };
npmConfigHook = pkgs.importNpmLock.npmConfigHook;
npmBuildScript = "build:src";
makeCacheWritable = true;
nativeBuildInputs = with pkgs; [
python3
(pkgs.python3.withPackages (ps: with ps; [ setuptools ]))
];
installPhase =
let
revsFile = pkgs.writeText "spacebar-server-rev.json" (
@@ -92,35 +94,6 @@
passthru.tests = pkgs.testers.runNixOSTest (import ./nix/tests/test-bundle-starts.nix self);
};
update-nix-hashes = pkgs.writeShellApplication {
name = "update-nix";
runtimeInputs = with pkgs; [
prefetch-npm-deps
nix
jq
];
text = ''
rm -rf node_modules
${pkgs.nodejs_24}/bin/npm install --save --no-audit --no-fund --prefer-offline
DEPS_HASH=$(prefetch-npm-deps package-lock.json)
TMPFILE=$(mktemp)
jq '.npmDepsHash = "'"$DEPS_HASH"'"' hashes.json > "$TMPFILE"
mv -- "$TMPFILE" hashes.json
'';
};
update-nix-flake = pkgs.writeShellApplication {
name = "update-nix";
runtimeInputs = with pkgs; [
prefetch-npm-deps
nix
jq
];
text = ''
nix flake update --extra-experimental-features 'nix-command flakes'
'';
};
};
containers.docker = pkgs.dockerTools.buildLayeredImage {
@@ -162,4 +135,4 @@
inherit self nixpkgs flake-utils;
}
);
}
}

View File

@@ -1,3 +0,0 @@
{
"npmDepsHash": "sha256-0SsHcwTnb17YAsbCIpZXZ/HEzcFBWMTQdIE4yySKXFE="
}