diff options
| author | Michael Hoang <Enzime@users.noreply.github.com> | 2024-09-05 16:11:19 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-05 16:11:19 +1000 |
| commit | 92bd25c29f3be33bc0d47acb7b5db0cae43bb7d3 (patch) | |
| tree | b2d680fd380aec97e9ac881a580e09bf2e80e6df | |
| parent | 7c4b53a7d9f3a3df902b3fddf2ae245ef20ebcda (diff) | |
| parent | e1b6f307ecfa88e9759646b22c8b9ece580e1b78 (diff) | |
Merge pull request #1058 from Enzime/linux-builder-apply
linux-builder: make `package.nixosConfig` accurate
| -rw-r--r-- | modules/nix/linux-builder.nix | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/modules/nix/linux-builder.nix b/modules/nix/linux-builder.nix index 9edfed6..9756fe4 100644 --- a/modules/nix/linux-builder.nix +++ b/modules/nix/linux-builder.nix @@ -3,16 +3,8 @@ with lib; let - inherit (pkgs) stdenv; - cfg = config.nix.linux-builder; - builderWithOverrides = cfg.package.override (previousArguments: { - # the linux-builder packages require a list `modules` argument, so it's - # always non-null. - modules = previousArguments.modules ++ [ cfg.config ]; - }); - # 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. @@ -23,9 +15,9 @@ let mkdir -p $TMPDIR trap "rm -rf $TMPDIR" EXIT ${lib.optionalString cfg.ephemeral '' - rm -f ${cfg.workingDirectory}/${builderWithOverrides.nixosConfig.networking.hostName}.qcow2 + rm -f ${cfg.workingDirectory}/${cfg.package.nixosConfig.networking.hostName}.qcow2 ''} - ${builderWithOverrides}/bin/create-builder + ${cfg.package}/bin/create-builder ''; in @@ -41,6 +33,11 @@ in type = types.package; default = pkgs.darwin.linux-builder; defaultText = "pkgs.darwin.linux-builder"; + apply = pkg: pkg.override (old: { + # the linux-builder package requires `modules` as an argument, so it's + # always non-null. + modules = old.modules ++ [ cfg.config ]; + }); description = '' This option specifies the Linux builder to use. ''; @@ -135,7 +132,7 @@ in systems = mkOption { type = types.listOf types.str; - default = [ builderWithOverrides.nixosConfig.nixpkgs.hostPlatform.system ]; + default = [ cfg.package.nixosConfig.nixpkgs.hostPlatform.system ]; defaultText = '' The `nixpkgs.hostPlatform.system` of the build machine's final NixOS configuration. ''; |
