Skip to content

Instantly share code, notes, and snippets.

@Pitometsu
Created September 13, 2019 05:58
Show Gist options
  • Save Pitometsu/18b8f98bb9d63f38324cd3da7e9c0b9b to your computer and use it in GitHub Desktop.
Save Pitometsu/18b8f98bb9d63f38324cd3da7e9c0b9b to your computer and use it in GitHub Desktop.
How to override CC by Nix overlay?
(self: super:
let
# gcc = super.pkgs.gcc8;
# gcc8 = super.pkgs.gcc8.override { stdenv = super.stdenv; };
stdenv = super.stdenvAdapters.overrideCC super.stdenv super.pkgs.gcc8;
in
{
inherit stdenv; # gcc8 gcc;
# stdenv = super.overrideCC super.stdenv self.pkgs.gcc;
# gcc8 = super.gcc8.override { stdenv = super.stdenv; };
} # // stdenv.overrides self super
)
@AleXoundOS
Copy link

AleXoundOS commented Nov 25, 2021

This awkward expression can be simplified to

self: super: {
  stdenv =
    (super.overrideCC super.stdenv super.gcc8).override
      { cc = super.stdenv.cc; };
}

Still, it's questionable whether it's the right way to override compiler.

@Pitometsu
Copy link
Author

@AleXoundOS nice, thank you for a reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment