mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-15 13:07:45 +00:00
Merge pull request #791 from lilyball/linux-builder-tmpdir
linux-builder: avoid /tmp for certs
This commit is contained in:
commit
afe83cbc2e
1 changed files with 13 additions and 1 deletions
|
@ -10,6 +10,18 @@ let
|
||||||
builderWithOverrides = cfg.package.override {
|
builderWithOverrides = cfg.package.override {
|
||||||
inherit (cfg) modules;
|
inherit (cfg) modules;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# create-builder uses TMPDIR to share files with the builder, notably certs.
|
||||||
|
# macOS will clean up files in /tmp automatically that haven't been accessed in 3+ days.
|
||||||
|
# If we let it use /tmp, leaving the computer asleep for 3 days makes the certs vanish.
|
||||||
|
# So we'll use /run/org.nixos.linux-builder instead and clean it up ourselves.
|
||||||
|
script = pkgs.writeShellScript "linux-builder-start" ''
|
||||||
|
export TMPDIR=/run/org.nixos.linux-builder USE_TMPDIR=1
|
||||||
|
rm -rf $TMPDIR
|
||||||
|
mkdir -p $TMPDIR
|
||||||
|
trap "rm -rf $TMPDIR" EXIT
|
||||||
|
${builderWithOverrides}/bin/create-builder
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -85,7 +97,7 @@ in
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ProgramArguments = [
|
ProgramArguments = [
|
||||||
"/bin/sh" "-c"
|
"/bin/sh" "-c"
|
||||||
"/bin/wait4path /nix/store && exec ${builderWithOverrides}/bin/create-builder"
|
"/bin/wait4path /nix/store && exec ${script}"
|
||||||
];
|
];
|
||||||
KeepAlive = true;
|
KeepAlive = true;
|
||||||
RunAtLoad = true;
|
RunAtLoad = true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue