From 482c80a02cd01d80fc5fa949d6e520006f0ec548 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 21 Apr 2025 23:27:40 +0800 Subject: [PATCH] add variable --- modules/nixos/user.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/nixos/user.nix b/modules/nixos/user.nix index 35abc94..3d66330 100644 --- a/modules/nixos/user.nix +++ b/modules/nixos/user.nix @@ -1,5 +1,8 @@ { pkgs, username, ... }: +let + binPath = "${pkgs.nix}/bin"; +in { nix.settings.trusted-users = [ username ]; @@ -31,7 +34,7 @@ commands = [ { - command = "/run/current-system/sw/bin/nix-store"; + command = "${binPath}/nix-store"; options = [ "NOPASSWD" ]; } { @@ -39,15 +42,11 @@ options = [ "NOPASSWD" "SETENV" ]; } { - command = "${pkgs.systemd}/bin/systemctl suspend"; + command = "${binPath}/reboot"; options = [ "NOPASSWD" ]; } { - command = "${pkgs.systemd}/bin/reboot"; - options = [ "NOPASSWD" ]; - } - { - command = "${pkgs.systemd}/bin/poweroff"; + command = "${binPath}/poweroff"; options = [ "NOPASSWD" ]; } ];