diff --git a/.github/workflows/dependabot-nix-update.yml b/.github/workflows/dependabot-nix-update.yml
index 4e594dfc..3e80884b 100644
--- a/.github/workflows/dependabot-nix-update.yml
+++ b/.github/workflows/dependabot-nix-update.yml
@@ -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: |
diff --git a/.husky/pre-commit b/.husky/pre-commit
index 631b169f..d1adb382 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -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."
diff --git a/flake.lock b/flake.lock
index 4ef7d21f..5222f3ca 100644
--- a/flake.lock
+++ b/flake.lock
@@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1764517877,
- "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=",
+ "lastModified": 1765779637,
+ "narHash": "sha256-KJ2wa/BLSrTqDjbfyNx70ov/HdgNBCBBSQP3BIzKnv4=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c",
+ "rev": "1306659b587dc277866c7b69eb97e5f07864d8c4",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index 805ac788..134afe7a 100644
--- a/flake.nix
+++ b/flake.nix
@@ -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;
}
);
-}
\ No newline at end of file
+}
diff --git a/hashes.json b/hashes.json
deleted file mode 100644
index 8a91aeae..00000000
--- a/hashes.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "npmDepsHash": "sha256-0SsHcwTnb17YAsbCIpZXZ/HEzcFBWMTQdIE4yySKXFE="
-}
|