diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 415e09f706f3..f728c028a122 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -201,6 +201,7 @@ ./programs/direnv.nix ./programs/dmrconfig.nix ./programs/droidcam.nix + ./programs/dsearch.nix ./programs/dublin-traceroute.nix ./programs/ecryptfs.nix ./programs/environment.nix diff --git a/nixos/modules/programs/dsearch.nix b/nixos/modules/programs/dsearch.nix new file mode 100644 index 000000000000..c6d7509c91dd --- /dev/null +++ b/nixos/modules/programs/dsearch.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + inherit (lib) + mkEnableOption + mkOption + mkIf + mkPackageOption + types + ; + + cfg = config.programs.dsearch; +in +{ + options.programs.dsearch = { + enable = mkEnableOption "dsearch, a fast filesystem search service with fuzzy matching"; + + package = mkPackageOption pkgs "dsearch" { }; + + systemd = { + enable = mkEnableOption "systemd user service for dsearch" // { + default = true; + }; + + target = mkOption { + type = types.str; + default = "default.target"; + description = '' + The systemd target that will automatically start the dsearch service. + + By default, dsearch starts with the user session (`default.target`). + You can change this to `graphical-session.target` if you only want + it to run in graphical sessions. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ cfg.package ]; + + systemd.packages = [ cfg.package ]; + + systemd.user.services.dsearch.wantedBy = mkIf cfg.systemd.enable [ cfg.systemd.target ]; + }; + + meta.maintainers = with lib.maintainers; [ luckshiba ]; +}