1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-01 04:23:34 +02:00
This commit is contained in:
Andrew Marshall 2024-04-25 15:34:21 +01:00 committed by GitHub
commit 67d09c373a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 10 deletions

View File

@ -474,6 +474,14 @@ in
'';
};
home.buildEnvWithNoChroot = mkEnableOption ''
Sets <code>__noChroot = true</code> on select <code>buildEnv</code>
derivations that assemble large numbers of paths, as well the activation
script derivations. This may be used to avoid sandbox failures on Darwin,
see https://github.com/NixOS/nix/issues/4119 and the <code>sandbox</code>
option in <command>man nix.conf</command>.
'';
home.preferXdgDirectories = mkEnableOption "" // {
description = ''
Whether to make programs use XDG directories whenever supported.
@ -701,7 +709,7 @@ in
)
+ optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH";
activationScript = pkgs.writeShellScript "activation-script" ''
activationScript = (pkgs.writeShellScript "activation-script" ''
set -eu
set -o pipefail
@ -718,9 +726,11 @@ in
fi
${activationCmds}
'';
'').overrideAttrs (old: {
__noChroot = cfg.buildEnvWithNoChroot;
});
in
pkgs.runCommand
(pkgs.runCommand
"home-manager-generation"
{
preferLocalBuild = true;
@ -742,9 +752,11 @@ in
ln -s ${cfg.path} $out/home-path
${cfg.extraBuilderCommands}
'';
'').overrideAttrs (old: {
__noChroot = cfg.buildEnvWithNoChroot;
});
home.path = pkgs.buildEnv {
home.path = (pkgs.buildEnv {
name = "home-manager-path";
paths = cfg.packages;
@ -755,6 +767,8 @@ in
meta = {
description = "Environment of packages installed through home-manager";
};
};
}).overrideAttrs (old: {
__noChroot = cfg.buildEnvWithNoChroot;
});
};
}

View File

@ -4,11 +4,11 @@ with lib;
let
homeDir = config.home.homeDirectory;
fontsEnv = pkgs.buildEnv {
fontsEnv = (pkgs.buildEnv {
name = "home-manager-fonts";
paths = config.home.packages;
pathsToLink = "/share/fonts";
};
}).overrideAttrs (old: { __noChroot = config.home.buildEnvWithNoChroot; });
fonts = "${fontsEnv}/share/fonts";
installDir = "${homeDir}/Library/Fonts/HomeManager";
in {

View File

@ -4,11 +4,12 @@
config = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
# Install MacOS applications to the user environment.
home.file."Applications/Home Manager Apps".source = let
apps = pkgs.buildEnv {
apps = (pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
}).overrideAttrs
(old: { __noChroot = config.home.buildEnvWithNoChroot; });
in "${apps}/Applications";
};
}