Skip to content

Commit

Permalink
Dedupe the WorkingDirectory path of the linux-builder
Browse files Browse the repository at this point in the history
  • Loading branch information
tfc committed Jan 15, 2024
1 parent 0dd382b commit 83e66b2
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions modules/nix/linux-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let
rm -rf $TMPDIR
mkdir -p $TMPDIR
trap "rm -rf $TMPDIR" EXIT
${lib.optionalString cfg.ephemeral "rm -f ${cfg.workingDirectory}/nixos.qcow2"}
${builderWithOverrides}/bin/create-builder
'';
in
Expand Down Expand Up @@ -77,6 +78,22 @@ in
This sets the corresponding `nix.buildMachines.*.supportedFeatures` option.
'';
};

workingDirectory = mkOption {
type = types.str;
default = "/var/lib/darwin-builder";
description = ''
The working directory of the Linux builder daemon process.
'';
};

ephemeral = mkEnableOption (lib.mdDoc ''
delete the builder's disk image on ever service restart.
This is useful whenever you change the builder's system configuration or
simply don't want it to accumulate state. Leave it disabled if you need to
rely on secrets or other information in the builder's file system.
'');
};

config = mkIf cfg.enable {
Expand All @@ -89,7 +106,7 @@ in
} ];

system.activationScripts.preActivation.text = ''
mkdir -p /var/lib/darwin-builder
mkdir -p ${cfg.workingDirectory}
'';

launchd.daemons.linux-builder = {
Expand All @@ -103,7 +120,7 @@ in
];
KeepAlive = true;
RunAtLoad = true;
WorkingDirectory = "/var/lib/darwin-builder";
WorkingDirectory = cfg.workingDirectory;
};
};

Expand Down

0 comments on commit 83e66b2

Please sign in to comment.