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
This commit is contained in:
Nikita 2025-08-11 01:04:46 +05:00 committed by GitHub
parent a9e091eae8
commit c936fe72c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 13 additions and 12 deletions

View File

@ -20,13 +20,13 @@ jobs:
NIX_CONFIG: access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} NIX_CONFIG: access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Update packwiz version - 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: env:
NIX_CONFIG: access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} NIX_CONFIG: access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Commit - name: Commit
uses: stefanzweifel/git-auto-commit-action@v4 uses: stefanzweifel/git-auto-commit-action@v4
with: with:
commit_message: "chore: update packwiz vendorSha256" commit_message: "chore: update packwiz vendorHash"
branch: main branch: main

11
flake.lock generated
View File

@ -2,17 +2,18 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1703013332, "lastModified": 1740367490,
"narHash": "sha256-+tFNwMvlXLbJZXiMHqYq77z/RfmpfpiI3yjL6o/Zo9M=", "narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "54aac082a4d9bb5bbc5c4e899603abfb76a3f6d6", "rev": "0196c0175e9191c474c26ab5548db27ef5d34b05",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-unstable",
"type": "indirect" "repo": "nixpkgs",
"type": "github"
} }
}, },
"root": { "root": {

View File

@ -33,7 +33,7 @@
in rec { in rec {
packwiz = pkgs.callPackage ./nix { packwiz = pkgs.callPackage ./nix {
version = substring 0 8 self.rev or "dirty"; version = substring 0 8 self.rev or "dirty";
vendorSha256 = readFile ./nix/vendor-sha256; vendorHash = readFile ./nix/vendor-hash;
buildGoModule = pkgs.buildGoModule; buildGoModule = pkgs.buildGoModule;
# As of writing, `pkgs.buildGoModule` is aliased to # As of writing, `pkgs.buildGoModule` is aliased to
# `pkgs.buildGo121Module` in Nixpkgs. # `pkgs.buildGo121Module` in Nixpkgs.

View File

@ -7,13 +7,13 @@ in
buildGoModule ? pkgs.buildGoModule, buildGoModule ? pkgs.buildGoModule,
fetchFromGitHub ? pkgs.fetchFromGitHub, fetchFromGitHub ? pkgs.fetchFromGitHub,
installShellFiles ? pkgs.installShellFiles, installShellFiles ? pkgs.installShellFiles,
# version and vendorSha256 should be specified by the caller # version and vendorHash should be specified by the caller
version ? "latest", version ? "latest",
vendorSha256, vendorHash,
}: }:
buildGoModule rec { buildGoModule rec {
pname = "packwiz"; pname = "packwiz";
inherit version vendorSha256; inherit version vendorHash;
src = ./..; src = ./..;

View File

@ -9,7 +9,7 @@ pkgs.callPackage (import ./.) {
## `pkgs.buildGo121Module` in Nixpkgs. ## `pkgs.buildGo121Module` in Nixpkgs.
## `buildGoModule` is set as `pkgs.buildGoModule` to try and work around ## `buildGoModule` is set as `pkgs.buildGoModule` to try and work around
## `vendorHash` issues in the future. ## `vendorHash` issues in the future.
vendorSha256 = sha256; vendorHash = sha256;
} }
// { // {
outputHash = sha256; outputHash = sha256;