Просмотр исходного кода

fix: unblock Nix updates

This commit works around issues introduced by
https://github.com/NixOS/nixpkgs/pull/470709 that broke the way that
environment variables attributes are extended in `buildGoModule` and
thus prevented bumping the nixpkgs flake input beyond December.

Signed-off-by: squat <lserven@gmail.com>
squat 2 месяцев назад
Родитель
Сommit
0217713fe4
2 измененных файлов с 31 добавлено и 23 удалено
  1. 3 3
      flake.lock
  2. 28 20
      flake.nix

+ 3 - 3
flake.lock

@@ -79,11 +79,11 @@
     },
     },
     "nixpkgs": {
     "nixpkgs": {
       "locked": {
       "locked": {
-        "lastModified": 1765472234,
-        "narHash": "sha256-9VvC20PJPsleGMewwcWYKGzDIyjckEz8uWmT0vCDYK0=",
+        "lastModified": 1771848320,
+        "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=",
         "owner": "nixos",
         "owner": "nixos",
         "repo": "nixpkgs",
         "repo": "nixpkgs",
-        "rev": "2fbfb1d73d239d2402a8fe03963e37aab15abe8b",
+        "rev": "2fc6539b481e1d2569f25f8799236694180c0993",
         "type": "github"
         "type": "github"
       },
       },
       "original": {
       "original": {

+ 28 - 20
flake.nix

@@ -33,20 +33,20 @@
             let
             let
               _version = builtins.getEnv "VERSION";
               _version = builtins.getEnv "VERSION";
               homepage = "https://github.com/squat/kilo";
               homepage = "https://github.com/squat/kilo";
-              base = pkgs.buildGoModule rec {
+              base = pkgs.buildGoModule (finallAttrs: {
                 pname = "kilo";
                 pname = "kilo";
                 version = if _version != "" then _version else toString (self.rev or self.dirtyRev or "unknown");
                 version = if _version != "" then _version else toString (self.rev or self.dirtyRev or "unknown");
                 src = ./.;
                 src = ./.;
                 vendorHash = null;
                 vendorHash = null;
                 env.CGO_ENABLED = 0;
                 env.CGO_ENABLED = 0;
                 ldflags = [
                 ldflags = [
-                  "-X github.com/squat/kilo/pkg/version.Version=${version}"
+                  "-X github.com/squat/kilo/pkg/version.Version=${finallAttrs.version}"
                 ];
                 ];
                 nativeBuildInputs = [ pkgs.installShellFiles ];
                 nativeBuildInputs = [ pkgs.installShellFiles ];
                 meta = {
                 meta = {
                   inherit homepage;
                   inherit homepage;
                 };
                 };
-              };
+              });
               kg = base.overrideAttrs {
               kg = base.overrideAttrs {
                 pname = "kg";
                 pname = "kg";
                 subPackages = [
                 subPackages = [
@@ -99,13 +99,17 @@
               map
               map
                 (target: {
                 (target: {
                   name = "kg-cross-${target.os}-${target.arch}";
                   name = "kg-cross-${target.os}-${target.arch}";
-                  value = kg.overrideAttrs {
-                    env.GOOS = target.os;
-                    env.GOARCH = target.arch;
-                    env.CGO_ENABLED = 0;
-                    checkPhase = false;
-                    postInstall = "";
-                  };
+                  value = kg.overrideAttrs (
+                    _: oldAttrs: {
+                      env = oldAttrs.env // {
+                        GOOS = target.os;
+                        GOARCH = target.arch;
+                        CGO_ENABLED = 0;
+                      };
+                      checkPhase = false;
+                      postInstall = "";
+                    }
+                  );
                 })
                 })
                 [
                 [
                   {
                   {
@@ -126,13 +130,17 @@
               map
               map
                 (target: {
                 (target: {
                   name = "kgctl-cross-${target.os}-${target.arch}";
                   name = "kgctl-cross-${target.os}-${target.arch}";
-                  value = kgctl.overrideAttrs {
-                    env.GOOS = target.os;
-                    env.GOARCH = target.arch;
-                    env.CGO_ENABLED = 0;
-                    checkPhase = false;
-                    postInstall = "";
-                  };
+                  value = kgctl.overrideAttrs (
+                    _: oldAttrs: {
+                      env = oldAttrs.env // {
+                        GOOS = target.os;
+                        GOARCH = target.arch;
+                        CGO_ENABLED = 0;
+                      };
+                      checkPhase = false;
+                      postInstall = "";
+                    }
+                  );
                 })
                 })
                 [
                 [
                   {
                   {
@@ -274,13 +282,13 @@
                 with pkgs;
                 with pkgs;
                 [
                 [
                   bash_unit
                   bash_unit
-                  (config.packages.kgctl.overrideAttrs rec {
+                  (config.packages.kgctl.overrideAttrs (finallAttrs: {
                     version = "dev";
                     version = "dev";
                     __intentionallyOverridingVersion = true;
                     __intentionallyOverridingVersion = true;
                     ldflags = [
                     ldflags = [
-                      "-X github.com/squat/kilo/pkg/version.Version=${version}"
+                      "-X github.com/squat/kilo/pkg/version.Version=${finallAttrs.version}"
                     ];
                     ];
-                  })
+                  }))
                   gettext # provides envsubst
                   gettext # provides envsubst
                   go
                   go
                   kind
                   kind