diff --git a/modules/environment/default.nix b/modules/environment/default.nix index 3b97a3ec..00d58c09 100644 --- a/modules/environment/default.nix +++ b/modules/environment/default.nix @@ -16,6 +16,10 @@ let in { + imports = [ + (mkRenamedOptionModule ["environment" "postBuild"] ["environment" "extraSetup"]) + ]; + options = { environment.systemPackages = mkOption { type = types.listOf types.package; @@ -43,12 +47,6 @@ in description = "A list of profiles used to setup the global environment."; }; - environment.postBuild = mkOption { - type = types.lines; - default = ""; - description = "Commands to execute when building the global environment."; - }; - environment.extraOutputsToInstall = mkOption { type = types.listOf types.str; default = []; @@ -147,6 +145,17 @@ in ''; type = types.lines; }; + + environment.extraSetup = mkOption { + type = types.lines; + default = ""; + description = '' + Shell fragments to be run after the system environment has been created. + This should only be used for things that need to modify the internals + of the environment, e.g. generating MIME caches. + The environment being built can be accessed at $out. + ''; + }; }; config = { @@ -188,7 +197,8 @@ in system.path = pkgs.buildEnv { name = "system-path"; paths = cfg.systemPackages; - inherit (cfg) postBuild pathsToLink extraOutputsToInstall; + postBuild = cfg.extraSetup; + inherit (cfg) pathsToLink extraOutputsToInstall; }; system.build.setEnvironment = pkgs.writeText "set-environment" '' @@ -205,6 +215,5 @@ in system.build.setAliases = pkgs.writeText "set-aliases" '' ${concatStringsSep "\n" aliasCommands} ''; - }; } diff --git a/modules/programs/info/default.nix b/modules/programs/info/default.nix index cf857d9f..d70e3770 100644 --- a/modules/programs/info/default.nix +++ b/modules/programs/info/default.nix @@ -22,7 +22,7 @@ in environment.pathsToLink = [ "/info" "/share/info" ]; environment.extraOutputsToInstall = [ "info" ]; - environment.postBuild = '' + environment.extraSetup = '' if test -w $out/share/info; then shopt -s nullglob for i in $out/share/info/*.info $out/share/info/*.info.gz; do