1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-16 05:18:17 +00:00

refactor: rename environment.postBuild to environment.extraSetup

This commit is contained in:
Alice Carroll 2024-08-03 14:57:36 +03:00
parent f7142b8024
commit d5dba1c6f5
No known key found for this signature in database
GPG key ID: 05140B67902CD3AF
2 changed files with 18 additions and 9 deletions

View file

@ -16,6 +16,10 @@ let
in in
{ {
imports = [
(mkRenamedOptionModule ["environment" "postBuild"] ["environment" "extraSetup"])
];
options = { options = {
environment.systemPackages = mkOption { environment.systemPackages = mkOption {
type = types.listOf types.package; type = types.listOf types.package;
@ -43,12 +47,6 @@ in
description = "A list of profiles used to setup the global environment."; 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 { environment.extraOutputsToInstall = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
@ -147,6 +145,17 @@ in
''; '';
type = types.lines; 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 = { config = {
@ -188,7 +197,8 @@ in
system.path = pkgs.buildEnv { system.path = pkgs.buildEnv {
name = "system-path"; name = "system-path";
paths = cfg.systemPackages; paths = cfg.systemPackages;
inherit (cfg) postBuild pathsToLink extraOutputsToInstall; postBuild = cfg.extraSetup;
inherit (cfg) pathsToLink extraOutputsToInstall;
}; };
system.build.setEnvironment = pkgs.writeText "set-environment" '' system.build.setEnvironment = pkgs.writeText "set-environment" ''
@ -205,6 +215,5 @@ in
system.build.setAliases = pkgs.writeText "set-aliases" '' system.build.setAliases = pkgs.writeText "set-aliases" ''
${concatStringsSep "\n" aliasCommands} ${concatStringsSep "\n" aliasCommands}
''; '';
}; };
} }

View file

@ -22,7 +22,7 @@ in
environment.pathsToLink = [ "/info" "/share/info" ]; environment.pathsToLink = [ "/info" "/share/info" ];
environment.extraOutputsToInstall = [ "info" ]; environment.extraOutputsToInstall = [ "info" ];
environment.postBuild = '' environment.extraSetup = ''
if test -w $out/share/info; then if test -w $out/share/info; then
shopt -s nullglob shopt -s nullglob
for i in $out/share/info/*.info $out/share/info/*.info.gz; do for i in $out/share/info/*.info $out/share/info/*.info.gz; do