1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-18 14:28:15 +00:00

treewide: null package support (#6582)

Can generate the config without installing application through home-manager. Helpful when a package is broken (or not provided) on a specific platform through nixpkgs and needs to be installed through other means but you still can benefit from the declarative configuration.
This commit is contained in:
Austin Horstman 2025-03-07 18:17:52 -06:00 committed by GitHub
parent 6c2b79403e
commit d2c014e1c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
83 changed files with 269 additions and 222 deletions

View file

@ -38,7 +38,7 @@ in {
enable = mkEnableOption "aerc"; enable = mkEnableOption "aerc";
package = mkPackageOption pkgs "aerc" { }; package = mkPackageOption pkgs "aerc" { nullable = true; };
extraAccounts = mkOption { extraAccounts = mkOption {
type = sectionsOrLines; type = sectionsOrLines;
@ -193,7 +193,7 @@ in {
''; '';
}]; }];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file = { home.file = {
"${configDir}/accounts.conf" = mkIf genAccountsConf { "${configDir}/accounts.conf" = mkIf genAccountsConf {

View file

@ -29,7 +29,7 @@ in {
options.programs.aerospace = { options.programs.aerospace = {
enable = lib.mkEnableOption "AeroSpace window manager"; enable = lib.mkEnableOption "AeroSpace window manager";
package = lib.mkPackageOption pkgs "aerospace" { }; package = lib.mkPackageOption pkgs "aerospace" { nullable = true; };
userSettings = mkOption { userSettings = mkOption {
type = types.submodule { type = types.submodule {
@ -232,7 +232,7 @@ in {
]; ];
home = { home = {
packages = [ cfg.package ]; packages = lib.mkIf (cfg.package != null) [ cfg.package ];
file.".config/aerospace/aerospace.toml".source = file.".config/aerospace/aerospace.toml".source =
tomlFormat.generate "aerospace" (filterNulls cfg.userSettings); tomlFormat.generate "aerospace" (filterNulls cfg.userSettings);
}; };

View file

@ -132,7 +132,7 @@ in {
''; '';
}; };
package = mkPackageOption pkgs "alot" { }; package = mkPackageOption pkgs "alot" { nullable = true; };
hooks = mkOption { hooks = mkOption {
type = types.lines; type = types.lines;
@ -231,7 +231,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."alot/config".text = configFile; xdg.configFile."alot/config".text = configFile;

View file

@ -19,7 +19,7 @@ in {
options.programs.bacon = { options.programs.bacon = {
enable = mkEnableOption "bacon, a background rust code checker"; enable = mkEnableOption "bacon, a background rust code checker";
package = mkPackageOption pkgs "bacon" { }; package = mkPackageOption pkgs "bacon" { nullable = true; };
settings = mkOption { settings = mkOption {
type = settingsFormat.type; type = settingsFormat.type;
@ -38,7 +38,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/prefs.toml" = mkIf (cfg.settings != { }) { home.file."${configDir}/prefs.toml" = mkIf (cfg.settings != { }) {
source = settingsFormat.generate "prefs.toml" cfg.settings; source = settingsFormat.generate "prefs.toml" cfg.settings;

View file

@ -29,7 +29,10 @@ in {
programs.bash = { programs.bash = {
enable = mkEnableOption "GNU Bourne-Again SHell"; enable = mkEnableOption "GNU Bourne-Again SHell";
package = mkPackageOption pkgs "bash" { default = "bashInteractive"; }; package = mkPackageOption pkgs "bash" {
nullable = true;
default = "bashInteractive";
};
enableCompletion = mkOption { enableCompletion = mkOption {
type = types.bool; type = types.bool;
@ -195,7 +198,7 @@ in {
}) ++ optional (cfg.historyFile != null) }) ++ optional (cfg.historyFile != null)
''mkdir -p "$(dirname "$HISTFILE")"'')); ''mkdir -p "$(dirname "$HISTFILE")"''));
in mkIf cfg.enable { in mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file.".bash_profile".source = writeBashScript "bash_profile" '' home.file.".bash_profile".source = writeBashScript "bash_profile" ''
# include .profile if it exists # include .profile if it exists

View file

@ -12,7 +12,7 @@ in {
options.programs.bemenu = { options.programs.bemenu = {
enable = mkEnableOption "bemenu"; enable = mkEnableOption "bemenu";
package = mkPackageOption pkgs "bemenu" { }; package = mkPackageOption pkgs "bemenu" { nullable = true; };
settings = mkOption { settings = mkOption {
type = with types; attrsOf (oneOf [ str number bool ]); type = with types; attrsOf (oneOf [ str number bool ]);
@ -44,7 +44,7 @@ in {
assertions = assertions =
[ (hm.assertions.assertPlatform "programs.bemenu" pkgs platforms.linux) ]; [ (hm.assertions.assertPlatform "programs.bemenu" pkgs platforms.linux) ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.sessionVariables = mkIf (cfg.settings != { }) { home.sessionVariables = mkIf (cfg.settings != { }) {
BEMENU_OPTS = cli.toGNUCommandLineShell { } cfg.settings; BEMENU_OPTS = cli.toGNUCommandLineShell { } cfg.settings;

View file

@ -243,7 +243,7 @@ in {
programs.borgmatic = { programs.borgmatic = {
enable = mkEnableOption "Borgmatic"; enable = mkEnableOption "Borgmatic";
package = mkPackageOption pkgs "borgmatic" { }; package = mkPackageOption pkgs "borgmatic" { nullable = true; };
backups = mkOption { backups = mkOption {
type = types.attrsOf configModule; type = types.attrsOf configModule;
@ -292,6 +292,6 @@ in {
text = writeConfig config; text = writeConfig config;
}) cfg.backups; }) cfg.backups;
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
}; };
} }

View file

@ -84,7 +84,7 @@ in {
options.programs.boxxy = { options.programs.boxxy = {
enable = mkEnableOption "boxxy: Boxes in badly behaving applications"; enable = mkEnableOption "boxxy: Boxes in badly behaving applications";
package = mkPackageOption pkgs "boxxy" { }; package = mkPackageOption pkgs "boxxy" { nullable = true; };
rules = mkOption { rules = mkOption {
type = types.listOf boxxyRulesOpts; type = types.listOf boxxyRulesOpts;
@ -102,7 +102,7 @@ in {
settingsFormat.generate "boxxy-config.yaml" { rules = cfg.rules; }; settingsFormat.generate "boxxy-config.yaml" { rules = cfg.rules; };
}; };
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
}; };
meta.maintainers = with lib.hm.maintainers; [ nikp123 ]; meta.maintainers = with lib.hm.maintainers; [ nikp123 ];

View file

@ -25,7 +25,7 @@ in {
options.programs.btop = { options.programs.btop = {
enable = lib.mkEnableOption "btop"; enable = lib.mkEnableOption "btop";
package = lib.mkPackageOption pkgs "btop" { }; package = lib.mkPackageOption pkgs "btop" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = with lib.types; attrsOf (oneOf [ bool float int str ]); type = with lib.types; attrsOf (oneOf [ bool float int str ]);
@ -51,7 +51,7 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."btop/btop.conf" = xdg.configFile."btop/btop.conf" =
lib.mkIf (cfg.settings != { }) { text = finalConfig; }; lib.mkIf (cfg.settings != { }) { text = finalConfig; };

View file

@ -9,7 +9,7 @@ in {
options.programs.bun = { options.programs.bun = {
enable = lib.mkEnableOption "Bun JavaScript runtime"; enable = lib.mkEnableOption "Bun JavaScript runtime";
package = lib.mkPackageOption pkgs "bun" { }; package = lib.mkPackageOption pkgs "bun" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = tomlFormat.type; type = tomlFormat.type;
@ -42,7 +42,13 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; warnings = lib.optional (cfg.package == null && cfg.enableGitIntegration) ''
You have enabled git integration for `bun` but have not set `package`.
Git integration will not be configured.
'';
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile.".bunfig.toml" = lib.mkIf (cfg.settings != { }) { xdg.configFile.".bunfig.toml" = lib.mkIf (cfg.settings != { }) {
source = tomlFormat.generate "bun-config" cfg.settings; source = tomlFormat.generate "bun-config" cfg.settings;
@ -50,10 +56,12 @@ in {
# https://bun.sh/docs/install/lockfile#how-do-i-git-diff-bun-s-lockfile # https://bun.sh/docs/install/lockfile#how-do-i-git-diff-bun-s-lockfile
programs.git.attributes = programs.git.attributes =
lib.mkIf cfg.enableGitIntegration [ "*.lockb binary diff=lockb" ]; lib.mkIf (cfg.enableGitIntegration && (cfg.package != null))
programs.git.extraConfig.diff.lockb = lib.mkIf cfg.enableGitIntegration { [ "*.lockb binary diff=lockb" ];
textconv = lib.getExe cfg.package; programs.git.extraConfig.diff.lockb =
binary = true; lib.mkIf (cfg.enableGitIntegration && (cfg.package != null)) {
}; textconv = lib.getExe cfg.package;
binary = true;
};
}; };
} }

View file

@ -14,7 +14,7 @@ in {
options.programs.cava = { options.programs.cava = {
enable = mkEnableOption "Cava audio visualizer"; enable = mkEnableOption "Cava audio visualizer";
package = mkPackageOption pkgs "cava" { }; package = mkPackageOption pkgs "cava" { nullable = true; };
settings = mkOption { settings = mkOption {
type = iniFmt.type; type = iniFmt.type;
@ -39,7 +39,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."cava/config" = mkIf (cfg.settings != { }) { xdg.configFile."cava/config" = mkIf (cfg.settings != { }) {
text = '' text = ''

View file

@ -16,7 +16,7 @@ in {
options.programs.cavalier = { options.programs.cavalier = {
enable = mkEnableOption "Cava audio visualizer GUI"; enable = mkEnableOption "Cava audio visualizer GUI";
package = mkPackageOption pkgs "cavalier" { }; package = mkPackageOption pkgs "cavalier" { nullable = true; };
settings = { settings = {
general = mkOption { general = mkOption {
@ -81,7 +81,7 @@ in {
lib.platforms.linux) lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = { xdg.configFile = {
"Nickvision Cavalier/config.json" = mkIf (cfg.settings.general != { }) { "Nickvision Cavalier/config.json" = mkIf (cfg.settings.general != { }) {

View file

@ -10,7 +10,7 @@ in {
options.programs.comodoro = { options.programs.comodoro = {
enable = lib.mkEnableOption "Comodoro, a CLI to manage your time"; enable = lib.mkEnableOption "Comodoro, a CLI to manage your time";
package = lib.mkPackageOption pkgs "comodoro" { }; package = lib.mkPackageOption pkgs "comodoro" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = lib.types.submodule { freeformType = tomlFormat.type; }; type = lib.types.submodule { freeformType = tomlFormat.type; };
@ -23,7 +23,7 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."comodoro/config.toml".source = xdg.configFile."comodoro/config.toml".source =
tomlFormat.generate "comodoro-config.toml" cfg.settings; tomlFormat.generate "comodoro-config.toml" cfg.settings;

View file

@ -13,7 +13,7 @@ in {
programs.darcs = { programs.darcs = {
enable = mkEnableOption "darcs"; enable = mkEnableOption "darcs";
package = mkPackageOption pkgs "darcs" { }; package = mkPackageOption pkgs "darcs" { nullable = true; };
author = mkOption { author = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
@ -36,7 +36,7 @@ in {
}; };
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
{ home.packages = [ cfg.package ]; } { home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; }
(mkIf (cfg.author != [ ]) { (mkIf (cfg.author != [ ]) {
home.file.".darcs/author".text = home.file.".darcs/author".text =

View file

@ -11,9 +11,9 @@ in {
enable = mkEnableOption enable = mkEnableOption
"discocss, a tiny Discord CSS injector for Linux and MacOS"; "discocss, a tiny Discord CSS injector for Linux and MacOS";
package = mkPackageOption pkgs "discocss" { }; package = mkPackageOption pkgs "discocss" { nullable = true; };
discordPackage = mkPackageOption pkgs "discord" { }; discordPackage = mkPackageOption pkgs "discord" { nullable = true; };
discordAlias = mkOption { discordAlias = mkOption {
type = types.bool; type = types.bool;
@ -37,10 +37,10 @@ in {
"To use discocss with discordAlias you have to remove discord from home.packages, or set discordAlias to false."; "To use discocss with discordAlias you have to remove discord from home.packages, or set discordAlias to false.";
}]; }];
home.packages = [ home.packages = lib.mkIf (cfg.package != null) [
(cfg.package.override { (cfg.package.override {
discordAlias = cfg.discordAlias; discordAlias = cfg.discordAlias;
discord = cfg.discordPackage; discord = lib.mkIf (cfg.discordPackage != null) cfg.discordPackage;
}) })
]; ];

View file

@ -12,7 +12,7 @@ in {
options.programs.earthly = { options.programs.earthly = {
enable = lib.mkEnableOption "earthly"; enable = lib.mkEnableOption "earthly";
package = lib.mkPackageOption pkgs "earthly" { }; package = lib.mkPackageOption pkgs "earthly" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = yamlFormat.type; type = yamlFormat.type;
@ -31,7 +31,7 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file.".earthly/config.yml" = lib.mkIf (cfg.settings != { }) { home.file.".earthly/config.yml" = lib.mkIf (cfg.settings != { }) {
source = yamlFormat.generate "earthly-config" cfg.settings; source = yamlFormat.generate "earthly-config" cfg.settings;

View file

@ -72,7 +72,7 @@ with lib;
''; '';
}; };
package = mkPackageOption pkgs "eza" { }; package = mkPackageOption pkgs "eza" { nullable = true; };
}; };
config = let config = let
@ -105,7 +105,7 @@ with lib;
programs.eza.icons = ${if cfg.icons then ''"auto"'' else "null"}''; programs.eza.icons = ${if cfg.icons then ''"auto"'' else "null"}'';
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
programs.bash.shellAliases = optionsAlias programs.bash.shellAliases = optionsAlias
// optionalAttrs cfg.enableBashIntegration aliases; // optionalAttrs cfg.enableBashIntegration aliases;

View file

@ -13,7 +13,7 @@ in {
options.programs.fastfetch = { options.programs.fastfetch = {
enable = mkEnableOption "Fastfetch"; enable = mkEnableOption "Fastfetch";
package = mkPackageOption pkgs "fastfetch" { }; package = mkPackageOption pkgs "fastfetch" { nullable = true; };
settings = mkOption { settings = mkOption {
type = jsonFormat.type; type = jsonFormat.type;
@ -59,7 +59,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."fastfetch/config.jsonc" = mkIf (cfg.settings != { }) { xdg.configFile."fastfetch/config.jsonc" = mkIf (cfg.settings != { }) {
source = jsonFormat.generate "config.jsonc" cfg.settings; source = jsonFormat.generate "config.jsonc" cfg.settings;

View file

@ -30,7 +30,7 @@ with lib; {
''; '';
}; };
package = mkPackageOption pkgs "fd" { }; package = mkPackageOption pkgs "fd" { nullable = true; };
}; };
config = let config = let
@ -40,7 +40,7 @@ with lib; {
optionsAlias = optionalAttrs (args != "") { fd = "fd ${args}"; }; optionsAlias = optionalAttrs (args != "") { fd = "fd ${args}"; };
in mkIf cfg.enable { in mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
programs.bash.shellAliases = optionsAlias; programs.bash.shellAliases = optionsAlias;

View file

@ -33,7 +33,7 @@ in {
options.programs.feh = { options.programs.feh = {
enable = mkEnableOption "feh - a fast and light image viewer"; enable = mkEnableOption "feh - a fast and light image viewer";
package = mkPackageOption pkgs "feh" { }; package = mkPackageOption pkgs "feh" { nullable = true; };
buttons = mkOption { buttons = mkOption {
default = { }; default = { };
@ -104,7 +104,7 @@ in {
"To disable a keybinding, use `null` instead of an empty string."; "To disable a keybinding, use `null` instead of an empty string.";
}]; }];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."feh/buttons" = xdg.configFile."feh/buttons" =
mkIf (cfg.buttons != { }) { text = renderBindings cfg.buttons + "\n"; }; mkIf (cfg.buttons != { }) { text = renderBindings cfg.buttons + "\n"; };

View file

@ -21,7 +21,7 @@ in {
options.programs.freetube = { options.programs.freetube = {
enable = mkEnableOption "FreeTube, a YT client for Windows, Mac, and Linux"; enable = mkEnableOption "FreeTube, a YT client for Windows, Mac, and Linux";
package = mkPackageOption pkgs "freetube" { }; package = mkPackageOption pkgs "freetube" { nullable = true; };
settings = mkOption { settings = mkOption {
type = lib.types.attrs; type = lib.types.attrs;
@ -44,7 +44,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."FreeTube/hm_settings.db" = { xdg.configFile."FreeTube/hm_settings.db" = {
source = pkgs.writeText "hm_settings.db" (settings cfg.settings); source = pkgs.writeText "hm_settings.db" (settings cfg.settings);

View file

@ -14,7 +14,7 @@ in {
options.programs.fuzzel = { options.programs.fuzzel = {
enable = mkEnableOption "fuzzel"; enable = mkEnableOption "fuzzel";
package = mkPackageOption pkgs "fuzzel" { }; package = mkPackageOption pkgs "fuzzel" { nullable = true; };
settings = mkOption { settings = mkOption {
type = iniFormat.type; type = iniFormat.type;
@ -42,7 +42,7 @@ in {
lib.platforms.linux) lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."fuzzel/fuzzel.ini" = mkIf (cfg.settings != { }) { xdg.configFile."fuzzel/fuzzel.ini" = mkIf (cfg.settings != { }) {
source = iniFormat.generate "fuzzel.ini" cfg.settings; source = iniFormat.generate "fuzzel.ini" cfg.settings;

View file

@ -14,7 +14,7 @@ in {
options.programs.gallery-dl = { options.programs.gallery-dl = {
enable = mkEnableOption "gallery-dl"; enable = mkEnableOption "gallery-dl";
package = mkPackageOption pkgs "gallery-dl" { }; package = mkPackageOption pkgs "gallery-dl" { nullable = true; };
settings = mkOption { settings = mkOption {
type = jsonFormat.type; type = jsonFormat.type;
@ -34,7 +34,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."gallery-dl/config.json" = mkIf (cfg.settings != { }) { xdg.configFile."gallery-dl/config.json" = mkIf (cfg.settings != { }) {
source = jsonFormat.generate "gallery-dl-settings" cfg.settings; source = jsonFormat.generate "gallery-dl-settings" cfg.settings;

View file

@ -12,7 +12,7 @@ in {
options.programs.gh-dash = { options.programs.gh-dash = {
enable = lib.mkEnableOption "GitHub CLI dashboard plugin"; enable = lib.mkEnableOption "GitHub CLI dashboard plugin";
package = lib.mkPackageOption pkgs "gh-dash" { }; package = lib.mkPackageOption pkgs "gh-dash" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = yamlFormat.type; type = yamlFormat.type;
@ -32,9 +32,9 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
programs.gh.extensions = [ cfg.package ]; programs.gh.extensions = (cfg.package != null) [ cfg.package ];
xdg.configFile."gh-dash/config.yml".source = xdg.configFile."gh-dash/config.yml".source =
yamlFormat.generate "gh-dash-config.yml" cfg.settings; yamlFormat.generate "gh-dash-config.yml" cfg.settings;

View file

@ -13,7 +13,7 @@ in {
options.programs.git-cliff = { options.programs.git-cliff = {
enable = mkEnableOption "git-cliff changelog generator"; enable = mkEnableOption "git-cliff changelog generator";
package = mkPackageOption pkgs "git-cliff" { }; package = mkPackageOption pkgs "git-cliff" { nullable = true; };
settings = mkOption { settings = mkOption {
type = tomlFormat.type; type = tomlFormat.type;
@ -34,7 +34,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = { xdg.configFile = {
"git-cliff/cliff.toml" = mkIf (cfg.settings != { }) { "git-cliff/cliff.toml" = mkIf (cfg.settings != { }) {

View file

@ -50,7 +50,10 @@ in {
''; '';
}; };
package = mkPackageOption pkgs "gradle" { example = "pkgs.gradle_7"; }; package = mkPackageOption pkgs "gradle" {
nullable = true;
example = "pkgs.gradle_7";
};
settings = mkOption { settings = mkOption {
type = types.submodule { freeformType = settingsFormat.type; }; type = types.submodule { freeformType = settingsFormat.type; };
@ -95,7 +98,7 @@ in {
config = let gradleHome = "${config.home.homeDirectory}/${cfg.home}"; config = let gradleHome = "${config.home.homeDirectory}/${cfg.home}";
in mkIf cfg.enable { in mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file = mkMerge ([{ home.file = mkMerge ([{
"${cfg.home}/gradle.properties" = mkIf (cfg.settings != { }) { "${cfg.home}/gradle.properties" = mkIf (cfg.settings != { }) {

View file

@ -13,7 +13,7 @@ in {
options.programs.havoc = { options.programs.havoc = {
enable = mkEnableOption "Havoc terminal"; enable = mkEnableOption "Havoc terminal";
package = mkPackageOption pkgs "havoc" { }; package = mkPackageOption pkgs "havoc" { nullable = true; };
settings = mkOption { settings = mkOption {
type = iniFormat.type; type = iniFormat.type;
@ -54,7 +54,7 @@ in {
assertions = assertions =
[ (hm.assertions.assertPlatform "programs.havoc" pkgs platforms.linux) ]; [ (hm.assertions.assertPlatform "programs.havoc" pkgs platforms.linux) ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."havoc.cfg" = mkIf (cfg.settings != { }) { xdg.configFile."havoc.cfg" = mkIf (cfg.settings != { }) {
source = iniFormat.generate "havoc.cfg" cfg.settings; source = iniFormat.generate "havoc.cfg" cfg.settings;

View file

@ -122,7 +122,7 @@ in {
options = { options = {
programs.himalaya = { programs.himalaya = {
enable = mkEnableOption "the email client Himalaya CLI"; enable = mkEnableOption "the email client Himalaya CLI";
package = mkPackageOption pkgs "himalaya" { }; package = mkPackageOption pkgs "himalaya" { nullable = true; };
settings = mkOption { settings = mkOption {
type = types.submodule { freeformType = tomlFormat.type; }; type = types.submodule { freeformType = tomlFormat.type; };
default = { }; default = { };
@ -153,7 +153,7 @@ in {
}; };
config = mkIf himalaya.enable { config = mkIf himalaya.enable {
home.packages = [ himalaya.package ]; home.packages = lib.mkIf (himalaya.package != null) [ himalaya.package ];
xdg = { xdg = {
configFile."himalaya/config.toml".source = let configFile."himalaya/config.toml".source = let
@ -164,17 +164,18 @@ in {
allConfig = globalConfig // { accounts = accountsConfig; }; allConfig = globalConfig // { accounts = accountsConfig; };
in tomlFormat.generate "himalaya.config.toml" allConfig; in tomlFormat.generate "himalaya.config.toml" allConfig;
desktopEntries.himalaya = mkIf pkgs.stdenv.hostPlatform.isLinux { desktopEntries.himalaya =
type = "Application"; mkIf (pkgs.stdenv.hostPlatform.isLinux && (himalaya.package != null)) {
name = "himalaya"; type = "Application";
genericName = "Email Client"; name = "himalaya";
comment = "CLI to manage emails"; genericName = "Email Client";
terminal = true; comment = "CLI to manage emails";
exec = "himalaya %u"; terminal = true;
categories = [ "Network" ]; exec = "himalaya %u";
mimeType = [ "x-scheme-handler/mailto" "message/rfc822" ]; categories = [ "Network" ];
settings = { Keywords = "email"; }; mimeType = [ "x-scheme-handler/mailto" "message/rfc822" ];
}; settings = { Keywords = "email"; };
};
}; };
}; };
} }

View file

@ -25,7 +25,7 @@ in {
''; '';
}; };
package = lib.mkPackageOption pkgs "hyprlock" { }; package = lib.mkPackageOption pkgs "hyprlock" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = with lib.types; type = with lib.types;
@ -110,7 +110,7 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."hypr/hyprlock.conf" = xdg.configFile."hypr/hyprlock.conf" =
let shouldGenerate = cfg.extraConfig != "" || cfg.settings != { }; let shouldGenerate = cfg.extraConfig != "" || cfg.settings != { };

View file

@ -130,7 +130,7 @@ in {
''; '';
}; };
package = mkPackageOption pkgs "i3status" { }; package = mkPackageOption pkgs "i3status" { nullable = true; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -190,7 +190,7 @@ in {
}; };
}; };
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."i3status/config".text = concatStringsSep "\n" ([ ] xdg.configFile."i3status/config".text = concatStringsSep "\n" ([ ]
++ optional (cfg.general != { }) (formatModule "general" cfg.general) ++ optional (cfg.general != { }) (formatModule "general" cfg.general)

View file

@ -16,7 +16,7 @@ in {
enable = mkEnableOption enable = mkEnableOption
"imv: a command line image viewer intended for use with tiling window managers"; "imv: a command line image viewer intended for use with tiling window managers";
package = mkPackageOption pkgs "imv" { }; package = mkPackageOption pkgs "imv" { nullable = true; };
settings = mkOption { settings = mkOption {
default = { }; default = { };
@ -38,7 +38,7 @@ in {
assertions = assertions =
[ (hm.assertions.assertPlatform "programs.imv" pkgs platforms.linux) ]; [ (hm.assertions.assertPlatform "programs.imv" pkgs platforms.linux) ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = xdg.configFile =
mkIf (cfg.settings != { }) { "imv/config".text = toConfig cfg.settings; }; mkIf (cfg.settings != { }) { "imv/config".text = toConfig cfg.settings; };

View file

@ -7,7 +7,7 @@ in {
options.programs.jqp = { options.programs.jqp = {
enable = lib.mkEnableOption "jqp, jq playground"; enable = lib.mkEnableOption "jqp, jq playground";
package = lib.mkPackageOption pkgs "jqp" { }; package = lib.mkPackageOption pkgs "jqp" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = yamlFormat.type; type = yamlFormat.type;
@ -23,7 +23,7 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home = { home = {
packages = [ cfg.package ]; packages = lib.mkIf (cfg.package != null) [ cfg.package ];
file.".jqp.yaml" = lib.mkIf (cfg.settings != { }) { file.".jqp.yaml" = lib.mkIf (cfg.settings != { }) {
source = yamlFormat.generate "jqp-config" cfg.settings; source = yamlFormat.generate "jqp-config" cfg.settings;

View file

@ -25,7 +25,7 @@ in {
enable = enable =
mkEnableOption "a Git-compatible DVCS that is both simple and powerful"; mkEnableOption "a Git-compatible DVCS that is both simple and powerful";
package = mkPackageOption pkgs "jujutsu" { }; package = mkPackageOption pkgs "jujutsu" { nullable = true; };
ediff = mkOption { ediff = mkOption {
type = types.bool; type = types.bool;
@ -54,7 +54,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/jj/config.toml" = mkIf (cfg.settings != { }) { home.file."${configDir}/jj/config.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "jujutsu-config" (cfg.settings source = tomlFormat.generate "jujutsu-config" (cfg.settings

View file

@ -24,7 +24,7 @@ in {
enable = enable =
mkEnableOption "k9s - Kubernetes CLI To Manage Your Clusters In Style"; mkEnableOption "k9s - Kubernetes CLI To Manage Your Clusters In Style";
package = mkPackageOption pkgs "k9s" { }; package = mkPackageOption pkgs "k9s" { nullable = true; };
settings = mkOption { settings = mkOption {
type = yamlFormat.type; type = yamlFormat.type;
@ -182,7 +182,7 @@ in {
enableXdgConfig = !isDarwin || config.xdg.enable; enableXdgConfig = !isDarwin || config.xdg.enable;
in mkIf cfg.enable { in mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = mkIf enableXdgConfig ({ xdg.configFile = mkIf enableXdgConfig ({
"k9s/config.yaml" = mkIf (cfg.settings != { }) { "k9s/config.yaml" = mkIf (cfg.settings != { }) {

View file

@ -622,7 +622,7 @@ in {
programs.kakoune = { programs.kakoune = {
enable = mkEnableOption "the kakoune text editor"; enable = mkEnableOption "the kakoune text editor";
package = mkPackageOption pkgs "kakoune-unwrapped" { }; package = mkPackageOption pkgs "kakoune-unwrapped" { nullable = true; };
config = mkOption { config = mkOption {
type = types.nullOr configModule; type = types.nullOr configModule;
@ -656,6 +656,8 @@ in {
List of kakoune plugins to install. To get a list of List of kakoune plugins to install. To get a list of
supported plugins run: supported plugins run:
{command}`nix-env -f '<nixpkgs>' -qaP -A kakounePlugins`. {command}`nix-env -f '<nixpkgs>' -qaP -A kakounePlugins`.
Requires `package` to not be set to have effect.
''; '';
}; };
@ -674,7 +676,13 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ kakouneWithPlugins ]; warnings = optional (cfg.package == null && cfg.plugins != [ ]) ''
You have configured `plugins` for `kakoune` but have not set `package`.
The listed plugins will not be installed.
'';
home.packages = lib.mkIf (cfg.package != null) [ kakouneWithPlugins ];
home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "kak"; }; home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "kak"; };
xdg.configFile = mkMerge [ xdg.configFile = mkMerge [
{ "kak/kakrc".source = configFile; } { "kak/kakrc".source = configFile; }

View file

@ -168,7 +168,7 @@ in {
options.programs.khal = { options.programs.khal = {
enable = mkEnableOption "khal, a CLI calendar application"; enable = mkEnableOption "khal, a CLI calendar application";
package = mkPackageOption pkgs "khal" { }; package = mkPackageOption pkgs "khal" { nullable = true; };
locale = mkOption { locale = mkOption {
type = lib.types.submodule { options = localeOptions; }; type = lib.types.submodule { options = localeOptions; };
@ -199,7 +199,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."khal/config".text = concatStringsSep "\n" ([ "[calendars]" ] xdg.configFile."khal/config".text = concatStringsSep "\n" ([ "[calendars]" ]
++ mapAttrsToList genCalendarStr khalAccounts ++ [ ++ mapAttrsToList genCalendarStr khalAccounts ++ [

View file

@ -55,7 +55,13 @@ in {
"kube/color.yaml"; "kube/color.yaml";
in mkIf cfg.enable { in mkIf cfg.enable {
home.packages = [ cfg.package ]; warnings = optional (cfg.package == null && cfg.plugins != [ ]) ''
You have configured `enableAlias` for `kubecolor` but have not set `package`.
The alias will not be created.
'';
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.sessionVariables = if preferXdgDirectories then { home.sessionVariables = if preferXdgDirectories then {
KUBECOLOR_CONFIG = "${config.xdg.configHome}/${configPathSuffix}"; KUBECOLOR_CONFIG = "${config.xdg.configHome}/${configPathSuffix}";
@ -81,7 +87,8 @@ in {
}; };
}; };
home.shellAliases = home.shellAliases = lib.mkIf (cfg.enableAlias && (cfg.package != null)) {
lib.mkIf cfg.enableAlias { kubectl = lib.getExe cfg.package; }; kubectl = lib.getExe cfg.package;
};
}; };
} }

View file

@ -7,7 +7,7 @@ let
options = { options = {
enable = mkEnableOption "lapce"; enable = mkEnableOption "lapce";
package = mkPackageOption pkgs "lapce" { }; package = mkPackageOption pkgs "lapce" { nullable = true; };
channel = mkOption { channel = mkOption {
type = types.enum [ "stable" "nightly" ]; type = types.enum [ "stable" "nightly" ];
default = "stable"; default = "stable";
@ -171,7 +171,7 @@ in {
options.programs.lapce = options; options.programs.lapce = options;
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg = let dir = "lapce-${cfg.channel}"; xdg = let dir = "lapce-${cfg.channel}";
in { in {

View file

@ -16,7 +16,7 @@ in {
options.programs.lazygit = { options.programs.lazygit = {
enable = mkEnableOption "lazygit, a simple terminal UI for git commands"; enable = mkEnableOption "lazygit, a simple terminal UI for git commands";
package = mkPackageOption pkgs "lazygit" { }; package = mkPackageOption pkgs "lazygit" { nullable = true; };
settings = mkOption { settings = mkOption {
type = yamlFormat.type; type = yamlFormat.type;
@ -45,7 +45,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."Library/Application Support/lazygit/config.yml" = home.file."Library/Application Support/lazygit/config.yml" =
mkIf (cfg.settings != { } && (isDarwin && !config.xdg.enable)) { mkIf (cfg.settings != { } && (isDarwin && !config.xdg.enable)) {

View file

@ -21,7 +21,7 @@ in {
options.programs.ledger = { options.programs.ledger = {
enable = mkEnableOption "ledger, a double-entry accounting system"; enable = mkEnableOption "ledger, a double-entry accounting system";
package = mkPackageOption pkgs "ledger" { }; package = mkPackageOption pkgs "ledger" { nullable = true; };
settings = mkOption { settings = mkOption {
type = with types; attrsOf (oneOf [ bool int str (listOf str) ]); type = with types; attrsOf (oneOf [ bool int str (listOf str) ]);
@ -59,7 +59,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."ledger/ledgerrc" = xdg.configFile."ledger/ledgerrc" =
mkIf (cfg.settings != { } || cfg.extraConfig != "") { mkIf (cfg.settings != { } || cfg.extraConfig != "") {

View file

@ -11,7 +11,7 @@ in {
options.programs.looking-glass-client = { options.programs.looking-glass-client = {
enable = mkEnableOption "looking-glass-client"; enable = mkEnableOption "looking-glass-client";
package = mkPackageOption pkgs "looking-glass-client" { }; package = mkPackageOption pkgs "looking-glass-client" { nullable = true; };
settings = mkOption { settings = mkOption {
type = settingsFormat.type; type = settingsFormat.type;
@ -50,7 +50,7 @@ in {
platforms.linux) platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."looking-glass/client.ini" = mkIf (cfg.settings != { }) { xdg.configFile."looking-glass/client.ini" = mkIf (cfg.settings != { }) {
source = source =

View file

@ -15,7 +15,7 @@ in {
programs.micro = { programs.micro = {
enable = mkEnableOption "micro, a terminal-based text editor"; enable = mkEnableOption "micro, a terminal-based text editor";
package = mkPackageOption pkgs "micro" { }; package = mkPackageOption pkgs "micro" { nullable = true; };
settings = mkOption { settings = mkOption {
type = jsonFormat.type; type = jsonFormat.type;
@ -37,7 +37,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."micro/settings.json".source = xdg.configFile."micro/settings.json".source =
jsonFormat.generate "micro-settings" cfg.settings; jsonFormat.generate "micro-settings" cfg.settings;

View file

@ -29,7 +29,7 @@ in {
programs.mise = { programs.mise = {
enable = mkEnableOption "mise"; enable = mkEnableOption "mise";
package = mkPackageOption pkgs "mise" { }; package = mkPackageOption pkgs "mise" { nullable = true; };
enableBashIntegration = enableBashIntegration =
lib.hm.shell.mkBashIntegrationOption { inherit config; }; lib.hm.shell.mkBashIntegrationOption { inherit config; };
@ -83,7 +83,15 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; warnings = optional (cfg.package == null && (cfg.enableBashIntegration
|| cfg.enableZshIntegration || cfg.enableFishIntegration
|| cfg.enableNushellIntegration)) ''
You have enabled shell integration for `mise` but have not set `package`.
The shell integration will not be added.
'';
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = { xdg.configFile = {
"mise/config.toml" = mkIf (cfg.globalConfig != { }) { "mise/config.toml" = mkIf (cfg.globalConfig != { }) {

View file

@ -17,7 +17,7 @@ in {
enable = mkEnableOption enable = mkEnableOption
"mr, a tool to manage all your version control repositories"; "mr, a tool to manage all your version control repositories";
package = mkPackageOption pkgs "mr" { }; package = mkPackageOption pkgs "mr" { nullable = true; };
settings = mkOption { settings = mkOption {
type = iniFormat.type; type = iniFormat.type;
@ -42,7 +42,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file.".mrconfig".source = iniFormat.generate ".mrconfig" cfg.settings; home.file.".mrconfig".source = iniFormat.generate ".mrconfig" cfg.settings;
}; };
} }

View file

@ -11,7 +11,7 @@ in {
options.programs.neovide = { options.programs.neovide = {
enable = lib.mkEnableOption "Neovide, No Nonsense Neovim Client in Rust"; enable = lib.mkEnableOption "Neovide, No Nonsense Neovim Client in Rust";
package = lib.mkPackageOption pkgs "neovide" { }; package = lib.mkPackageOption pkgs "neovide" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = settingsFormat.type; type = settingsFormat.type;
@ -45,7 +45,7 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."neovide/config.toml".source = xdg.configFile."neovide/config.toml".source =
settingsFormat.generate "config.toml" cfg.settings; settingsFormat.generate "config.toml" cfg.settings;
}; };

View file

@ -24,7 +24,7 @@ in {
options.programs.nheko = { options.programs.nheko = {
enable = mkEnableOption "Qt desktop client for Matrix"; enable = mkEnableOption "Qt desktop client for Matrix";
package = mkPackageOption pkgs "nheko" { }; package = mkPackageOption pkgs "nheko" { nullable = true; };
settings = mkOption { settings = mkOption {
type = iniFmt.type; type = iniFmt.type;
@ -64,7 +64,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/nheko/nheko.conf" = mkIf (cfg.settings != { }) { home.file."${configDir}/nheko/nheko.conf" = mkIf (cfg.settings != { }) {
text = '' text = ''

View file

@ -46,7 +46,7 @@ in {
options.programs.nushell = { options.programs.nushell = {
enable = lib.mkEnableOption "nushell"; enable = lib.mkEnableOption "nushell";
package = lib.mkPackageOption pkgs "nushell" { }; package = lib.mkPackageOption pkgs "nushell" { nullable = true; };
configFile = lib.mkOption { configFile = lib.mkOption {
type = types.nullOr (linesOrSource "config.nu"); type = types.nullOr (linesOrSource "config.nu");
@ -197,7 +197,13 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; warnings = lib.optional (cfg.package == null && cfg.plugins != [ ]) ''
You have configured `plugins` for `nushell` but have not set `package`.
The listed plugins will not be installed.
'';
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file = lib.mkMerge [ home.file = lib.mkMerge [
(let (let
@ -261,7 +267,7 @@ in {
(map (plugin: "plugin add ${lib.getExe plugin}") cfg.plugins) (map (plugin: "plugin add ${lib.getExe plugin}") cfg.plugins)
}' }'
''; '';
in lib.mkIf (cfg.plugins != [ ]) { in lib.mkIf ((cfg.package != null) && (cfg.plugins != [ ])) {
"${configDir}/plugin.msgpackz".source = "${msgPackz}/plugin.msgpackz"; "${configDir}/plugin.msgpackz".source = "${msgPackz}/plugin.msgpackz";
}) })
]; ];

View file

@ -9,7 +9,7 @@ in {
options.programs.openstackclient = { options.programs.openstackclient = {
enable = lib.mkEnableOption "OpenStack command-line client"; enable = lib.mkEnableOption "OpenStack command-line client";
package = lib.mkPackageOption pkgs "openstackclient" { }; package = lib.mkPackageOption pkgs "openstackclient" { nullable = true; };
clouds = lib.mkOption { clouds = lib.mkOption {
type = lib.types.submodule { freeformType = yamlFormat.type; }; type = lib.types.submodule { freeformType = yamlFormat.type; };
@ -58,7 +58,7 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."openstack/clouds.yaml".source = yamlFormat.generate xdg.configFile."openstack/clouds.yaml".source = yamlFormat.generate
"openstackclient-clouds-yaml-${config.home.username}" { "openstackclient-clouds-yaml-${config.home.username}" {

View file

@ -19,7 +19,7 @@ in {
options.programs.papis = { options.programs.papis = {
enable = mkEnableOption "papis"; enable = mkEnableOption "papis";
package = mkPackageOption pkgs "papis" { }; package = mkPackageOption pkgs "papis" { nullable = true; };
settings = mkOption { settings = mkOption {
type = with types; attrsOf (oneOf [ bool int str ]); type = with types; attrsOf (oneOf [ bool int str ]);
@ -86,7 +86,7 @@ in {
(", namely " + concatStringsSep "," defaultLibraries); (", namely " + concatStringsSep "," defaultLibraries);
}]; }];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."papis/config" = xdg.configFile."papis/config" =
mkIf (cfg.libraries != { }) { text = generators.toINI { } settingsIni; }; mkIf (cfg.libraries != { }) { text = generators.toINI { } settingsIni; };

View file

@ -20,6 +20,7 @@ in {
enable = mkEnableOption "poetry"; enable = mkEnableOption "poetry";
package = mkPackageOption pkgs "poetry" { package = mkPackageOption pkgs "poetry" {
nullable = true;
example = "pkgs.poetry.withPlugins (ps: with ps; [ poetry-plugin-up ])"; example = "pkgs.poetry.withPlugins (ps: with ps; [ poetry-plugin-up ])";
extraDescription = "May be used to install custom poetry plugins."; extraDescription = "May be used to install custom poetry plugins.";
}; };
@ -45,7 +46,7 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/pypoetry/config.toml" = home.file."${configDir}/pypoetry/config.toml" =
lib.mkIf (cfg.settings != { }) { lib.mkIf (cfg.settings != { }) {

View file

@ -12,7 +12,7 @@ in {
''; '';
}; };
package = lib.mkPackageOption pkgs "rio" { }; package = lib.mkPackageOption pkgs "rio" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = settingsFormat.type; type = settingsFormat.type;
@ -27,7 +27,7 @@ in {
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
{ {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
} }
# Only manage configuration if not empty # Only manage configuration if not empty

View file

@ -2,9 +2,7 @@
with lib; with lib;
let let cfg = config.programs.ripgrep;
cfg = config.programs.ripgrep;
configPath = "${config.xdg.configHome}/ripgrep/ripgreprc";
in { in {
meta.maintainers = meta.maintainers =
[ lib.maintainers.khaneliman lib.hm.maintainers.pedorich-n ]; [ lib.maintainers.khaneliman lib.hm.maintainers.pedorich-n ];
@ -13,7 +11,7 @@ in {
programs.ripgrep = { programs.ripgrep = {
enable = mkEnableOption "Ripgrep"; enable = mkEnableOption "Ripgrep";
package = mkPackageOption pkgs "ripgrep" { }; package = mkPackageOption pkgs "ripgrep" { nullable = true; };
arguments = mkOption { arguments = mkOption {
type = with types; listOf str; type = with types; listOf str;
@ -31,8 +29,9 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home = mkMerge [ home = let configPath = "${config.xdg.configHome}/ripgrep/ripgreprc";
{ packages = [ cfg.package ]; } in mkMerge [
{ packages = lib.mkIf (cfg.package != null) [ cfg.package ]; }
(mkIf (cfg.arguments != [ ]) { (mkIf (cfg.arguments != [ ]) {
file."${configPath}".text = lib.concatLines cfg.arguments; file."${configPath}".text = lib.concatLines cfg.arguments;

View file

@ -12,8 +12,10 @@ in {
options.programs.rofi.pass = { options.programs.rofi.pass = {
enable = mkEnableOption "rofi integration with password-store"; enable = mkEnableOption "rofi integration with password-store";
package = package = mkPackageOption pkgs "rofi-pass" {
mkPackageOption pkgs "rofi-pass" { example = "pkgs.rofi-pass-wayland"; }; nullable = true;
example = "pkgs.rofi-pass-wayland";
};
stores = mkOption { stores = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
@ -40,7 +42,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."rofi-pass/config".text = optionalString (cfg.stores != [ ]) xdg.configFile."rofi-pass/config".text = optionalString (cfg.stores != [ ])
("root=" + (concatStringsSep ":" cfg.stores) + "\n") + cfg.extraConfig ("root=" + (concatStringsSep ":" cfg.stores) + "\n") + cfg.extraConfig

View file

@ -15,7 +15,7 @@ in {
enable = mkEnableOption enable = mkEnableOption
"ruff, an extremely fast Python linter and code formatter, written in Rust"; "ruff, an extremely fast Python linter and code formatter, written in Rust";
package = mkPackageOption pkgs "ruff" { }; package = mkPackageOption pkgs "ruff" { nullable = true; };
settings = mkOption { settings = mkOption {
type = settingsFormat.type; type = settingsFormat.type;
@ -37,7 +37,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."ruff/ruff.toml".source = xdg.configFile."ruff/ruff.toml".source =
settingsFormat.generate "ruff.toml" cfg.settings; settingsFormat.generate "ruff.toml" cfg.settings;

View file

@ -12,11 +12,11 @@ in {
options.programs.sagemath = { options.programs.sagemath = {
enable = mkEnableOption "SageMath, a mathematics software system"; enable = mkEnableOption "SageMath, a mathematics software system";
package = mkOption { package = lib.mkPackageOption pkgs "sage" {
type = types.package; nullable = true;
default = pkgs.sage; extraDescription = ''
defaultText = literalExpression "pkgs.sage"; The SageMath package to use.
description = "The SageMath package to use."; '';
}; };
configDir = mkOption { configDir = mkOption {
@ -52,9 +52,10 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${cfg.configDir}/init.sage".text = cfg.initScript; home.file."${cfg.configDir}/init.sage".text = cfg.initScript;
home.sessionVariables = { home.sessionVariables = {
DOT_SAGE = cfg.dataDir; DOT_SAGE = cfg.dataDir;
SAGE_STARTUP_FILE = "${cfg.configDir}/init.sage"; SAGE_STARTUP_FILE = "${cfg.configDir}/init.sage";

View file

@ -15,7 +15,7 @@ in {
programs.sapling = { programs.sapling = {
enable = mkEnableOption "Sapling"; enable = mkEnableOption "Sapling";
package = mkPackageOption pkgs "sapling" { }; package = mkPackageOption pkgs "sapling" { nullable = true; };
userName = mkOption { userName = mkOption {
type = types.str; type = types.str;
@ -48,7 +48,7 @@ in {
config = mkIf cfg.enable (mkMerge [ config = mkIf cfg.enable (mkMerge [
{ {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
programs.sapling.iniContent.ui = { programs.sapling.iniContent.ui = {
username = cfg.userName + " <" + cfg.userEmail + ">"; username = cfg.userName + " <" + cfg.userEmail + ">";

View file

@ -73,7 +73,7 @@ in {
enable = mkEnableOption enable = mkEnableOption
"sftpman, an application that handles sshfs/sftp file systems mounting"; "sftpman, an application that handles sshfs/sftp file systems mounting";
package = mkPackageOption pkgs "sftpman" { }; package = mkPackageOption pkgs "sftpman" { nullable = true; };
defaultSshKey = mkOption { defaultSshKey = mkOption {
type = types.nullOr types.str; type = types.nullOr types.str;
@ -107,7 +107,7 @@ in {
}) })
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = mapAttrs' (name: value: xdg.configFile = mapAttrs' (name: value:
nameValuePair "sftpman/mounts/${name}.json" { nameValuePair "sftpman/mounts/${name}.json" {

View file

@ -34,11 +34,7 @@ in {
options.programs.sm64ex = { options.programs.sm64ex = {
enable = mkEnableOption "sm64ex"; enable = mkEnableOption "sm64ex";
package = mkOption { package = lib.mkPackageOption pkgs "sm64ex" { nullable = true; };
type = types.package;
default = pkgs.sm64ex;
description = "The sm64ex package to use.";
};
region = mkOption { region = mkOption {
type = types.nullOr (types.enum [ "us" "eu" "jp" ]); type = types.nullOr (types.enum [ "us" "eu" "jp" ]);
@ -120,7 +116,7 @@ in {
configFile = optionals (cfg.settings != null) configFile = optionals (cfg.settings != null)
(concatStringsSep "\n" ((mapAttrsToList mkConfig cfg.settings))); (concatStringsSep "\n" ((mapAttrsToList mkConfig cfg.settings)));
in mkIf cfg.enable { in mkIf cfg.enable {
home.packages = [ package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.dataFile."sm64pc/sm64config.txt" = xdg.dataFile."sm64pc/sm64config.txt" =
mkIf (cfg.settings != null) { text = configFile; }; mkIf (cfg.settings != null) { text = configFile; };

View file

@ -13,7 +13,7 @@ in {
options.programs.spotify-player = { options.programs.spotify-player = {
enable = mkEnableOption "spotify-player"; enable = mkEnableOption "spotify-player";
package = mkPackageOption pkgs "spotify-player" { }; package = mkPackageOption pkgs "spotify-player" { nullable = true; };
settings = mkOption { settings = mkOption {
type = tomlType; type = tomlType;
@ -162,7 +162,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = { xdg.configFile = {
"spotify-player/app.toml" = mkIf (cfg.settings != { }) { "spotify-player/app.toml" = mkIf (cfg.settings != { }) {

View file

@ -33,7 +33,7 @@ in {
''; '';
}; };
package = mkPackageOption pkgs "swaylock" { }; package = mkPackageOption pkgs "swaylock" { nullable = true; };
settings = mkOption { settings = mkOption {
type = with types; attrsOf (oneOf [ bool float int str ]); type = with types; attrsOf (oneOf [ bool float int str ]);
@ -59,7 +59,7 @@ in {
lib.platforms.linux) lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."swaylock/config" = mkIf (cfg.settings != { }) { xdg.configFile."swaylock/config" = mkIf (cfg.settings != { }) {
text = concatStrings (mapAttrsToList (n: v: text = concatStrings (mapAttrsToList (n: v:

View file

@ -23,9 +23,6 @@ let
formatPair = key: value: formatPair = key: value:
if isAttrs value then formatSet key value else formatLine key value; if isAttrs value then formatSet key value else formatLine key value;
homeConf = "${config.xdg.configHome}/task/home-manager-taskrc";
userConf = "${config.xdg.configHome}/task/taskrc";
in { in {
options = { options = {
programs.taskwarrior = { programs.taskwarrior = {
@ -85,13 +82,18 @@ in {
''; '';
}; };
package = package = mkPackageOption pkgs "taskwarrior" {
mkPackageOption pkgs "taskwarrior" { example = "pkgs.taskwarrior3"; }; nullable = true;
example = "pkgs.taskwarrior3";
};
}; };
}; };
config = mkIf cfg.enable { config = let
home.packages = [ cfg.package ]; homeConf = "${config.xdg.configHome}/task/home-manager-taskrc";
userConf = "${config.xdg.configHome}/task/taskrc";
in mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file."${homeConf}".text = '' home.file."${homeConf}".text = ''
data.location=${cfg.dataLocation} data.location=${cfg.dataLocation}

View file

@ -12,7 +12,7 @@ in {
options.programs.tofi = { options.programs.tofi = {
enable = mkEnableOption "Tofi, a tiny dynamic menu for Wayland"; enable = mkEnableOption "Tofi, a tiny dynamic menu for Wayland";
package = mkPackageOption pkgs "tofi" { }; package = mkPackageOption pkgs "tofi" { nullable = true; };
settings = mkOption { settings = mkOption {
type = with types; type = with types;
@ -46,7 +46,7 @@ in {
assertions = assertions =
[ (hm.assertions.assertPlatform "programs.tofi" pkgs platforms.linux) ]; [ (hm.assertions.assertPlatform "programs.tofi" pkgs platforms.linux) ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."tofi/config" = mkIf (cfg.settings != { }) { xdg.configFile."tofi/config" = mkIf (cfg.settings != { }) {
text = let text = let

View file

@ -12,7 +12,7 @@ in {
options.programs.vifm = { options.programs.vifm = {
enable = lib.mkEnableOption "vifm, a Vim-like file manager"; enable = lib.mkEnableOption "vifm, a Vim-like file manager";
package = lib.mkPackageOption pkgs "vifm" { }; package = lib.mkPackageOption pkgs "vifm" { nullable = true; };
extraConfig = mkOption { extraConfig = mkOption {
type = types.lines; type = types.lines;
@ -25,7 +25,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."vifm/vifmrc" = xdg.configFile."vifm/vifmrc" =
mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; };

View file

@ -14,7 +14,7 @@ in {
options = { options = {
programs.vim-vint = { programs.vim-vint = {
enable = mkEnableOption "the Vint linter for Vimscript"; enable = mkEnableOption "the Vint linter for Vimscript";
package = mkPackageOption pkgs "vim-vint" { }; package = mkPackageOption pkgs "vim-vint" { nullable = true; };
settings = mkOption { settings = mkOption {
type = yamlFormat.type; type = yamlFormat.type;
@ -28,7 +28,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile.".vintrc.yaml".source = xdg.configFile.".vintrc.yaml".source =
yamlFormat.generate "vim-vint-config" cfg.settings; yamlFormat.generate "vim-vint-config" cfg.settings;

View file

@ -6,7 +6,7 @@ in {
options.programs.vinegar = { options.programs.vinegar = {
enable = lib.mkEnableOption "Vinegar"; enable = lib.mkEnableOption "Vinegar";
package = lib.mkPackageOption pkgs "vinegar" { }; package = lib.mkPackageOption pkgs "vinegar" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = lib.types.attrsOf toml.type; type = lib.types.attrsOf toml.type;
@ -41,7 +41,7 @@ in {
lib.platforms.linux) lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."vinegar/config.toml" = lib.mkIf (cfg.settings != { }) { xdg.configFile."vinegar/config.toml" = lib.mkIf (cfg.settings != { }) {
source = toml.generate "vinegar-config.toml" cfg.settings; source = toml.generate "vinegar-config.toml" cfg.settings;

View file

@ -72,7 +72,7 @@ in {
options.programs.wlogout = with lib.types; { options.programs.wlogout = with lib.types; {
enable = mkEnableOption "wlogout"; enable = mkEnableOption "wlogout";
package = mkPackageOption pkgs "wlogout" { }; package = mkPackageOption pkgs "wlogout" { nullable = true; };
layout = mkOption { layout = mkOption {
type = listOf wlogoutLayoutConfig; type = listOf wlogoutLayoutConfig;
@ -132,7 +132,7 @@ in {
lib.platforms.linux) lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."wlogout/layout" = mkIf (cfg.layout != [ ]) { xdg.configFile."wlogout/layout" = mkIf (cfg.layout != [ ]) {
source = pkgs.writeText "wlogout/layout" layoutContent; source = pkgs.writeText "wlogout/layout" layoutContent;

View file

@ -17,7 +17,7 @@ in {
enable = mkEnableOption enable = mkEnableOption
"wofi: a launcher/menu program for wlroots based wayland compositors such as sway"; "wofi: a launcher/menu program for wlroots based wayland compositors such as sway";
package = mkPackageOption pkgs "wofi" { }; package = mkPackageOption pkgs "wofi" { nullable = true; };
settings = mkOption { settings = mkOption {
default = { }; default = { };
@ -58,7 +58,7 @@ in {
assertions = assertions =
[ (hm.assertions.assertPlatform "programs.wofi" pkgs platforms.linux) ]; [ (hm.assertions.assertPlatform "programs.wofi" pkgs platforms.linux) ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = mkMerge [ xdg.configFile = mkMerge [
(mkIf (cfg.settings != { }) { (mkIf (cfg.settings != { }) {

View file

@ -9,7 +9,7 @@ let
version = '${cfg.package.version}' version = '${cfg.package.version}'
''; '';
# If `value` is a Nix store path, create the symlink `/nix/store/newhash/${name}/*` # If `value` is a Nix store path, create the symlink `/nix/store/newhash/${name}/*`
# to `/nix/store/oldhash/*` and returns `/nix/store/newhash`. # to `/nix/store/oldhash/*` and returns `/nix/store/newhash`.
wrapPlugin = name: value: wrapPlugin = name: value:
if lib.isStorePath value then if lib.isStorePath value then
@ -49,7 +49,7 @@ in {
options.programs.xplr = { options.programs.xplr = {
enable = mkEnableOption "xplr, terminal UI based file explorer"; enable = mkEnableOption "xplr, terminal UI based file explorer";
package = mkPackageOption pkgs "xplr" { }; package = mkPackageOption pkgs "xplr" { nullable = true; };
plugins = mkOption { plugins = mkOption {
type = with types; nullOr (attrsOf (either package str)); type = with types; nullOr (attrsOf (either package str));
@ -58,7 +58,7 @@ in {
description = '' description = ''
An attribute set of plugin paths to be added to the [package.path]<https://www.lua.org/manual/5.4/manual.html#pdf-package.path> of the {file}`~/config/xplr/init.lua` configuration file. An attribute set of plugin paths to be added to the [package.path]<https://www.lua.org/manual/5.4/manual.html#pdf-package.path> of the {file}`~/config/xplr/init.lua` configuration file.
Must be a package or string representing the plugin directory's path. Must be a package or string representing the plugin directory's path.
If the path string is not absolute, it will be relative to {file}`$XDG_CONFIG_HOME/xplr/init.lua`. If the path string is not absolute, it will be relative to {file}`$XDG_CONFIG_HOME/xplr/init.lua`.
''; '';
example = literalExpression '' example = literalExpression ''
@ -91,7 +91,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."xplr/init.lua".source = xdg.configFile."xplr/init.lua".source =
pkgs.writeText "init.lua" configFile; pkgs.writeText "init.lua" configFile;

View file

@ -11,7 +11,7 @@ in {
options.programs.yambar = { options.programs.yambar = {
enable = lib.mkEnableOption "Yambar"; enable = lib.mkEnableOption "Yambar";
package = lib.mkPackageOption pkgs "yambar" { }; package = lib.mkPackageOption pkgs "yambar" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = yamlFormat.type; type = yamlFormat.type;
@ -46,7 +46,7 @@ in {
lib.platforms.linux) lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."yambar/config.yml" = lib.mkIf (cfg.settings != { }) { xdg.configFile."yambar/config.yml" = lib.mkIf (cfg.settings != { }) {
source = yamlFormat.generate "config.yml" cfg.settings; source = yamlFormat.generate "config.yml" cfg.settings;

View file

@ -12,7 +12,7 @@ in {
options.programs.yazi = { options.programs.yazi = {
enable = mkEnableOption "yazi"; enable = mkEnableOption "yazi";
package = lib.mkPackageOption pkgs "yazi" { }; package = lib.mkPackageOption pkgs "yazi" { nullable = true; };
shellWrapperName = lib.mkOption { shellWrapperName = lib.mkOption {
type = types.str; type = types.str;
@ -159,7 +159,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
programs = let programs = let
bashIntegration = '' bashIntegration = ''

View file

@ -11,7 +11,7 @@ in {
options.programs.zk = { options.programs.zk = {
enable = lib.mkEnableOption "zk"; enable = lib.mkEnableOption "zk";
package = lib.mkPackageOption pkgs "zk" { }; package = lib.mkPackageOption pkgs "zk" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = tomlFormat.type; type = tomlFormat.type;
@ -43,7 +43,7 @@ in {
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."zk/config.toml" = lib.mkIf (cfg.settings != { }) { xdg.configFile."zk/config.toml" = lib.mkIf (cfg.settings != { }) {
source = tomlFormat.generate "config.toml" cfg.settings; source = tomlFormat.generate "config.toml" cfg.settings;

View file

@ -8,7 +8,7 @@ in {
options.services.clipse = { options.services.clipse = {
enable = lib.mkEnableOption "Enable clipse clipboard manager"; enable = lib.mkEnableOption "Enable clipse clipboard manager";
package = lib.mkPackageOption pkgs "clipse" { }; package = lib.mkPackageOption pkgs "clipse" { nullable = true; };
systemdTarget = lib.mkOption { systemdTarget = lib.mkOption {
type = lib.types.str; type = lib.types.str;
@ -130,7 +130,7 @@ in {
lib.platforms.linux) lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."clipse/config.json".source = xdg.configFile."clipse/config.json".source =
jsonFormat.generate "settings" { jsonFormat.generate "settings" {
@ -147,20 +147,21 @@ in {
xdg.configFile."clipse/custom_theme.json".source = xdg.configFile."clipse/custom_theme.json".source =
jsonFormat.generate "theme" cfg.theme; jsonFormat.generate "theme" cfg.theme;
systemd.user.services.clipse = lib.mkIf pkgs.stdenv.isLinux { systemd.user.services.clipse =
Unit = { lib.mkIf (pkgs.stdenv.isLinux && (cfg.package != null)) {
Description = "Clipse listener"; Unit = {
PartOf = [ "graphical-session.target" ]; Description = "Clipse listener";
After = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
}; After = [ "graphical-session.target" ];
};
Service = { Service = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
ExecStart = "${cfg.package}/bin/clipse -listen"; ExecStart = "${cfg.package}/bin/clipse -listen";
}; };
Install = { WantedBy = [ cfg.systemdTarget ]; }; Install = { WantedBy = [ cfg.systemdTarget ]; };
}; };
}; };
} }

View file

@ -48,7 +48,7 @@ in {
darkman, a tool that automatically switches dark-mode on and off based on darkman, a tool that automatically switches dark-mode on and off based on
the time of the day''; the time of the day'';
package = mkPackageOption pkgs "darkman" { }; package = mkPackageOption pkgs "darkman" { nullable = true; };
settings = mkOption { settings = mkOption {
type = types.submodule { freeformType = yamlFormat.type; }; type = types.submodule { freeformType = yamlFormat.type; };
@ -76,7 +76,7 @@ in {
(hm.assertions.assertPlatform "services.darkman" pkgs platforms.linux) (hm.assertions.assertPlatform "services.darkman" pkgs platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = { xdg.configFile = {
"darkman/config.yaml" = mkIf (cfg.settings != { }) { "darkman/config.yaml" = mkIf (cfg.settings != { }) {
@ -91,7 +91,7 @@ in {
(generateScripts "light-mode.d" cfg.lightModeScripts)) (generateScripts "light-mode.d" cfg.lightModeScripts))
]; ];
systemd.user.services.darkman = { systemd.user.services.darkman = lib.mkIf (cfg.package != null) {
Unit = { Unit = {
Description = "Darkman system service"; Description = "Darkman system service";
Documentation = "man:darkman(1)"; Documentation = "man:darkman(1)";

View file

@ -59,11 +59,11 @@ in {
lib.platforms.linux) lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."glance/glance.yml".source = settingsFile; xdg.configFile."glance/glance.yml".source = settingsFile;
systemd.user.services.glance = { systemd.user.services.glance = lib.mkIf (cfg.package != null) {
Unit = { Unit = {
Description = "Glance feed dashboard server"; Description = "Glance feed dashboard server";
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];

View file

@ -6,7 +6,7 @@ in {
options.services.hypridle = { options.services.hypridle = {
enable = lib.mkEnableOption "Hypridle, Hyprland's idle daemon"; enable = lib.mkEnableOption "Hypridle, Hyprland's idle daemon";
package = lib.mkPackageOption pkgs "hypridle" { }; package = lib.mkPackageOption pkgs "hypridle" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = with lib.types; type = with lib.types;
@ -70,7 +70,7 @@ in {
}; };
}; };
systemd.user.services.hypridle = { systemd.user.services.hypridle = lib.mkIf (cfg.package != null) {
Install = { WantedBy = [ config.wayland.systemd.target ]; }; Install = { WantedBy = [ config.wayland.systemd.target ]; };
Unit = { Unit = {

View file

@ -6,7 +6,7 @@ in {
options.services.hyprpaper = { options.services.hyprpaper = {
enable = lib.mkEnableOption "Hyprpaper, Hyprland's wallpaper daemon"; enable = lib.mkEnableOption "Hyprpaper, Hyprland's wallpaper daemon";
package = lib.mkPackageOption pkgs "hyprpaper" { }; package = lib.mkPackageOption pkgs "hyprpaper" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = with lib.types; type = with lib.types;
@ -64,7 +64,7 @@ in {
}; };
}; };
systemd.user.services.hyprpaper = { systemd.user.services.hyprpaper = lib.mkIf (cfg.package != null) {
Install = { WantedBy = [ config.wayland.systemd.target ]; }; Install = { WantedBy = [ config.wayland.systemd.target ]; };
Unit = { Unit = {

View file

@ -15,7 +15,7 @@ in {
options.services.listenbrainz-mpd = { options.services.listenbrainz-mpd = {
enable = mkEnableOption "listenbrainz-mpd"; enable = mkEnableOption "listenbrainz-mpd";
package = mkPackageOption pkgs "listenbrainz-mpd" { }; package = mkPackageOption pkgs "listenbrainz-mpd" { nullable = true; };
settings = mkOption { settings = mkOption {
type = tomlFormat.type; type = tomlFormat.type;
@ -29,7 +29,7 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.user.services."listenbrainz-mpd" = { systemd.user.services."listenbrainz-mpd" = lib.mkIf (cfg.package != null) {
Unit = { Unit = {
Description = "ListenBrainz submission client for MPD"; Description = "ListenBrainz submission client for MPD";
Documentation = "https://codeberg.org/elomatreb/listenbrainz-mpd"; Documentation = "https://codeberg.org/elomatreb/listenbrainz-mpd";

View file

@ -15,7 +15,7 @@ in {
options.services.pueue = { options.services.pueue = {
enable = mkEnableOption "Pueue, CLI process scheduler and manager"; enable = mkEnableOption "Pueue, CLI process scheduler and manager";
package = mkPackageOption pkgs "pueue" { }; package = mkPackageOption pkgs "pueue" { nullable = true; };
settings = mkOption { settings = mkOption {
type = yamlFormat.type; type = yamlFormat.type;
@ -38,11 +38,11 @@ in {
assertions = assertions =
[ (hm.assertions.assertPlatform "services.pueue" pkgs platforms.linux) ]; [ (hm.assertions.assertPlatform "services.pueue" pkgs platforms.linux) ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile."pueue/pueue.yml".source = configFile; xdg.configFile."pueue/pueue.yml".source = configFile;
systemd.user = { systemd.user = lib.mkIf (cfg.package != null) {
services.pueued = { services.pueued = {
Unit = { Unit = {
Description = "Pueue Daemon - CLI process scheduler and manager"; Description = "Pueue Daemon - CLI process scheduler and manager";

View file

@ -79,7 +79,8 @@ in {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# at-spi2-core is to minimize journalctl noise of: # at-spi2-core is to minimize journalctl noise of:
# "AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files" # "AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files"
home.packages = [ cfg.package pkgs.at-spi2-core ]; home.packages =
lib.mkIf (cfg.package != null) [ cfg.package pkgs.at-spi2-core ];
xdg.configFile = { xdg.configFile = {
"swaync/config.json".source = "swaync/config.json".source =
@ -92,7 +93,7 @@ in {
}; };
}; };
systemd.user.services.swaync = { systemd.user.services.swaync = lib.mkIf (cfg.package != null) {
Unit = { Unit = {
Description = "Swaync notification daemon"; Description = "Swaync notification daemon";
Documentation = "https://github.com/ErikReider/SwayNotificationCenter"; Documentation = "https://github.com/ErikReider/SwayNotificationCenter";

View file

@ -13,7 +13,7 @@ in {
xsession.windowManager.fluxbox = { xsession.windowManager.fluxbox = {
enable = mkEnableOption "Fluxbox window manager"; enable = mkEnableOption "Fluxbox window manager";
package = mkPackageOption pkgs "fluxbox" { }; package = mkPackageOption pkgs "fluxbox" { nullable = true; };
init = mkOption { init = mkOption {
type = types.lines; type = types.lines;
@ -95,7 +95,7 @@ in {
platforms.linux) platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file = { home.file = {
".fluxbox/init" = mkIf (cfg.init != "") { text = cfg.init; }; ".fluxbox/init" = mkIf (cfg.init != "") { text = cfg.init; };

View file

@ -208,7 +208,7 @@ in {
xsession.windowManager.i3 = { xsession.windowManager.i3 = {
enable = mkEnableOption "i3 window manager"; enable = mkEnableOption "i3 window manager";
package = mkPackageOption pkgs "i3" { }; package = mkPackageOption pkgs "i3" { nullable = true; };
config = mkOption { config = mkOption {
type = types.nullOr configModule; type = types.nullOr configModule;
@ -232,7 +232,7 @@ in {
platforms.linux) platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xsession.windowManager.command = "${cfg.package}/bin/i3"; xsession.windowManager.command = "${cfg.package}/bin/i3";

View file

@ -14,7 +14,7 @@ in {
options.services.wob = { options.services.wob = {
enable = mkEnableOption "wob"; enable = mkEnableOption "wob";
package = mkPackageOption pkgs "wob" { }; package = mkPackageOption pkgs "wob" { nullable = true; };
settings = mkOption { settings = mkOption {
type = settingsFormat.type; type = settingsFormat.type;
@ -44,7 +44,7 @@ in {
(lib.hm.assertions.assertPlatform "services.wob" pkgs lib.platforms.linux) (lib.hm.assertions.assertPlatform "services.wob" pkgs lib.platforms.linux)
]; ];
systemd.user = mkIf cfg.systemd { systemd.user = mkIf (cfg.systemd && (cfg.package != null)) {
services.wob = { services.wob = {
Unit = { Unit = {
Description = Description =

View file

@ -22,7 +22,7 @@ in {
options.services.wpaperd = { options.services.wpaperd = {
enable = lib.mkEnableOption "wpaperd"; enable = lib.mkEnableOption "wpaperd";
package = lib.mkPackageOption pkgs "wpaperd" { }; package = lib.mkPackageOption pkgs "wpaperd" { nullable = true; };
settings = lib.mkOption { settings = lib.mkOption {
type = tomlFormat.type; type = tomlFormat.type;
@ -54,7 +54,7 @@ in {
lib.platforms.linux) lib.platforms.linux)
]; ];
home.packages = [ cfg.package ]; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
xdg.configFile = { xdg.configFile = {
"wpaperd/wallpaper.toml" = mkIf (cfg.settings != { }) { "wpaperd/wallpaper.toml" = mkIf (cfg.settings != { }) {
@ -62,7 +62,7 @@ in {
}; };
}; };
systemd.user.services.wpaperd = { systemd.user.services.wpaperd = lib.mkIf (cfg.package != null) {
Install = { WantedBy = [ config.wayland.systemd.target ]; }; Install = { WantedBy = [ config.wayland.systemd.target ]; };
Unit = { Unit = {