From 9da942ba47d34210e86a1a709e802eda5c3b95db Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Sat, 30 Aug 2025 12:31:28 -0500 Subject: refactor users activation. refactor home manager config to match nixos conf and move tjkeller archetypes to users/timmy. update many of the exising home manager configs to be nicer and better organized. profile archetypes now include homeconfigs which can be enabled per user, and are setup using a new mkProfileArchetype function. --- users/timmy/default.nix | 100 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 users/timmy/default.nix (limited to 'users/timmy/default.nix') diff --git a/users/timmy/default.nix b/users/timmy/default.nix new file mode 100644 index 0000000..313449d --- /dev/null +++ b/users/timmy/default.nix @@ -0,0 +1,100 @@ +{ lib, config, pkgs, home-manager, ... }: let + cfg = config._users.timmy; + username = "timmy"; + email = "tjk@tjkeller.xyz"; + fullname = "Tim Keller"; + home = "/home/${username}"; + userDirs = { + desktop = "${home}"; + download = "${home}/dls"; + documents = "${home}/docs"; + pictures = "${home}/pics"; + }; + sshKeyPaths = [ "${home}/.ssh/id_ed25519" ]; + sshPublicKeyPaths = lib.map (keyPath: keyPath + ".pub") sshKeyPaths; + sshPublicKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDnsnAWcz46OVi1MWSxpOIUtUvwalijDwvW+oEvNjzep" ]; +in { + imports = [ + ./hosts.nix + ./localization.nix + ./nas.nix + ./printing.nix + ./user.nix + ./wifi.nix + ]; + + options._users.timmy = { + enable = lib.mkEnableOption "create user timmy"; + autologin.enable = lib.mkEnableOption "enables getty automatic login"; + }; + + #config = lib.mkIf cfg.enable { + config = { + # Setup zsh + programs.zsh.enable = true; + #environment.systemPackages = [ pkgs.zsh-fast-syntax-highlighting ]; # TODO + + # Setup normal user + users.users.timmy = { + home = home; + description = fullname; + isNormalUser = true; + shell = pkgs.zsh; + extraGroups = [ + "nixbld" + "video" + "wheel" + ] ++ lib.optionals config.hardware.i2c.enable [ + "i2c" + ] ++ lib.optionals config.virtualisation.libvirtd.enable [ + "libvirtd" + ] ++ lib.optionals config.virtualisation.docker.enable [ + "docker" + ]; + }; + + # Configure automatic login with getty + services.getty = lib.mkIf cfg.autologin.enable { + autologinUser = username; + }; + + # Configure sops age key paths since age keys are generated via ssh private key + sops.age = { inherit sshKeyPaths; }; + + # Add authorizedKeys to cgit service + services._cgit.ssh.authorizedKeys = { + keys = sshPublicKeys; + keyFiles = sshPublicKeyPaths; + }; + + # Configure user home + home-manager.users.timmy = { + # Setup home-manager + home = { + username = username; + homeDirectory = home; + stateVersion = "24.05"; + }; + + # Setup userdirs + xdg.userDirs = { + enable = true; + createDirectories = true; + } // userDirs; + + # Setup git + programs.git = { + enable = true; + userName = fullname; + userEmail = email; + }; + + # Setup gtk bookmarks + gtk.gtk3.bookmarks = ( + lib.mapAttrsToList (name: path: + "file://${path} ${lib.toUpper (lib.substring 0 1 name)}${lib.substring 1 (-1) name}" # Make first letter upper case + ) userDirs + ); + }; + }; +} -- cgit v1.2.3