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

treewide: format with latest stable formatter

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2025-07-23 10:00:12 -05:00
parent 56ee5d0670
commit b4752b0eda
56 changed files with 816 additions and 832 deletions

View file

@ -32,7 +32,8 @@ let
class = "homeManager";
specialArgs = {
modulesPath = builtins.toString ./.;
} // extraSpecialArgs;
}
// extraSpecialArgs;
};
moduleChecks =

View file

@ -615,21 +615,20 @@ in
home.sessionVariablesPackage = pkgs.writeTextFile {
name = "hm-session-vars.sh";
destination = "/etc/profile.d/hm-session-vars.sh";
text =
''
# Only source this once.
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
export __HM_SESS_VARS_SOURCED=1
text = ''
# Only source this once.
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
export __HM_SESS_VARS_SOURCED=1
${config.lib.shell.exportAll cfg.sessionVariables}
''
+ lib.concatStringsSep "\n" (
lib.mapAttrsToList (
env: values: config.lib.shell.export env (config.lib.shell.prependToVar ":" env values)
) cfg.sessionSearchVariables
)
+ "\n"
+ cfg.sessionVariablesExtra;
${config.lib.shell.exportAll cfg.sessionVariables}
''
+ lib.concatStringsSep "\n" (
lib.mapAttrsToList (
env: values: config.lib.shell.export env (config.lib.shell.prependToVar ":" env values)
) cfg.sessionSearchVariables
)
+ "\n"
+ cfg.sessionVariablesExtra;
};
home.sessionSearchVariables.PATH = lib.mkIf (cfg.sessionPath != [ ]) cfg.sessionPath;

View file

@ -199,19 +199,18 @@ in
};
home = {
sessionVariables =
{
GLFW_IM_MODULE = "ibus"; # IME support in kitty
SDL_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
}
// lib.optionalAttrs (!cfg.waylandFrontend) {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
}
// lib.optionalAttrs cfg.ignoreUserConfig {
SKIP_FCITX_USER_PATH = "1";
};
sessionVariables = {
GLFW_IM_MODULE = "ibus"; # IME support in kitty
SDL_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
}
// lib.optionalAttrs (!cfg.waylandFrontend) {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
}
// lib.optionalAttrs cfg.ignoreUserConfig {
SKIP_FCITX_USER_PATH = "1";
};
sessionSearchVariables.QT_PLUGIN_PATH = [ "${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}" ];
};

View file

@ -18,17 +18,16 @@ rec {
# All characters that are considered safe. Note "-" is not
# included to avoid "-" followed by digit being interpreted as a
# version.
safeChars =
[
"+"
"."
"_"
"?"
"="
]
++ lowerChars
++ upperChars
++ stringToCharacters "0123456789";
safeChars = [
"+"
"."
"_"
"?"
"="
]
++ lowerChars
++ upperChars
++ stringToCharacters "0123456789";
empties = l: genList (x: "") (length l);

View file

@ -20,38 +20,36 @@ in
nameExample ? "Adwaita",
}:
types.submodule {
options =
{
package = mkOption {
type = types.nullOr types.package;
default = null;
example = literalExpression packageExample;
description =
''
Package providing the ${typeName}. This package will be installed
to your profile. If `null` then the ${typeName}
is assumed to already be available in your profile.
''
+ optionalString (typeName == "theme") ''
options = {
package = mkOption {
type = types.nullOr types.package;
default = null;
example = literalExpression packageExample;
description = ''
Package providing the ${typeName}. This package will be installed
to your profile. If `null` then the ${typeName}
is assumed to already be available in your profile.
''
+ optionalString (typeName == "theme") ''
For the theme to apply to GTK 4, this option is mandatory.
'';
};
name = mkOption {
type = types.str;
example = nameExample;
description = "The name of the ${typeName} within the package.";
};
}
// optionalAttrs hasSize {
size = mkOption {
type = types.nullOr types.int;
default = null;
example = 16;
description = "The size of the cursor.";
};
For the theme to apply to GTK 4, this option is mandatory.
'';
};
name = mkOption {
type = types.str;
example = nameExample;
description = "The name of the ${typeName} within the package.";
};
}
// optionalAttrs hasSize {
size = mkOption {
type = types.nullOr types.int;
default = null;
example = 16;
description = "The size of the cursor.";
};
};
};
# Helper function to generate the settings attribute set for a given version

View file

@ -190,24 +190,23 @@ in
"DRI_PRIME" = "${cfg.prime.card}";
};
nvOffloadEnv =
{
"DRI_PRIME" = "${cfg.prime.card}";
"__NV_PRIME_RENDER_OFFLOAD" = "1";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
"__VK_LAYER_NV_optimus" = "NVIDIA_only";
}
// (
let
provider = cfg.prime.nvidiaProvider;
in
if !isNull provider then
{
"__NV_PRIME_RENDER_OFFLOAD_PROVIDER" = "${provider}";
}
else
{ }
);
nvOffloadEnv = {
"DRI_PRIME" = "${cfg.prime.card}";
"__NV_PRIME_RENDER_OFFLOAD" = "1";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
"__VK_LAYER_NV_optimus" = "NVIDIA_only";
}
// (
let
provider = cfg.prime.nvidiaProvider;
in
if !isNull provider then
{
"__NV_PRIME_RENDER_OFFLOAD_PROVIDER" = "${provider}";
}
else
{ }
);
makePackageWrapper =
vendor: environment: pkg:

View file

@ -386,12 +386,11 @@ in
)
++ (lib.optionals (cfg.style.package != null) (lib.toList cfg.style.package));
xsession.importedVariables =
[
"QT_PLUGIN_PATH"
"QML2_IMPORT_PATH"
]
++ lib.optionals (platformTheme.name != null) [ "QT_QPA_PLATFORMTHEME" ]
++ lib.optionals (cfg.style.name != null) [ "QT_STYLE_OVERRIDE" ];
xsession.importedVariables = [
"QT_PLUGIN_PATH"
"QML2_IMPORT_PATH"
]
++ lib.optionals (platformTheme.name != null) [ "QT_QPA_PLATFORMTHEME" ]
++ lib.optionals (cfg.style.name != null) [ "QT_STYLE_OVERRIDE" ];
};
}

View file

@ -229,7 +229,8 @@ in
config = lib.mkIf (config.xdg.desktopEntries != { }) {
assertions = [
(lib.hm.assertions.assertPlatform "xdg.desktopEntries" pkgs lib.platforms.linux)
] ++ lib.flatten (lib.catAttrs "assertions" (lib.attrValues config.xdg.desktopEntries));
]
++ lib.flatten (lib.catAttrs "assertions" (lib.attrValues config.xdg.desktopEntries));
home.packages = (
map lib.hiPrio # we need hiPrio to override existing entries

View file

@ -13,102 +13,100 @@
let
modules =
[
# keep-sorted start case=no numeric=yes
./accounts/calendar.nix
./accounts/contacts.nix
./accounts/email.nix
./config/home-cursor.nix
./config/i18n.nix
./dbus.nix
./files.nix
./home-environment.nix
./i18n/input-method/default.nix
./launchd/default.nix
./manual.nix
./misc/dconf.nix
./misc/debug.nix
./misc/editorconfig.nix
./misc/fontconfig.nix
./misc/gtk.nix
./misc/lib.nix
./misc/mozilla-messaging-hosts.nix
./misc/news.nix
./misc/nix.nix
./misc/nixgl.nix
./misc/numlock.nix
./misc/pam.nix
./misc/qt.nix
./misc/qt/kconfig.nix
./misc/shell.nix
./misc/specialisation.nix
./misc/submodule-support.nix
./misc/tmpfiles.nix
./misc/uninstall.nix
./misc/version.nix
./misc/vte.nix
./misc/xdg-autostart.nix
./misc/xdg-desktop-entries.nix
./misc/xdg-mime-apps.nix
./misc/xdg-mime.nix
./misc/xdg-portal.nix
./misc/xdg-system-dirs.nix
./misc/xdg-user-dirs.nix
./misc/xdg.nix
./misc/xfconf.nix
./systemd.nix
./targets/darwin
./targets/generic-linux.nix
./wayland.nix
./xresources.nix
./xsession.nix
# keep-sorted end
(pkgs.path + "/nixos/modules/misc/assertions.nix")
(pkgs.path + "/nixos/modules/misc/meta.nix")
modules = [
# keep-sorted start case=no numeric=yes
./accounts/calendar.nix
./accounts/contacts.nix
./accounts/email.nix
./config/home-cursor.nix
./config/i18n.nix
./dbus.nix
./files.nix
./home-environment.nix
./i18n/input-method/default.nix
./launchd/default.nix
./manual.nix
./misc/dconf.nix
./misc/debug.nix
./misc/editorconfig.nix
./misc/fontconfig.nix
./misc/gtk.nix
./misc/lib.nix
./misc/mozilla-messaging-hosts.nix
./misc/news.nix
./misc/nix.nix
./misc/nixgl.nix
./misc/numlock.nix
./misc/pam.nix
./misc/qt.nix
./misc/qt/kconfig.nix
./misc/shell.nix
./misc/specialisation.nix
./misc/submodule-support.nix
./misc/tmpfiles.nix
./misc/uninstall.nix
./misc/version.nix
./misc/vte.nix
./misc/xdg-autostart.nix
./misc/xdg-desktop-entries.nix
./misc/xdg-mime-apps.nix
./misc/xdg-mime.nix
./misc/xdg-portal.nix
./misc/xdg-system-dirs.nix
./misc/xdg-user-dirs.nix
./misc/xdg.nix
./misc/xfconf.nix
./systemd.nix
./targets/darwin
./targets/generic-linux.nix
./wayland.nix
./xresources.nix
./xsession.nix
# keep-sorted end
(pkgs.path + "/nixos/modules/misc/assertions.nix")
(pkgs.path + "/nixos/modules/misc/meta.nix")
(lib.mkRemovedOptionModule [ "services" "password-store-sync" ] ''
Use services.git-sync instead.
'')
(lib.mkRemovedOptionModule [ "services" "keepassx" ] ''
KeePassX is no longer maintained.
'')
]
++ (lib.concatMap
(
dir:
lib.pipe (builtins.readDir dir) [
(lib.filterAttrs (path: _kind: !lib.hasPrefix "_" path))
(lib.filterAttrs (
_path: kind: kind == "directory" || (kind == "regular" && lib.hasSuffix ".nix" _path)
))
(lib.mapAttrsToList (path: _kind: lib.path.append dir path))
]
)
[
./services
./programs
(lib.mkRemovedOptionModule [ "services" "password-store-sync" ] ''
Use services.git-sync instead.
'')
(lib.mkRemovedOptionModule [ "services" "keepassx" ] ''
KeePassX is no longer maintained.
'')
]
++ (lib.concatMap
(
dir:
lib.pipe (builtins.readDir dir) [
(lib.filterAttrs (path: _kind: !lib.hasPrefix "_" path))
(lib.filterAttrs (
_path: kind: kind == "directory" || (kind == "regular" && lib.hasSuffix ".nix" _path)
))
(lib.mapAttrsToList (path: _kind: lib.path.append dir path))
]
)
++ lib.optional useNixpkgsModule ./misc/nixpkgs.nix
++ lib.optional (!useNixpkgsModule) ./misc/nixpkgs-disabled.nix;
[
./services
./programs
]
)
++ lib.optional useNixpkgsModule ./misc/nixpkgs.nix
++ lib.optional (!useNixpkgsModule) ./misc/nixpkgs-disabled.nix;
pkgsModule =
{ config, ... }:
{
config =
{
_module.args.baseModules = modules;
_module.args.pkgsPath = lib.mkDefault (
if lib.versionAtLeast config.home.stateVersion "20.09" then pkgs.path else <nixpkgs>
);
_module.args.pkgs = lib.mkDefault pkgs;
_module.check = check;
lib = lib.hm;
}
// lib.optionalAttrs useNixpkgsModule {
nixpkgs.system = lib.mkDefault pkgs.stdenv.hostPlatform.system;
};
config = {
_module.args.baseModules = modules;
_module.args.pkgsPath = lib.mkDefault (
if lib.versionAtLeast config.home.stateVersion "20.09" then pkgs.path else <nixpkgs>
);
_module.args.pkgs = lib.mkDefault pkgs;
_module.check = check;
lib = lib.hm;
}
// lib.optionalAttrs useNixpkgsModule {
nixpkgs.system = lib.mkDefault pkgs.stdenv.hostPlatform.system;
};
};
in

View file

@ -254,34 +254,33 @@ in
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.file =
{
"${configDir}/accounts.conf" = mkIf genAccountsConf {
text = joinCfg [
header
(mkINI cfg.extraAccounts)
(mkINI primaryAccountAccounts)
(mkINI accountsExtraAccounts)
];
};
home.file = {
"${configDir}/accounts.conf" = mkIf genAccountsConf {
text = joinCfg [
header
(mkINI cfg.extraAccounts)
(mkINI primaryAccountAccounts)
(mkINI accountsExtraAccounts)
];
};
"${configDir}/aerc.conf" = mkIf genAercConf {
text = joinCfg [
header
(mkINI cfg.extraConfig)
(joinContextual accountsExtraConfig)
];
};
"${configDir}/aerc.conf" = mkIf genAercConf {
text = joinCfg [
header
(mkINI cfg.extraConfig)
(joinContextual accountsExtraConfig)
];
};
"${configDir}/binds.conf" = mkIf genBindsConf {
text = joinCfg [
header
(mkINI cfg.extraBinds)
(joinContextual accountsExtraBinds)
];
};
}
// (mkStyleset cfg.stylesets)
// (mkTemplates cfg.templates);
"${configDir}/binds.conf" = mkIf genBindsConf {
text = joinCfg [
header
(mkINI cfg.extraBinds)
(joinContextual accountsExtraBinds)
];
};
}
// (mkStyleset cfg.stylesets)
// (mkTemplates cfg.templates);
};
}

View file

@ -281,11 +281,10 @@ in
xdg.configFile."alot/config".text = configFile;
xdg.configFile."alot/hooks.py" = lib.mkIf (cfg.hooks != "") {
text =
''
# Generated by Home Manager.
''
+ cfg.hooks;
text = ''
# Generated by Home Manager.
''
+ cfg.hooks;
};
};
}

View file

@ -53,8 +53,7 @@ in
(pkgs.eclipses.eclipseWithPlugins {
eclipse = cfg.package;
jvmArgs =
cfg.jvmArgs
++ lib.optional cfg.enableLombok "-javaagent:${pkgs.lombok}/share/java/lombok.jar";
cfg.jvmArgs ++ lib.optional cfg.enableLombok "-javaagent:${pkgs.lombok}/share/java/lombok.jar";
plugins = cfg.plugins;
})
];

View file

@ -63,13 +63,12 @@ let
}
)
// {
General =
{
StartWithLastProfile = 1;
}
// lib.optionalAttrs (cfg.profileVersion != null) {
Version = cfg.profileVersion;
};
General = {
StartWithLastProfile = 1;
}
// lib.optionalAttrs (cfg.profileVersion != null) {
Version = cfg.profileVersion;
};
};
profilesIni = lib.generators.toINI { } profiles;
@ -168,11 +167,10 @@ let
in
{
assertion = duplicates == { };
message =
''
Must not have a ${appName} ${entityKind} with an existing ID but
''
+ concatStringsSep "\n" (mapAttrsToList mkMsg duplicates);
message = ''
Must not have a ${appName} ${entityKind} with an existing ID but
''
+ concatStringsSep "\n" (mapAttrsToList mkMsg duplicates);
}
);
@ -784,54 +782,53 @@ in
};
config = {
assertions =
assertions = [
(mkNoDuplicateAssertion config.containers "container")
{
assertion = !(extensionSettingsNeedForce config.extensions.settings) || config.extensions.force;
message = ''
Using '${lib.showOption profilePath}.extensions.settings' will override all
previous extensions settings. Enable
'${lib.showOption profilePath}.extensions.force' to acknowledge this.
'';
}
]
++ (builtins.concatMap (
{ name, value }:
let
packages = builtins.filter (pkg: pkg.addonId == name) config.extensions.packages;
package = builtins.head packages;
unauthorized = lib.subtractLists value.permissions package.meta.mozPermissions;
in
[
(mkNoDuplicateAssertion config.containers "container")
{
assertion = !(extensionSettingsNeedForce config.extensions.settings) || config.extensions.force;
assertion = value.permissions == null || length packages == 1;
message = ''
Using '${lib.showOption profilePath}.extensions.settings' will override all
previous extensions settings. Enable
'${lib.showOption profilePath}.extensions.force' to acknowledge this.
Must have exactly one extension with addonId '${name}'
in '${lib.showOption profilePath}.extensions.packages' but found ${toString (length packages)}.
'';
}
{
assertion = value.permissions == null || length packages != 1 || unauthorized == [ ];
message = ''
Extension ${name} requests permissions that weren't
authorized: ${builtins.toJSON unauthorized}.
Consider adding the missing permissions to
'${
lib.showAttrPath (
profilePath
++ [
"extensions"
name
]
)
}.permissions'.
'';
}
]
++ (builtins.concatMap (
{ name, value }:
let
packages = builtins.filter (pkg: pkg.addonId == name) config.extensions.packages;
package = builtins.head packages;
unauthorized = lib.subtractLists value.permissions package.meta.mozPermissions;
in
[
{
assertion = value.permissions == null || length packages == 1;
message = ''
Must have exactly one extension with addonId '${name}'
in '${lib.showOption profilePath}.extensions.packages' but found ${toString (length packages)}.
'';
}
{
assertion = value.permissions == null || length packages != 1 || unauthorized == [ ];
message = ''
Extension ${name} requests permissions that weren't
authorized: ${builtins.toJSON unauthorized}.
Consider adding the missing permissions to
'${
lib.showAttrPath (
profilePath
++ [
"extensions"
name
]
)
}.permissions'.
'';
}
]
) (lib.attrsToList config.extensions.settings))
++ config.bookmarks.assertions;
) (lib.attrsToList config.extensions.settings))
++ config.bookmarks.assertions;
};
}
)
@ -902,7 +899,8 @@ in
}
(mkNoDuplicateAssertion cfg.profiles "profile")
] ++ (lib.concatMap (profile: profile.assertions) (attrValues cfg.profiles));
]
++ (lib.concatMap (profile: profile.assertions) (attrValues cfg.profiles));
warnings =
optional (cfg.enableGnomeExtensions or false) ''

View file

@ -566,11 +566,12 @@ in
package:
pkgs.runCommand "${getName package}-fish-completions"
{
srcs =
[ package ]
++ lib.filter (p: p != null) (
builtins.map (outName: package.${outName} or null) config.home.extraOutputsToInstall
);
srcs = [
package
]
++ lib.filter (p: p != null) (
builtins.map (outName: package.${outName} or null) config.home.extraOutputsToInstall
);
nativeBuildInputs = [ pkgs.python3 ];
buildInputs = [ cfg.package ];
preferLocalBuild = true;

View file

@ -203,8 +203,7 @@ in
FZF_CTRL_T_OPTS = cfg.fileWidgetOptions;
FZF_DEFAULT_COMMAND = cfg.defaultCommand;
FZF_DEFAULT_OPTS =
cfg.defaultOptions
++ lib.optionals (cfg.colors != { }) [ "--color ${renderedColors cfg.colors}" ];
cfg.defaultOptions ++ lib.optionals (cfg.colors != { }) [ "--color ${renderedColors cfg.colors}" ];
FZF_TMUX = if cfg.tmux.enableShellIntegration then "1" else null;
FZF_TMUX_OPTS = cfg.tmux.shellIntegrationOptions;
}

View file

@ -120,7 +120,8 @@ in
"bezier"
"monitor"
"size"
] ++ lib.optionals cfg.sourceFirst [ "source" ];
]
++ lib.optionals cfg.sourceFirst [ "source" ];
example = [
"$"
"bezier"

View file

@ -28,11 +28,10 @@ in
# Errors out if the symlink already exists
"${ide}/bin/${ide.meta.mainProgram}-remote-dev-server registerBackendLocationForGateway || true";
lines = map mkLine cfg.ides;
linesStr =
''
rm $HOME/.cache/JetBrains/RemoteDev/userProvidedDist/_nix_store* || true
''
+ lib.concatStringsSep "\n" lines;
linesStr = ''
rm $HOME/.cache/JetBrains/RemoteDev/userProvidedDist/_nix_store* || true
''
+ lib.concatStringsSep "\n" lines;
in
lib.hm.dag.entryAfter [ "writeBoundary" ] linesStr;
};

View file

@ -301,24 +301,23 @@ in
(mkOrder 570 (toKittyEnv cfg.environment))
];
xdg.configFile."kitty/kitty.conf" =
{
text = ''
# Generated by Home Manager.
# See https://sw.kovidgoyal.net/kitty/conf.html
${cfg.extraConfig}
'';
}
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
onChange = ''
${pkgs.procps}/bin/pkill -USR1 -u $USER kitty || true
'';
}
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
onChange = ''
/usr/bin/pkill -USR1 -u $USER kitty || true
'';
};
xdg.configFile."kitty/kitty.conf" = {
text = ''
# Generated by Home Manager.
# See https://sw.kovidgoyal.net/kitty/conf.html
${cfg.extraConfig}
'';
}
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
onChange = ''
${pkgs.procps}/bin/pkill -USR1 -u $USER kitty || true
'';
}
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
onChange = ''
/usr/bin/pkill -USR1 -u $USER kitty || true
'';
};
home.activation.checkKittyTheme = mkIf (cfg.themeFile != null) (
let

View file

@ -106,13 +106,12 @@ in
MANGOHUD_DLSYM = 1;
};
xdg.configFile =
{
"MangoHud/MangoHud.conf" = mkIf (cfg.settings != { }) { text = renderSettings cfg.settings; };
}
// lib.mapAttrs' (
n: v: lib.nameValuePair "MangoHud/${n}.conf" { text = renderSettings v; }
) cfg.settingsPerApplication;
xdg.configFile = {
"MangoHud/MangoHud.conf" = mkIf (cfg.settings != { }) { text = renderSettings cfg.settings; };
}
// lib.mapAttrs' (
n: v: lib.nameValuePair "MangoHud/${n}.conf" { text = renderSettings v; }
) cfg.settingsPerApplication;
};
meta.maintainers = with lib.maintainers; [ zeratax ];

View file

@ -22,33 +22,30 @@ let
# See: https://github.com/nix-community/home-manager/issues/6663
# and https://github.com/bnprks/mcfly-fzf/issues/10
bashIntegration =
''
eval "$(${getExe cfg.package} init bash)"
''
+ optionalString cfg.fzf.enable ''
if [[ $- =~ i ]]; then
eval "$(${getExe cfg.mcflyFzfPackage} init bash)"
fi
'';
bashIntegration = ''
eval "$(${getExe cfg.package} init bash)"
''
+ optionalString cfg.fzf.enable ''
if [[ $- =~ i ]]; then
eval "$(${getExe cfg.mcflyFzfPackage} init bash)"
fi
'';
fishIntegration =
''
${getExe cfg.package} init fish | source
''
+ optionalString cfg.fzf.enable ''
${getExe cfg.mcflyFzfPackage} init fish | source
'';
fishIntegration = ''
${getExe cfg.package} init fish | source
''
+ optionalString cfg.fzf.enable ''
${getExe cfg.mcflyFzfPackage} init fish | source
'';
zshIntegration =
''
eval "$(${getExe cfg.package} init zsh)"
''
+ optionalString cfg.fzf.enable ''
if [[ -o interactive ]]; then
eval "$(${getExe cfg.mcflyFzfPackage} init zsh)"
fi
'';
zshIntegration = ''
eval "$(${getExe cfg.package} init zsh)"
''
+ optionalString cfg.fzf.enable ''
if [[ -o interactive ]]; then
eval "$(${getExe cfg.mcflyFzfPackage} init zsh)"
fi
'';
in
{

View file

@ -84,17 +84,16 @@ in
(mkIf (cfg.ignores != [ ] || cfg.ignoresRegexp != [ ]) {
programs.mercurial.iniContent.ui.ignore = "${config.xdg.configHome}/hg/hgignore_global";
xdg.configFile."hg/hgignore_global".text =
''
syntax: glob
''
+ lib.concatStringsSep "\n" cfg.ignores
+ "\n"
+ ''
syntax: regexp
''
+ lib.concatStringsSep "\n" cfg.ignoresRegexp
+ "\n";
xdg.configFile."hg/hgignore_global".text = ''
syntax: glob
''
+ lib.concatStringsSep "\n" cfg.ignores
+ "\n"
+ ''
syntax: regexp
''
+ lib.concatStringsSep "\n" cfg.ignoresRegexp
+ "\n";
})
(mkIf (cfg.aliases != { }) {

View file

@ -99,6 +99,7 @@ in
".ne/.keys" = mkIf (cfg.keybindings != "") { text = cfg.keybindings; };
".ne/.extensions" = mkIf (cfg.virtualExtensions != "") { text = cfg.virtualExtensions; };
".ne/.menus" = mkIf (cfg.menus != "") { text = cfg.menus; };
} // autoPrefFiles;
}
// autoPrefFiles;
};
}

View file

@ -109,7 +109,8 @@ in
"${lib.getExe cfg.package}"
"clean"
"user"
] ++ lib.optional (cfg.clean.extraArgs != "") cfg.clean.extraArgs;
]
++ lib.optional (cfg.clean.extraArgs != "") cfg.clean.extraArgs;
StartCalendarInterval = lib.hm.darwin.mkCalendarInterval cfg.clean.dates;

View file

@ -532,13 +532,12 @@ in
vaults = builtins.listToAttrs (
builtins.map (vault: {
name = builtins.hashString "md5" vault.target;
value =
{
path = "${config.home.homeDirectory}/${vault.target}";
}
// (lib.attrsets.optionalAttrs ((builtins.length vaults) == 1) {
open = true;
});
value = {
path = "${config.home.homeDirectory}/${vault.target}";
}
// (lib.attrsets.optionalAttrs ((builtins.length vaults) == 1) {
open = true;
});
}) vaults
);
updateDisabled = true;

View file

@ -65,29 +65,28 @@ let
};
in
toIni {
"Account ${name}" =
{
localrepository = "${name}-local";
remoterepository = "${name}-remote";
}
// postSyncHook
// offlineimap.extraConfig.account;
"Account ${name}" = {
localrepository = "${name}-local";
remoterepository = "${name}-remote";
}
// postSyncHook
// offlineimap.extraConfig.account;
"Repository ${name}-local" = {
type = localType;
localfolders = account.maildir.absPath;
} // offlineimap.extraConfig.local;
}
// offlineimap.extraConfig.local;
"Repository ${name}-remote" =
{
type = remoteType;
remoteuser = account.userName;
}
// remoteHost
// remotePort
// remotePassEval
// ssl
// offlineimap.extraConfig.remote;
"Repository ${name}-remote" = {
type = remoteType;
remoteuser = account.userName;
}
// remoteHost
// remotePort
// remotePassEval
// ssl
// offlineimap.extraConfig.remote;
};
extraConfigType = with lib.types; attrsOf (either (either str int) bool);
@ -189,30 +188,31 @@ in
''
}/bin/get_settings.pyc";
xdg.configFile."offlineimap/config".text =
''
# Generated by Home Manager.
# See https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf
# for an exhaustive list of options.
''
+ toIni (
{
general = {
accounts = lib.concatMapStringsSep "," (a: a.name) accounts;
pythonfile = "${config.xdg.configHome}/offlineimap/get_settings.py";
metadata = "${config.xdg.dataHome}/offlineimap";
} // cfg.extraConfig.general;
xdg.configFile."offlineimap/config".text = ''
# Generated by Home Manager.
# See https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf
# for an exhaustive list of options.
''
+ toIni (
{
general = {
accounts = lib.concatMapStringsSep "," (a: a.name) accounts;
pythonfile = "${config.xdg.configHome}/offlineimap/get_settings.py";
metadata = "${config.xdg.dataHome}/offlineimap";
}
// lib.optionalAttrs (cfg.extraConfig.mbnames != { }) {
mbnames = {
enabled = true;
} // cfg.extraConfig.mbnames;
// cfg.extraConfig.general;
}
// lib.optionalAttrs (cfg.extraConfig.mbnames != { }) {
mbnames = {
enabled = true;
}
// lib.optionalAttrs (cfg.extraConfig.default != { }) {
DEFAULT = cfg.extraConfig.default;
}
)
+ "\n"
+ lib.concatStringsSep "\n" (map accountStr accounts);
// cfg.extraConfig.mbnames;
}
// lib.optionalAttrs (cfg.extraConfig.default != { }) {
DEFAULT = cfg.extraConfig.default;
}
)
+ "\n"
+ lib.concatStringsSep "\n" (map accountStr accounts);
};
}

View file

@ -176,10 +176,11 @@ in
let
resolvedExtraLuaPackages = cfg.extraLuaPackages pkgs.lua54Packages;
pathPackages =
[ cfg.package ]
++ cfg.extraPackages
++ lib.optional (cfg.configType == "lua" && cfg.luaPackage != null) cfg.luaPackage;
pathPackages = [
cfg.package
]
++ cfg.extraPackages
++ lib.optional (cfg.configType == "lua" && cfg.luaPackage != null) cfg.luaPackage;
luaPaths = lib.filter (x: x != "") [
(lib.optionalString (cfg.configType == "lua" && resolvedExtraLuaPackages != [ ]) (

View file

@ -135,20 +135,19 @@ in
{ home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; }
(lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
xdg.configFile =
{
"streamlink/config" = lib.mkIf (cfg.settings != { }) {
text = renderSettings cfg.settings;
};
}
// (lib.mapAttrs' (
name: value:
lib.nameValuePair "streamlink/config.${name}" (
lib.mkIf (value.settings != { }) {
text = renderSettings value.settings;
}
)
) cfg.plugins);
xdg.configFile = {
"streamlink/config" = lib.mkIf (cfg.settings != { }) {
text = renderSettings cfg.settings;
};
}
// (lib.mapAttrs' (
name: value:
lib.nameValuePair "streamlink/config.${name}" (
lib.mkIf (value.settings != { }) {
text = renderSettings value.settings;
}
)
) cfg.plugins);
xdg.dataFile = lib.mapAttrs' (
name: value:
@ -168,35 +167,34 @@ in
})
(lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
home.file =
{
"Library/Application Support/streamlink/config" = lib.mkIf (cfg.settings != { }) {
text = renderSettings cfg.settings;
};
}
// (lib.mapAttrs' (
name: value:
lib.nameValuePair "Library/Application Support/streamlink/config.${name}" (
lib.mkIf (value.settings != { }) {
text = renderSettings value.settings;
}
home.file = {
"Library/Application Support/streamlink/config" = lib.mkIf (cfg.settings != { }) {
text = renderSettings cfg.settings;
};
}
// (lib.mapAttrs' (
name: value:
lib.nameValuePair "Library/Application Support/streamlink/config.${name}" (
lib.mkIf (value.settings != { }) {
text = renderSettings value.settings;
}
)
) cfg.plugins)
// (lib.mapAttrs' (
name: value:
lib.nameValuePair "Library/Application Support/streamlink/plugins/${name}.py" (
lib.mkIf (value.src != null) (
if (builtins.isPath value.src) then
{
source = value.src;
}
else
{
text = value.src;
}
)
) cfg.plugins)
// (lib.mapAttrs' (
name: value:
lib.nameValuePair "Library/Application Support/streamlink/plugins/${name}.py" (
lib.mkIf (value.src != null) (
if (builtins.isPath value.src) then
{
source = value.src;
}
else
{
text = value.src;
}
)
)
) cfg.plugins);
)
) cfg.plugins);
})
]
);

View file

@ -54,13 +54,12 @@ let
profilesIni =
lib.foldl lib.recursiveUpdate
{
General =
{
StartWithLastProfile = 1;
}
// lib.optionalAttrs (cfg.profileVersion != null) {
Version = cfg.profileVersion;
};
General = {
StartWithLastProfile = 1;
}
// lib.optionalAttrs (cfg.profileVersion != null) {
Version = cfg.profileVersion;
};
}
(
lib.flip map profilesWithId (profile: {
@ -882,11 +881,13 @@ in
home.packages = [
cfg.package
] ++ lib.optional (lib.any (p: p.withExternalGnupg) (attrValues cfg.profiles)) pkgs.gpgme;
]
++ lib.optional (lib.any (p: p.withExternalGnupg) (attrValues cfg.profiles)) pkgs.gpgme;
mozilla.thunderbirdNativeMessagingHosts = [
cfg.package # package configured native messaging hosts (entire mail app actually)
] ++ cfg.nativeMessagingHosts; # user configured native messaging hosts
]
++ cfg.nativeMessagingHosts; # user configured native messaging hosts
home.file = lib.mkMerge (
[

View file

@ -357,10 +357,11 @@ in
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
home.packages =
[ cfg.package ]
++ lib.optional cfg.tmuxinator.enable pkgs.tmuxinator
++ lib.optional cfg.tmuxp.enable pkgs.tmuxp;
home.packages = [
cfg.package
]
++ lib.optional cfg.tmuxinator.enable pkgs.tmuxinator
++ lib.optional cfg.tmuxp.enable pkgs.tmuxp;
}
{ xdg.configFile."tmux/tmux.conf".text = lib.mkBefore tmuxConf; }

View file

@ -142,27 +142,26 @@ in
config = lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
xresources.properties =
{
"URxvt.scrollBar" = cfg.scroll.bar.enable;
"URxvt.scrollstyle" = cfg.scroll.bar.style;
"URxvt.scrollBar_align" = cfg.scroll.bar.align;
"URxvt.scrollBar_right" = cfg.scroll.bar.position == "right";
"URxvt.scrollBar_floating" = cfg.scroll.bar.floating;
"URxvt.saveLines" = cfg.scroll.lines;
"URxvt.scrollWithBuffer" = cfg.scroll.keepPosition;
"URxvt.scrollTtyKeypress" = cfg.scroll.scrollOnKeystroke;
"URxvt.scrollTtyOutput" = cfg.scroll.scrollOnOutput;
"URxvt.transparent" = cfg.transparent;
"URxvt.shading" = cfg.shading;
"URxvt.iso14755" = cfg.iso14755;
}
// lib.flip lib.mapAttrs' cfg.keybindings (
kb: action: lib.nameValuePair "URxvt.keysym.${kb}" action
)
// lib.optionalAttrs (cfg.fonts != [ ]) {
"URxvt.font" = lib.concatStringsSep "," cfg.fonts;
}
// lib.flip lib.mapAttrs' cfg.extraConfig (k: v: lib.nameValuePair "URxvt.${k}" v);
xresources.properties = {
"URxvt.scrollBar" = cfg.scroll.bar.enable;
"URxvt.scrollstyle" = cfg.scroll.bar.style;
"URxvt.scrollBar_align" = cfg.scroll.bar.align;
"URxvt.scrollBar_right" = cfg.scroll.bar.position == "right";
"URxvt.scrollBar_floating" = cfg.scroll.bar.floating;
"URxvt.saveLines" = cfg.scroll.lines;
"URxvt.scrollWithBuffer" = cfg.scroll.keepPosition;
"URxvt.scrollTtyKeypress" = cfg.scroll.scrollOnKeystroke;
"URxvt.scrollTtyOutput" = cfg.scroll.scrollOnOutput;
"URxvt.transparent" = cfg.transparent;
"URxvt.shading" = cfg.shading;
"URxvt.iso14755" = cfg.iso14755;
}
// lib.flip lib.mapAttrs' cfg.keybindings (
kb: action: lib.nameValuePair "URxvt.keysym.${kb}" action
)
// lib.optionalAttrs (cfg.fonts != [ ]) {
"URxvt.font" = lib.concatStringsSep "," cfg.fonts;
}
// lib.flip lib.mapAttrs' cfg.extraConfig (k: v: lib.nameValuePair "URxvt.${k}" v);
};
}

View file

@ -259,20 +259,20 @@ let
allProfilesExceptDefault = removeAttrs cfg.profiles [ "default" ];
in
{
imports =
[
./haskell.nix
(lib.mkChangedOptionModule
[
"programs"
"vscode"
"immutableExtensionsDir"
]
[ "programs" "vscode" "mutableExtensionsDir" ]
(config: !config.programs.vscode.immutableExtensionsDir)
)
]
++ map
imports = [
./haskell.nix
(lib.mkChangedOptionModule
[
"programs"
"vscode"
"immutableExtensionsDir"
]
[ "programs" "vscode" "mutableExtensionsDir" ]
(config: !config.programs.vscode.immutableExtensionsDir)
)
]
++
map
(
v:
lib.mkRenamedOptionModule

View file

@ -62,6 +62,7 @@ in
programs.vscode.profiles.default.extensions = [
pkgs.vscode-extensions.justusadam.language-haskell
] ++ lib.optional cfg.hie.enable pkgs.vscode-extensions.alanz.vscode-hie-server;
]
++ lib.optional cfg.hie.enable pkgs.vscode-extensions.alanz.vscode-hie-server;
};
}

View file

@ -227,34 +227,33 @@ in
nushell.extraConfig = mkIf cfg.enableNushellIntegration nushellIntegration;
};
xdg.configFile =
{
"yazi/keymap.toml" = mkIf (cfg.keymap != { }) {
source = tomlFormat.generate "yazi-keymap" cfg.keymap;
};
"yazi/yazi.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "yazi-settings" cfg.settings;
};
"yazi/theme.toml" = mkIf (cfg.theme != { }) {
source = tomlFormat.generate "yazi-theme" cfg.theme;
};
"yazi/init.lua" = mkIf (cfg.initLua != null) (
if builtins.isPath cfg.initLua then
{
source = cfg.initLua;
}
else
{
text = cfg.initLua;
}
);
}
// (lib.mapAttrs' (
name: value: lib.nameValuePair "yazi/flavors/${name}.yazi" { source = value; }
) cfg.flavors)
// (lib.mapAttrs' (
name: value: lib.nameValuePair "yazi/plugins/${name}.yazi" { source = value; }
) cfg.plugins);
xdg.configFile = {
"yazi/keymap.toml" = mkIf (cfg.keymap != { }) {
source = tomlFormat.generate "yazi-keymap" cfg.keymap;
};
"yazi/yazi.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "yazi-settings" cfg.settings;
};
"yazi/theme.toml" = mkIf (cfg.theme != { }) {
source = tomlFormat.generate "yazi-theme" cfg.theme;
};
"yazi/init.lua" = mkIf (cfg.initLua != null) (
if builtins.isPath cfg.initLua then
{
source = cfg.initLua;
}
else
{
text = cfg.initLua;
}
);
}
// (lib.mapAttrs' (
name: value: lib.nameValuePair "yazi/flavors/${name}.yazi" { source = value; }
) cfg.flavors)
// (lib.mapAttrs' (
name: value: lib.nameValuePair "yazi/plugins/${name}.yazi" { source = value; }
) cfg.plugins);
warnings = lib.filter (s: s != "") (
lib.concatLists [

View file

@ -154,11 +154,13 @@ in
"/run/current-system/sw"
config.home.profileDirectory
cfg.iconTheme.package
] ++ optional useCustomTheme hicolorTheme.package;
]
++ optional useCustomTheme hicolorTheme.package;
themes = [
cfg.iconTheme
] ++ optional useCustomTheme (hicolorTheme // { size = cfg.iconTheme.size; });
]
++ optional useCustomTheme (hicolorTheme // { size = cfg.iconTheme.size; });
categories = [
"actions"

View file

@ -22,7 +22,8 @@ let
finalConfig = {
inherit (cfg) order;
} // cfg.extraConfig;
}
// cfg.extraConfig;
configFile = jsonFormat.generate "dwm-status.json" finalConfig;

View file

@ -129,64 +129,61 @@ in
}
(mkIf pkgs.stdenv.isLinux {
systemd.user.services.emacs =
{
Unit =
{
Description = "Emacs text editor";
Documentation = "info:emacs man:emacs(1) https://gnu.org/software/emacs/";
systemd.user.services.emacs = {
Unit = {
Description = "Emacs text editor";
Documentation = "info:emacs man:emacs(1) https://gnu.org/software/emacs/";
After = optional (cfg.startWithUserSession == "graphical") "graphical-session.target";
PartOf = optional (cfg.startWithUserSession == "graphical") "graphical-session.target";
After = optional (cfg.startWithUserSession == "graphical") "graphical-session.target";
PartOf = optional (cfg.startWithUserSession == "graphical") "graphical-session.target";
# Avoid killing the Emacs session, which may be full of
# unsaved buffers.
X-RestartIfChanged = false;
}
// optionalAttrs needsSocketWorkaround {
# Emacs deletes its socket when shutting down, which systemd doesn't
# handle, resulting in a server without a socket.
# See https://github.com/nix-community/home-manager/issues/2018
RefuseManualStart = true;
};
Service =
{
Type = "notify";
# We wrap ExecStart in a login shell so Emacs starts with the user's
# environment, most importantly $PATH and $NIX_PROFILES. It may be
# worth investigating a more targeted approach for user services to
# import the user environment.
ExecStart = ''${pkgs.runtimeShell} -l -c "${emacsBinPath}/emacs --fg-daemon${
# In case the user sets 'server-directory' or 'server-name' in
# their Emacs config, we want to specify the socket path explicitly
# so launching 'emacs.service' manually doesn't break emacsclient
# when using socket activation.
lib.optionalString cfg.socketActivation.enable "=${lib.escapeShellArg socketPath}"
} ${lib.escapeShellArgs cfg.extraOptions}"'';
# Emacs will exit with status 15 after having received SIGTERM, which
# is the default "KillSignal" value systemd uses to stop services.
SuccessExitStatus = 15;
Restart = "on-failure";
}
// optionalAttrs needsSocketWorkaround {
# Use read-only directory permissions to prevent emacs from
# deleting systemd's socket file before exiting.
ExecStartPost = "${pkgs.coreutils}/bin/chmod --changes -w ${socketDir}";
ExecStopPost = "${pkgs.coreutils}/bin/chmod --changes +w ${socketDir}";
};
# Avoid killing the Emacs session, which may be full of
# unsaved buffers.
X-RestartIfChanged = false;
}
// optionalAttrs (cfg.startWithUserSession != false) {
Install = {
WantedBy = [
(if cfg.startWithUserSession == true then "default.target" else "graphical-session.target")
];
};
// optionalAttrs needsSocketWorkaround {
# Emacs deletes its socket when shutting down, which systemd doesn't
# handle, resulting in a server without a socket.
# See https://github.com/nix-community/home-manager/issues/2018
RefuseManualStart = true;
};
Service = {
Type = "notify";
# We wrap ExecStart in a login shell so Emacs starts with the user's
# environment, most importantly $PATH and $NIX_PROFILES. It may be
# worth investigating a more targeted approach for user services to
# import the user environment.
ExecStart = ''${pkgs.runtimeShell} -l -c "${emacsBinPath}/emacs --fg-daemon${
# In case the user sets 'server-directory' or 'server-name' in
# their Emacs config, we want to specify the socket path explicitly
# so launching 'emacs.service' manually doesn't break emacsclient
# when using socket activation.
lib.optionalString cfg.socketActivation.enable "=${lib.escapeShellArg socketPath}"
} ${lib.escapeShellArgs cfg.extraOptions}"'';
# Emacs will exit with status 15 after having received SIGTERM, which
# is the default "KillSignal" value systemd uses to stop services.
SuccessExitStatus = 15;
Restart = "on-failure";
}
// optionalAttrs needsSocketWorkaround {
# Use read-only directory permissions to prevent emacs from
# deleting systemd's socket file before exiting.
ExecStartPost = "${pkgs.coreutils}/bin/chmod --changes -w ${socketDir}";
ExecStopPost = "${pkgs.coreutils}/bin/chmod --changes +w ${socketDir}";
};
}
// optionalAttrs (cfg.startWithUserSession != false) {
Install = {
WantedBy = [
(if cfg.startWithUserSession == true then "default.target" else "graphical-session.target")
];
};
};
home.packages = optional cfg.client.enable (lib.hiPrio clientDesktopItem);
})
@ -227,7 +224,8 @@ in
ProgramArguments = [
"${cfg.package}/bin/emacs"
"--fg-daemon"
] ++ cfg.extraOptions;
]
++ cfg.extraOptions;
RunAtLoad = true;
KeepAlive = {
Crashed = true;

View file

@ -23,34 +23,30 @@ let
${gpgPkg}/bin/gpg-connect-agent --quiet updatestartuptty /bye > /dev/null
'';
gpgInitStr =
''
GPG_TTY="$(tty)"
export GPG_TTY
''
+ optionalString cfg.enableSshSupport gpgSshSupportStr;
gpgInitStr = ''
GPG_TTY="$(tty)"
export GPG_TTY
''
+ optionalString cfg.enableSshSupport gpgSshSupportStr;
gpgZshInitStr =
''
export GPG_TTY=$TTY
''
+ optionalString cfg.enableSshSupport gpgSshSupportStr;
gpgZshInitStr = ''
export GPG_TTY=$TTY
''
+ optionalString cfg.enableSshSupport gpgSshSupportStr;
gpgFishInitStr =
''
set -gx GPG_TTY (tty)
''
+ optionalString cfg.enableSshSupport gpgSshSupportStr;
gpgFishInitStr = ''
set -gx GPG_TTY (tty)
''
+ optionalString cfg.enableSshSupport gpgSshSupportStr;
gpgNushellInitStr =
''
$env.GPG_TTY = (tty)
''
+ optionalString cfg.enableSshSupport ''
${gpgPkg}/bin/gpg-connect-agent --quiet updatestartuptty /bye | ignore
gpgNushellInitStr = ''
$env.GPG_TTY = (tty)
''
+ optionalString cfg.enableSshSupport ''
${gpgPkg}/bin/gpg-connect-agent --quiet updatestartuptty /bye | ignore
$env.SSH_AUTH_SOCK = ($env.SSH_AUTH_SOCK? | default (${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket))
'';
$env.SSH_AUTH_SOCK = ($env.SSH_AUTH_SOCK? | default (${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket))
'';
# mimic `gpgconf` output for use in the service definitions.
# we cannot use `gpgconf` directly because it heavily depends on system
@ -439,7 +435,8 @@ in
ProgramArguments = [
"${gpgPkg}/bin/gpg-agent"
"--supervised"
] ++ optional cfg.verbose "--verbose";
]
++ optional cfg.verbose "--verbose";
EnvironmentVariables = {
GNUPGHOME = homedir;
};

View file

@ -131,7 +131,8 @@ in
RestartSec = "10";
};
};
} // transitionServices;
}
// transitionServices;
timers = lib.mapAttrs' (
name: transitionCfg:

View file

@ -44,9 +44,10 @@ let
Restart = "always";
RestartSec = 30;
Type = "simple";
Environment =
[ "PATH=${cfg.path}" ]
++ lib.optional account.notmuch.enable "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config";
Environment = [
"PATH=${cfg.path}"
]
++ lib.optional account.notmuch.enable "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/default/config";
};
Install = {
@ -64,23 +65,22 @@ let
name = "imapnotify-${name}";
value = {
enable = true;
config =
{
# Use the nix store path for config to ensure service restarts when it changes
ProgramArguments = [
"${lib.getExe cfg.package}"
"-conf"
"${genAccountConfig account}"
];
KeepAlive = true;
ThrottleInterval = 30;
ExitTimeOut = 0;
ProcessType = "Background";
RunAtLoad = true;
}
// optionalAttrs account.notmuch.enable {
EnvironmentVariables.NOTMUCH_CONFIG = "${config.xdg.configHome}/notmuch/default/config";
};
config = {
# Use the nix store path for config to ensure service restarts when it changes
ProgramArguments = [
"${lib.getExe cfg.package}"
"-conf"
"${genAccountConfig account}"
];
KeepAlive = true;
ThrottleInterval = 30;
ExitTimeOut = 0;
ProcessType = "Background";
RunAtLoad = true;
}
// optionalAttrs account.notmuch.enable {
EnvironmentVariables.NOTMUCH_CONFIG = "${config.xdg.configHome}/notmuch/default/config";
};
};
};

View file

@ -90,14 +90,13 @@ in
systemd.user = {
services.ludusavi = {
Unit.Description = "Run a game save backup with Ludusavi";
Service =
{
Type = "oneshot";
ExecStart = "${lib.getExe cfg.package} backup --force";
}
// lib.optionalAttrs cfg.backupNotification {
ExecStartPost = "${lib.getExe pkgs.libnotify} 'Ludusavi' 'Backup completed' -i com.mtkennerly.ludusavi -a 'Ludusavi'";
};
Service = {
Type = "oneshot";
ExecStart = "${lib.getExe cfg.package} backup --force";
}
// lib.optionalAttrs cfg.backupNotification {
ExecStartPost = "${lib.getExe pkgs.libnotify} 'Ludusavi' 'Backup completed' -i com.mtkennerly.ludusavi -a 'Ludusavi'";
};
};
timers.ludusavi = {
Unit.Description = "Run a game save backup with Ludusavi";

View file

@ -9,10 +9,11 @@ let
cfg = config.services.mbsync;
mbsyncOptions =
[ "--all" ]
++ lib.optional (cfg.verbose) "--verbose"
++ lib.optional (cfg.configFile != null) "--config ${cfg.configFile}";
mbsyncOptions = [
"--all"
]
++ lib.optional (cfg.verbose) "--verbose"
++ lib.optional (cfg.configFile != null) "--config ${cfg.configFile}";
in
{
@ -82,17 +83,16 @@ in
Description = "mbsync mailbox synchronization";
};
Service =
{
Type = "oneshot";
ExecStart = "${cfg.package}/bin/mbsync ${lib.concatStringsSep " " mbsyncOptions}";
}
// (lib.optionalAttrs (cfg.postExec != null) {
ExecStartPost = cfg.postExec;
})
// (lib.optionalAttrs (cfg.preExec != null) {
ExecStartPre = cfg.preExec;
});
Service = {
Type = "oneshot";
ExecStart = "${cfg.package}/bin/mbsync ${lib.concatStringsSep " " mbsyncOptions}";
}
// (lib.optionalAttrs (cfg.postExec != null) {
ExecStartPost = cfg.postExec;
})
// (lib.optionalAttrs (cfg.preExec != null) {
ExecStartPre = cfg.preExec;
});
};
systemd.user.timers.mbsync = {

View file

@ -228,7 +228,8 @@ in
(lib.getExe cfg.package)
"--no-daemon"
"${mpdConf}"
] ++ cfg.extraArgs;
]
++ cfg.extraArgs;
KeepAlive = true;
ProcessType = "Interactive";
};

View file

@ -19,15 +19,14 @@ let
};
mpdris2Conf = {
Connection =
{
host = cfg.mpd.host;
port = cfg.mpd.port;
music_dir = cfg.mpd.musicDirectory;
}
// lib.optionalAttrs (cfg.mpd.password != null) {
password = cfg.mpd.password;
};
Connection = {
host = cfg.mpd.host;
port = cfg.mpd.port;
music_dir = cfg.mpd.musicDirectory;
}
// lib.optionalAttrs (cfg.mpd.password != null) {
password = cfg.mpd.password;
};
Bling = {
notify = cfg.notifications;

View file

@ -118,7 +118,8 @@ in
config = {
ProgramArguments = [
"${nixPackage}/bin/nix-collect-garbage"
] ++ lib.optional (cfg.options != null) cfg.options;
]
++ lib.optional (cfg.options != null) cfg.options;
StartCalendarInterval = lib.hm.darwin.mkCalendarInterval cfg.frequency;
};
};

View file

@ -218,8 +218,11 @@ in
{
Description = "${programName} colour temperature adjuster";
Documentation = serviceDocumentation;
After =
[ "graphical-session.target" ] ++ (lib.optional cfg.tray "tray.target") ++ geoclueAgentService;
After = [
"graphical-session.target"
]
++ (lib.optional cfg.tray "tray.target")
++ geoclueAgentService;
Wants = geoclueAgentService;
Requires = lib.mkIf cfg.tray "tray.target";
PartOf = [ "graphical-session.target" ];

View file

@ -395,87 +395,85 @@ in
After = [ "network-online.target" ];
};
Service =
{
Type = "oneshot";
Service = {
Type = "oneshot";
X-RestartIfChanged = true;
RuntimeDirectory = serviceName;
CacheDirectory = serviceName;
CacheDirectoryMode = "0700";
PrivateTmp = true;
X-RestartIfChanged = true;
RuntimeDirectory = serviceName;
CacheDirectory = serviceName;
CacheDirectoryMode = "0700";
PrivateTmp = true;
Environment =
[
"RESTIC_CACHE_DIR=%C"
"PATH=${backup.ssh-package}/bin"
]
++ attrsToEnvs (
{
RESTIC_PROGRESS_FPS = backup.progressFps;
RESTIC_PASSWORD_FILE = backup.passwordFile;
RESTIC_REPOSITORY = backup.repository;
RESTIC_REPOSITORY_FILE = backup.repositoryFile;
}
// backup.rcloneOptions
);
Environment = [
"RESTIC_CACHE_DIR=%C"
"PATH=${backup.ssh-package}/bin"
]
++ attrsToEnvs (
{
RESTIC_PROGRESS_FPS = backup.progressFps;
RESTIC_PASSWORD_FILE = backup.passwordFile;
RESTIC_REPOSITORY = backup.repository;
RESTIC_REPOSITORY_FILE = backup.repositoryFile;
}
// backup.rcloneOptions
);
ExecStart =
lib.optional doBackup backupCmd
++ lib.optionals doPrune [
unlockCmd
forgetCmd
]
++ lib.optional doCheck checkCmd;
ExecStart =
lib.optional doBackup backupCmd
++ lib.optionals doPrune [
unlockCmd
forgetCmd
]
++ lib.optional doCheck checkCmd;
ExecStartPre = lib.getExe (
pkgs.writeShellApplication {
name = "${serviceName}-exec-start-pre";
inherit runtimeInputs;
text = ''
set -x
ExecStartPre = lib.getExe (
pkgs.writeShellApplication {
name = "${serviceName}-exec-start-pre";
inherit runtimeInputs;
text = ''
set -x
${lib.optionalString (backup.backupPrepareCommand != null) ''
${pkgs.writeScript "backupPrepareCommand" backup.backupPrepareCommand}
''}
${lib.optionalString (backup.backupPrepareCommand != null) ''
${pkgs.writeScript "backupPrepareCommand" backup.backupPrepareCommand}
''}
${lib.optionalString (backup.initialize) ''
${
mkResticCmd [
"cat"
"config"
]
} 2>/dev/null || ${mkResticCmd "init"}
''}
${lib.optionalString (backup.initialize) ''
${
mkResticCmd [
"cat"
"config"
]
} 2>/dev/null || ${mkResticCmd "init"}
''}
${lib.optionalString (backup.paths != null && backup.paths != [ ]) ''
cat ${pkgs.writeText "staticPaths" (lib.concatLines backup.paths)} >> ${filesFromTmpFile}
''}
${lib.optionalString (backup.paths != null && backup.paths != [ ]) ''
cat ${pkgs.writeText "staticPaths" (lib.concatLines backup.paths)} >> ${filesFromTmpFile}
''}
${lib.optionalString (backup.dynamicFilesFrom != null) ''
${pkgs.writeScript "dynamicFilesFromScript" backup.dynamicFilesFrom} >> ${filesFromTmpFile}
''}
'';
}
);
${lib.optionalString (backup.dynamicFilesFrom != null) ''
${pkgs.writeScript "dynamicFilesFromScript" backup.dynamicFilesFrom} >> ${filesFromTmpFile}
''}
'';
}
);
ExecStopPost = lib.getExe (
pkgs.writeShellApplication {
name = "${serviceName}-exec-stop-post";
inherit runtimeInputs;
text = ''
set -x
ExecStopPost = lib.getExe (
pkgs.writeShellApplication {
name = "${serviceName}-exec-stop-post";
inherit runtimeInputs;
text = ''
set -x
${lib.optionalString (backup.backupCleanupCommand != null) ''
${pkgs.writeScript "backupCleanupCommand" backup.backupCleanupCommand}
''}
'';
}
);
}
// lib.optionalAttrs (backup.environmentFile != null) {
EnvironmentFile = backup.environmentFile;
};
${lib.optionalString (backup.backupCleanupCommand != null) ''
${pkgs.writeScript "backupCleanupCommand" backup.backupCleanupCommand}
''}
'';
}
);
}
// lib.optionalAttrs (backup.environmentFile != null) {
EnvironmentFile = backup.environmentFile;
};
}
) cfg.backups;

View file

@ -250,7 +250,8 @@ in
"$"
"bezier"
"name"
] ++ lib.optionals cfg.sourceFirst [ "source" ];
]
++ lib.optionals cfg.sourceFirst [ "source" ];
example = [
"$"
"bezier"
@ -334,7 +335,8 @@ in
BindsTo = [ "graphical-session.target" ];
Wants = [
"graphical-session-pre.target"
] ++ lib.optional cfg.systemd.enableXdgAutostart "xdg-desktop-autostart.target";
]
++ lib.optional cfg.systemd.enableXdgAutostart "xdg-desktop-autostart.target";
After = [ "graphical-session-pre.target" ];
Before = lib.mkIf cfg.systemd.enableXdgAutostart [ "xdg-desktop-autostart.target" ];
};

View file

@ -48,40 +48,39 @@ let
};
startupModule = types.submodule {
options =
{
command = mkOption {
type = types.str;
description = "Command that will be executed on startup.";
};
always = mkOption {
type = types.bool;
default = false;
description = "Whether to run command on each ${moduleName} restart.";
};
}
// lib.optionalAttrs isI3 {
notification = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable startup-notification support for the command.
See {option}`--no-startup-id` option description in the i3 user guide.
'';
};
workspace = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Launch application on a particular workspace. DEPRECATED:
Use [](#opt-xsession.windowManager.i3.config.assigns)
instead. See <https://github.com/nix-community/home-manager/issues/265>.
'';
};
options = {
command = mkOption {
type = types.str;
description = "Command that will be executed on startup.";
};
always = mkOption {
type = types.bool;
default = false;
description = "Whether to run command on each ${moduleName} restart.";
};
}
// lib.optionalAttrs isI3 {
notification = mkOption {
type = types.bool;
default = true;
description = ''
Whether to enable startup-notification support for the command.
See {option}`--no-startup-id` option description in the i3 user guide.
'';
};
workspace = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
Launch application on a particular workspace. DEPRECATED:
Use [](#opt-xsession.windowManager.i3.config.assigns)
instead. See <https://github.com/nix-community/home-manager/issues/265>.
'';
};
};
};
barModule = types.submodule {

View file

@ -718,7 +718,8 @@ in
BindsTo = [ "graphical-session.target" ];
Wants = [
"graphical-session-pre.target"
] ++ optional cfg.systemd.xdgAutostart "xdg-desktop-autostart.target";
]
++ optional cfg.systemd.xdgAutostart "xdg-desktop-autostart.target";
After = [ "graphical-session-pre.target" ];
Before = optional cfg.systemd.xdgAutostart "xdg-desktop-autostart.target";
};

View file

@ -201,8 +201,7 @@ in
];
home.packages =
lib.optional (cfg.package != null) cfg.package
++ lib.optional cfg.xwayland.enable pkgs.xwayland;
lib.optional (cfg.package != null) cfg.package ++ lib.optional cfg.xwayland.enable pkgs.xwayland;
# Configuration file ~/.config/river/init
xdg.configFile."river/init".source = pkgs.writeShellScript "init" (

View file

@ -167,7 +167,8 @@ in
Service = {
Type = if cfg.once then "oneshot" else "simple";
ExecStart = "${script}";
} // lib.optionalAttrs (!cfg.once) { Restart = "always"; };
}
// lib.optionalAttrs (!cfg.once) { Restart = "always"; };
Install.WantedBy = [ "graphical-session.target" ];
};
};

View file

@ -31,7 +31,8 @@ let
osConfig = config;
osClass = _class;
modulesPath = builtins.toString ../modules;
} // cfg.extraSpecialArgs;
}
// cfg.extraSpecialArgs;
modules = [
(
{ name, ... }:
@ -62,7 +63,8 @@ let
};
}
)
] ++ cfg.sharedModules;
]
++ cfg.sharedModules;
};
in

View file

@ -13,13 +13,11 @@ let
dynDir = testDir.overrideAttrs (
final: prev: {
buildCommand =
prev.buildCommand
+ ''
echo more secret data > $out/top-secret
echo shhhh > $out/top-secret-v2
echo this isnt secret > $out/metadata
'';
buildCommand = prev.buildCommand + ''
echo more secret data > $out/top-secret
echo shhhh > $out/top-secret-v2
echo this isnt secret > $out/metadata
'';
}
);
in

View file

@ -3,47 +3,46 @@
{
config = {
programs.htop.enable = true;
programs.htop.settings =
{
color_scheme = 6;
cpu_count_from_one = 0;
delay = 15;
fields = with config.lib.htop.fields; [
PID
USER
PRIORITY
NICE
M_SIZE
M_RESIDENT
M_SHARE
STATE
PERCENT_CPU
PERCENT_MEM
TIME
COMM
];
highlight_base_name = 1;
highlight_megabytes = 1;
highlight_threads = 1;
}
// (
with config.lib.htop;
leftMeters [
(bar "AllCPUs2")
(bar "Memory")
(bar "Swap")
(text "Zram")
]
)
// (
with config.lib.htop;
rightMeters [
(text "Tasks")
(text "LoadAverage")
(text "Uptime")
(text "Systemd")
]
);
programs.htop.settings = {
color_scheme = 6;
cpu_count_from_one = 0;
delay = 15;
fields = with config.lib.htop.fields; [
PID
USER
PRIORITY
NICE
M_SIZE
M_RESIDENT
M_SHARE
STATE
PERCENT_CPU
PERCENT_MEM
TIME
COMM
];
highlight_base_name = 1;
highlight_megabytes = 1;
highlight_threads = 1;
}
// (
with config.lib.htop;
leftMeters [
(bar "AllCPUs2")
(bar "Memory")
(bar "Swap")
(text "Zram")
]
)
// (
with config.lib.htop;
rightMeters [
(text "Tasks")
(text "LoadAverage")
(text "Uptime")
(text "Systemd")
]
);
nmt.script = ''
htoprc=home-files/.config/htop/htoprc

View file

@ -35,17 +35,16 @@
};
};
nmt.script =
''
assertFileExists home-files/.config/kitty/kitty.conf
assertFileContent \
home-files/.config/kitty/kitty.conf \
${./example-settings-expected.conf}
''
+ lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
assertFileContent \
home-files/.config/kitty/macos-launch-services-cmdline \
${./example-macos-launch-services-cmdline}
'';
nmt.script = ''
assertFileExists home-files/.config/kitty/kitty.conf
assertFileContent \
home-files/.config/kitty/kitty.conf \
${./example-settings-expected.conf}
''
+ lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
assertFileContent \
home-files/.config/kitty/macos-launch-services-cmdline \
${./example-macos-launch-services-cmdline}
'';
};
}

View file

@ -42,7 +42,8 @@ espansoExtraArgs: {
];
};
};
} // espansoExtraArgs;
}
// espansoExtraArgs;
nmt.script = ''
serviceFile=home-files/.config/systemd/user/espanso.service