From c936fe72c5804f915ce2310484fc629ffbd8fb2f Mon Sep 17 00:00:00 2001 From: Nikita <50599445+nasrally@users.noreply.github.com> Date: Mon, 11 Aug 2025 01:04:46 +0500 Subject: [PATCH] Update and fix nix flake (#341) Since nix tries to update inputs on newer versions out of, I suppose, some introduced incompatibility, `nix build` fails. And nixpkgs from 2023 sounds rather obsolete at this point, so update was kinda due I think. On newer versions of nixpkgs however buildGoModule has changed and requires one of its arguments to be called vendorHash and not vendorSha256, this patch changes that as well. Fixes #297, closes #314, closes #307 --- .github/workflows/nix.yml | 4 ++-- flake.lock | 11 ++++++----- flake.nix | 2 +- nix/default.nix | 6 +++--- nix/prefetcher.nix | 2 +- nix/{vendor-sha256 => vendor-hash} | 0 6 files changed, 13 insertions(+), 12 deletions(-) rename nix/{vendor-sha256 => vendor-hash} (100%) diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 6eaa53c..c7320eb 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -20,13 +20,13 @@ jobs: NIX_CONFIG: access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - name: Update packwiz version - run: nix run nixpkgs#nix-prefetch ./nix/prefetcher.nix | tee ./nix/vendor-sha256 + run: nix run nixpkgs#nix-prefetch ./nix/prefetcher.nix | tee ./nix/vendor-hash env: NIX_CONFIG: access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - name: Commit uses: stefanzweifel/git-auto-commit-action@v4 with: - commit_message: "chore: update packwiz vendorSha256" + commit_message: "chore: update packwiz vendorHash" branch: main diff --git a/flake.lock b/flake.lock index cbc8415..e19c85d 100644 --- a/flake.lock +++ b/flake.lock @@ -2,17 +2,18 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1703013332, - "narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=", + "lastModified": 1740367490, + "narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6", + "rev": "0196c0175e9191c474c26ab5548db27ef5d34b05", "type": "github" }, "original": { - "id": "nixpkgs", + "owner": "NixOS", "ref": "nixos-unstable", - "type": "indirect" + "repo": "nixpkgs", + "type": "github" } }, "root": { diff --git a/flake.nix b/flake.nix index 31f46ec..5165559 100644 --- a/flake.nix +++ b/flake.nix @@ -33,7 +33,7 @@ in rec { packwiz = pkgs.callPackage ./nix { version = substring 0 8 self.rev or "dirty"; - vendorSha256 = readFile ./nix/vendor-sha256; + vendorHash = readFile ./nix/vendor-hash; buildGoModule = pkgs.buildGoModule; # As of writing, `pkgs.buildGoModule` is aliased to # `pkgs.buildGo121Module` in Nixpkgs. diff --git a/nix/default.nix b/nix/default.nix index f1a8eb9..2e92c3e 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -7,13 +7,13 @@ in buildGoModule ? pkgs.buildGoModule, fetchFromGitHub ? pkgs.fetchFromGitHub, installShellFiles ? pkgs.installShellFiles, - # version and vendorSha256 should be specified by the caller + # version and vendorHash should be specified by the caller version ? "latest", - vendorSha256, + vendorHash, }: buildGoModule rec { pname = "packwiz"; - inherit version vendorSha256; + inherit version vendorHash; src = ./..; diff --git a/nix/prefetcher.nix b/nix/prefetcher.nix index 18ee3f6..6dbdfa0 100644 --- a/nix/prefetcher.nix +++ b/nix/prefetcher.nix @@ -9,7 +9,7 @@ pkgs.callPackage (import ./.) { ## `pkgs.buildGo121Module` in Nixpkgs. ## `buildGoModule` is set as `pkgs.buildGoModule` to try and work around ## `vendorHash` issues in the future. - vendorSha256 = sha256; + vendorHash = sha256; } // { outputHash = sha256; diff --git a/nix/vendor-sha256 b/nix/vendor-hash similarity index 100% rename from nix/vendor-sha256 rename to nix/vendor-hash