nixos/xmonad: rename NIX_GHC env var to XMONAD_GHC

Upstream XMonad was using our xmonad patch file for their flake build to
support our nixos module. This would of course break the build upstream
if the version we patched and their master branch diverged. We
[discussed] that it'd make sense to upstream the environment var code.
In the process it seemed sensible to rename the NIX_GHC variable as
well, since it isn't really Nix-specific – it's just a way to set the
GHC binary to execute. This change has been [implemented] upstream in an
unreleased version of xmonad now – meaning we'll be able to drop the
xmonad patch soon!

This also clarifies the situation in nixpkgs a bit: NIX_GHC is easy to
confuse with the environment variable used in the ghcWithPackages
wrapper where it is used to set an alternative prefix for a GHC-wrapper
for applications trying to discover it via e.g. ghc-paths. It is an
implementation detail in this context, as it is in the case of the
xmonad module. Since they are different implementations doing different
things, different names also make sense.

[discussed]: 36d5761b3e
[implemented]: 23f36d7e23
This commit is contained in:
sternenseemann 2022-08-02 11:33:47 +02:00
parent 1a5602e833
commit 531ff521d4
3 changed files with 3 additions and 3 deletions

View file

@ -30,7 +30,7 @@ let
install -D ${xmonadEnv}/share/man/man1/xmonad.1.gz $out/share/man/man1/xmonad.1.gz
makeWrapper ${configured}/bin/xmonad $out/bin/xmonad \
'' + optionalString cfg.enableConfiguredRecompile ''
--set NIX_GHC "${xmonadEnv}/bin/ghc" \
--set XMONAD_GHC "${xmonadEnv}/bin/ghc" \
'' + ''
--set XMONAD_XMESSAGE "${pkgs.xorg.xmessage}/bin/xmessage"
'');

View file

@ -11,7 +11,7 @@ in stdenv.mkDerivation {
buildCommand = ''
install -D ${xmonadEnv}/share/man/man1/xmonad.1.gz $out/share/man/man1/xmonad.1.gz
makeWrapper ${xmonadEnv}/bin/xmonad $out/bin/xmonad \
--set NIX_GHC "${xmonadEnv}/bin/ghc" \
--set XMONAD_GHC "${xmonadEnv}/bin/ghc" \
--set XMONAD_XMESSAGE "${xmessage}/bin/xmessage"
'';

View file

@ -27,7 +27,7 @@ index 46a0939..92af53d 100644
- CompileGhc ->
- run "ghc" ghcArgs
+ CompileGhc -> do
+ ghc <- fromMaybe "ghc" <$> (lookupEnv "NIX_GHC")
+ ghc <- fromMaybe "ghc" <$> (lookupEnv "XMONAD_GHC")
+ run ghc ghcArgs
CompileStackGhc stackYaml ->
run "stack" ["build", "--silent", "--stack-yaml", stackYaml] .&&.