diff options
| author | Tim Keller <tjk@tjkeller.xyz> | 2026-05-11 17:15:55 -0500 |
|---|---|---|
| committer | Tim Keller <tjk@tjkeller.xyz> | 2026-05-11 17:15:55 -0500 |
| commit | 3e3a211e750708b528ae13dd9c8f721867ff4115 (patch) | |
| tree | 38287fe46fc4e8013aed5e89405b4a6bcc7ca28a | |
| parent | f6693f606a7258044b9629eadf805b1301747a9d (diff) | |
| download | nixos-3e3a211e750708b528ae13dd9c8f721867ff4115.tar.xz nixos-3e3a211e750708b528ae13dd9c8f721867ff4115.zip | |
move users.timmy.home into its own file
| -rw-r--r-- | users/timmy/default.nix | 73 | ||||
| -rw-r--r-- | users/timmy/home.nix | 65 |
2 files changed, 77 insertions, 61 deletions
diff --git a/users/timmy/default.nix b/users/timmy/default.nix index 4d75a80..c143a0e 100644 --- a/users/timmy/default.nix +++ b/users/timmy/default.nix @@ -1,24 +1,18 @@ { 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"; - # Set these as null so they're not created - music = null; - publicShare = null; - templates = null; - videos = null; - }; sshKeyPaths = [ "${home}/.ssh/id_ed25519" ]; #sshPublicKeyPaths = lib.map (keyPath: keyPath + ".pub") sshKeyPaths; sshPublicKeys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDnsnAWcz46OVi1MWSxpOIUtUvwalijDwvW+oEvNjzep" ]; in { + options._users.${username} = { + enable = lib.mkEnableOption "create user ${username}"; + autologin.enable = lib.mkEnableOption "enables getty automatic login"; + }; + + # FIXME imports = [ ./hosts.nix ./localization.nix @@ -29,13 +23,7 @@ in { ./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 = { + config = lib.mkIf cfg.enable { # Setup zsh programs.zsh = { enable = true; @@ -49,8 +37,8 @@ in { #environment.systemPackages = [ pkgs.zsh-fast-syntax-highlighting ]; # TODO # Setup normal user - users.users.timmy = { - home = home; + users.users.${username} = { + inherit home; description = fullname; isNormalUser = true; shell = pkgs.zsh; @@ -82,46 +70,9 @@ in { }; # 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; - settings = { - user = { - name = fullname; - email = email; - }; - merge.tool = "nvimdiff"; - mergetool.nvimdiff = { - cmd = ''nvim -d "$LOCAL" "$MERGED" "$REMOTE"''; - prompt = false; - }; - # Unfortunately, this doesn't work for some reason - #url = { - # "ssh://git@publicgit/".insteadOf = "https://git.tjkeller.xyz/"; - #}; - }; - }; - - # Setup gtk bookmarks - gtk.gtk3.bookmarks = ( - lib.mapAttrsToList (name: dir: - lib.mkIf (dir != null) "file://${dir} ${lib.toUpper (lib.substring 0 1 name)}${lib.substring 1 (-1) name}" # Make first letter upper case - ) userDirs - ); + home-manager.users.${username} = { + imports = [ ./home.nix ]; + _users.${username}.home.enable = true; }; }; } diff --git a/users/timmy/home.nix b/users/timmy/home.nix new file mode 100644 index 0000000..cb99456 --- /dev/null +++ b/users/timmy/home.nix @@ -0,0 +1,65 @@ +{ lib, config, ... }: let + cfg = config._users.${username}.home; + username = "timmy"; + email = "tjk@tjkeller.xyz"; + fullname = "Tim Keller"; + home = "/home/${username}"; + userDirs = { + desktop = "${home}"; + download = "${home}/dls"; + documents = "${home}/docs"; + pictures = "${home}/pics"; + # Set these as null so they're not created + music = null; + publicShare = null; + templates = null; + videos = null; + #projects = "${home}/docs/src" + }; +in { + options._users.${username}.home = { + enable = lib.mkEnableOption "configure home for user ${username}"; + }; + + config = lib.mkIf cfg.enable { + # 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; + settings = { + user = { + name = fullname; + email = email; + }; + merge.tool = "nvimdiff"; + mergetool.nvimdiff = { + cmd = ''nvim -d "$LOCAL" "$MERGED" "$REMOTE"''; + prompt = false; + }; + # Unfortunately, this doesn't work for some reason + #url = { + # "ssh://git@publicgit/".insteadOf = "https://git.tjkeller.xyz/"; + #}; + }; + }; + + # Setup gtk bookmarks + gtk.gtk3.bookmarks = ( + lib.mapAttrsToList (name: dir: + lib.mkIf (dir != null) "file://${dir} ${lib.toUpper (lib.substring 0 1 name)}${lib.substring 1 (-1) name}" # Make first letter upper case + ) userDirs + ); + }; +} |
