Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildGoApplication.override fails #112

Open
eliasnaur opened this issue Mar 15, 2023 · 2 comments
Open

buildGoApplication.override fails #112

eliasnaur opened this issue Mar 15, 2023 · 2 comments

Comments

@eliasnaur
Copy link
Contributor

eliasnaur commented Mar 15, 2023

See https://discourse.nixos.org/t/overriding-stdenv-of-gomod2nix-buildgoapplication/26364 where I try to override stdenv of buildGoApplication. I believe override worked at some point, as evidenced by https://github.com/doronbehar/pistol/blob/d4a4290269357d3f98b03a4e8f730a2063ce22bb/flake.nix#L45

Error message:

% nix build github:eliasnaur/gomod2nix-stdenv
error:
       … while evaluating the attribute 'buildGoApplication.override'

         at /nix/store/y6p51jza33989fck64faj0wyk2b1cp15-source/overlay.nix:8:38:

            7| {
            8|   inherit (callPackage ./builder { }) buildGoApplication mkGoEnv;
             |                                      ^
            9|   gomod2nix = callPackage ./default.nix { };

       … while selecting an attribute

         at /nix/store/gg4swr5bg6md0rygxf8q7kbr0w053mh6-source/flake.nix:20:29:

           19|       in {
           20|         packages.default = (pkgs.buildGoApplication.override { stdenv = pkgs.llvmPackages_14.stdenv; }) {
             |                             ^
           21|           name = "test";

       error: value is a function while a set was expected

Source

https://github.com/eliasnaur/gomod2nix-stdenv/blob/8e6f64962cc51ff712980ed92904b193ad19f7f0/flake.nix#L20

@eliasnaur
Copy link
Contributor Author

eliasnaur commented Mar 15, 2023

@eliasnaur
Copy link
Contributor Author

I can confirm the following hack restores override functionality:

diff --git a/builder/default.nix b/builder/default.nix
index d500555..ecd4946 100644
--- a/builder/default.nix
+++ b/builder/default.nix
@@ -436,6 +436,4 @@ let
       });

 in
-{
-  inherit buildGoApplication mkGoEnv;
-}
+ buildGoApplication
diff --git a/overlay.nix b/overlay.nix
index 9010386..64d86cb 100644
--- a/overlay.nix
+++ b/overlay.nix
@@ -5,6 +5,6 @@ let
   callPackage = final.darwin.apple_sdk_11_0.callPackage or final.callPackage;
 in
 {
-  inherit (callPackage ./builder { }) buildGoApplication mkGoEnv;
+  buildGoApplication = (callPackage ./builder { });
   gomod2nix = callPackage ./default.nix { };
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant