From 02890fc72590aa8d1d22f4faf453aded04b937c3 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 29 Jan 2025 01:49:03 +0000 Subject: [PATCH] Make `NOTES_DIRECTORY` configurable per host --- nix/home/opdavies/hosts/PW05CH3L.nix | 7 ++++ nix/home/opdavies/hosts/t490.nix | 7 ++++ .../home-manager/features/cli/default.nix | 3 +- .../home-manager/features/cli/notes.nix | 33 +++++++++++++++---- todo.txt | 1 - 5 files changed, 41 insertions(+), 10 deletions(-) diff --git a/nix/home/opdavies/hosts/PW05CH3L.nix b/nix/home/opdavies/hosts/PW05CH3L.nix index 91f7832..526ed3c 100644 --- a/nix/home/opdavies/hosts/PW05CH3L.nix +++ b/nix/home/opdavies/hosts/PW05CH3L.nix @@ -2,6 +2,13 @@ features = { cli = { direnv.enable = true; + + notes = { + enable = true; + + directory = "$HOME/Documents/wiki/tfw-notes"; + }; + syncthing.enable = true; tmux-sessionizer.enable = true; }; diff --git a/nix/home/opdavies/hosts/t490.nix b/nix/home/opdavies/hosts/t490.nix index 2936ce8..9d3d039 100644 --- a/nix/home/opdavies/hosts/t490.nix +++ b/nix/home/opdavies/hosts/t490.nix @@ -4,6 +4,13 @@ features = { cli = { direnv.enable = true; + + notes = { + enable = true; + + directory = "$HOME/Documents/wiki/notes"; + }; + syncthing.enable = true; tmux-sessionizer.enable = true; }; diff --git a/nix/modules/home-manager/features/cli/default.nix b/nix/modules/home-manager/features/cli/default.nix index 7e268d7..6043c7d 100644 --- a/nix/modules/home-manager/features/cli/default.nix +++ b/nix/modules/home-manager/features/cli/default.nix @@ -19,8 +19,6 @@ ; }) - (import ./notes.nix { inherit pkgs; }) - (import ./tmux-sessionizer.nix { inherit config @@ -34,6 +32,7 @@ ./direnv.nix ./fzf.nix ./git.nix + ./notes.nix ./phpactor.nix ./ripgrep.nix ./starship.nix diff --git a/nix/modules/home-manager/features/cli/notes.nix b/nix/modules/home-manager/features/cli/notes.nix index 997d356..4edbda4 100644 --- a/nix/modules/home-manager/features/cli/notes.nix +++ b/nix/modules/home-manager/features/cli/notes.nix @@ -1,12 +1,31 @@ -{ pkgs, ... }: - { - home = { - packages = with pkgs; [ notes ]; + config, + lib, + pkgs, + ... +}: - sessionVariables = { - NOTES_DIRECTORY = "$DOCUMENTS/wiki/notes"; - WIKI_DIRECTORY = "$DOCUMENTS/wiki"; +with lib; + +let + cfg = config.features.cli.notes; +in +{ + options.features.cli.notes = { + enable = mkEnableOption "Enable notes"; + + directory = mkOption { + type = types.str; + }; + }; + + config = mkIf cfg.enable { + home = { + packages = with pkgs; [ notes ]; + + sessionVariables = { + NOTES_DIRECTORY = "${cfg.directory}"; + }; }; }; diff --git a/todo.txt b/todo.txt index c8b8d6e..5c3275d 100644 --- a/todo.txt +++ b/todo.txt @@ -3,5 +3,4 @@ Add create-podcast-tasks script Replace doppler with agenix Evaluate services.languagetool as a replacement for Grammarly Make git email address configurable -Make NOTES_DIRECTORY configurable Finish configuring syncthing with nix - https://github.com/neeasade/dotfiles/blob/694c2a11107c10947af956befe16cbe5cee0abda/os/nixos/config/shared.nix#L62