about summary refs log tree commit diff stats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/by-name/lf/lf/commands/default.nix5
-rwxr-xr-xmodules/by-name/lf/lf/commands/scripts/open.sh15
-rw-r--r--modules/by-name/lf/lf/module.nix2
-rw-r--r--modules/by-name/mp/mpd/mpc.nix5
-rw-r--r--modules/by-name/nv/nvim/plgs/harpoon/default.nix116
-rw-r--r--modules/by-name/nv/nvim/plgs/lf-nvim/default.nix10
-rw-r--r--modules/by-name/wa/water-reminder/module.nix57
-rw-r--r--modules/by-name/xd/xdg/module.nix4
-rwxr-xr-xmodules/by-name/xd/xdg/scripts/url-handler.sh7
-rw-r--r--modules/by-name/zs/zsh/module.nix5
-rw-r--r--modules/common/default.nix1
-rw-r--r--modules/home.legacy/pkgs/default.nix5
12 files changed, 104 insertions, 128 deletions
diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix
index 0c42607b..90b333c6 100644
--- a/modules/by-name/lf/lf/commands/default.nix
+++ b/modules/by-name/lf/lf/commands/default.nix
@@ -124,11 +124,6 @@ in {
     dependencies = [pkgs.gnused];
   };
 
-  open = async {
-    name = "open";
-    dependencies = [pkgs.handlr-regex];
-  };
-
   trash = pipe {
     name = "trash";
     dependencies = [pkgs.trash-cli];
diff --git a/modules/by-name/lf/lf/commands/scripts/open.sh b/modules/by-name/lf/lf/commands/scripts/open.sh
deleted file mode 100755
index b494074f..00000000
--- a/modules/by-name/lf/lf/commands/scripts/open.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-# shellcheck shell=sh
-
-# shellcheck disable=SC2269
-f="$f"
-# shellcheck disable=SC2269
-fx="$fx"
-# shellcheck disable=SC2269
-fs="$fs"
-# shellcheck disable=SC2269
-id="$id"
-
-# TODO: For some reason, `xdg-utils` tries to open firefox with it's default profile for
-# _everything_. Using `handlr-regex` sort-of solves this. <2025-04-04>
-handlr open "$f"
-# vim: ft=sh
diff --git a/modules/by-name/lf/lf/module.nix b/modules/by-name/lf/lf/module.nix
index 6dc8e919..ae1534d0 100644
--- a/modules/by-name/lf/lf/module.nix
+++ b/modules/by-name/lf/lf/module.nix
@@ -75,7 +75,7 @@ in {
           icons = true;
           ifs = "\\n"; # internal field separator for shell commands
           #info = "size"; # show the size of a directory
-          shell = "sh";
+          shell = "${lib.getExe pkgs.dash}";
           shellopts = "-eu"; # e: exit on error; u: error for unset variables
         };
         extraConfig = ''
diff --git a/modules/by-name/mp/mpd/mpc.nix b/modules/by-name/mp/mpd/mpc.nix
index 031465fe..b1398b77 100644
--- a/modules/by-name/mp/mpd/mpc.nix
+++ b/modules/by-name/mp/mpd/mpc.nix
@@ -5,7 +5,6 @@
   ...
 }: let
   cfg = config.soispha.services.mpd.mpc;
-  parentCfg = config.soispha.services.mpd;
 in {
   options.soispha.services.mpd.mpc = {
     enable = lib.mkEnableOption "mpc with extensions";
@@ -29,9 +28,7 @@ in {
         beets = cfg.beetsPkg;
       })
       # Displays the lyrics of the currently playing song
-      (pkgs.mpp-lyrics.override {
-        mpd_music_dir = parentCfg.directories.music;
-      })
+      pkgs.mpp-lyrics
     ];
   };
 }
diff --git a/modules/by-name/nv/nvim/plgs/harpoon/default.nix b/modules/by-name/nv/nvim/plgs/harpoon/default.nix
index 05a40d9f..3760ce15 100644
--- a/modules/by-name/nv/nvim/plgs/harpoon/default.nix
+++ b/modules/by-name/nv/nvim/plgs/harpoon/default.nix
@@ -1,100 +1,44 @@
 {
-  pkgs,
-  config,
   lib,
+  config,
   ...
 }: let
-  numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"];
-  mkNumberedCommand = {
-    command_template,
-    prefix,
-    number,
-    desc_template,
-  }: {
-    key = "${prefix}${number}";
-    action.__raw = ''
-      function()
-        ${command_template number}
-      end
-    '';
-    options.desc = "${desc_template number}";
-  };
-  mkGotoTerminalCommand = number: let
-    desc_template = number: "Goto terminal number ${number}";
-    command_template = number: ''require("harpoon.term").gotoTerminal(${number})'';
-    prefix = "gt";
-  in
-    mkNumberedCommand {inherit desc_template command_template prefix number;};
-  mkGotoFileCommand = number: let
-    desc_template = number: "Goto Buffer number ${number}";
-    command_template = number: ''require("harpoon.ui").nav_file(${number})'';
-    prefix = "gf";
-  in
-    mkNumberedCommand {inherit desc_template command_template prefix number;};
-
-  gotoTerminalMappings = builtins.map mkGotoTerminalCommand numbers;
-  gotoFileMappings = builtins.map mkGotoFileCommand numbers;
   cfg = config.soispha.programs.nvim;
 in {
   home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable {
-    plugins.harpoon = {
-      enable = true;
-      package = pkgs.vimPlugins.harpoon;
-      enableTelescope = true;
-      # menu.width = "vim.api.nvim_win_get_width(0) - 4"; # TODO: integrate that
-      keymaps = {
-        tmuxGotoTerminal = null; # TODO:
-      };
-    };
+    plugins.harpoon.enable = true;
+
     keymaps =
-      [
-        {
-          key = "-";
-          action.__raw = ''
+      lib.mapAttrsToList
+      (key: action: {
+        mode = "n";
+        inherit key;
+        action.__raw = builtins.elemAt action 0;
+        options.silent = true;
+        options.desc = builtins.elemAt action 1;
+      })
+      {
+        # add current file
+        "<leader><leader>" = [
+          # lua
+          ''
             function()
-              require("harpoon.ui").nav_next()
-             end
-          '';
-          options.desc = "go to the next marked file";
-        }
-        {
-          key = "_";
-          action.__raw = ''
-            function()
-              require("harpoon.ui").nav_prev()
-             end
-          '';
-          options.desc = "go to the previous marked file";
-        }
-        {
-          key = "<leader><leader>";
-          action.__raw = ''
-            function()
-              require("harpoon.mark").add_file()
-            end
-          '';
-          options.desc = "add a mark to the open file in harpoon.";
-        }
-        {
-          key = "gqc";
-          action.__raw = ''
-            function()
-              require("harpoon.cmd-ui").toggle_quick_menu()
+              require("harpoon"):list():add()
             end
-          '';
-          options.desc = "toggle the harpoon command quick menu to see all commands.";
-        }
-        {
-          key = "<leader>q";
-          action.__raw = ''
+          ''
+          "Add a mark to the open file in harpoon."
+        ];
+
+        # open menu
+        "<leader>q" = [
+          # lua
+          ''
             function()
-              require("harpoon.ui").toggle_quick_menu()
+                require("harpoon").ui:toggle_quick_menu(require("harpoon"):list())
             end
-          '';
-          options.desc = "toggle the harpoon normal quick menu to see all marks.";
-        }
-      ]
-      ++ gotoFileMappings
-      ++ gotoTerminalMappings;
+          ''
+          "Toggle the harpoon normal quick menu to see all marks."
+        ];
+      };
   };
 }
diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix
index 1e7c91e3..6c363ee1 100644
--- a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix
+++ b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix
@@ -2,22 +2,18 @@
   pkgs,
   lib,
   config,
-  nixpkgs_open_prs,
-  system,
   ...
 }: let
   cfg = config.soispha.programs.nvim;
 in {
+  # TODO: package lf-nvim though a module
+  # TODO: change the nvim path, when I change the path with lf
   home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable {
-    # TODO: package lf-nvim though a module
-    # FIXME: change the nvim path, when I change the path with lf
     extraConfigLuaPost = ''
       ${lib.strings.fileContents ./lua/lf-nvim.lua}
     '';
     extraPlugins = [
-      nixpkgs_open_prs.nixpkgs-lf.legacyPackages."${system}".vimPlugins.lf-nvim
-
-      pkgs.vimPlugins.toggleterm-nvim # required by lf-nvim
+      pkgs.vimPlugins.lf-nvim
     ];
   };
 }
diff --git a/modules/by-name/wa/water-reminder/module.nix b/modules/by-name/wa/water-reminder/module.nix
new file mode 100644
index 00000000..39e63771
--- /dev/null
+++ b/modules/by-name/wa/water-reminder/module.nix
@@ -0,0 +1,57 @@
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}: let
+  cfg = config.soispha.services.water-reminder;
+in {
+  options.soispha.services.water-reminder = {
+    enable = lib.mkEnableOption "periodic reminder for water intake";
+
+    frequency = lib.mkOption {
+      type = lib.types.str;
+      default = "*-*-* *:00/30:00"; # Every 30 minutes
+      description = ''
+        How often to remind. This value is passed to the systemd
+        timer configuration as the `OnCalendar` option. See
+        {manpage}`systemd.time(7)` for more information about the format.
+      '';
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    home-manager.users.soispha = {
+      systemd.user.services.water-reminder = {
+        Unit = {Description = "Water reminder";};
+        Service = {
+          CPUSchedulingPolicy = "idle";
+          IOSchedulingClass = "idle";
+          ExecStart = lib.getExe (
+            pkgs.writeShellApplication {
+              name = "water-reminder";
+
+              inheritPath = false;
+              runtimeInputs = [pkgs.libnotify];
+
+              text =
+                # bash
+                ''
+                  notify-send 'Seek fluid intake' 'Water intake required' --wait --expire-time=0 --urgency=critical
+                '';
+            }
+          );
+        };
+      };
+
+      systemd.user.timers.water-reminder = {
+        Unit = {Description = "periodic reminder for water intake";};
+        Timer = {
+          Unit = "water-reminder.service";
+          OnCalendar = cfg.frequency;
+        };
+        Install = {WantedBy = ["timers.target"];};
+      };
+    };
+  };
+}
diff --git a/modules/by-name/xd/xdg/module.nix b/modules/by-name/xd/xdg/module.nix
index f1781d86..a7c77cd7 100644
--- a/modules/by-name/xd/xdg/module.nix
+++ b/modules/by-name/xd/xdg/module.nix
@@ -38,6 +38,8 @@ in {
   config = lib.mkIf cfg.enable {
     home-manager.users.soispha = {
       xdg = {
+        configFile."xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile;
+
         desktopEntries = {
           url-handler = {
             name = "url-handler";
@@ -107,8 +109,6 @@ in {
       };
     };
 
-    environment.etc."xdg/xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile;
-
     systemd.user.services.xdg-desktop-portal-termfilechooser = {
       serviceConfig.ExecStart = [
         ""
diff --git a/modules/by-name/xd/xdg/scripts/url-handler.sh b/modules/by-name/xd/xdg/scripts/url-handler.sh
index 5aa01a48..d1c8277d 100755
--- a/modules/by-name/xd/xdg/scripts/url-handler.sh
+++ b/modules/by-name/xd/xdg/scripts/url-handler.sh
@@ -2,7 +2,7 @@
 
 project="$({
     tskm projects list
-    echo nvim zathura
+    printf "%s\n" nvim zathura
 } | rofi -sep "$(printf "\n")" -dmenu)"
 
 if [ "$project" = "nvim" ]; then
@@ -10,9 +10,10 @@ if [ "$project" = "nvim" ]; then
 elif [ "$project" = "zathura" ]; then
     zathura "$1"
 elif [ "$project" ]; then
-    tskm open "$project" "$1"
+    tskm open project "$project" "$1"
 else
-    notify-send "(URL HANDLER) No project selected"; exit 1
+    notify-send "(URL HANDLER) No project selected"
+    exit 1
 fi
 
 # vim: ft=sh
diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix
index b50e72ac..fd99031b 100644
--- a/modules/by-name/zs/zsh/module.nix
+++ b/modules/by-name/zs/zsh/module.nix
@@ -3,6 +3,7 @@
   lib,
   shell_library,
   system,
+  pkgs,
   ...
 }: let
   cfg = config.soispha.programs.zsh;
@@ -133,8 +134,8 @@ in {
         };
 
         shellAliases = {
-          ll = ". ll";
-          lm = ". lm";
+          ll = ". ${lib.getExe pkgs.ll}";
+          lm = ". ${lib.getExe pkgs.lm}";
         };
       };
     };
diff --git a/modules/common/default.nix b/modules/common/default.nix
index 4fc6bf51..1c00c710 100644
--- a/modules/common/default.nix
+++ b/modules/common/default.nix
@@ -57,6 +57,7 @@
       printing.enable = true;
       scanning.enable = true;
       snapper.enable = true;
+      water-reminder.enable = true;
       steam.enable = false;
       systemDiff.enable = true;
       unison = {
diff --git a/modules/home.legacy/pkgs/default.nix b/modules/home.legacy/pkgs/default.nix
index 31942f0d..fd8b811a 100644
--- a/modules/home.legacy/pkgs/default.nix
+++ b/modules/home.legacy/pkgs/default.nix
@@ -85,7 +85,8 @@ with pkgs; let
 
     SystemUpdate = [
       fupdate # Generic update tool.
-      update-sys # System update tool (meant to slot into `fupdate`).
+      fupdate-sys # System update tool (meant to slot into `fupdate`).
+      fupdate-flake # Nix flake update tool (meant to slot into `fupdate`).
     ];
 
     FileListers = [
@@ -93,8 +94,6 @@ with pkgs; let
       fd # Simple, fast and user-friendly alternative to find
       ripgrep # A search tool that combines the usability of ag with the raw speed of grep
       file # Show information about a file
-      ll # Wrapper around `lf` to automatically change the path
-      lm # Wrapper around `ll` to automatically cd to the last accessed path
     ];
 
     Programming = {