aboutsummaryrefslogtreecommitdiffstats
path: root/modules/home
diff options
context:
space:
mode:
Diffstat (limited to 'modules/home')
-rw-r--r--modules/home/cli-tools.nix1
-rw-r--r--modules/home/default.nix2
-rw-r--r--modules/home/dotfiles.nix32
-rw-r--r--modules/home/git.nix9
4 files changed, 34 insertions, 10 deletions
diff --git a/modules/home/cli-tools.nix b/modules/home/cli-tools.nix
index c489e1c..aedbb40 100644
--- a/modules/home/cli-tools.nix
+++ b/modules/home/cli-tools.nix
@@ -1,6 +1,7 @@
1{ pkgs, ... }: 1{ pkgs, ... }:
2{ 2{
3 home.packages = with pkgs; [ 3 home.packages = with pkgs; [
4 git
4 ripgrep 5 ripgrep
5 fd 6 fd
6 bat 7 bat
diff --git a/modules/home/default.nix b/modules/home/default.nix
index 206a0ad..ec32c7f 100644
--- a/modules/home/default.nix
+++ b/modules/home/default.nix
@@ -1,8 +1,8 @@
1{ 1{
2 imports = [ 2 imports = [
3 ./git.nix
4 ./shell.nix 3 ./shell.nix
5 ./editor.nix 4 ./editor.nix
6 ./cli-tools.nix 5 ./cli-tools.nix
6 ./dotfiles.nix
7 ]; 7 ];
8} 8}
diff --git a/modules/home/dotfiles.nix b/modules/home/dotfiles.nix
new file mode 100644
index 0000000..3df944c
--- /dev/null
+++ b/modules/home/dotfiles.nix
@@ -0,0 +1,32 @@
1{ config, lib, pkgs, ... }:
2let
3 cfg = config.home.dotfiles;
4 dotfilesDir = "${config.home.homeDirectory}/dotfiles";
5in
6{
7 options.home.dotfiles.repoUrl = lib.mkOption {
8 type = lib.types.str;
9 default = "";
10 description = "Git URL of the personal dotfiles repo to clone and stow into $HOME. Leave empty to disable.";
11 };
12
13 config = lib.mkIf (cfg.repoUrl != "") {
14 home.packages = [ pkgs.git pkgs.stow ];
15
16 home.activation.dotfiles = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
17 DOTFILES_DIR=${lib.escapeShellArg dotfilesDir}
18 if [ ! -d "$DOTFILES_DIR/.git" ]; then
19 $DRY_RUN_CMD ${pkgs.git}/bin/git clone --recurse-submodules \
20 ${lib.escapeShellArg cfg.repoUrl} "$DOTFILES_DIR"
21 fi
22 if [ -d "$DOTFILES_DIR" ]; then
23 for pkg in "$DOTFILES_DIR"/*/; do
24 pkg_name="$(basename "$pkg")"
25 case "$pkg_name" in .*) continue ;; esac
26 $DRY_RUN_CMD ${pkgs.stow}/bin/stow -d "$DOTFILES_DIR" -t ${lib.escapeShellArg config.home.homeDirectory} "$pkg_name" \
27 || echo "Warning: stow failed for package '$pkg_name' — skipped." >&2
28 done
29 fi
30 '';
31 };
32}
diff --git a/modules/home/git.nix b/modules/home/git.nix
deleted file mode 100644
index 4eab076..0000000
--- a/modules/home/git.nix
+++ /dev/null
@@ -1,9 +0,0 @@
1{
2 programs.git = {
3 enable = true;
4 extraConfig = {
5 init.defaultBranch = "main";
6 pull.rebase = true;
7 };
8 };
9}