1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

treewide: add missing package options (#7575)

Add options to support more flexible module configurations.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-07-29 12:20:22 -05:00 committed by GitHub
parent 25deca8939
commit 03fdb31290
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 147 additions and 70 deletions

View file

@ -20,6 +20,8 @@ in
programs.browserpass = { programs.browserpass = {
enable = lib.mkEnableOption "the browserpass extension host application"; enable = lib.mkEnableOption "the browserpass extension host application";
package = lib.mkPackageOption pkgs "browserpass" { };
browsers = lib.mkOption { browsers = lib.mkOption {
type = lib.types.listOf (lib.types.enum browsers); type = lib.types.listOf (lib.types.enum browsers);
default = browsers; default = browsers;
@ -47,7 +49,7 @@ in
# Policies are read from `/etc/brave/policies` only # Policies are read from `/etc/brave/policies` only
# https://github.com/brave/brave-browser/issues/19052 # https://github.com/brave/brave-browser/issues/19052
"${dir}/com.github.browserpass.native.json".source = "${dir}/com.github.browserpass.native.json".source =
"${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; "${cfg.package}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
} }
] ]
else if x == "chrome" then else if x == "chrome" then
@ -61,9 +63,9 @@ in
[ [
{ {
"${dir}/com.github.browserpass.native.json".source = "${dir}/com.github.browserpass.native.json".source =
"${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; "${cfg.package}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
"${dir}/../policies/managed/com.github.browserpass.native.json".source = "${dir}/../policies/managed/com.github.browserpass.native.json".source =
"${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; "${cfg.package}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
} }
] ]
else if x == "chromium" then else if x == "chromium" then
@ -77,11 +79,11 @@ in
[ [
{ {
"${dir}/com.github.browserpass.native.json".source = "${dir}/com.github.browserpass.native.json".source =
"${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; "${cfg.package}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
} }
{ {
"${dir}/../policies/managed/com.github.browserpass.native.json".source = "${dir}/../policies/managed/com.github.browserpass.native.json".source =
"${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; "${cfg.package}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
} }
] ]
else if x == "firefox" then else if x == "firefox" then
@ -95,7 +97,7 @@ in
[ [
{ {
"${dir}/com.github.browserpass.native.json".source = "${dir}/com.github.browserpass.native.json".source =
"${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json"; "${cfg.package}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json";
} }
] ]
else if x == "librewolf" then else if x == "librewolf" then
@ -109,7 +111,7 @@ in
[ [
{ {
"${dir}/com.github.browserpass.native.json".source = "${dir}/com.github.browserpass.native.json".source =
"${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json"; "${cfg.package}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json";
} }
] ]
@ -124,9 +126,9 @@ in
[ [
{ {
"${dir}/com.github.browserpass.native.json".source = "${dir}/com.github.browserpass.native.json".source =
"${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json"; "${cfg.package}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
"${dir}/../policies/managed/com.github.browserpass.native.json".source = "${dir}/../policies/managed/com.github.browserpass.native.json".source =
"${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json"; "${cfg.package}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
} }
] ]
else else

View file

@ -26,12 +26,6 @@
let let
cfg = config.programs.info; cfg = config.programs.info;
# Installs this package -- the interactive just means that it
# includes the curses `info` program. We also use `install-info`
# from this package in the activation script.
infoPkg = pkgs.texinfoInteractive;
in in
{ {
imports = [ imports = [
@ -41,11 +35,18 @@ in
'') '')
]; ];
options.programs.info.enable = lib.mkEnableOption "GNU Info"; options.programs.info = {
enable = lib.mkEnableOption "GNU Info";
# Installs this package -- the interactive just means that it
# includes the curses `info` program. We also use `install-info`
# from this package in the activation script.
package = lib.mkPackageOption pkgs "texinfo" { default = "texinfoInteractive"; };
};
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ home.packages = [
infoPkg cfg.package
# Make sure the target directory is a real directory. # Make sure the target directory is a real directory.
(pkgs.runCommandLocal "dummy-info-dir1" { } "mkdir -p $out/share/info") (pkgs.runCommandLocal "dummy-info-dir1" { } "mkdir -p $out/share/info")
@ -63,7 +64,7 @@ in
PATH="${ PATH="${
lib.makeBinPath [ lib.makeBinPath [
pkgs.gzip pkgs.gzip
infoPkg cfg.package
] ]
}''${PATH:+:}$PATH" \ }''${PATH:+:}$PATH" \
find -L "${infoPath}" \( -name '*.info' -o -name '*.info.gz' \) \ find -L "${infoPath}" \( -name '*.info' -o -name '*.info.gz' \) \

View file

@ -186,6 +186,8 @@ in
programs.irssi = { programs.irssi = {
enable = lib.mkEnableOption "the Irssi chat client"; enable = lib.mkEnableOption "the Irssi chat client";
package = lib.mkPackageOption pkgs "irssi" { nullable = true; };
extraConfig = mkOption { extraConfig = mkOption {
default = ""; default = "";
description = "These lines are appended to the Irssi configuration."; description = "These lines are appended to the Irssi configuration.";
@ -226,7 +228,7 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ pkgs.irssi ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file.".irssi/config".text = '' home.file.".irssi/config".text = ''
settings = { settings = {

View file

@ -60,6 +60,8 @@ in
programs.powerline-go = { programs.powerline-go = {
enable = lib.mkEnableOption "Powerline-go, a beautiful and useful low-latency prompt for your shell"; enable = lib.mkEnableOption "Powerline-go, a beautiful and useful low-latency prompt for your shell";
package = lib.mkPackageOption pkgs "powerline-go" { };
modules = mkOption { modules = mkOption {
default = null; default = null;
type = types.nullOr (types.listOf types.str); type = types.nullOr (types.listOf types.str);
@ -157,7 +159,7 @@ in
local old_exit_status=$? local old_exit_status=$?
${ ${
if evalMode then "eval " else "PS1=" if evalMode then "eval " else "PS1="
}"$(${pkgs.powerline-go}/bin/powerline-go -error $old_exit_status -shell bash${commandLineArguments})" }"$(${lib.getExe cfg.package} -error $old_exit_status -shell bash${commandLineArguments})"
${cfg.extraUpdatePS1} ${cfg.extraUpdatePS1}
return $old_exit_status return $old_exit_status
} }
@ -171,7 +173,7 @@ in
function powerline_precmd() { function powerline_precmd() {
${ ${
if evalMode then "eval " else "PS1=" if evalMode then "eval " else "PS1="
}"$(${pkgs.powerline-go}/bin/powerline-go -error $? -shell zsh${commandLineArguments})" }"$(${lib.getExe cfg.package} -error $? -shell zsh${commandLineArguments})"
${cfg.extraUpdatePS1} ${cfg.extraUpdatePS1}
} }
@ -192,7 +194,7 @@ in
# https://github.com/justjanne/powerline-go#fish # https://github.com/justjanne/powerline-go#fish
programs.fish.interactiveShellInit = mkIf (cfg.enable && config.programs.fish.enable) '' programs.fish.interactiveShellInit = mkIf (cfg.enable && config.programs.fish.enable) ''
function fish_prompt function fish_prompt
eval ${pkgs.powerline-go}/bin/powerline-go -error $status -jobs (count (jobs -p))${commandLineArguments} eval ${lib.getExe cfg.package} -error $status -jobs (count (jobs -p))${commandLineArguments}
${cfg.extraUpdatePS1} ${cfg.extraUpdatePS1}
end end
''; '';

View file

@ -28,6 +28,8 @@ in
options.programs.zsh.zplug = { options.programs.zsh.zplug = {
enable = lib.mkEnableOption "zplug - a zsh plugin manager"; enable = lib.mkEnableOption "zplug - a zsh plugin manager";
package = lib.mkPackageOption pkgs "zplug" { };
plugins = mkOption { plugins = mkOption {
default = [ ]; default = [ ];
type = types.listOf pluginModule; type = types.listOf pluginModule;
@ -44,12 +46,12 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ pkgs.zplug ]; home.packages = [ cfg.package ];
programs.zsh.initContent = lib.mkOrder 550 '' programs.zsh.initContent = lib.mkOrder 550 ''
export ZPLUG_HOME=${cfg.zplugHome} export ZPLUG_HOME=${cfg.zplugHome}
source ${pkgs.zplug}/share/zplug/init.zsh source ${cfg.package}/share/zplug/init.zsh
${optionalString (cfg.plugins != [ ]) '' ${optionalString (cfg.plugins != [ ]) ''
${lib.concatStrings ( ${lib.concatStrings (

View file

@ -6,6 +6,7 @@
}: }:
let let
inherit (lib) inherit (lib)
getExe'
mkEnableOption mkEnableOption
mkOption mkOption
optional optional
@ -26,6 +27,8 @@ in
options.services.barrier = { options.services.barrier = {
package = lib.mkPackageOption pkgs "barrier" { };
client = { client = {
enable = mkEnableOption "Barrier Client daemon"; enable = mkEnableOption "Barrier Client daemon";
@ -81,7 +84,7 @@ in
Service.ExecStart = Service.ExecStart =
with cfg.client; with cfg.client;
toString ( toString (
[ "${pkgs.barrier}/bin/barrierc" ] [ "${getExe' cfg.package "barrierc"}" ]
++ optional (name != null) "--name ${name}" ++ optional (name != null) "--name ${name}"
++ optional (!enableCrypto) "--disable-crypto" ++ optional (!enableCrypto) "--disable-crypto"
++ optional enableDragDrop "--enable-drag-drop" ++ optional enableDragDrop "--enable-drag-drop"

View file

@ -4,6 +4,9 @@
pkgs, pkgs,
... ...
}: }:
let
cfg = config.services.blueman-applet;
in
{ {
options = { options = {
services.blueman-applet = { services.blueman-applet = {
@ -19,6 +22,8 @@
``` ```
''; '';
}; };
package = lib.mkPackageOption pkgs "blueman" { };
}; };
}; };
@ -43,7 +48,7 @@
}; };
Service = { Service = {
ExecStart = "${pkgs.blueman}/bin/blueman-applet"; ExecStart = "${lib.getExe' cfg.package "blueman-applet"}";
}; };
}; };
}; };

View file

@ -13,6 +13,8 @@ in
options = { options = {
services.caffeine = { services.caffeine = {
enable = lib.mkEnableOption "Caffeine service"; enable = lib.mkEnableOption "Caffeine service";
package = lib.mkPackageOption pkgs "caffeine-ng" { };
}; };
}; };
@ -36,7 +38,7 @@ in
ProtectSystem = "full"; ProtectSystem = "full";
Type = "exec"; Type = "exec";
Slice = "session.slice"; Slice = "session.slice";
ExecStart = "${pkgs.caffeine-ng}/bin/caffeine"; ExecStart = "${lib.getExe' cfg.package "caffeine"}";
}; };
}; };
}; };

View file

@ -16,6 +16,8 @@ in
Devilspie2, a window matching utility, allowing the user to Devilspie2, a window matching utility, allowing the user to
perform scripted actions on windows as they are created''; perform scripted actions on windows as they are created'';
package = lib.mkPackageOption pkgs "devilspie2" { };
config = lib.mkOption { config = lib.mkOption {
type = lib.types.lines; type = lib.types.lines;
default = ""; default = "";
@ -37,7 +39,7 @@ in
]; ];
systemd.user.services.devilspie2 = { systemd.user.services.devilspie2 = {
Service.ExecStart = "${pkgs.devilspie2}/bin/devilspie2"; Service.ExecStart = "${lib.getExe cfg.package}";
Unit = { Unit = {
Description = "devilspie2"; Description = "devilspie2";
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];

View file

@ -8,7 +8,7 @@ let
cfg = config.services.dropbox; cfg = config.services.dropbox;
baseDir = ".dropbox-hm"; baseDir = ".dropbox-hm";
dropboxCmd = "${pkgs.dropbox-cli}/bin/dropbox"; dropboxCmd = "${lib.getExe' cfg.package "dropbox"}";
homeBaseDir = "${config.home.homeDirectory}/${baseDir}"; homeBaseDir = "${config.home.homeDirectory}/${baseDir}";
in in
@ -19,6 +19,8 @@ in
services.dropbox = { services.dropbox = {
enable = lib.mkEnableOption "Dropbox daemon"; enable = lib.mkEnableOption "Dropbox daemon";
package = lib.mkPackageOption pkgs "dropbox-cli" { };
path = lib.mkOption { path = lib.mkOption {
type = lib.types.path; type = lib.types.path;
default = "${config.home.homeDirectory}/Dropbox"; default = "${config.home.homeDirectory}/Dropbox";
@ -34,7 +36,7 @@ in
(lib.hm.assertions.assertPlatform "services.dropbox" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.dropbox" pkgs lib.platforms.linux)
]; ];
home.packages = [ pkgs.dropbox-cli ]; home.packages = [ cfg.package ];
systemd.user.services.dropbox = { systemd.user.services.dropbox = {
Unit = { Unit = {

View file

@ -17,6 +17,8 @@ in
services.fluidsynth = { services.fluidsynth = {
enable = lib.mkEnableOption "fluidsynth midi synthesizer"; enable = lib.mkEnableOption "fluidsynth midi synthesizer";
package = lib.mkPackageOption pkgs "fluidsynth" { };
soundFont = mkOption { soundFont = mkOption {
type = types.path; type = types.path;
default = "${pkgs.soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2"; default = "${pkgs.soundfont-fluid}/share/soundfonts/FluidR3_GM2-2.sf2";
@ -71,7 +73,7 @@ in
}; };
Service = { Service = {
ExecStart = "${pkgs.fluidsynth}/bin/fluidsynth -a pulseaudio -si ${lib.concatStringsSep " " cfg.extraOptions} ${cfg.soundFont}"; ExecStart = "${lib.getExe cfg.package} -a pulseaudio -si ${lib.concatStringsSep " " cfg.extraOptions} ${cfg.soundFont}";
}; };
}; };
}; };

View file

@ -19,6 +19,8 @@ in
services.getmail = { services.getmail = {
enable = lib.mkEnableOption "the getmail systemd service to automatically retrieve mail"; enable = lib.mkEnableOption "the getmail systemd service to automatically retrieve mail";
package = lib.mkPackageOption pkgs "getmail" { default = "getmail6"; };
frequency = lib.mkOption { frequency = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "*:0/5"; default = "*:0/5";
@ -45,7 +47,7 @@ in
Description = "getmail email fetcher"; Description = "getmail email fetcher";
}; };
Service = { Service = {
ExecStart = "${pkgs.getmail6}/bin/getmail ${configFiles}"; ExecStart = "${lib.getExe cfg.package} ${configFiles}";
}; };
}; };

View file

@ -16,6 +16,8 @@ in
services.gnome-keyring = { services.gnome-keyring = {
enable = lib.mkEnableOption "GNOME Keyring"; enable = lib.mkEnableOption "GNOME Keyring";
package = lib.mkPackageOption pkgs "gnome-keyring" { };
components = lib.mkOption { components = lib.mkOption {
type = lib.types.listOf ( type = lib.types.listOf (
lib.types.enum [ lib.types.enum [
@ -63,7 +65,7 @@ in
++ lib.optional (cfg.components != [ ]) ("--components=" + lib.concatStringsSep "," cfg.components) ++ lib.optional (cfg.components != [ ]) ("--components=" + lib.concatStringsSep "," cfg.components)
); );
in in
"${pkgs.gnome-keyring}/bin/gnome-keyring-daemon ${args}"; "${lib.getExe' cfg.package "gnome-keyring-daemon"} ${args}";
Restart = "on-abort"; Restart = "on-abort";
}; };

View file

@ -19,6 +19,8 @@ in
services.grobi = { services.grobi = {
enable = lib.mkEnableOption "the grobi display setup daemon"; enable = lib.mkEnableOption "the grobi display setup daemon";
package = lib.mkPackageOption pkgs "grobi" { };
executeAfter = mkOption { executeAfter = mkOption {
type = with types; listOf str; type = with types; listOf str;
default = [ ]; default = [ ];
@ -87,7 +89,7 @@ in
Service = { Service = {
Type = "simple"; Type = "simple";
ExecStart = "${pkgs.grobi}/bin/grobi watch -v"; ExecStart = "${lib.getExe cfg.package} watch -v";
Restart = "always"; Restart = "always";
RestartSec = "2s"; RestartSec = "2s";
Environment = [ "PATH=${pkgs.xorg.xrandr}/bin:${pkgs.bash}/bin" ]; Environment = [ "PATH=${pkgs.xorg.xrandr}/bin:${pkgs.bash}/bin" ];

View file

@ -30,6 +30,8 @@ in
options.services.hound = { options.services.hound = {
enable = lib.mkEnableOption "hound"; enable = lib.mkEnableOption "hound";
package = lib.mkPackageOption pkgs "hound" { };
maxConcurrentIndexers = mkOption { maxConcurrentIndexers = mkOption {
type = types.ints.positive; type = types.ints.positive;
default = 2; default = 2;
@ -70,7 +72,7 @@ in
(lib.hm.assertions.assertPlatform "services.hound" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.hound" pkgs lib.platforms.linux)
]; ];
home.packages = [ pkgs.hound ]; home.packages = [ cfg.package ];
systemd.user.services.hound = { systemd.user.services.hound = {
Unit = { Unit = {
@ -90,7 +92,7 @@ in
] ]
}" }"
]; ];
ExecStart = "${pkgs.hound}/bin/houndd ${lib.concatStringsSep " " houndOptions}"; ExecStart = "${lib.getExe' cfg.package "houndd"} ${lib.concatStringsSep " " houndOptions}";
}; };
}; };
}; };

View file

@ -14,6 +14,8 @@ in
services.kbfs = { services.kbfs = {
enable = lib.mkEnableOption "Keybase File System"; enable = lib.mkEnableOption "Keybase File System";
package = lib.mkPackageOption pkgs "kbfs" { };
mountPoint = lib.mkOption { mountPoint = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "keybase"; default = "keybase";
@ -59,7 +61,7 @@ in
"KEYBASE_SYSTEMD=1" "KEYBASE_SYSTEMD=1"
]; ];
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${mountPoint}"; ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${mountPoint}";
ExecStart = "${pkgs.kbfs}/bin/kbfsfuse ${toString cfg.extraFlags} ${mountPoint}"; ExecStart = "${lib.getExe' cfg.package "kbfsfuse"} ${toString cfg.extraFlags} ${mountPoint}";
ExecStopPost = "/run/wrappers/bin/fusermount -u ${mountPoint}"; ExecStopPost = "/run/wrappers/bin/fusermount -u ${mountPoint}";
Restart = "on-failure"; Restart = "on-failure";
}; };
@ -67,7 +69,7 @@ in
Install.WantedBy = [ "default.target" ]; Install.WantedBy = [ "default.target" ];
}; };
home.packages = [ pkgs.kbfs ]; home.packages = [ cfg.package ];
services.keybase.enable = true; services.keybase.enable = true;
}; };
} }

View file

@ -10,20 +10,24 @@ let
in in
{ {
options.services.keybase.enable = lib.mkEnableOption "Keybase"; options.services.keybase = {
enable = lib.mkEnableOption "Keybase";
package = lib.mkPackageOption pkgs "keybase" { };
};
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
(lib.hm.assertions.assertPlatform "services.keybase" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.keybase" pkgs lib.platforms.linux)
]; ];
home.packages = [ pkgs.keybase ]; home.packages = [ cfg.package ];
systemd.user.services.keybase = { systemd.user.services.keybase = {
Unit.Description = "Keybase service"; Unit.Description = "Keybase service";
Service = { Service = {
ExecStart = "${pkgs.keybase}/bin/keybase service --auto-forked"; ExecStart = "${lib.getExe cfg.package} service --auto-forked";
Restart = "on-failure"; Restart = "on-failure";
PrivateTmp = true; PrivateTmp = true;
}; };

View file

@ -12,6 +12,8 @@ in
{ {
options.services.keynav = { options.services.keynav = {
enable = lib.mkEnableOption "keynav"; enable = lib.mkEnableOption "keynav";
package = lib.mkPackageOption pkgs "keynav" { };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -27,7 +29,7 @@ in
}; };
Service = { Service = {
ExecStart = "${pkgs.keynav}/bin/keynav"; ExecStart = lib.getExe cfg.package;
RestartSec = 3; RestartSec = 3;
Restart = "always"; Restart = "always";
}; };

View file

@ -12,7 +12,11 @@ in
{ {
meta.maintainers = [ lib.maintainers.thibautmarty ]; meta.maintainers = [ lib.maintainers.thibautmarty ];
options.services.mpris-proxy.enable = lib.mkEnableOption "a proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players"; options.services.mpris-proxy = {
enable = lib.mkEnableOption "a proxy forwarding Bluetooth MIDI controls via MPRIS2 to control media players";
package = lib.mkPackageOption pkgs "bluez" { };
};
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
assertions = [ assertions = [
@ -30,7 +34,7 @@ in
Service = { Service = {
Type = "simple"; Type = "simple";
ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; ExecStart = lib.getExe' cfg.package "mpris-proxy";
}; };
}; };
}; };

View file

@ -139,6 +139,8 @@ in
meta.maintainers = with lib.maintainers; [ euxane ]; meta.maintainers = with lib.maintainers; [ euxane ];
options.services.muchsync = { options.services.muchsync = {
package = lib.mkPackageOption pkgs "muchsync" { };
remotes = mkOption { remotes = mkOption {
type = with types; attrsOf (submodule syncOptions); type = with types; attrsOf (submodule syncOptions);
default = { }; default = { };
@ -190,7 +192,7 @@ in
''"NMBGIT=${config.home.sessionVariables.NMBGIT}"'' ''"NMBGIT=${config.home.sessionVariables.NMBGIT}"''
]; ];
ExecStart = lib.concatStringsSep " " ( ExecStart = lib.concatStringsSep " " (
[ "${pkgs.muchsync}/bin/muchsync" ] [ (lib.getExe cfg.package) ]
++ [ "-s ${escapeShellArg remoteCfg.sshCommand}" ] ++ [ "-s ${escapeShellArg remoteCfg.sshCommand}" ]
++ optional (!remoteCfg.upload) "--noup" ++ optional (!remoteCfg.upload) "--noup"

View file

@ -18,6 +18,8 @@ in
options = { options = {
services.network-manager-applet = { services.network-manager-applet = {
enable = lib.mkEnableOption "the Network Manager applet (nm-applet)"; enable = lib.mkEnableOption "the Network Manager applet (nm-applet)";
package = lib.mkPackageOption pkgs "networkmanagerapplet" { };
}; };
}; };
@ -27,7 +29,7 @@ in
]; ];
# The package provides some icons that are good to have available. # The package provides some icons that are good to have available.
xdg.systemDirs.data = [ "${pkgs.networkmanagerapplet}/share" ]; xdg.systemDirs.data = [ "${cfg.package}/share" ];
systemd.user.services.network-manager-applet = { systemd.user.services.network-manager-applet = {
Unit = { Unit = {
@ -46,7 +48,7 @@ in
Service = { Service = {
ExecStart = toString ( ExecStart = toString (
[ "${pkgs.networkmanagerapplet}/bin/nm-applet" ] [ (lib.getExe' cfg.package "nm-applet") ]
++ lib.optional config.xsession.preferStatusNotifierItems "--indicator" ++ lib.optional config.xsession.preferStatusNotifierItems "--indicator"
); );
}; };

View file

@ -15,6 +15,8 @@ in
services.pasystray = { services.pasystray = {
enable = lib.mkEnableOption "PulseAudio system tray"; enable = lib.mkEnableOption "PulseAudio system tray";
package = lib.mkPackageOption pkgs "pasystray" { };
extraOptions = lib.mkOption { extraOptions = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.str;
default = [ ]; default = [ ];
@ -54,7 +56,7 @@ in
]; ];
in in
[ "PATH=${toolPaths}" ]; [ "PATH=${toolPaths}" ];
ExecStart = lib.escapeShellArgs ([ "${pkgs.pasystray}/bin/pasystray" ] ++ cfg.extraOptions); ExecStart = lib.escapeShellArgs ([ (lib.getExe cfg.package) ] ++ cfg.extraOptions);
}; };
}; };
}; };

View file

@ -13,6 +13,8 @@ in
meta.maintainers = [ lib.maintainers.ehmry ]; meta.maintainers = [ lib.maintainers.ehmry ];
options.services.plan9port = { options.services.plan9port = {
package = lib.mkPackageOption pkgs "plan9port" { };
fontsrv.enable = lib.mkEnableOption "the Plan 9 file system access to host fonts"; fontsrv.enable = lib.mkEnableOption "the Plan 9 file system access to host fonts";
plumber.enable = lib.mkEnableOption "the Plan 9 file system for interprocess messaging"; plumber.enable = lib.mkEnableOption "the Plan 9 file system for interprocess messaging";
}; };
@ -25,13 +27,13 @@ in
systemd.user.services.fontsrv = lib.mkIf cfg.fontsrv.enable { systemd.user.services.fontsrv = lib.mkIf cfg.fontsrv.enable {
Unit.Description = "the Plan 9 file system access to host fonts"; Unit.Description = "the Plan 9 file system access to host fonts";
Install.WantedBy = [ "default.target" ]; Install.WantedBy = [ "default.target" ];
Service.ExecStart = "${pkgs.plan9port}/bin/9 fontsrv"; Service.ExecStart = "${lib.getExe' cfg.package "9"} fontsrv";
}; };
systemd.user.services.plumber = lib.mkIf cfg.plumber.enable { systemd.user.services.plumber = lib.mkIf cfg.plumber.enable {
Unit.Description = "file system for interprocess messaging"; Unit.Description = "file system for interprocess messaging";
Install.WantedBy = [ "default.target" ]; Install.WantedBy = [ "default.target" ];
Service.ExecStart = "${pkgs.plan9port}/bin/9 plumber -f"; Service.ExecStart = "${lib.getExe' cfg.package "9"} plumber -f";
}; };
}; };

View file

@ -31,6 +31,8 @@ in
options.services.poweralertd = { options.services.poweralertd = {
enable = lib.mkEnableOption "the Upower-powered power alertd"; enable = lib.mkEnableOption "the Upower-powered power alertd";
package = lib.mkPackageOption pkgs "poweralertd" { };
extraArgs = lib.mkOption { extraArgs = lib.mkOption {
type = with types; listOf str; type = with types; listOf str;
default = [ ]; default = [ ];
@ -61,7 +63,7 @@ in
Service = { Service = {
Type = "simple"; Type = "simple";
ExecStart = "${pkgs.poweralertd}/bin/poweralertd ${escapeSystemdExecArgs cfg.extraArgs}"; ExecStart = "${lib.getExe cfg.package} ${escapeSystemdExecArgs cfg.extraArgs}";
Restart = "always"; Restart = "always";
}; };
}; };

View file

@ -24,6 +24,8 @@ in
options.services.psd = { options.services.psd = {
enable = lib.mkEnableOption "Profile-sync-daemon service"; enable = lib.mkEnableOption "Profile-sync-daemon service";
package = lib.mkPackageOption pkgs "profile-sync-daemon" { };
resyncTimer = lib.mkOption { resyncTimer = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "1h"; default = "1h";
@ -75,12 +77,12 @@ in
(lib.hm.assertions.assertPlatform "services.psd" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.psd" pkgs lib.platforms.linux)
]; ];
home.packages = [ pkgs.profile-sync-daemon ]; home.packages = [ cfg.package ];
systemd.user = { systemd.user = {
services = services =
let let
exe = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon"; exe = lib.getExe' cfg.package "profile-sync-daemon";
envPath = lib.makeBinPath ( envPath = lib.makeBinPath (
with pkgs; with pkgs;
[ [
@ -93,7 +95,7 @@ in
findutils findutils
nettools nettools
util-linux util-linux
profile-sync-daemon cfg.package
] ]
); );
in in

View file

@ -37,6 +37,8 @@ in
''; '';
}; };
package = lib.mkPackageOption pkgs "feh" { };
imageDirectory = mkOption { imageDirectory = mkOption {
type = types.str; type = types.str;
example = "%h/backgrounds"; example = "%h/backgrounds";
@ -98,7 +100,7 @@ in
Service = { Service = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${pkgs.feh}/bin/feh ${flags} ${cfg.imageDirectory}"; ExecStart = "${lib.getExe cfg.package} ${flags} ${cfg.imageDirectory}";
IOSchedulingClass = "idle"; IOSchedulingClass = "idle";
}; };

View file

@ -12,9 +12,9 @@ let
in in
{ {
options.services.rsibreak = { options.services.rsibreak = {
enable = lib.mkEnableOption "rsibreak"; enable = lib.mkEnableOption "rsibreak";
package = lib.mkPackageOption pkgs "rsibreak" { };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -22,7 +22,7 @@ in
(lib.hm.assertions.assertPlatform "services.rsibreak" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.rsibreak" pkgs lib.platforms.linux)
]; ];
home.packages = [ pkgs.rsibreak ]; home.packages = [ cfg.package ];
systemd.user.services.rsibreak = { systemd.user.services.rsibreak = {
Unit = { Unit = {
Description = "RSI break timer"; Description = "RSI break timer";
@ -36,7 +36,7 @@ in
Service = { Service = {
Environment = [ "PATH=${config.home.profileDirectory}/bin" ]; Environment = [ "PATH=${config.home.profileDirectory}/bin" ];
ExecStart = "${pkgs.rsibreak}/bin/rsibreak"; ExecStart = lib.getExe cfg.package;
}; };
}; };
}; };

View file

@ -12,6 +12,8 @@
services.sctd = { services.sctd = {
enable = lib.mkEnableOption "sctd"; enable = lib.mkEnableOption "sctd";
package = lib.mkPackageOption pkgs "sct" { };
baseTemperature = lib.mkOption { baseTemperature = lib.mkOption {
type = lib.types.ints.between 2500 9000; type = lib.types.ints.between 2500 9000;
default = 4500; default = 4500;
@ -38,8 +40,8 @@
Install.WantedBy = [ "graphical-session.target" ]; Install.WantedBy = [ "graphical-session.target" ];
Service = { Service = {
ExecStart = "${pkgs.sct}/bin/sctd ${toString config.services.sctd.baseTemperature}"; ExecStart = "${config.services.sctd.package}/bin/sctd ${toString config.services.sctd.baseTemperature}";
ExecStopPost = "${pkgs.sct}/bin/sct"; ExecStopPost = "${config.services.sctd.package}/bin/sct";
Restart = "on-abnormal"; Restart = "on-abnormal";
SuccessExitStatus = 1; SuccessExitStatus = 1;
@ -61,7 +63,7 @@
pkgs.coreutils pkgs.coreutils
pkgs.gnused pkgs.gnused
pkgs.which pkgs.which
pkgs.sct config.services.sctd.package
logger logger
] ]
}" }"

View file

@ -16,6 +16,8 @@ in
options = { options = {
services.ssh-agent = { services.ssh-agent = {
enable = lib.mkEnableOption "OpenSSH private key agent"; enable = lib.mkEnableOption "OpenSSH private key agent";
package = lib.mkPackageOption pkgs "openssh" { };
}; };
}; };
@ -39,7 +41,7 @@ in
}; };
Service = { Service = {
ExecStart = "${pkgs.openssh}/bin/ssh-agent -D -a %t/ssh-agent"; ExecStart = "${lib.getExe' cfg.package "ssh-agent"} -D -a %t/ssh-agent";
}; };
}; };
}; };

View file

@ -4,13 +4,17 @@
pkgs, pkgs,
... ...
}: }:
let
cfg = config.services.systembus-notify;
in
{ {
meta.maintainers = [ lib.maintainers.asymmetric ]; meta.maintainers = [ lib.maintainers.asymmetric ];
options = { options = {
services.systembus-notify = { services.systembus-notify = {
enable = lib.mkEnableOption "systembus-notify - system bus notification daemon"; enable = lib.mkEnableOption "systembus-notify - system bus notification daemon";
package = lib.mkPackageOption pkgs "systembus-notify" { };
}; };
}; };
@ -22,7 +26,7 @@
systemd.user.services.systembus-notify = { systemd.user.services.systembus-notify = {
Unit.Description = "systembus-notify daemon"; Unit.Description = "systembus-notify daemon";
Install.WantedBy = [ "graphical-session.target" ]; Install.WantedBy = [ "graphical-session.target" ];
Service.ExecStart = "${pkgs.systembus-notify}/bin/systembus-notify"; Service.ExecStart = lib.getExe cfg.package;
}; };
}; };
} }

View file

@ -4,13 +4,17 @@
pkgs, pkgs,
... ...
}: }:
let
cfg = config.services.tahoe-lafs;
in
{ {
meta.maintainers = [ lib.maintainers.rycee ]; meta.maintainers = [ lib.maintainers.rycee ];
options = { options = {
services.tahoe-lafs = { services.tahoe-lafs = {
enable = lib.mkEnableOption "Tahoe-LAFS"; enable = lib.mkEnableOption "Tahoe-LAFS";
package = lib.mkPackageOption pkgs "tahoelafs" { };
}; };
}; };
@ -25,7 +29,7 @@
}; };
Service = { Service = {
ExecStart = "${pkgs.tahoelafs}/bin/tahoe run -C %h/.tahoe"; ExecStart = "${lib.getExe' cfg.package "tahoe"} run -C %h/.tahoe";
}; };
}; };
}; };

View file

@ -44,6 +44,8 @@ in
''; '';
}; };
package = lib.mkPackageOption pkgs "udiskie" { };
settings = mkOption { settings = mkOption {
type = yaml.type; type = yaml.type;
default = { }; default = { };
@ -133,7 +135,7 @@ in
}; };
Service.ExecStart = toString ( Service.ExecStart = toString (
[ "${pkgs.udiskie}/bin/udiskie" ] [ (lib.getExe cfg.package) ]
++ lib.optional config.xsession.preferStatusNotifierItems "--appindicator" ++ lib.optional config.xsession.preferStatusNotifierItems "--appindicator"
); );

View file

@ -20,6 +20,8 @@ in
services.xcape = { services.xcape = {
enable = lib.mkEnableOption "xcape"; enable = lib.mkEnableOption "xcape";
package = lib.mkPackageOption pkgs "xcape" { };
timeout = lib.mkOption { timeout = lib.mkOption {
type = types.nullOr types.int; type = types.nullOr types.int;
default = null; default = null;
@ -80,7 +82,7 @@ in
Service = { Service = {
Type = "forking"; Type = "forking";
ExecStart = ExecStart =
"${pkgs.xcape}/bin/xcape" "${lib.getExe cfg.package}"
+ lib.optionalString (cfg.timeout != null) " -t ${toString cfg.timeout}" + lib.optionalString (cfg.timeout != null) " -t ${toString cfg.timeout}"
+ +
lib.optionalString (cfg.mapExpression != { }) lib.optionalString (cfg.mapExpression != { })

View file

@ -119,6 +119,8 @@ in
services.xsuspender = { services.xsuspender = {
enable = lib.mkEnableOption "XSuspender"; enable = lib.mkEnableOption "XSuspender";
package = lib.mkPackageOption pkgs "xsuspender" { };
defaults = mkOption { defaults = mkOption {
description = "XSuspender defaults."; description = "XSuspender defaults.";
type = xsuspenderOptions; type = xsuspenderOptions;
@ -182,7 +184,7 @@ in
// lib.mapAttrs (_: mkSection) cfg.rules; // lib.mapAttrs (_: mkSection) cfg.rules;
# To make the xsuspender tool available. # To make the xsuspender tool available.
home.packages = [ pkgs.xsuspender ]; home.packages = [ cfg.package ];
xdg.configFile."xsuspender.conf".source = iniFormat.generate "xsuspender.conf" cfg.iniContent; xdg.configFile."xsuspender.conf".source = iniFormat.generate "xsuspender.conf" cfg.iniContent;
@ -195,7 +197,7 @@ in
}; };
Service = { Service = {
ExecStart = "${pkgs.xsuspender}/bin/xsuspender"; ExecStart = lib.getExe cfg.package;
Environment = lib.mkIf cfg.debug [ "G_MESSAGES_DEBUG=all" ]; Environment = lib.mkIf cfg.debug [ "G_MESSAGES_DEBUG=all" ];
}; };