From dadc54aabee276e3535e5bac85d906b07756363e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Tue, 23 Jan 2024 16:10:31 +0100 Subject: [PATCH] nixos/installation-device: enable polkit Polkit enables running 'reboot' and 'poweroff' in the installer without being root, and non-root is the default login for a few NixOS releases now. There's no size increase in the minimal ISO: $ git checkout nixpkgs-unstable $ nix-build -A config.system.build.isoImage -I nixos-config=nixos/modules/installer/cd-dvd/installation-cd-minimal.nix nixos/default.nix && du -sc ./result/iso/*.iso /nix/store/bfvbvrrqjmnqqhyqyxc0w32gagdz2rya-nixos-24.05.git.1149dab64e7-x86_64-linux.iso 998404 ./result/iso/nixos-24.05.git.1149dab64e7-x86_64-linux.iso 998404 total $ git checkout THIS_COMMIT $ nix-build -A config.system.build.isoImage -I nixos-config=nixos/modules/installer/cd-dvd/installation-cd-minimal.nix nixos/default.nix && du -sc ./result/iso/*.iso /nix/store/l9x9rwlvfddnri70h1ifx865q0cvka5l-nixos-24.05.git.1149dab64e7-x86_64-linux.iso 998404 ./result/iso/nixos-24.05.git.1149dab64e7-x86_64-linux.iso 998404 total --- nixos/modules/profiles/installation-device.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nixos/modules/profiles/installation-device.nix b/nixos/modules/profiles/installation-device.nix index 58f07b050b5c..0b10c0414147 100644 --- a/nixos/modules/profiles/installation-device.nix +++ b/nixos/modules/profiles/installation-device.nix @@ -39,6 +39,9 @@ with lib; # Allow the user to log in as root without a password. users.users.root.initialHashedPassword = ""; + # Don't require sudo/root to `reboot` or `poweroff`. + security.polkit.enable = true; + # Allow passwordless sudo from nixos user security.sudo = { enable = mkDefault true;