about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2024-01-23 16:10:31 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2024-01-23 16:10:31 +0100
commitdadc54aabee276e3535e5bac85d906b07756363e (patch)
treebad9994b1d7413a5df90b4790382ef0814e86fc0 /nixos
parent5f5210aa20e343b7e35f40c033000db0ef80d7b9 (diff)
downloadnixlib-dadc54aabee276e3535e5bac85d906b07756363e.tar
nixlib-dadc54aabee276e3535e5bac85d906b07756363e.tar.gz
nixlib-dadc54aabee276e3535e5bac85d906b07756363e.tar.bz2
nixlib-dadc54aabee276e3535e5bac85d906b07756363e.tar.lz
nixlib-dadc54aabee276e3535e5bac85d906b07756363e.tar.xz
nixlib-dadc54aabee276e3535e5bac85d906b07756363e.tar.zst
nixlib-dadc54aabee276e3535e5bac85d906b07756363e.zip
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
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/profiles/installation-device.nix3
1 files changed, 3 insertions, 0 deletions
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;