From 77cf8d46a3b0dfd711b76a41807fd92ab24b5b98 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Tue, 28 May 2024 20:55:02 -0600 Subject: [PATCH 1/6] Add ben module --- nixos/ben.nix | 13 +++++++++++++ nixos/configuration.nix | 1 + 2 files changed, 14 insertions(+) create mode 100644 nixos/ben.nix diff --git a/nixos/ben.nix b/nixos/ben.nix new file mode 100644 index 00000000..e7f243fb --- /dev/null +++ b/nixos/ben.nix @@ -0,0 +1,13 @@ +{ pkgs, inputs, config, makeEnable, ... }: +makeEnable config "modules.ben" true { + home-manager.users.ben = { + programs.zsh = { + enable = true; + shellAliases = { + ll = "ls -alF"; + la = "ls -A"; + l = "ls -CF"; + }; + }; + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 2c6b962a..f3768445 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -3,6 +3,7 @@ imports = [ ./android.nix ./base.nix + ./ben.nix ./cache-server.nix ./cache.nix ./code.nix From 94e7e738fb168b762cbe3ed5b88d463c59c054f5 Mon Sep 17 00:00:00 2001 From: Ben Corner Date: Sat, 25 May 2024 08:53:45 -0500 Subject: [PATCH 2/6] Add ben to realUsers, users.nix; key to keys.nix. zsh now default?? uhh paste contents of .profile into .zprofile I guess? --- nixos/bootstrap/flake.nix | 2 +- nixos/keys.nix | 3 +++ nixos/users.nix | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/nixos/bootstrap/flake.nix b/nixos/bootstrap/flake.nix index 4ddd5974..8c329744 100644 --- a/nixos/bootstrap/flake.nix +++ b/nixos/bootstrap/flake.nix @@ -98,7 +98,7 @@ inherit inputs machineNames; makeEnable = (import ../make-enable.nix) nixpkgs.lib; mapValueToKeys = keys: value: builtins.listToAttrs (map (name: { inherit name value; }) keys); - realUsers = [ "root" "imalison" "kat" "dean" "alex" ]; + realUsers = [ "root" "imalison" "kat" "dean" "alex" "ben"]; forEachUser = mapValueToKeys realUsers; } // specialArgs // (import ../keys.nix); }); diff --git a/nixos/keys.nix b/nixos/keys.nix index e5666216..92eb35cd 100644 --- a/nixos/keys.nix +++ b/nixos/keys.nix @@ -52,4 +52,7 @@ rec { "AAAAB3NzaC1yc2EAAAADAQABAAACAQC4ayU9sly58EHQ2YdrnoJ5o0mFD8I8UiDvN3kVh6oSMMQ9wkVzLUY6wUzlc0uq3P/OYco9mURMt83C+lY4UC+jvN09nIEHV7yVJWsKV3ntmnEqM63e9cOWnpC9XA1MSha7xrf9DaO/doxST4fY6ixZA+nbE0bFgNTqyjzdya7pCamAdnPqKqwUEha+0KfpA8TJlrfgrDLd65f2/+jLU8fhTkU6yhrJ9Piq7C+RwVTu/dlrp50PNirfQRSa7vUPNS8Y973XtK6jzB/xS2Qc6iGJ+4QcCy6lgu2xksO/MNIimZYGOCP2yx6/GDp/gnOlAktrJ3flMycJdEHkZVH61HfQV76O/mY3tck/SiCwhuNxXw0uh9wf4UO8JHlnJcsIsBkSBemJsxQul+G7kV4EV/gqW/iO5U2nKmDqbwNWigO9mN44LqBOwsnAnu78kiSE8sNCEdSy/qVWloBw4VyT/emvmTwP1okh/CKNnu0/HmfSNL6Vib1XuvKSPvrUIOLMrSeRdtu85LrWaS0CvKEoMrIgpvc+3jHtdbxwINE3JBGrbXvfe20CuHl6Fx0ONkhirRmrjG7iUjV/4c6nS2aguPVsGi7q3GYvtz7cNEe3XbfpZaHzrCncnoQPbnSDLjHdeZf4O5Aew6iOwwkpgBBDA3lJO55ujq2vNbgkpH3hmQjltQ==" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBEBce6E/XCdo8+dC4PPyyTsO/Z0BZxuz0IrTLaGehrT weitzman.micah@gmail.com" ]; + benKeys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAJ6lD0c+frh2vzQjvsrsmJpwM1ovaY59m5NNPml5G+E benjamin.j.corner@gmail.com" + ]; } diff --git a/nixos/users.nix b/nixos/users.nix index 0010d03f..76a2134a 100644 --- a/nixos/users.nix +++ b/nixos/users.nix @@ -84,6 +84,11 @@ in name = "unprivileged"; openssh.authorizedKeys.keys = [giteaSecret] ++ kanivanKeys; }; + ben = userDefaults // { + inherit extraGroups; + name = "ben"; + openssh.authorizedKeys.keys = benKeys ++ kanivanKeys; + }; }; nix.sshServe = { From 32d68061a5b2bcb903e268d53d72d08b7ae285df Mon Sep 17 00:00:00 2001 From: Ben Corner Date: Tue, 28 May 2024 22:17:40 -0500 Subject: [PATCH 3/6] Make sure user ben has sudo; quick fix, prefer no repeat extraGroups --- nixos/machines/bencbox.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nixos/machines/bencbox.nix b/nixos/machines/bencbox.nix index 52026793..29034ba9 100644 --- a/nixos/machines/bencbox.nix +++ b/nixos/machines/bencbox.nix @@ -21,4 +21,19 @@ home-manager.users = forEachUser { home.stateVersion = "22.05"; }; + + users.users.ben = { + extraGroups = [ + "audio" + "adbusers" + "disk" + "docker" + "networkmanager" + "openrazer" + "plugdev" + "syncthing" + "systemd-journal" + "video" + ] ++ ["wheel"]; + }; } From a8a66916f41d56d75ea035d928c769a4bd1603f0 Mon Sep 17 00:00:00 2001 From: Ben Corner Date: Tue, 28 May 2024 22:17:40 -0500 Subject: [PATCH 4/6] Add shellAliases, set backupFileExtension in ben.nix. --- nixos/ben.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nixos/ben.nix b/nixos/ben.nix index e7f243fb..16b04036 100644 --- a/nixos/ben.nix +++ b/nixos/ben.nix @@ -1,12 +1,20 @@ { pkgs, inputs, config, makeEnable, ... }: makeEnable config "modules.ben" true { home-manager.users.ben = { + home-manager = { + backupFileExtension = "backup"; + }; + programs.zsh = { enable = true; shellAliases = { - ll = "ls -alF"; - la = "ls -A"; l = "ls -CF"; + la = "ls -A"; + ll = "ls -lh"; + lla = "ls -alh"; + ls = "ls --color=auto"; + gts = "git status"; + gtl = "git log"; }; }; }; From 86b545761fa54961347b1630dad654f224178158 Mon Sep 17 00:00:00 2001 From: Ben Corner Date: Wed, 29 May 2024 00:02:55 -0500 Subject: [PATCH 5/6] Move home-manager.backupFileExtension entry to bottom of ben.nix --- nixos/ben.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nixos/ben.nix b/nixos/ben.nix index 16b04036..254db57a 100644 --- a/nixos/ben.nix +++ b/nixos/ben.nix @@ -1,10 +1,7 @@ { pkgs, inputs, config, makeEnable, ... }: makeEnable config "modules.ben" true { home-manager.users.ben = { - home-manager = { - backupFileExtension = "backup"; - }; - + home-manager.backupFileExtension = "backup"; # Add this line programs.zsh = { enable = true; shellAliases = { From 9d900057f6f4dca981001546f5194e1916f977cc Mon Sep 17 00:00:00 2001 From: Ben Corner Date: Wed, 29 May 2024 01:03:49 -0500 Subject: [PATCH 6/6] Working ben.nix file. Probably unrelated, had to remove ~/.zshrc and ~/.zprofile in order for nixos-rebuild switch to work. --- nixos/ben.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/ben.nix b/nixos/ben.nix index 254db57a..9201566a 100644 --- a/nixos/ben.nix +++ b/nixos/ben.nix @@ -1,7 +1,7 @@ { pkgs, inputs, config, makeEnable, ... }: makeEnable config "modules.ben" true { + home-manager.backupFileExtension = "backup"; # Add this line home-manager.users.ben = { - home-manager.backupFileExtension = "backup"; # Add this line programs.zsh = { enable = true; shellAliases = {