From eb2cb6f263dffb82da86372b14d6fcd7077fe9fe Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 2 Jan 2021 21:22:45 +0100 Subject: gkleen: setup --- users/gkleen/authorized-keys/gkleen-sif.pub | 1 + users/gkleen/default.nix | 12 ++++++++++-- users/root.nix | 8 +++++++- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 users/gkleen/authorized-keys/gkleen-sif.pub diff --git a/users/gkleen/authorized-keys/gkleen-sif.pub b/users/gkleen/authorized-keys/gkleen-sif.pub new file mode 100644 index 00000000..e9aaf215 --- /dev/null +++ b/users/gkleen/authorized-keys/gkleen-sif.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKrHPERae+OUTNOzNf9d2767ljFCm5hgmQw48Dj4RrlU gkleen@sif.midgard.yggdrasil diff --git a/users/gkleen/default.nix b/users/gkleen/default.nix index 03e4a64b..f74701a5 100644 --- a/users/gkleen/default.nix +++ b/users/gkleen/default.nix @@ -1,7 +1,15 @@ -{ userName, pkgs, ... }: +{ userName, pkgs, customUtils, lib, ... }: { users.users.${userName} = { + description = "Gregor Kleen"; + extraGroups = [ "wheel" "networkmanager" "lp" "dialout" "audio" "video" "xmpp" "mail" "ssh" "vboxusers" "libvirtd" "wireshark" "games"]; + group = "users"; + uid = 1000; + createHome = true; + home = "/home/${userName}"; + shell = "${pkgs.zsh}/bin/zsh"; + isNormalUser = true; + openssh.authorizedKeys.keyFiles = lib.attrValues (customUtils.recImport rec { dir = ./authorized-keys; _import = name: _base: dir + "/${name}"; }); hashedPassword = "$6$rounds=500000$dOMgCU7DAk$yQFYGOURTEt12387LIYBnFKSWmtwXMUk1LJWnV0m7OFt.y2TnxQn2abdGA5dhwG9EmMB5wZGXf4J5F71c746C/"; - extraGroups = ["wheel" "networkmanager"]; }; } diff --git a/users/root.nix b/users/root.nix index 88cc6b26..95fe37c4 100644 --- a/users/root.nix +++ b/users/root.nix @@ -1 +1,7 @@ -import ./gkleen +{ flake, lib, config, hostName, ... }: +{ + users.users.root = lib.mkIf (flake.nixosModules.accounts ? "gkleen@${hostName}") { + inherit (config.users.users."gkleen") hashedPassword shell; + openssh.authorizedKeys.keyFiles = config.users.users."gkleen".openssh.authorizedKeys.keyFiles; + }; +} -- cgit v1.2.3