mirror of
https://github.com/simplex-chat/haskell.nix.git
synced 2026-06-03 09:17:32 +00:00
Add shellHook option to components (and packages and plans) (#117)
This commit is contained in:
committed by
Moritz Angermann
parent
ae457c17d3
commit
413d5c9dbd
@@ -18,7 +18,7 @@
|
||||
, preCheck ? null, postCheck ? null
|
||||
, preInstall ? null, postInstall ? null
|
||||
, preHaddock ? null, postHaddock ? null
|
||||
, shellHook ? null
|
||||
, shellHook ? ""
|
||||
|
||||
, doCheck ? component.doCheck || haskellLib.isTest componentId
|
||||
, doCrossCheck ? component.doCrossCheck || false
|
||||
@@ -187,6 +187,11 @@ let
|
||||
inherit configFiles;
|
||||
};
|
||||
|
||||
# In order to let shell hooks make package-specific things like Hoogle databases
|
||||
shellHookApplied = if builtins.isString shellHook then shellHook else
|
||||
if builtins.isFunction shellHook then shellHook { inherit package shellWrappers; }
|
||||
else abort "shellHook should be a string or a function";
|
||||
|
||||
# the target dir for haddock documentation
|
||||
docdir = docoutput: docoutput + "/share/doc/" + componentId.cname;
|
||||
|
||||
@@ -332,7 +337,7 @@ stdenv.mkDerivation ({
|
||||
|
||||
shellHook = ''
|
||||
export PATH="${shellWrappers}/bin:$PATH"
|
||||
${toString shellHook}
|
||||
${shellHookApplied}
|
||||
'';
|
||||
}
|
||||
# patches can (if they like) depend on the version and revision of the package.
|
||||
|
||||
@@ -5,7 +5,7 @@ let
|
||||
inherit haskellLib;
|
||||
ghc = config.ghc.package;
|
||||
buildGHC = buildModules.config.ghc.package;
|
||||
inherit (config) nonReinstallablePkgs hsPkgs;
|
||||
inherit (config) nonReinstallablePkgs hsPkgs shellHook;
|
||||
inherit ghcForComponent;
|
||||
};
|
||||
|
||||
|
||||
+5
-4
@@ -73,6 +73,11 @@ let
|
||||
type = bool;
|
||||
default = (def.doHaddock or true);
|
||||
};
|
||||
shellHook = mkOption {
|
||||
description = "Hook to run when entering a shell";
|
||||
type = unspecified; # Can be either a string or a function
|
||||
default = (def.shellHook or "");
|
||||
};
|
||||
};
|
||||
packageOptions = def: componentOptions def // {
|
||||
preUnpack = mkOption {
|
||||
@@ -123,10 +128,6 @@ let
|
||||
type = nullOr string;
|
||||
default = (def.postHaddock or null);
|
||||
};
|
||||
shellHook = mkOption {
|
||||
type = nullOr string;
|
||||
default = (def.shellHook or null);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user