From f41698a4ec99c2d55e71f3b82abcaa7632ff6122 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Mon, 17 Mar 2025 15:06:01 -0400 Subject: [PATCH] Sudo -> run0 alias --- modules/common-desktop/vscodium.nix | 1 + modules/common/fish.nix | 6 +++--- modules/common/nh.nix | 7 +++++++ modules/common/run0.nix | 9 ++++++--- 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 modules/common/nh.nix diff --git a/modules/common-desktop/vscodium.nix b/modules/common-desktop/vscodium.nix index 22d77b8..81cae8a 100644 --- a/modules/common-desktop/vscodium.nix +++ b/modules/common-desktop/vscodium.nix @@ -9,6 +9,7 @@ vscodeExtensions = with vscode-extensions; [ mkhl.direnv eamodio.gitlens + dart-code.dart-code dart-code.flutter jnoortheen.nix-ide timonwong.shellcheck diff --git a/modules/common/fish.nix b/modules/common/fish.nix index 8c8dea6..77fa24a 100644 --- a/modules/common/fish.nix +++ b/modules/common/fish.nix @@ -26,9 +26,9 @@ commit = "git commit -am"; # NixOS - garbage = "run0 nix-collect-garbage -d && nix-collect-garbage -d"; - rebuild = "run0 nixos-rebuild switch --flake ~/.config/nixos/#"; - update = "pushd ~/.config/nixos && nix flake update && rebuild && popd"; + clean = "nh clean all"; + rebuild = "nh os switch"; + update = "pushd ~/.config/nixos && nix flake update && popd && rebuild"; }; }; users.defaultUserShell = pkgs.fish; diff --git a/modules/common/nh.nix b/modules/common/nh.nix new file mode 100644 index 0000000..96195e5 --- /dev/null +++ b/modules/common/nh.nix @@ -0,0 +1,7 @@ +{ + programs.nh = { + enable = true; + clean.enable = true; + flake = "/home/quadradical/.config/nixos"; + }; +} diff --git a/modules/common/run0.nix b/modules/common/run0.nix index adb2661..ec62ce1 100644 --- a/modules/common/run0.nix +++ b/modules/common/run0.nix @@ -1,4 +1,7 @@ -{ - security.sudo.enable = false; - security.pam.services.systemd-run0 = {}; +{pkgs, ...}: { + environment.systemPackages = [(pkgs.writeShellScriptBin "sudo" "run0 $@")]; + security = { + sudo.enable = false; + pam.services.systemd-run0 = {}; + }; }