nixos-rebuild --use-remote-sudo no more

This commit is contained in:
Shelvacu
2024-09-14 10:35:31 -07:00
parent 014961aef8
commit e6b5c98bcd
2 changed files with 26 additions and 1 deletions

25
common/nixos-rebuild.nix Normal file
View File

@@ -0,0 +1,25 @@
{
pkgs,
config,
lib,
...
}: let
nixos-rebuild = pkgs.nixos-rebuild.override { nix = config.nix.package.out; };
in
{
options.vacu.alwaysUseRemoteSudo = (lib.mkEnableOption "always deploy to this machine with --use-remote-sudo") // { default = true; };
config = lib.mkIf config.vacu.alwaysUseRemoteSudo {
system.build.nixos-rebuild = pkgs.stdenvNoCC.mkDerivation {
nativeBuildInputs = [ pkgs.makeShellWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
makeShellWrapper ${nixos-rebuild} $out/bin/nixos-rebuild --add-flags "--use-remote-sudo"
runHook postInstall
'';
};
};
}

View File

@@ -2,7 +2,6 @@
lib,
pkgs,
config,
inputs,
utils,
...
}:
@@ -11,6 +10,7 @@
./module.nix
./common-but-not.nix
./verify-system/nixos.nix
./nixos-rebuild.nix
];
options.vacu.underTest = lib.mkOption {
default = false;