summaryrefslogtreecommitdiff
path: root/users/timmy/home.nix
blob: cb99456e96d1513cbb561e26a1fc80c5c20b911c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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
		);
	};
}