aboutsummaryrefslogtreecommitdiff
path: root/home-manager/modules/programs
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/modules/programs')
-rw-r--r--home-manager/modules/programs/alacritty.nix11
-rw-r--r--home-manager/modules/programs/alot-accounts.nix25
-rw-r--r--home-manager/modules/programs/astroid-accounts.nix7
-rw-r--r--home-manager/modules/programs/astroid.nix90
-rw-r--r--home-manager/modules/programs/autorandr.nix206
-rw-r--r--home-manager/modules/programs/bat.nix13
-rw-r--r--home-manager/modules/programs/beets.nix30
-rw-r--r--home-manager/modules/programs/broot.nix97
-rw-r--r--home-manager/modules/programs/browserpass.nix94
-rw-r--r--home-manager/modules/programs/chromium.nix103
-rw-r--r--home-manager/modules/programs/command-not-found/command-not-found.nix14
-rw-r--r--home-manager/modules/programs/direnv.nix50
-rw-r--r--home-manager/modules/programs/eclipse.nix14
-rw-r--r--home-manager/modules/programs/emacs.nix10
-rw-r--r--home-manager/modules/programs/feh.nix55
-rw-r--r--home-manager/modules/programs/firefox.nix39
-rw-r--r--home-manager/modules/programs/fzf.nix38
-rw-r--r--home-manager/modules/programs/getmail-accounts.nix4
-rw-r--r--home-manager/modules/programs/getmail.nix59
-rw-r--r--home-manager/modules/programs/git.nix250
-rw-r--r--home-manager/modules/programs/gnome-terminal.nix352
-rw-r--r--home-manager/modules/programs/go.nix48
-rw-r--r--home-manager/modules/programs/home-manager.nix11
-rw-r--r--home-manager/modules/programs/htop.nix79
-rw-r--r--home-manager/modules/programs/info.nix33
-rw-r--r--home-manager/modules/programs/jq.nix26
-rw-r--r--home-manager/modules/programs/kakoune.nix150
-rw-r--r--home-manager/modules/programs/keychain.nix51
-rw-r--r--home-manager/modules/programs/lsd.nix8
-rw-r--r--home-manager/modules/programs/matplotlib.nix25
-rw-r--r--home-manager/modules/programs/mbsync-accounts.nix12
-rw-r--r--home-manager/modules/programs/mbsync.nix198
-rw-r--r--home-manager/modules/programs/mercurial.nix68
-rw-r--r--home-manager/modules/programs/mpv.nix59
-rw-r--r--home-manager/modules/programs/msmtp-accounts.nix3
-rw-r--r--home-manager/modules/programs/msmtp.nix54
-rw-r--r--home-manager/modules/programs/neomutt-accounts.nix34
-rw-r--r--home-manager/modules/programs/neomutt.nix302
-rw-r--r--home-manager/modules/programs/neovim.nix9
-rw-r--r--home-manager/modules/programs/newsboat.nix56
-rw-r--r--home-manager/modules/programs/noti.nix13
-rw-r--r--home-manager/modules/programs/notmuch-accounts.nix4
-rw-r--r--home-manager/modules/programs/notmuch.nix140
-rw-r--r--home-manager/modules/programs/obs-studio.nix36
-rw-r--r--home-manager/modules/programs/offlineimap-accounts.nix18
-rw-r--r--home-manager/modules/programs/offlineimap.nix162
-rw-r--r--home-manager/modules/programs/opam.nix4
-rw-r--r--home-manager/modules/programs/password-store.nix62
-rw-r--r--home-manager/modules/programs/pazi.nix55
-rw-r--r--home-manager/modules/programs/pidgin.nix6
-rw-r--r--home-manager/modules/programs/readline.nix77
-rw-r--r--home-manager/modules/programs/rofi.nix120
-rw-r--r--home-manager/modules/programs/rtorrent.nix9
-rw-r--r--home-manager/modules/programs/skim.nix36
-rw-r--r--home-manager/modules/programs/ssh.nix12
-rw-r--r--home-manager/modules/programs/starship.nix45
-rw-r--r--home-manager/modules/programs/taskwarrior.nix36
-rw-r--r--home-manager/modules/programs/termite.nix157
-rw-r--r--home-manager/modules/programs/texlive.nix16
-rw-r--r--home-manager/modules/programs/urxvt.nix36
-rw-r--r--home-manager/modules/programs/vim.nix154
-rw-r--r--home-manager/modules/programs/vscode.nix30
-rw-r--r--home-manager/modules/programs/vscode/haskell.nix14
-rw-r--r--home-manager/modules/programs/z-lua.nix28
-rw-r--r--home-manager/modules/programs/zathura.nix27
-rw-r--r--home-manager/modules/programs/zsh.nix31
66 files changed, 2299 insertions, 1816 deletions
diff --git a/home-manager/modules/programs/alacritty.nix b/home-manager/modules/programs/alacritty.nix
index 84675cb1c8a..69b9ea9673d 100644
--- a/home-manager/modules/programs/alacritty.nix
+++ b/home-manager/modules/programs/alacritty.nix
@@ -6,16 +6,14 @@ let
cfg = config.programs.alacritty;
-in
-
-{
+in {
options = {
programs.alacritty = {
enable = mkEnableOption "Alacritty";
settings = mkOption {
type = types.attrs;
- default = {};
+ default = { };
example = literalExample ''
{
window.dimensions = {
@@ -45,8 +43,9 @@ in
(mkIf cfg.enable {
home.packages = [ pkgs.alacritty ];
- xdg.configFile."alacritty/alacritty.yml" = mkIf (cfg.settings != {}) {
- text = replaceStrings ["\\\\"] ["\\"] (builtins.toJSON cfg.settings);
+ xdg.configFile."alacritty/alacritty.yml" = mkIf (cfg.settings != { }) {
+ text =
+ replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.settings);
};
})
];
diff --git a/home-manager/modules/programs/alot-accounts.nix b/home-manager/modules/programs/alot-accounts.nix
index 8f3ffdfb31e..89ae28f9c8e 100644
--- a/home-manager/modules/programs/alot-accounts.nix
+++ b/home-manager/modules/programs/alot-accounts.nix
@@ -18,12 +18,10 @@ with lib;
type = types.attrsOf types.str;
default = {
type = "shellcommand";
- command = "'${pkgs.notmuch}/bin/notmuch address --format=json --output=recipients date:6M..'";
- regexp =
- "'\\[?{"
- + ''"name": "(?P<name>.*)", ''
- + ''"address": "(?P<email>.+)", ''
- + ''"name-addr": ".*"''
+ command =
+ "'${pkgs.notmuch}/bin/notmuch address --format=json --output=recipients date:6M..'";
+ regexp = "'\\[?{" + ''
+ "name": "(?P<name>.*)", "address": "(?P<email>.+)", "name-addr": ".*"''
+ "}[,\\]]?'";
shellcommand_external_filtering = "False";
};
@@ -36,9 +34,9 @@ with lib;
}
'';
description = ''
- Contact completion configuration as expected per alot.
- See <link xlink:href="http://alot.readthedocs.io/en/latest/configuration/contacts_completion.html">alot's wiki</link> for
- explanation about possible values.
+ Contact completion configuration as expected per alot.
+ See <link xlink:href="http://alot.readthedocs.io/en/latest/configuration/contacts_completion.html">alot's wiki</link> for
+ explanation about possible values.
'';
};
@@ -52,10 +50,9 @@ with lib;
};
config = mkIf config.notmuch.enable {
- alot.sendMailCommand = mkOptionDefault (
- if config.msmtp.enable
- then "msmtpq --read-envelope-from --read-recipients"
- else null
- );
+ alot.sendMailCommand = mkOptionDefault (if config.msmtp.enable then
+ "msmtpq --read-envelope-from --read-recipients"
+ else
+ null);
};
}
diff --git a/home-manager/modules/programs/astroid-accounts.nix b/home-manager/modules/programs/astroid-accounts.nix
index bc94a301db0..17544ff7899 100644
--- a/home-manager/modules/programs/astroid-accounts.nix
+++ b/home-manager/modules/programs/astroid-accounts.nix
@@ -17,7 +17,7 @@ with lib;
extraConfig = mkOption {
type = types.attrs;
- default = {};
+ default = { };
example = { select_query = ""; };
description = ''
Extra settings to add to this astroid account configuration.
@@ -26,8 +26,7 @@ with lib;
};
config = mkIf config.notmuch.enable {
- astroid.sendMailCommand = mkIf config.msmtp.enable (
- mkOptionDefault "msmtpq --read-envelope-from --read-recipients"
- );
+ astroid.sendMailCommand = mkIf config.msmtp.enable
+ (mkOptionDefault "msmtpq --read-envelope-from --read-recipients");
};
}
diff --git a/home-manager/modules/programs/astroid.nix b/home-manager/modules/programs/astroid.nix
index 0463cd15528..8b3762fac0b 100644
--- a/home-manager/modules/programs/astroid.nix
+++ b/home-manager/modules/programs/astroid.nix
@@ -8,35 +8,32 @@ let
cfg = config.programs.astroid;
astroidAccounts =
- filterAttrs
- (n: v: v.astroid.enable)
- config.accounts.email.accounts;
+ filterAttrs (n: v: v.astroid.enable) config.accounts.email.accounts;
boolOpt = b: if b then "true" else "false";
- accountAttr = account: with account; {
- email = address;
- name = realName;
- sendmail = astroid.sendMailCommand;
- additional_sent_tags = "";
- default = boolOpt primary;
- save_drafts_to = folders.drafts;
- save_sent = "true";
- save_sent_to = folders.sent;
- select_query = "";
- }
- // optionalAttrs (signature.showSignature != "none") {
- signature_attach = boolOpt (signature.showSignature == "attach");
- signature_default_on = boolOpt (signature.showSignature != "none");
- signature_file = pkgs.writeText "signature.txt" signature.text;
- signature_file_markdown = "false";
- signature_separate = "true"; # prepends '--\n' to the signature
- }
- // optionalAttrs (gpg != null) {
- always_gpg_sign = boolOpt gpg.signByDefault;
- gpgkey = gpg.key;
- }
- // astroid.extraConfig;
+ accountAttr = account:
+ with account;
+ {
+ email = address;
+ name = realName;
+ sendmail = astroid.sendMailCommand;
+ additional_sent_tags = "";
+ default = boolOpt primary;
+ save_drafts_to = "${maildir.absPath}/${folders.drafts}";
+ save_sent = "true";
+ save_sent_to = "${maildir.absPath}/${folders.sent}";
+ select_query = "";
+ } // optionalAttrs (signature.showSignature != "none") {
+ signature_attach = boolOpt (signature.showSignature == "attach");
+ signature_default_on = boolOpt (signature.showSignature != "none");
+ signature_file = pkgs.writeText "signature.txt" signature.text;
+ signature_file_markdown = "false";
+ signature_separate = "true"; # prepends '--\n' to the signature
+ } // optionalAttrs (gpg != null) {
+ always_gpg_sign = boolOpt gpg.signByDefault;
+ gpgkey = gpg.key;
+ } // astroid.extraConfig;
# See https://github.com/astroidmail/astroid/wiki/Configuration-Reference
configFile = mailAccounts:
@@ -51,12 +48,9 @@ let
cfg.extraConfig
cfg.externalEditor
];
- in
- builtins.toJSON astroidConfig;
+ in builtins.toJSON astroidConfig;
-in
-
-{
+in {
options = {
programs.astroid = {
enable = mkEnableOption "Astroid";
@@ -81,7 +75,8 @@ in
"cmd" = cmd;
};
};
- example = "nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1";
+ example =
+ "nvim-qt -- -c 'set ft=mail' '+set fileencoding=utf-8' '+set ff=unix' '+set enc=utf-8' '+set fo+=w' %1";
description = ''
You can use <code>%1</code>, <code>%2</code>, and
<code>%3</code> to refer respectively to:
@@ -96,7 +91,7 @@ in
extraConfig = mkOption {
type = types.attrs;
- default = {};
+ default = { };
example = { poll.interval = 0; };
description = ''
JSON config that will override the default Astroid configuration.
@@ -106,26 +101,15 @@ in
};
config = mkIf cfg.enable {
- assertions = [
- {
- assertion = config.programs.notmuch.maildir.synchronizeFlags;
- message = "The astroid module requires"
- + " 'programs.notmuch.maildir.synchronizeFlags = true'.";
- }
- ];
-
- home.packages = [ pkgs.astroid ];
-
- xdg.configFile."astroid/config".source =
- pkgs.runCommand "out.json"
- {
- json = configFile astroidAccounts;
- preferLocalBuild = true;
- allowSubstitutes = false;
- }
- ''
- echo -n "$json" | ${pkgs.jq}/bin/jq . > $out
- '';
+ home.packages = [ pkgs.astroid ];
+
+ xdg.configFile."astroid/config".source = pkgs.runCommand "out.json" {
+ json = configFile astroidAccounts;
+ preferLocalBuild = true;
+ allowSubstitutes = false;
+ } ''
+ echo -n "$json" | ${pkgs.jq}/bin/jq . > $out
+ '';
xdg.configFile."astroid/poll.sh" = {
executable = true;
diff --git a/home-manager/modules/programs/autorandr.nix b/home-manager/modules/programs/autorandr.nix
index 4514a5b5d58..02fc77c1e58 100644
--- a/home-manager/modules/programs/autorandr.nix
+++ b/home-manager/modules/programs/autorandr.nix
@@ -6,20 +6,21 @@ let
cfg = config.programs.autorandr;
- matrixOf = n: m: elemType: mkOptionType rec {
- name = "matrixOf";
- description = "${toString n}×${toString m} matrix of ${elemType.description}s";
- check = xss:
- let
- listOfSize = l: xs: isList xs && length xs == l;
- in
- listOfSize n xss && all (xs: listOfSize m xs && all elemType.check xs) xss;
- merge = mergeOneOption;
- getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*" "*"]);
- getSubModules = elemType.getSubModules;
- substSubModules = mod: matrixOf n m (elemType.substSubModules mod);
- functor = (defaultFunctor name) // { wrapped = elemType; };
- };
+ matrixOf = n: m: elemType:
+ mkOptionType rec {
+ name = "matrixOf";
+ description =
+ "${toString n}×${toString m} matrix of ${elemType.description}s";
+ check = xss:
+ let listOfSize = l: xs: isList xs && length xs == l;
+ in listOfSize n xss
+ && all (xs: listOfSize m xs && all elemType.check xs) xss;
+ merge = mergeOneOption;
+ getSubOptions = prefix: elemType.getSubOptions (prefix ++ [ "*" "*" ]);
+ getSubModules = elemType.getSubModules;
+ substSubModules = mod: matrixOf n m (elemType.substSubModules mod);
+ functor = (defaultFunctor name) // { wrapped = elemType; };
+ };
profileModule = types.submodule {
options = {
@@ -29,19 +30,19 @@ let
Output name to EDID mapping.
Use <code>autorandr --fingerprint</code> to get current setup values.
'';
- default = {};
+ default = { };
};
config = mkOption {
type = types.attrsOf configModule;
description = "Per output profile configuration.";
- default = {};
+ default = { };
};
hooks = mkOption {
type = profileHooksModule;
description = "Profile hook scripts.";
- default = {};
+ default = { };
};
};
};
@@ -89,7 +90,7 @@ let
};
rotate = mkOption {
- type = types.nullOr (types.enum ["normal" "left" "right" "inverted"]);
+ type = types.nullOr (types.enum [ "normal" "left" "right" "inverted" ]);
description = "Output rotate configuration.";
default = null;
example = "left";
@@ -126,7 +127,7 @@ let
type = types.nullOr (types.submodule {
options = {
method = mkOption {
- type = types.enum ["factor" "pixel" ];
+ type = types.enum [ "factor" "pixel" ];
description = "Output scaling method.";
default = "factor";
example = "pixel";
@@ -178,19 +179,21 @@ let
postswitch = mkOption {
type = types.attrsOf hookType;
description = "Postswitch hook executed after mode switch.";
- default = {};
+ default = { };
};
preswitch = mkOption {
type = types.attrsOf hookType;
description = "Preswitch hook executed before mode switch.";
- default = {};
+ default = { };
};
predetect = mkOption {
type = types.attrsOf hookType;
- description = "Predetect hook executed before autorandr attempts to run xrandr.";
- default = {};
+ description = ''
+ Predetect hook executed before autorandr attempts to run xrandr.
+ '';
+ default = { };
};
};
};
@@ -211,50 +214,56 @@ let
predetect = mkOption {
type = hookType;
- description = "Predetect hook executed before autorandr attempts to run xrandr.";
+ description = ''
+ Predetect hook executed before autorandr attempts to run xrandr.
+ '';
default = "";
};
};
};
hookToFile = folder: name: hook:
- nameValuePair
- "autorandr/${folder}/${name}"
- { source = "${pkgs.writeShellScriptBin "hook" hook}/bin/hook"; };
- profileToFiles = name: profile: with profile; mkMerge ([
- {
- "autorandr/${name}/setup".text = concatStringsSep "\n" (mapAttrsToList fingerprintToString fingerprint);
- "autorandr/${name}/config".text = concatStringsSep "\n" (mapAttrsToList configToString profile.config);
- }
- (mkIf (hooks.postswitch != "") (listToAttrs [ (hookToFile name "postswitch" hooks.postswitch) ]))
- (mkIf (hooks.preswitch != "") (listToAttrs [ (hookToFile name "preswitch" hooks.preswitch) ]))
- (mkIf (hooks.predetect != "") (listToAttrs [ (hookToFile name "predetect" hooks.predetect) ]))
- ]);
+ nameValuePair "autorandr/${folder}/${name}" {
+ source = "${pkgs.writeShellScriptBin "hook" hook}/bin/hook";
+ };
+ profileToFiles = name: profile:
+ with profile;
+ mkMerge ([
+ {
+ "autorandr/${name}/setup".text = concatStringsSep "\n"
+ (mapAttrsToList fingerprintToString fingerprint);
+ "autorandr/${name}/config".text =
+ concatStringsSep "\n" (mapAttrsToList configToString profile.config);
+ }
+ (mkIf (hooks.postswitch != "")
+ (listToAttrs [ (hookToFile name "postswitch" hooks.postswitch) ]))
+ (mkIf (hooks.preswitch != "")
+ (listToAttrs [ (hookToFile name "preswitch" hooks.preswitch) ]))
+ (mkIf (hooks.predetect != "")
+ (listToAttrs [ (hookToFile name "predetect" hooks.predetect) ]))
+ ]);
fingerprintToString = name: edid: "${name} ${edid}";
- configToString = name: config: if config.enable then ''
- output ${name}
- ${optionalString (config.position != "") "pos ${config.position}"}
- ${optionalString config.primary "primary"}
- ${optionalString (config.dpi != null) "dpi ${toString config.dpi}"}
- ${optionalString (config.gamma != "") "gamma ${config.gamma}"}
- ${optionalString (config.mode != "") "mode ${config.mode}"}
- ${optionalString (config.rate != "") "rate ${config.rate}"}
- ${optionalString (config.rotate != null) "rotate ${config.rotate}"}
- ${optionalString (config.scale != null) (
- (if config.scale.method == "factor" then "scale" else "scale-from")
- + " ${toString config.scale.x}x${toString config.scale.y}"
- )}
- ${optionalString (config.transform != null) (
- "transform " + concatMapStringsSep "," toString (flatten config.transform)
- )}
- '' else ''
- output ${name}
- off
- '';
-
-in
-
-{
+ configToString = name: config:
+ if config.enable then ''
+ output ${name}
+ ${optionalString (config.position != "") "pos ${config.position}"}
+ ${optionalString config.primary "primary"}
+ ${optionalString (config.dpi != null) "dpi ${toString config.dpi}"}
+ ${optionalString (config.gamma != "") "gamma ${config.gamma}"}
+ ${optionalString (config.mode != "") "mode ${config.mode}"}
+ ${optionalString (config.rate != "") "rate ${config.rate}"}
+ ${optionalString (config.rotate != null) "rotate ${config.rotate}"}
+ ${optionalString (config.scale != null)
+ ((if config.scale.method == "factor" then "scale" else "scale-from")
+ + " ${toString config.scale.x}x${toString config.scale.y}")}
+ ${optionalString (config.transform != null) ("transform "
+ + concatMapStringsSep "," toString (flatten config.transform))}
+ '' else ''
+ output ${name}
+ off
+ '';
+
+in {
options = {
programs.autorandr = {
enable = mkEnableOption "Autorandr";
@@ -262,39 +271,39 @@ in
hooks = mkOption {
type = globalHooksModule;
description = "Global hook scripts";
- default = {};
+ default = { };
example = literalExample ''
- {
- postswitch = {
- "notify-i3" = "''${pkgs.i3}/bin/i3-msg restart";
- "change-background" = readFile ./change-background.sh;
- "change-dpi" = '''
- case "$AUTORANDR_CURRENT_PROFILE" in
- default)
- DPI=120
- ;;
- home)
- DPI=192
- ;;
- work)
- DPI=144
- ;;
- *)
- echo "Unknown profle: $AUTORANDR_CURRENT_PROFILE"
- exit 1
- esac
-
- echo "Xft.dpi: $DPI" | ''${pkgs.xorg.xrdb}/bin/xrdb -merge
- '''
- };
- }
+ {
+ postswitch = {
+ "notify-i3" = "''${pkgs.i3}/bin/i3-msg restart";
+ "change-background" = readFile ./change-background.sh;
+ "change-dpi" = '''
+ case "$AUTORANDR_CURRENT_PROFILE" in
+ default)
+ DPI=120
+ ;;
+ home)
+ DPI=192
+ ;;
+ work)
+ DPI=144
+ ;;
+ *)
+ echo "Unknown profle: $AUTORANDR_CURRENT_PROFILE"
+ exit 1
+ esac
+
+ echo "Xft.dpi: $DPI" | ''${pkgs.xorg.xrdb}/bin/xrdb -merge
+ '''
+ };
+ }
'';
};
profiles = mkOption {
type = types.attrsOf profileModule;
description = "Autorandr profiles specification.";
- default = {};
+ default = { };
example = literalExample ''
{
"work" = {
@@ -323,24 +332,21 @@ in
};
config = mkIf cfg.enable {
- assertions = flatten (mapAttrsToList (
- profile: { config, ... }: mapAttrsToList (
- output: opts: {
- assertion = opts.scale == null || opts.transform == null;
- message = ''
- Cannot use the profile output options 'scale' and 'transform' simultaneously.
- Check configuration for: programs.autorandr.profiles.${profile}.config.${output}
- '';
- })
- config
- )
- cfg.profiles);
+ assertions = flatten (mapAttrsToList (profile:
+ { config, ... }:
+ mapAttrsToList (output: opts: {
+ assertion = opts.scale == null || opts.transform == null;
+ message = ''
+ Cannot use the profile output options 'scale' and 'transform' simultaneously.
+ Check configuration for: programs.autorandr.profiles.${profile}.config.${output}
+ '';
+ }) config) cfg.profiles);
home.packages = [ pkgs.autorandr ];
xdg.configFile = mkMerge ([
(mapAttrs' (hookToFile "postswitch.d") cfg.hooks.postswitch)
- (mapAttrs' (hookToFile "preswitch.d") cfg.hooks.preswitch)
- (mapAttrs' (hookToFile "predetect.d") cfg.hooks.predetect)
+ (mapAttrs' (hookToFile "preswitch.d") cfg.hooks.preswitch)
+ (mapAttrs' (hookToFile "predetect.d") cfg.hooks.predetect)
(mkMerge (mapAttrsToList profileToFiles cfg.profiles))
]);
};
diff --git a/home-manager/modules/programs/bat.nix b/home-manager/modules/programs/bat.nix
index 860c5e82f54..aa0df9abd45 100644
--- a/home-manager/modules/programs/bat.nix
+++ b/home-manager/modules/programs/bat.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.bat;
-in
-
-{
+in {
meta.maintainers = [ maintainers.marsam ];
options.programs.bat = {
@@ -16,7 +14,7 @@ in
config = mkOption {
type = types.attrsOf types.str;
- default = {};
+ default = { };
example = {
theme = "TwoDark";
pager = "less -FR";
@@ -31,10 +29,9 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.bat ];
- xdg.configFile."bat/config" = mkIf (cfg.config != {}) {
- text = concatStringsSep "\n" (
- mapAttrsToList (n: v: ''--${n}="${v}"'') cfg.config
- );
+ xdg.configFile."bat/config" = mkIf (cfg.config != { }) {
+ text = concatStringsSep "\n"
+ (mapAttrsToList (n: v: ''--${n}="${v}"'') cfg.config);
};
};
}
diff --git a/home-manager/modules/programs/beets.nix b/home-manager/modules/programs/beets.nix
index 152bfd304a4..1a45bbea1c7 100644
--- a/home-manager/modules/programs/beets.nix
+++ b/home-manager/modules/programs/beets.nix
@@ -6,19 +6,17 @@ let
cfg = config.programs.beets;
-in
-
-{
+in {
meta.maintainers = [ maintainers.rycee ];
options = {
programs.beets = {
enable = mkOption {
type = types.bool;
- default =
- if versionAtLeast config.home.stateVersion "19.03"
- then false
- else cfg.settings != {};
+ default = if versionAtLeast config.home.stateVersion "19.03" then
+ false
+ else
+ cfg.settings != { };
defaultText = "false";
description = ''
Whether to enable the beets music library manager. This
@@ -28,9 +26,21 @@ in
'';
};
+ package = mkOption {
+ type = types.package;
+ default = pkgs.beets;
+ defaultText = literalExample "pkgs.beets";
+ example =
+ literalExample "(pkgs.beets.override { enableCheck = true; })";
+ description = ''
+ The <literal>beets</literal> package to use.
+ Can be used to specify extensions.
+ '';
+ };
+
settings = mkOption {
type = types.attrs;
- default = {};
+ default = { };
description = ''
Configuration written to
<filename>~/.config/beets/config.yaml</filename>
@@ -40,9 +50,9 @@ in
};
config = mkIf cfg.enable {
- home.packages = [ pkgs.beets ];
+ home.packages = [ cfg.package ];
xdg.configFile."beets/config.yaml".text =
- builtins.toJSON config.programs.beets.settings;
+ builtins.toJSON config.programs.beets.settings;
};
}
diff --git a/home-manager/modules/programs/broot.nix b/home-manager/modules/programs/broot.nix
index f6d3cd7f920..eac31b56801 100644
--- a/home-manager/modules/programs/broot.nix
+++ b/home-manager/modules/programs/broot.nix
@@ -7,29 +7,23 @@ let
cfg = config.programs.broot;
configFile = config:
- pkgs.runCommand "conf.toml"
- {
- buildInputs = [ pkgs.remarshal ];
- preferLocalBuild = true;
- allowSubstitutes = false;
- }
- ''
- remarshal -if json -of toml \
- < ${pkgs.writeText "verbs.json" (builtins.toJSON config)} \
- > $out
- '';
+ pkgs.runCommand "conf.toml" {
+ buildInputs = [ pkgs.remarshal ];
+ preferLocalBuild = true;
+ allowSubstitutes = false;
+ } ''
+ remarshal -if json -of toml \
+ < ${pkgs.writeText "verbs.json" (builtins.toJSON config)} \
+ > $out
+ '';
brootConf = {
verbs =
- mapAttrsToList
- (name: value: value // { invocation = name; })
- cfg.verbs;
+ mapAttrsToList (name: value: value // { invocation = name; }) cfg.verbs;
skin = cfg.skin;
};
-in
-
-{
+in {
meta.maintainers = [ maintainers.aheaume ];
options.programs.broot = {
@@ -63,7 +57,10 @@ in
type = with types; attrsOf (attrsOf (either bool str));
default = {
"p" = { execution = ":parent"; };
- "edit" = { shortcut = "e"; execution = "$EDITOR {file}" ; };
+ "edit" = {
+ shortcut = "e";
+ execution = "$EDITOR {file}";
+ };
"create {subpath}" = { execution = "$EDITOR {directory}/{subpath}"; };
"view" = { execution = "less {file}"; };
};
@@ -114,7 +111,7 @@ in
skin = mkOption {
type = types.attrsOf types.str;
- default = {};
+ default = { };
example = literalExample ''
{
status_normal_fg = "grayscale(18)";
@@ -177,38 +174,36 @@ in
# Dummy file to prevent broot from trying to reinstall itself
xdg.configFile."broot/launcher/installed".text = "";
- programs.bash.initExtra =
- mkIf cfg.enableBashIntegration (
- # Using mkAfter to make it more likely to appear after other
- # manipulations of the prompt.
- mkAfter ''
- # This script was automatically generated by the broot function
- # More information can be found in https://github.com/Canop/broot
- # This function starts broot and executes the command
- # it produces, if any.
- # It's needed because some shell commands, like `cd`,
- # have no useful effect if executed in a subshell.
- function br {
- f=$(mktemp)
- (
- set +e
- broot --outcmd "$f" "$@"
- code=$?
- if [ "$code" != 0 ]; then
- rm -f "$f"
- exit "$code"
- fi
- )
- code=$?
- if [ "$code" != 0 ]; then
- return "$code"
- fi
- d=$(cat "$f")
- rm -f "$f"
- eval "$d"
- }
- ''
- );
+ programs.bash.initExtra = mkIf cfg.enableBashIntegration (
+ # Using mkAfter to make it more likely to appear after other
+ # manipulations of the prompt.
+ mkAfter ''
+ # This script was automatically generated by the broot function
+ # More information can be found in https://github.com/Canop/broot
+ # This function starts broot and executes the command
+ # it produces, if any.
+ # It's needed because some shell commands, like `cd`,
+ # have no useful effect if executed in a subshell.
+ function br {
+ f=$(mktemp)
+ (
+ set +e
+ broot --outcmd "$f" "$@"
+ code=$?
+ if [ "$code" != 0 ]; then
+ rm -f "$f"
+ exit "$code"
+ fi
+ )
+ code=$?
+ if [ "$code" != 0 ]; then
+ return "$code"
+ fi
+ d=$(cat "$f")
+ rm -f "$f"
+ eval "$d"
+ }
+ '');
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
# This script was automatically generated by the broot function
diff --git a/home-manager/modules/programs/browserpass.nix b/home-manager/modules/programs/browserpass.nix
index 7af5e8f8756..10a2883c871 100644
--- a/home-manager/modules/programs/browserpass.nix
+++ b/home-manager/modules/programs/browserpass.nix
@@ -2,13 +2,7 @@
with lib;
-let
- browsers = [
- "chrome"
- "chromium"
- "firefox"
- "vivaldi"
- ];
+let browsers = [ "chrome" "chromium" "firefox" "vivaldi" ];
in {
options = {
programs.browserpass = {
@@ -24,57 +18,59 @@ in {
};
config = mkIf config.programs.browserpass.enable {
- home.file = builtins.concatLists (with pkgs.stdenv; map (x:
+ home.file = foldl' (a: b: a // b) { } (concatMap (x:
+ with pkgs.stdenv;
if x == "chrome" then
- let dir = if isDarwin
- then "Library/Application Support/Google/Chrome/NativeMessagingHosts"
- else ".config/google-chrome/NativeMessagingHosts";
- in [
- {
- target = "${dir}/com.github.browserpass.native.json";
- source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
- }
- {
- target = "${dir}/../policies/managed/com.github.browserpass.native.json";
- source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
- }
- ]
+ let
+ dir = if isDarwin then
+ "Library/Application Support/Google/Chrome/NativeMessagingHosts"
+ else
+ ".config/google-chrome/NativeMessagingHosts";
+ in [{
+ "${dir}/com.github.browserpass.native.json".source =
+ "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
+ "${dir}/../policies/managed/com.github.browserpass.native.json".source =
+ "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
+ }]
else if x == "chromium" then
- let dir = if isDarwin
- then "Library/Application Support/Chromium/NativeMessagingHosts"
- else ".config/chromium/NativeMessagingHosts";
+ let
+ dir = if isDarwin then
+ "Library/Application Support/Chromium/NativeMessagingHosts"
+ else
+ ".config/chromium/NativeMessagingHosts";
in [
{
- target = "${dir}/com.github.browserpass.native.json";
- source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
+ "${dir}/com.github.browserpass.native.json".source =
+ "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
}
{
- target = "${dir}/../policies/managed/com.github.browserpass.native.json";
- source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
+ "${dir}/../policies/managed/com.github.browserpass.native.json".source =
+ "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
}
]
else if x == "firefox" then
- [ {
- target = (if isDarwin
- then "Library/Application Support/Mozilla/NativeMessagingHosts"
- else ".mozilla/native-messaging-hosts")
- + "/com.github.browserpass.native.json";
- source = "${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json";
- } ]
+ let
+ dir = if isDarwin then
+ "Library/Application Support/Mozilla/NativeMessagingHosts"
+ else
+ ".mozilla/native-messaging-hosts";
+ in [{
+ "${dir}/com.github.browserpass.native.json".source =
+ "${pkgs.browserpass}/lib/browserpass/hosts/firefox/com.github.browserpass.native.json";
+ }]
else if x == "vivaldi" then
- let dir = if isDarwin
- then "Library/Application Support/Vivaldi/NativeMessagingHosts"
- else ".config/vivaldi/NativeMessagingHosts";
- in [
- {
- target = "${dir}/com.github.browserpass.native.json";
- source = "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
- }
- {
- target = "${dir}/../policies/managed/com.github.browserpass.native.json";
- source = "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
- }
- ]
- else throw "unknown browser ${x}") config.programs.browserpass.browsers);
+ let
+ dir = if isDarwin then
+ "Library/Application Support/Vivaldi/NativeMessagingHosts"
+ else
+ ".config/vivaldi/NativeMessagingHosts";
+ in [{
+ "${dir}/com.github.browserpass.native.json".source =
+ "${pkgs.browserpass}/lib/browserpass/hosts/chromium/com.github.browserpass.native.json";
+ "${dir}/../policies/managed/com.github.browserpass.native.json".source =
+ "${pkgs.browserpass}/lib/browserpass/policies/chromium/com.github.browserpass.native.json";
+ }]
+ else
+ throw "unknown browser ${x}") config.programs.browserpass.browsers);
};
}
diff --git a/home-manager/modules/programs/chromium.nix b/home-manager/modules/programs/chromium.nix
index 83a827a0ed0..4e35c07b90c 100644
--- a/home-manager/modules/programs/chromium.nix
+++ b/home-manager/modules/programs/chromium.nix
@@ -5,45 +5,43 @@ with lib;
let
browserModule = defaultPkg: name: visible:
- let
- browser = (builtins.parseDrvName defaultPkg.name).name;
- in
- {
- enable = mkOption {
- inherit visible;
- default = false;
- example = true;
- description = "Whether to enable ${name}.";
- type = lib.types.bool;
- };
+ let browser = (builtins.parseDrvName defaultPkg.name).name;
+ in {
+ enable = mkOption {
+ inherit visible;
+ default = false;
+ example = true;
+ description = "Whether to enable ${name}.";
+ type = lib.types.bool;
+ };
- package = mkOption {
- inherit visible;
- type = types.package;
- default = defaultPkg;
- defaultText = literalExample "pkgs.${browser}";
- description = "The ${name} package to use.";
- };
+ package = mkOption {
+ inherit visible;
+ type = types.package;
+ default = defaultPkg;
+ defaultText = literalExample "pkgs.${browser}";
+ description = "The ${name} package to use.";
+ };
- extensions = mkOption {
- inherit visible;
- type = types.listOf types.str;
- default = [];
- example = literalExample ''
- [
- "chlffgpmiacpedhhbkiomidkjlcfhogd" # pushbullet
- "mbniclmhobmnbdlbpiphghaielnnpgdp" # lightshot
- "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere
- "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin
- ]
- '';
- description = ''
- List of ${name} extensions to install.
- To find the extension ID, check its URL on the
- <link xlink:href="https://chrome.google.com/webstore/category/extensions">Chrome Web Store</link>.
- '';
- };
+ extensions = mkOption {
+ inherit visible;
+ type = types.listOf types.str;
+ default = [ ];
+ example = literalExample ''
+ [
+ "chlffgpmiacpedhhbkiomidkjlcfhogd" # pushbullet
+ "mbniclmhobmnbdlbpiphghaielnnpgdp" # lightshot
+ "gcbommkclmclpchllfjekcdonpmejbdp" # https everywhere
+ "cjpalhdlnbpafiamejdnhcphjbkeiagm" # ublock origin
+ ]
+ '';
+ description = ''
+ List of ${name} extensions to install.
+ To find the extension ID, check its URL on the
+ <link xlink:href="https://chrome.google.com/webstore/category/extensions">Chrome Web Store</link>.
+ '';
};
+ };
browserConfig = cfg:
let
@@ -57,31 +55,32 @@ let
google-chrome-dev = "Google/Chrome Dev";
};
- configDir = if pkgs.stdenv.isDarwin
- then "Library/Application Support/${getAttr browser darwinDirs}"
- else "${config.xdg.configHome}/${browser}";
+ configDir = if pkgs.stdenv.isDarwin then
+ "Library/Application Support/${getAttr browser darwinDirs}"
+ else
+ "${config.xdg.configHome}/${browser}";
extensionJson = ext: {
- target = "${configDir}/External Extensions/${ext}.json";
- text = builtins.toJSON {
- external_update_url = "https://clients2.google.com/service/update2/crx";
+ name = "${configDir}/External Extensions/${ext}.json";
+ value.text = builtins.toJSON {
+ external_update_url =
+ "https://clients2.google.com/service/update2/crx";
};
};
- in
- mkIf cfg.enable {
- home.packages = [ cfg.package ];
- home.file = map extensionJson cfg.extensions;
- };
-
-in
+ in mkIf cfg.enable {
+ home.packages = [ cfg.package ];
+ home.file = listToAttrs (map extensionJson cfg.extensions);
+ };
-{
+in {
options.programs = {
chromium = browserModule pkgs.chromium "Chromium" true;
google-chrome = browserModule pkgs.google-chrome "Google Chrome" false;
- google-chrome-beta = browserModule pkgs.google-chrome-beta "Google Chrome Beta" false;
- google-chrome-dev = browserModule pkgs.google-chrome-dev "Google Chrome Dev" false;
+ google-chrome-beta =
+ browserModule pkgs.google-chrome-beta "Google Chrome Beta" false;
+ google-chrome-dev =
+ browserModule pkgs.google-chrome-dev "Google Chrome Dev" false;
};
config = mkMerge [
diff --git a/home-manager/modules/programs/command-not-found/command-not-found.nix b/home-manager/modules/programs/command-not-found/command-not-found.nix
index 0053fe36ad7..b79fde0f619 100644
--- a/home-manager/modules/programs/command-not-found/command-not-found.nix
+++ b/home-manager/modules/programs/command-not-found/command-not-found.nix
@@ -13,8 +13,11 @@ let
isExecutable = true;
inherit (pkgs) perl;
inherit (cfg) dbPath;
- perlFlags = concatStrings (map (path: "-I ${path}/lib/perl5/site_perl ")
- [ pkgs.perlPackages.DBI pkgs.perlPackages.DBDSQLite pkgs.perlPackages.StringShellQuote ]);
+ perlFlags = concatStrings (map (path: "-I ${path}/lib/perl5/site_perl ") [
+ pkgs.perlPackages.DBI
+ pkgs.perlPackages.DBDSQLite
+ pkgs.perlPackages.StringShellQuote
+ ]);
};
shInit = commandNotFoundHandlerName: ''
@@ -31,14 +34,13 @@ let
}
'';
-in
-
-{
+in {
options.programs.command-not-found = {
enable = mkEnableOption "command-not-found hook for interactive shell";
dbPath = mkOption {
- default = "/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite" ;
+ default =
+ "/nix/var/nix/profiles/per-user/root/channels/nixos/programs.sqlite";
description = ''
Absolute path to <filename>programs.sqlite</filename>. By
default this file will be provided by your channel
diff --git a/home-manager/modules/programs/direnv.nix b/home-manager/modules/programs/direnv.nix
index e4c17239c58..beb40a96261 100644
--- a/home-manager/modules/programs/direnv.nix
+++ b/home-manager/modules/programs/direnv.nix
@@ -6,21 +6,17 @@ let
cfg = config.programs.direnv;
configFile = config:
- pkgs.runCommand "config.toml"
- {
- buildInputs = [ pkgs.remarshal ];
- preferLocalBuild = true;
- allowSubstitutes = false;
- }
- ''
- remarshal -if json -of toml \
- < ${pkgs.writeText "config.json" (builtins.toJSON config)} \
- > $out
- '';
-
-in
+ pkgs.runCommand "config.toml" {
+ buildInputs = [ pkgs.remarshal ];
+ preferLocalBuild = true;
+ allowSubstitutes = false;
+ } ''
+ remarshal -if json -of toml \
+ < ${pkgs.writeText "config.json" (builtins.toJSON config)} \
+ > $out
+ '';
-{
+in {
meta.maintainers = [ maintainers.rycee ];
options.programs.direnv = {
@@ -28,7 +24,7 @@ in
config = mkOption {
type = types.attrs;
- default = {};
+ default = { };
description = ''
Configuration written to
<filename>~/.config/direnv/config.toml</filename>.
@@ -79,22 +75,18 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.direnv ];
- xdg.configFile."direnv/config.toml" = mkIf (cfg.config != {}) {
- source = configFile cfg.config;
- };
+ xdg.configFile."direnv/config.toml" =
+ mkIf (cfg.config != { }) { source = configFile cfg.config; };
- xdg.configFile."direnv/direnvrc" = mkIf (cfg.stdlib != "") {
- text = cfg.stdlib;
- };
+ xdg.configFile."direnv/direnvrc" =
+ mkIf (cfg.stdlib != "") { text = cfg.stdlib; };
- programs.bash.initExtra =
- mkIf cfg.enableBashIntegration (
- # Using mkAfter to make it more likely to appear after other
- # manipulations of the prompt.
- mkAfter ''
- eval "$(${pkgs.direnv}/bin/direnv hook bash)"
- ''
- );
+ programs.bash.initExtra = mkIf cfg.enableBashIntegration (
+ # Using mkAfter to make it more likely to appear after other
+ # manipulations of the prompt.
+ mkAfter ''
+ eval "$(${pkgs.direnv}/bin/direnv hook bash)"
+ '');
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
eval "$(${pkgs.direnv}/bin/direnv hook zsh)"
diff --git a/home-manager/modules/programs/eclipse.nix b/home-manager/modules/programs/eclipse.nix
index 4a432c9fe1a..8ce605b106a 100644
--- a/home-manager/modules/programs/eclipse.nix
+++ b/home-manager/modules/programs/eclipse.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.eclipse;
-in
-
-{
+in {
meta.maintainers = [ maintainers.rycee ];
options = {
@@ -27,13 +25,13 @@ in
jvmArgs = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
description = "JVM arguments to use for the Eclipse process.";
};
plugins = mkOption {
type = types.listOf types.package;
- default = [];
+ default = [ ];
description = "Plugins that should be added to Eclipse.";
};
};
@@ -43,10 +41,8 @@ in
home.packages = [
(pkgs.eclipses.eclipseWithPlugins {
eclipse = pkgs.eclipses.eclipse-platform;
- jvmArgs =
- cfg.jvmArgs
- ++ optional cfg.enableLombok
- "-javaagent:${pkgs.lombok}/share/java/lombok.jar";
+ jvmArgs = cfg.jvmArgs ++ optional cfg.enableLombok
+ "-javaagent:${pkgs.lombok}/share/java/lombok.jar";
plugins = cfg.plugins;
})
];
diff --git a/home-manager/modules/programs/emacs.nix b/home-manager/modules/programs/emacs.nix
index 78c136c9868..987a9f2431e 100644
--- a/home-manager/modules/programs/emacs.nix
+++ b/home-manager/modules/programs/emacs.nix
@@ -4,15 +4,13 @@ with lib;
let
- hmTypes = import ../lib/types.nix { inherit lib; };
-
cfg = config.programs.emacs;
# Copied from all-packages.nix, with modifications to support
# overrides.
emacsPackages =
let
- epkgs = pkgs.emacsPackagesNgGen cfg.package;
+ epkgs = pkgs.emacsPackagesGen cfg.package;
in
epkgs.overrideScope' cfg.overrides;
emacsWithPackages = emacsPackages.emacsWithPackages;
@@ -36,19 +34,19 @@ in
extraPackages = mkOption {
default = self: [];
- type = hmTypes.selectorFunction;
+ type = hm.types.selectorFunction;
defaultText = "epkgs: []";
example = literalExample "epkgs: [ epkgs.emms epkgs.magit ]";
description = ''
Extra packages available to Emacs. To get a list of
available packages run:
- <command>nix-env -f '&lt;nixpkgs&gt;' -qaP -A emacsPackagesNg</command>.
+ <command>nix-env -f '&lt;nixpkgs&gt;' -qaP -A emacsPackages</command>.
'';
};
overrides = mkOption {
default = self: super: {};
- type = hmTypes.overlayFunction;
+ type = hm.types.overlayFunction;
defaultText = "self: super: {}";
example = literalExample ''
self: super: rec {
diff --git a/home-manager/modules/programs/feh.nix b/home-manager/modules/programs/feh.nix
index 4342181fa4a..b1b33697e95 100644
--- a/home-manager/modules/programs/feh.nix
+++ b/home-manager/modules/programs/feh.nix
@@ -7,20 +7,37 @@ let
cfg = config.programs.feh;
disableBinding = func: key: func;
- enableBinding = func: key: "${func} ${key}";
+ enableBinding = func: key: "${func} ${toString key}";
-in
-
-{
+in {
options.programs.feh = {
enable = mkEnableOption "feh - a fast and light image viewer";
+ buttons = mkOption {
+ default = { };
+ type = with types; attrsOf (nullOr (either str int));
+ example = {
+ zoom_in = 4;
+ zoom_out = "C-4";
+ };
+ description = ''
+ Override feh's default mouse button mapping. If you want to disable an
+ action, set its value to null.
+ See <link xlink:href="https://man.finalrewind.org/1/feh/#x425554544f4e53"/> for
+ default bindings and available commands.
+ '';
+ };
+
keybindings = mkOption {
- default = {};
- type = types.attrsOf types.str;
- example = { zoom_in = "plus"; zoom_out = "minus"; };
+ default = { };
+ type = types.attrsOf (types.nullOr types.str);
+ example = {
+ zoom_in = "plus";
+ zoom_out = "minus";
+ };
description = ''
- Set keybindings.
+ Override feh's default keybindings. If you want to disable a keybinding
+ set its value to null.
See <link xlink:href="https://man.finalrewind.org/1/feh/#x4b455953"/> for
default bindings and available commands.
'';
@@ -28,14 +45,26 @@ in
};
config = mkIf cfg.enable {
+ assertions = [{
+ assertion = ((filterAttrs (n: v: v == "") cfg.keybindings) == { });
+ message =
+ "To disable a keybinding, use `null` instead of an empty string.";
+ }];
+
home.packages = [ pkgs.feh ];
- xdg.configFile."feh/keys".text = ''
- # Disable default keybindings
- ${concatStringsSep "\n" (mapAttrsToList disableBinding cfg.keybindings)}
+ xdg.configFile."feh/buttons".text = ''
+ ${concatStringsSep "\n" (mapAttrsToList disableBinding
+ (filterAttrs (n: v: v == null) cfg.buttons))}
+ ${concatStringsSep "\n" (mapAttrsToList enableBinding
+ (filterAttrs (n: v: v != null) cfg.buttons))}
+ '';
- # Enable new keybindings
- ${concatStringsSep "\n" (mapAttrsToList enableBinding cfg.keybindings)}
+ xdg.configFile."feh/keys".text = ''
+ ${concatStringsSep "\n" (mapAttrsToList disableBinding
+ (filterAttrs (n: v: v == null) cfg.keybindings))}
+ ${concatStringsSep "\n" (mapAttrsToList enableBinding
+ (filterAttrs (n: v: v != null) cfg.keybindings))}
'';
};
}
diff --git a/home-manager/modules/programs/firefox.nix b/home-manager/modules/programs/firefox.nix
index 708b05417d6..17c64752d66 100644
--- a/home-manager/modules/programs/firefox.nix
+++ b/home-manager/modules/programs/firefox.nix
@@ -4,15 +4,35 @@ with lib;
let
+ inherit (pkgs.stdenv.hostPlatform) isDarwin;
+
cfg = config.programs.firefox;
+ mozillaConfigPath =
+ if isDarwin
+ then "Library/Application Support/Mozilla"
+ else ".mozilla";
+
+ firefoxConfigPath =
+ if isDarwin
+ then "Library/Application Support/Firefox"
+ else "${mozillaConfigPath}/firefox";
+
+ profilesPath =
+ if isDarwin
+ then "${firefoxConfigPath}/Profiles"
+ else firefoxConfigPath;
+
extensionPath = "extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
profiles =
flip mapAttrs' cfg.profiles (_: profile:
nameValuePair "Profile${toString profile.id}" {
Name = profile.name;
- Path = profile.path;
+ Path =
+ if isDarwin
+ then "Profiles/${profile.path}"
+ else profile.path;
IsRelative = 1;
Default = if profile.isDefault then 1 else 0;
}
@@ -242,15 +262,18 @@ in
bcfg = setAttrByPath [browserName] fcfg;
package =
- if versionAtLeast config.home.stateVersion "19.09"
- then cfg.package.override { cfg = fcfg; }
- else (pkgs.wrapFirefox.override { config = bcfg; }) cfg.package { };
+ if isDarwin then
+ cfg.package
+ else if versionAtLeast config.home.stateVersion "19.09" then
+ cfg.package.override { cfg = fcfg; }
+ else
+ (pkgs.wrapFirefox.override { config = bcfg; }) cfg.package { };
in
[ package ];
home.file = mkMerge (
[{
- ".mozilla/${extensionPath}" = mkIf (cfg.extensions != []) (
+ "${mozillaConfigPath}/${extensionPath}" = mkIf (cfg.extensions != []) (
let
extensionsEnv = pkgs.buildEnv {
name = "hm-firefox-extensions";
@@ -262,17 +285,17 @@ in
}
);
- ".mozilla/firefox/profiles.ini" = mkIf (cfg.profiles != {}) {
+ "${firefoxConfigPath}/profiles.ini" = mkIf (cfg.profiles != {}) {
text = profilesIni;
};
}]
++ flip mapAttrsToList cfg.profiles (_: profile: {
- ".mozilla/firefox/${profile.path}/chrome/userChrome.css" =
+ "${profilesPath}/${profile.path}/chrome/userChrome.css" =
mkIf (profile.userChrome != "") {
text = profile.userChrome;
};
- ".mozilla/firefox/${profile.path}/user.js" =
+ "${profilesPath}/${profile.path}/user.js" =
mkIf (profile.settings != {} || profile.extraConfig != "") {
text = mkUserJs profile.settings profile.extraConfig;
};
diff --git a/home-manager/modules/programs/fzf.nix b/home-manager/modules/programs/fzf.nix
index 832c0bfa3e4..36eb3a1cdba 100644
--- a/home-manager/modules/programs/fzf.nix
+++ b/home-manager/modules/programs/fzf.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.fzf;
-in
-
-{
+in {
options.programs.fzf = {
enable = mkEnableOption "fzf - a command-line fuzzy finder";
@@ -24,7 +22,7 @@ in
defaultOptions = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "--height 40%" "--border" ];
description = ''
Extra command line options given to fzf by default.
@@ -43,7 +41,7 @@ in
fileWidgetOptions = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "--preview 'head {}'" ];
description = ''
Command line options for the CTRL-T keybinding.
@@ -53,7 +51,7 @@ in
changeDirWidgetCommand = mkOption {
type = types.nullOr types.str;
default = null;
- example = "fd --type d" ;
+ example = "fd --type d";
description = ''
The command that gets executed as the source for fzf for the
ALT-C keybinding.
@@ -62,7 +60,7 @@ in
changeDirWidgetOptions = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "--preview 'tree -C {} | head -200'" ];
description = ''
Command line options for the ALT-C keybinding.
@@ -80,7 +78,7 @@ in
historyWidgetOptions = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "--sort" "--exact" ];
description = ''
Command line options for the CTRL-R keybinding.
@@ -107,19 +105,17 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.fzf ];
- home.sessionVariables =
- mapAttrs (n: v: toString v) (
- filterAttrs (n: v: v != [] && v != null) {
- FZF_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
- FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions;
- FZF_CTRL_R_COMMAND = cfg.historyWidgetCommand;
- FZF_CTRL_R_OPTS = cfg.historyWidgetOptions;
- FZF_CTRL_T_COMMAND = cfg.fileWidgetCommand;
- FZF_CTRL_T_OPTS = cfg.fileWidgetOptions;
- FZF_DEFAULT_COMMAND = cfg.defaultCommand;
- FZF_DEFAULT_OPTS = cfg.defaultOptions;
- }
- );
+ home.sessionVariables = mapAttrs (n: v: toString v)
+ (filterAttrs (n: v: v != [ ] && v != null) {
+ FZF_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
+ FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions;
+ FZF_CTRL_R_COMMAND = cfg.historyWidgetCommand;
+ FZF_CTRL_R_OPTS = cfg.historyWidgetOptions;
+ FZF_CTRL_T_COMMAND = cfg.fileWidgetCommand;
+ FZF_CTRL_T_OPTS = cfg.fileWidgetOptions;
+ FZF_DEFAULT_COMMAND = cfg.defaultCommand;
+ FZF_DEFAULT_OPTS = cfg.defaultOptions;
+ });
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then
diff --git a/home-manager/modules/programs/getmail-accounts.nix b/home-manager/modules/programs/getmail-accounts.nix
index 32e1312dc8f..24eb4fb588a 100644
--- a/home-manager/modules/programs/getmail-accounts.nix
+++ b/home-manager/modules/programs/getmail-accounts.nix
@@ -17,8 +17,8 @@ with lib;
mailboxes = mkOption {
type = types.nonEmptyListOf types.str;
- default = [];
- example = ["INBOX" "INBOX.spam"];
+ default = [ ];
+ example = [ "INBOX" "INBOX.spam" ];
description = ''
A non-empty list of mailboxes. To download all mail you can
use the <literal>ALL</literal> mailbox.
diff --git a/home-manager/modules/programs/getmail.nix b/home-manager/modules/programs/getmail.nix
index 04a958d6cda..2c3919dcf2f 100644
--- a/home-manager/modules/programs/getmail.nix
+++ b/home-manager/modules/programs/getmail.nix
@@ -4,34 +4,33 @@ with lib;
let
- accounts = filter (a: a.getmail.enable)
- (attrValues config.accounts.email.accounts);
+ accounts =
+ filter (a: a.getmail.enable) (attrValues config.accounts.email.accounts);
- renderAccountConfig = account: with account;
+ renderAccountConfig = account:
+ with account;
let
passCmd = concatMapStringsSep ", " (x: "'${x}'") passwordCommand;
- renderedMailboxes = concatMapStringsSep ", " (x: "'${x}'") getmail.mailboxes;
- retrieverType = if imap.tls.enable
- then "SimpleIMAPSSLRetriever"
- else "SimpleIMAPRetriever";
- destination = if getmail.destinationCommand != null
- then
- {
- destinationType = "MDA_external";
- destinationPath = getmail.destinationCommand;
- }
- else
- {
- destinationType = "Maildir";
- destinationPath = "${maildir.absPath}/";
- };
+ renderedMailboxes =
+ concatMapStringsSep ", " (x: "'${x}'") getmail.mailboxes;
+ retrieverType = if imap.tls.enable then
+ "SimpleIMAPSSLRetriever"
+ else
+ "SimpleIMAPRetriever";
+ destination = if getmail.destinationCommand != null then {
+ destinationType = "MDA_external";
+ destinationPath = getmail.destinationCommand;
+ } else {
+ destinationType = "Maildir";
+ destinationPath = "${maildir.absPath}/";
+ };
renderGetmailBoolean = v: if v then "true" else "false";
in ''
# Generated by Home-Manager.
[retriever]
type = ${retrieverType}
server = ${imap.host}
- ${optionalString (imap.port != null) "port = ${imap.port}"}
+ ${optionalString (imap.port != null) "port = ${toString imap.port}"}
username = ${userName}
password_command = (${passCmd})
mailboxes = ( ${renderedMailboxes} )
@@ -46,15 +45,13 @@ let
'';
getmailEnabled = length (filter (a: a.getmail.enable) accounts) > 0;
# Watch out! This is used by the getmail.service too!
- renderConfigFilepath = a: ".getmail/getmail${if a.primary then "rc" else a.name}";
-in
-
- {
- config = mkIf getmailEnabled {
- home.file = map (a:
- { target = renderConfigFilepath a;
- text = renderAccountConfig a;
- }) accounts;
-
- };
- }
+ renderConfigFilepath = a:
+ ".getmail/getmail${if a.primary then "rc" else a.name}";
+
+in {
+ config = mkIf getmailEnabled {
+ home.file = foldl' (a: b: a // b) { }
+ (map (a: { "${renderConfigFilepath a}".text = renderAccountConfig a; })
+ accounts);
+ };
+}
diff --git a/home-manager/modules/programs/git.nix b/home-manager/modules/programs/git.nix
index 913f86f71ce..a56aa10d50e 100644
--- a/home-manager/modules/programs/git.nix
+++ b/home-manager/modules/programs/git.nix
@@ -14,36 +14,31 @@ let
section = head sections;
subsections = tail sections;
subsection = concatStringsSep "." subsections;
- in
- if containsQuote || subsections == []
- then name
- else "${section} \"${subsection}\"";
+ in if containsQuote || subsections == [ ] then
+ name
+ else
+ ''${section} "${subsection}"'';
# generation for multiple ini values
mkKeyValue = k: v:
- let
- mkKeyValue = generators.mkKeyValueDefault {} "=" k;
- in
- concatStringsSep "\n" (map mkKeyValue (toList v));
+ let mkKeyValue = generators.mkKeyValueDefault { } "=" k;
+ in concatStringsSep "\n" (map mkKeyValue (toList v));
# converts { a.b.c = 5; } to { "a.b".c = 5; } for toINI
- gitFlattenAttrs =
- let
- recurse = path: value:
- if isAttrs value then
- mapAttrsToList (name: value: recurse ([name] ++ path) value) value
- else if length path > 1 then
- { ${concatStringsSep "." (reverseList (tail path))}.${head path} = value; }
- else
- { ${head path} = value; };
- in
- attrs: foldl recursiveUpdate {} (flatten (recurse [] attrs));
+ gitFlattenAttrs = let
+ recurse = path: value:
+ if isAttrs value then
+ mapAttrsToList (name: value: recurse ([ name ] ++ path) value) value
+ else if length path > 1 then {
+ ${concatStringsSep "." (reverseList (tail path))}.${head path} = value;
+ } else {
+ ${head path} = value;
+ };
+ in attrs: foldl recursiveUpdate { } (flatten (recurse [ ] attrs));
gitToIni = attrs:
- let
- toIni = generators.toINI { inherit mkKeyValue mkSectionName; };
- in
- toIni (gitFlattenAttrs attrs);
+ let toIni = generators.toINI { inherit mkKeyValue mkSectionName; };
+ in toIni (gitFlattenAttrs attrs);
gitIniType = with types;
let
@@ -51,8 +46,7 @@ let
multipleType = either primitiveType (listOf primitiveType);
sectionType = attrsOf multipleType;
supersectionType = attrsOf (either multipleType sectionType);
- in
- attrsOf supersectionType;
+ in attrsOf supersectionType;
signModule = types.submodule {
options = {
@@ -98,21 +92,18 @@ let
contents = mkOption {
type = types.attrs;
- default = {};
+ default = { };
description = ''
Configuration to include. If empty then a path must be given.
'';
};
};
- config.path = mkIf (config.contents != {}) (
- mkDefault (pkgs.writeText "contents" (gitToIni config.contents))
- );
+ config.path = mkIf (config.contents != { })
+ (mkDefault (pkgs.writeText "contents" (gitToIni config.contents)));
});
-in
-
-{
+in {
meta.maintainers = [ maintainers.rycee ];
options = {
@@ -143,7 +134,7 @@ in
aliases = mkOption {
type = types.attrsOf types.str;
- default = {};
+ default = { };
example = { co = "checkout"; };
description = "Git aliases to define.";
};
@@ -156,7 +147,7 @@ in
extraConfig = mkOption {
type = types.either types.lines gitIniType;
- default = {};
+ default = { };
example = {
core = { whitespace = "trailing-space,space-before-tab"; };
url."ssh://git@host".insteadOf = "otherhost";
@@ -174,21 +165,21 @@ in
ignores = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "*~" "*.swp" ];
description = "List of paths that should be globally ignored.";
};
attributes = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "*.pdf diff=pdf" ];
description = "List of defining attributes set globally.";
};
includes = mkOption {
type = types.listOf includeModule;
- default = [];
+ default = [ ];
example = literalExample ''
[
{ path = "~/path/to/config.inc"; }
@@ -217,109 +208,96 @@ in
};
};
- config = mkIf cfg.enable (
- mkMerge [
- {
- home.packages = [ cfg.package ];
+ config = mkIf cfg.enable (mkMerge [
+ {
+ home.packages = [ cfg.package ];
- programs.git.iniContent.user = {
- name = mkIf (cfg.userName != null) cfg.userName;
- email = mkIf (cfg.userEmail != null) cfg.userEmail;
- };
+ programs.git.iniContent.user = {
+ name = mkIf (cfg.userName != null) cfg.userName;
+ email = mkIf (cfg.userEmail != null) cfg.userEmail;
+ };
- xdg.configFile = {
- "git/config".text = gitToIni cfg.iniContent;
+ xdg.configFile = {
+ "git/config".text = gitToIni cfg.iniContent;
- "git/ignore" = mkIf (cfg.ignores != []) {
- text = concatStringsSep "\n" cfg.ignores + "\n";
- };
+ "git/ignore" = mkIf (cfg.ignores != [ ]) {
+ text = concatStringsSep "\n" cfg.ignores + "\n";
+ };
- "git/attributes" = mkIf (cfg.attributes != []) {
- text = concatStringsSep "\n" cfg.attributes + "\n";
- };
+ "git/attributes" = mkIf (cfg.attributes != [ ]) {
+ text = concatStringsSep "\n" cfg.attributes + "\n";
};
- }
-
- {
- programs.git.iniContent =
- let
- hasSmtp = name: account: account.smtp != null;
-
- genIdentity = name: account: with account;
- nameValuePair "sendemail.${name}" ({
- smtpEncryption = if smtp.tls.enable then "tls" else "";
- smtpServer = smtp.host;
- smtpUser = userName;
- from = address;
- }
- // optionalAttrs (smtp.port != null) {
- smtpServerPort = smtp.port;
- });
- in
- mapAttrs' genIdentity
- (filterAttrs hasSmtp config.accounts.email.accounts);
- }
-
- (mkIf (cfg.signing != null) {
- programs.git.iniContent = {
- user.signingKey = cfg.signing.key;
- commit.gpgSign = cfg.signing.signByDefault;
- gpg.program = cfg.signing.gpgPath;
+ };
+ }
+
+ {
+ programs.git.iniContent = let
+ hasSmtp = name: account: account.smtp != null;
+
+ genIdentity = name: account:
+ with account;
+ nameValuePair "sendemail.${name}" ({
+ smtpEncryption = if smtp.tls.enable then "tls" else "";
+ smtpServer = smtp.host;
+ smtpUser = userName;
+ from = address;
+ } // optionalAttrs (smtp.port != null) {
+ smtpServerPort = smtp.port;
+ });
+ in mapAttrs' genIdentity
+ (filterAttrs hasSmtp config.accounts.email.accounts);
+ }
+
+ (mkIf (cfg.signing != null) {
+ programs.git.iniContent = {
+ user.signingKey = cfg.signing.key;
+ commit.gpgSign = cfg.signing.signByDefault;
+ gpg.program = cfg.signing.gpgPath;
+ };
+ })
+
+ (mkIf (cfg.aliases != { }) { programs.git.iniContent.alias = cfg.aliases; })
+
+ (mkIf (lib.isAttrs cfg.extraConfig) {
+ programs.git.iniContent = cfg.extraConfig;
+ })
+
+ (mkIf (lib.isString cfg.extraConfig) {
+ warnings = [''
+ Using programs.git.extraConfig as a string option is
+ deprecated and will be removed in the future. Please
+ change to using it as an attribute set instead.
+ ''];
+
+ xdg.configFile."git/config".text = cfg.extraConfig;
+ })
+
+ (mkIf (cfg.includes != [ ]) {
+ xdg.configFile."git/config".text = let
+ include = i:
+ with i;
+ if condition != null then {
+ includeIf.${condition}.path = "${path}";
+ } else {
+ include.path = "${path}";
+ };
+ in mkAfter
+ (concatStringsSep "\n" (map gitToIni (map include cfg.includes)));
+ })
+
+ (mkIf cfg.lfs.enable {
+ home.packages = [ pkgs.git-lfs ];
+
+ programs.git.iniContent.filter.lfs =
+ let skipArg = optional cfg.lfs.skipSmudge "--skip";
+ in {
+ clean = "git-lfs clean -- %f";
+ process =
+ concatStringsSep " " ([ "git-lfs" "filter-process" ] ++ skipArg);
+ required = true;
+ smudge = concatStringsSep " "
+ ([ "git-lfs" "smudge" ] ++ skipArg ++ [ "--" "%f" ]);
};
- })
-
- (mkIf (cfg.aliases != {}) {
- programs.git.iniContent.alias = cfg.aliases;
- })
-
- (mkIf (lib.isAttrs cfg.extraConfig) {
- programs.git.iniContent = cfg.extraConfig;
- })
-
- (mkIf (lib.isString cfg.extraConfig) {
- warnings = [
- ''
- Using programs.git.extraConfig as a string option is
- deprecated and will be removed in the future. Please
- change to using it as an attribute set instead.
- ''
- ];
-
- xdg.configFile."git/config".text = cfg.extraConfig;
- })
-
- (mkIf (cfg.includes != []) {
- xdg.configFile."git/config".text =
- let
- include = i: with i;
- if condition != null
- then { includeIf.${condition}.path = "${path}"; }
- else { include.path = "${path}"; };
- in
- mkAfter
- (concatStringsSep "\n"
- (map gitToIni
- (map include cfg.includes)));
- })
-
- (mkIf cfg.lfs.enable {
- home.packages = [ pkgs.git-lfs ];
-
- programs.git.iniContent.filter.lfs =
- let
- skipArg = optional cfg.lfs.skipSmudge "--skip";
- in
- {
- clean = "git-lfs clean -- %f";
- process = concatStringsSep " " (
- [ "git-lfs" "filter-process" ] ++ skipArg
- );
- required = true;
- smudge = concatStringsSep " " (
- [ "git-lfs" "smudge" ] ++ skipArg ++ [ "--" "%f" ]
- );
- };
- })
- ]
- );
+ })
+ ]);
}
diff --git a/home-manager/modules/programs/gnome-terminal.nix b/home-manager/modules/programs/gnome-terminal.nix
index 9a44364491d..570a1fc7df0 100644
--- a/home-manager/modules/programs/gnome-terminal.nix
+++ b/home-manager/modules/programs/gnome-terminal.nix
@@ -11,125 +11,118 @@ let
. ${pkgs.gnome3.vte}/etc/profile.d/vte.sh
'';
- backForeSubModule = types.submodule (
- { ... }: {
- options = {
- foreground = mkOption {
- type = types.str;
- description = "The foreground color.";
- };
-
- background = mkOption {
- type = types.str;
- description = "The background color.";
- };
- };
- }
- );
-
- profileColorsSubModule = types.submodule (
- { ... }: {
- options = {
- foregroundColor = mkOption {
- type = types.str;
- description = "The foreground color.";
- };
-
- backgroundColor = mkOption {
- type = types.str;
- description = "The background color.";
- };
-
- boldColor = mkOption {
- default = null;
- type = types.nullOr types.str;
- description = "The bold color, null to use same as foreground.";
- };
-
- palette = mkOption {
- type = types.listOf types.str;
- description = "The terminal palette.";
- };
-
- cursor = mkOption {
- default = null;
- type = types.nullOr backForeSubModule;
- description = "The color for the terminal cursor.";
- };
-
- highlight = mkOption {
- default = null;
- type = types.nullOr backForeSubModule;
- description = "The colors for the terminal’s highlighted area.";
- };
- };
- }
- );
-
- profileSubModule = types.submodule (
- { name, config, ... }: {
- options = {
- default = mkOption {
- default = false;
- type = types.bool;
- description = "Whether this should be the default profile.";
- };
-
- visibleName = mkOption {
- type = types.str;
- description = "The profile name.";
- };
-
- colors = mkOption {
- default = null;
- type = types.nullOr profileColorsSubModule;
- description = "The terminal colors, null to use system default.";
- };
-
- cursorShape = mkOption {
- default = "block";
- type = types.enum [ "block" "ibeam" "underline" ];
- description = "The cursor shape.";
- };
-
- font = mkOption {
- default = null;
- type = types.nullOr types.str;
- description = "The font name, null to use system default.";
- };
-
- allowBold = mkOption {
- default = null;
- type = types.nullOr types.bool;
- description = ''
- If <literal>true</literal>, allow applications in the
- terminal to make text boldface.
- '';
- };
-
- scrollOnOutput = mkOption {
- default = true;
- type = types.bool;
- description = "Whether to scroll when output is written.";
- };
-
- showScrollbar = mkOption {
- default = true;
- type = types.bool;
- description = "Whether the scroll bar should be visible.";
- };
-
- scrollbackLines = mkOption {
- default = 10000;
- type = types.nullOr types.int;
- description =
- ''
- The number of scrollback lines to keep, null for infinite.
- '';
- };
- };
- }
- );
+ backForeSubModule = types.submodule ({ ... }: {
+ options = {
+ foreground = mkOption {
+ type = types.str;
+ description = "The foreground color.";
+ };
+
+ background = mkOption {
+ type = types.str;
+ description = "The background color.";
+ };
+ };
+ });
+
+ profileColorsSubModule = types.submodule ({ ... }: {
+ options = {
+ foregroundColor = mkOption {
+ type = types.str;
+ description = "The foreground color.";
+ };
+
+ backgroundColor = mkOption {
+ type = types.str;
+ description = "The background color.";
+ };
+
+ boldColor = mkOption {
+ default = null;
+ type = types.nullOr types.str;
+ description = "The bold color, null to use same as foreground.";
+ };
+
+ palette = mkOption {
+ type = types.listOf types.str;
+ description = "The terminal palette.";
+ };
+
+ cursor = mkOption {
+ default = null;
+ type = types.nullOr backForeSubModule;
+ description = "The color for the terminal cursor.";
+ };
+
+ highlight = mkOption {
+ default = null;
+ type = types.nullOr backForeSubModule;
+ description = "The colors for the terminal’s highlighted area.";
+ };
+ };
+ });
+
+ profileSubModule = types.submodule ({ name, config, ... }: {
+ options = {
+ default = mkOption {
+ default = false;
+ type = types.bool;
+ description = "Whether this should be the default profile.";
+ };
+
+ visibleName = mkOption {
+ type = types.str;
+ description = "The profile name.";
+ };
+
+ colors = mkOption {
+ default = null;
+ type = types.nullOr profileColorsSubModule;
+ description = "The terminal colors, null to use system default.";
+ };
+
+ cursorShape = mkOption {
+ default = "block";
+ type = types.enum [ "block" "ibeam" "underline" ];
+ description = "The cursor shape.";
+ };
+
+ font = mkOption {
+ default = null;
+ type = types.nullOr types.str;
+ description = "The font name, null to use system default.";
+ };
+
+ allowBold = mkOption {
+ default = null;
+ type = types.nullOr types.bool;
+ description = ''
+ If <literal>true</literal>, allow applications in the
+ terminal to make text boldface.
+ '';
+ };
+
+ scrollOnOutput = mkOption {
+ default = true;
+ type = types.bool;
+ description = "Whether to scroll when output is written.";
+ };
+
+ showScrollbar = mkOption {
+ default = true;
+ type = types.bool;
+ description = "Whether the scroll bar should be visible.";
+ };
+
+ scrollbackLines = mkOption {
+ default = 10000;
+ type = types.nullOr types.int;
+ description = ''
+ The number of scrollback lines to keep, null for infinite.
+ '';
+ };
+ };
+ });
buildProfileSet = pcfg:
{
@@ -137,56 +130,41 @@ let
scrollbar-policy = if pcfg.showScrollbar then "always" else "never";
scrollback-lines = pcfg.scrollbackLines;
cursor-shape = pcfg.cursorShape;
- }
- // (
- if (pcfg.font == null)
- then { use-system-font = true; }
- else { use-system-font = false; font = pcfg.font; }
- ) // (
- if (pcfg.colors == null)
- then { use-theme-colors = true; }
- else (
- {
- use-theme-colors = false;
- foreground-color = pcfg.colors.foregroundColor;
- background-color = pcfg.colors.backgroundColor;
- palette = pcfg.colors.palette;
- }
- // optionalAttrs (pcfg.allowBold != null) {
- allow-bold = pcfg.allowBold;
- }
- // (
- if (pcfg.colors.boldColor == null)
- then { bold-color-same-as-fg = true; }
- else {
- bold-color-same-as-fg = false;
- bold-color = pcfg.colors.boldColor;
- }
- )
- // (
- if (pcfg.colors.cursor != null)
- then {
- cursor-colors-set = true;
- cursor-foreground-color = pcfg.colors.cursor.foreground;
- cursor-background-color = pcfg.colors.cursor.background;
- }
- else { cursor-colors-set = false; }
- )
- // (
- if (pcfg.colors.highlight != null)
- then {
- highlight-colors-set = true;
- highlight-foreground-color = pcfg.colors.highlight.foreground;
- highlight-background-color = pcfg.colors.highlight.background;
- }
- else { highlight-colors-set = false; }
- )
- )
- );
-
-in
-
-{
+ } // (if (pcfg.font == null) then {
+ use-system-font = true;
+ } else {
+ use-system-font = false;
+ font = pcfg.font;
+ }) // (if (pcfg.colors == null) then {
+ use-theme-colors = true;
+ } else
+ ({
+ use-theme-colors = false;
+ foreground-color = pcfg.colors.foregroundColor;
+ background-color = pcfg.colors.backgroundColor;
+ palette = pcfg.colors.palette;
+ } // optionalAttrs (pcfg.allowBold != null) {
+ allow-bold = pcfg.allowBold;
+ } // (if (pcfg.colors.boldColor == null) then {
+ bold-color-same-as-fg = true;
+ } else {
+ bold-color-same-as-fg = false;
+ bold-color = pcfg.colors.boldColor;
+ }) // (if (pcfg.colors.cursor != null) then {
+ cursor-colors-set = true;
+ cursor-foreground-color = pcfg.colors.cursor.foreground;
+ cursor-background-color = pcfg.colors.cursor.background;
+ } else {
+ cursor-colors-set = false;
+ }) // (if (pcfg.colors.highlight != null) then {
+ highlight-colors-set = true;
+ highlight-foreground-color = pcfg.colors.highlight.foreground;
+ highlight-background-color = pcfg.colors.highlight.background;
+ } else {
+ highlight-colors-set = false;
+ })));
+
+in {
meta.maintainers = [ maintainers.rycee ];
options = {
@@ -206,7 +184,7 @@ in
};
profile = mkOption {
- default = {};
+ default = { };
type = types.attrsOf profileSubModule;
description = "A set of Gnome Terminal profiles.";
};
@@ -216,25 +194,21 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.gnome3.gnome_terminal ];
- dconf.settings =
- let
- dconfPath = "org/gnome/terminal/legacy";
- in
- {
- "${dconfPath}" = {
- default-show-menubar = cfg.showMenubar;
- theme-variant = cfg.themeVariant;
- schema-version = 3;
- };
-
- "${dconfPath}/profiles:" = {
- default = head (attrNames (filterAttrs (n: v: v.default) cfg.profile));
- list = attrNames cfg.profile;
- };
- }
- // mapAttrs' (n: v:
- nameValuePair ("${dconfPath}/profiles:/:${n}") (buildProfileSet v)
- ) cfg.profile;
+ dconf.settings = let dconfPath = "org/gnome/terminal/legacy";
+ in {
+ "${dconfPath}" = {
+ default-show-menubar = cfg.showMenubar;
+ theme-variant = cfg.themeVariant;
+ schema-version = 3;
+ };
+
+ "${dconfPath}/profiles:" = {
+ default = head (attrNames (filterAttrs (n: v: v.default) cfg.profile));
+ list = attrNames cfg.profile;
+ };
+ } // mapAttrs'
+ (n: v: nameValuePair ("${dconfPath}/profiles:/:${n}") (buildProfileSet v))
+ cfg.profile;
programs.bash.initExtra = mkBefore vteInitStr;
programs.zsh.initExtra = vteInitStr;
diff --git a/home-manager/modules/programs/go.nix b/home-manager/modules/programs/go.nix
index 06c25c9b82a..983769d26af 100644
--- a/home-manager/modules/programs/go.nix
+++ b/home-manager/modules/programs/go.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.go;
-in
-
-{
+in {
meta.maintainers = [ maintainers.rvolosatovs ];
options = {
@@ -24,7 +22,7 @@ in
packages = mkOption {
type = with types; attrsOf path;
- default = {};
+ default = { };
example = literalExample ''
{
"golang.org/x/text" = builtins.fetchGit "https://go.googlesource.com/text";
@@ -38,7 +36,24 @@ in
type = with types; nullOr str;
default = null;
example = "go";
- description = "GOPATH relative to HOME";
+ description = ''
+ Primary <envar>GOPATH</envar> relative to
+ <envar>HOME</envar>. It will be exported first and therefore
+ used by default by the Go tooling.
+ '';
+ };
+
+ extraGoPaths = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "extraGoPath1" "extraGoPath2" ];
+ description = let goPathOpt = "programs.go.goPath";
+ in ''
+ Extra <envar>GOPATH</envar>s relative to <envar>HOME</envar> appended
+ after
+ <varname><link linkend="opt-${goPathOpt}">${goPathOpt}</link></varname>,
+ if that option is set.
+ '';
};
goBin = mkOption {
@@ -54,22 +69,21 @@ in
{
home.packages = [ cfg.package ];
- home.file =
- let
- goPath = if cfg.goPath != null then cfg.goPath else "go";
-
- mkSrc = n: v: {
- target = "${goPath}/src/${n}";
- source = v;
- };
- in
- mapAttrsToList mkSrc cfg.packages;
+ home.file = let
+ goPath = if cfg.goPath != null then cfg.goPath else "go";
+ mkSrc = n: v: { "${goPath}/src/${n}".source = v; };
+ in foldl' (a: b: a // b) { } (mapAttrsToList mkSrc cfg.packages);
}
+
(mkIf (cfg.goPath != null) {
- home.sessionVariables.GOPATH = builtins.toPath "${config.home.homeDirectory}/${cfg.goPath}";
+ home.sessionVariables.GOPATH = concatStringsSep ":" (map builtins.toPath
+ (map (path: "${config.home.homeDirectory}/${path}")
+ ([ cfg.goPath ] ++ cfg.extraGoPaths)));
})
+
(mkIf (cfg.goBin != null) {
- home.sessionVariables.GOBIN = builtins.toPath "${config.home.homeDirectory}/${cfg.goBin}";
+ home.sessionVariables.GOBIN =
+ builtins.toPath "${config.home.homeDirectory}/${cfg.goBin}";
})
]);
}
diff --git a/home-manager/modules/programs/home-manager.nix b/home-manager/modules/programs/home-manager.nix
index 42e3c8a384f..9039a59d7c5 100644
--- a/home-manager/modules/programs/home-manager.nix
+++ b/home-manager/modules/programs/home-manager.nix
@@ -8,9 +8,7 @@ let
dag = config.lib.dag;
-in
-
-{
+in {
meta.maintainers = [ maintainers.rycee ];
options = {
@@ -33,10 +31,7 @@ in
};
config = mkIf (cfg.enable && !config.submoduleSupport.enable) {
- home.packages = [
- (pkgs.callPackage ../../home-manager {
- inherit (cfg) path;
- })
- ];
+ home.packages =
+ [ (pkgs.callPackage ../../home-manager { inherit (cfg) path; }) ];
};
}
diff --git a/home-manager/modules/programs/htop.nix b/home-manager/modules/programs/htop.nix
index d700c4855fe..84966040534 100644
--- a/home-manager/modules/programs/htop.nix
+++ b/home-manager/modules/programs/htop.nix
@@ -3,6 +3,7 @@
with lib;
let
+
cfg = config.programs.htop;
list = xs: concatMapStrings (x: "${toString x} ") xs;
@@ -81,16 +82,15 @@ let
RightCPUs2 = 1;
Blank = 2;
CPU = 1;
- "CPU(1)"= 1;
+ "CPU(1)" = 1;
"CPU(2)" = 1;
"CPU(3)" = 1;
"CPU(4)" = 1;
};
- singleMeterType = types.coercedTo
- (types.enum (attrNames meters))
- (m: { kind = m; mode = meters.${m}; })
- (types.submodule {
+ singleMeterType = let
+ meterEnum = types.enum (attrNames meters);
+ meterSubmodule = types.submodule {
options = {
kind = mkOption {
type = types.enum (attrNames meters);
@@ -101,10 +101,15 @@ let
mode = mkOption {
type = types.enum [ 1 2 3 4 ];
example = 2;
- description = "Which mode the meter should use, one of 1(Bar) 2(Text) 3(Graph) 4(LED).";
+ description =
+ "Which mode the meter should use, one of 1(Bar) 2(Text) 3(Graph) 4(LED).";
};
};
- });
+ };
+ in types.coercedTo meterEnum (m: {
+ kind = m;
+ mode = meters.${m};
+ }) meterSubmodule;
meterType = types.submodule {
options = {
@@ -115,7 +120,10 @@ let
"Memory"
"LeftCPUs2"
"RightCPUs2"
- { kind = "CPU"; mode = 3; }
+ {
+ kind = "CPU";
+ mode = 3;
+ }
];
type = types.listOf singleMeterType;
};
@@ -123,7 +131,10 @@ let
description = "Meters shown in the right header.";
default = [ "Tasks" "LoadAverage" "Uptime" ];
example = [
- { kind = "Clock"; mode = 4; }
+ {
+ kind = "Clock";
+ mode = 4;
+ }
"Uptime"
"Tasks"
];
@@ -131,15 +142,37 @@ let
};
};
};
-in
-{
+
+in {
options.programs.htop = {
enable = mkEnableOption "htop";
fields = mkOption {
type = types.listOf (types.enum (attrNames fields));
- default = [ "PID" "USER" "PRIORITY" "NICE" "M_SIZE" "M_RESIDENT" "M_SHARE" "STATE" "PERCENT_CPU" "PERCENT_MEM" "TIME" "COMM" ];
- example = [ "PID" "USER" "PRIORITY" "PERCENT_CPU" "M_RESIDENT" "PERCENT_MEM" "TIME" "COMM" ];
+ default = [
+ "PID"
+ "USER"
+ "PRIORITY"
+ "NICE"
+ "M_SIZE"
+ "M_RESIDENT"
+ "M_SHARE"
+ "STATE"
+ "PERCENT_CPU"
+ "PERCENT_MEM"
+ "TIME"
+ "COMM"
+ ];
+ example = [
+ "PID"
+ "USER"
+ "PRIORITY"
+ "PERCENT_CPU"
+ "M_RESIDENT"
+ "PERCENT_MEM"
+ "TIME"
+ "COMM"
+ ];
description = "Active fields shown in the table.";
};
@@ -209,7 +242,7 @@ in
default = true;
description = "Display threads in a different color.";
};
-
+
treeView = mkOption {
type = types.bool;
default = false;
@@ -225,7 +258,8 @@ in
detailedCpuTime = mkOption {
type = types.bool;
default = false;
- description = "Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest).";
+ description =
+ "Detailed CPU time (System/IO-Wait/Hard-IRQ/Soft-IRQ/Steal/Guest).";
};
cpuCountFromZero = mkOption {
@@ -272,14 +306,23 @@ in
"CPU"
"LeftCPUs2"
"RightCPUs2"
- { kind = "CPU"; mode = 3; }
+ {
+ kind = "CPU";
+ mode = 3;
+ }
];
right = [
- { kind = "Clock"; mode = 4; }
+ {
+ kind = "Clock";
+ mode = 4;
+ }
"Uptime"
"Tasks"
"LoadAverage"
- { kind = "Battery"; mode = 1; }
+ {
+ kind = "Battery";
+ mode = 1;
+ }
];
};
type = meterType;
diff --git a/home-manager/modules/programs/info.nix b/home-manager/modules/programs/info.nix
index 93dcaf474af..9e4a5d4aaff 100644
--- a/home-manager/modules/programs/info.nix
+++ b/home-manager/modules/programs/info.nix
@@ -26,8 +26,6 @@ let
cfg = config.programs.info;
- dag = config.lib.dag;
-
# Indexes info files found in this location
homeInfoPath = "${config.home.profileDirectory}/share/info";
@@ -36,9 +34,7 @@ let
# from this package in the activation script.
infoPkg = pkgs.texinfoInteractive;
-in
-
-{
+in {
options = {
programs.info = {
enable = mkEnableOption "GNU Info";
@@ -57,19 +53,20 @@ in
home.sessionVariables.INFOPATH =
"${cfg.homeInfoDirLocation}\${INFOPATH:+:}\${INFOPATH}";
- home.activation.createHomeInfoDir = dag.entryAfter ["installPackages"] ''
- oPATH=$PATH
- export PATH="${lib.makeBinPath [ pkgs.gzip ]}''${PATH:+:}$PATH"
- $DRY_RUN_CMD mkdir -p "${cfg.homeInfoDirLocation}"
- $DRY_RUN_CMD rm -f "${cfg.homeInfoDirLocation}/dir"
- if [[ -d "${homeInfoPath}" ]]; then
- find -L "${homeInfoPath}" \( -name '*.info' -o -name '*.info.gz' \) \
- -exec $DRY_RUN_CMD ${infoPkg}/bin/install-info '{}' \
- "${cfg.homeInfoDirLocation}/dir" \;
- fi
- export PATH="$oPATH"
- unset oPATH
- '';
+ home.activation.createHomeInfoDir =
+ hm.dag.entryAfter [ "installPackages" ] ''
+ oPATH=$PATH
+ export PATH="${lib.makeBinPath [ pkgs.gzip ]}''${PATH:+:}$PATH"
+ $DRY_RUN_CMD mkdir -p "${cfg.homeInfoDirLocation}"
+ $DRY_RUN_CMD rm -f "${cfg.homeInfoDirLocation}/dir"
+ if [[ -d "${homeInfoPath}" ]]; then
+ find -L "${homeInfoPath}" \( -name '*.info' -o -name '*.info.gz' \) \
+ -exec $DRY_RUN_CMD ${infoPkg}/bin/install-info '{}' \
+ "${cfg.homeInfoDirLocation}/dir" \;
+ fi
+ export PATH="$oPATH"
+ unset oPATH
+ '';
home.packages = [ infoPkg ];
diff --git a/home-manager/modules/programs/jq.nix b/home-manager/modules/programs/jq.nix
index 56c3adf0654..6c89df0df93 100644
--- a/home-manager/modules/programs/jq.nix
+++ b/home-manager/modules/programs/jq.nix
@@ -15,19 +15,17 @@ let
colorsType = types.submodule {
options = {
- null = colorType;
- false = colorType;
- true = colorType;
+ null = colorType;
+ false = colorType;
+ true = colorType;
numbers = colorType;
strings = colorType;
- arrays = colorType;
+ arrays = colorType;
objects = colorType;
};
};
-in
-
-{
+in {
options = {
programs.jq = {
enable = mkEnableOption "the jq command-line JSON processor";
@@ -52,12 +50,12 @@ in
'';
default = {
- null = "1;30";
- false = "0;39";
- true = "0;39";
+ null = "1;30";
+ false = "0;39";
+ true = "0;39";
numbers = "0;39";
strings = "0;32";
- arrays = "1;39";
+ arrays = "1;39";
objects = "1;39";
};
@@ -69,8 +67,10 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.jq ];
- home.sessionVariables = let c = cfg.colors; in {
- JQ_COLORS = "${c.null}:${c.false}:${c.true}:${c.numbers}:${c.strings}:${c.arrays}:${c.objects}";
+ home.sessionVariables = let c = cfg.colors;
+ in {
+ JQ_COLORS =
+ "${c.null}:${c.false}:${c.true}:${c.numbers}:${c.strings}:${c.arrays}:${c.objects}";
};
};
}
diff --git a/home-manager/modules/programs/kakoune.nix b/home-manager/modules/programs/kakoune.nix
index dbaa764a212..faf2542dc70 100644
--- a/home-manager/modules/programs/kakoune.nix
+++ b/home-manager/modules/programs/kakoune.nix
@@ -10,16 +10,44 @@ let
options = {
name = mkOption {
type = types.enum [
- "NormalBegin" "NormalIdle" "NormalEnd" "NormalKey"
- "InsertBegin" "InsertIdle" "InsertEnd" "InsertKey"
- "InsertChar" "InsertDelete" "InsertMove" "WinCreate"
- "WinClose" "WinResize" "WinDisplay" "WinSetOption"
- "BufSetOption" "BufNewFile" "BufOpenFile" "BufCreate"
- "BufWritePre" "BufWritePost" "BufReload" "BufClose"
- "BufOpenFifo" "BufReadFifo" "BufCloseFifo" "RuntimeError"
- "ModeChange" "PromptIdle" "GlobalSetOption" "KakBegin"
- "KakEnd" "FocusIn" "FocusOut" "RawKey"
- "InsertCompletionShow" "InsertCompletionHide"
+ "NormalBegin"
+ "NormalIdle"
+ "NormalEnd"
+ "NormalKey"
+ "InsertBegin"
+ "InsertIdle"
+ "InsertEnd"
+ "InsertKey"
+ "InsertChar"
+ "InsertDelete"
+ "InsertMove"
+ "WinCreate"
+ "WinClose"
+ "WinResize"
+ "WinDisplay"
+ "WinSetOption"
+ "BufSetOption"
+ "BufNewFile"
+ "BufOpenFile"
+ "BufCreate"
+ "BufWritePre"
+ "BufWritePost"
+ "BufReload"
+ "BufClose"
+ "BufOpenFifo"
+ "BufReadFifo"
+ "BufCloseFifo"
+ "RuntimeError"
+ "ModeChange"
+ "PromptIdle"
+ "GlobalSetOption"
+ "KakBegin"
+ "KakEnd"
+ "FocusIn"
+ "FocusOut"
+ "RawKey"
+ "InsertCompletionShow"
+ "InsertCompletionHide"
"InsertCompletionSelect"
];
example = "SetOption";
@@ -159,7 +187,8 @@ let
};
autoInfo = mkOption {
- type = types.nullOr (types.listOf (types.enum [ "command" "onkey" "normal" ]));
+ type = types.nullOr
+ (types.listOf (types.enum [ "command" "onkey" "normal" ]));
default = null;
example = [ "command" "normal" ];
description = ''
@@ -169,7 +198,7 @@ let
};
autoComplete = mkOption {
- type = types.nullOr(types.listOf (types.enum [ "insert" "prompt" ]));
+ type = types.nullOr (types.listOf (types.enum [ "insert" "prompt" ]));
default = null;
description = ''
Modes in which to display possible completions.
@@ -450,7 +479,7 @@ let
keyMappings = mkOption {
type = types.listOf keyMapping;
- default = [];
+ default = [ ];
description = ''
User-defined key mappings. For documentation, see
<link xlink:href="https://github.com/mawww/kakoune/blob/master/doc/pages/mapping.asciidoc"/>.
@@ -459,7 +488,7 @@ let
hooks = mkOption {
type = types.listOf hook;
- default = [];
+ default = [ ];
description = ''
Global hooks. For documentation, see
<link xlink:href="https://github.com/mawww/kakoune/blob/master/doc/pages/hooks.asciidoc"/>.
@@ -468,92 +497,103 @@ let
};
};
- configFile =
- let
- wrapOptions = with cfg.config.wrapLines; concatStrings [
+ configFile = let
+ wrapOptions = with cfg.config.wrapLines;
+ concatStrings [
"${optionalString word " -word"}"
"${optionalString indent " -indent"}"
"${optionalString (marker != null) " -marker ${marker}"}"
"${optionalString (maxWidth != null) " -width ${toString maxWidth}"}"
];
- numberLinesOptions = with cfg.config.numberLines; concatStrings [
+ numberLinesOptions = with cfg.config.numberLines;
+ concatStrings [
"${optionalString relative " -relative "}"
"${optionalString highlightCursor " -hlcursor"}"
"${optionalString (separator != null) " -separator ${separator}"}"
];
- uiOptions = with cfg.config.ui; concatStringsSep " " [
+ uiOptions = with cfg.config.ui;
+ concatStringsSep " " [
"ncurses_set_title=${if setTitle then "true" else "false"}"
- "ncurses_status_on_top=${if (statusLine == "top") then "true" else "false"}"
+ "ncurses_status_on_top=${
+ if (statusLine == "top") then "true" else "false"
+ }"
"ncurses_assistant=${assistant}"
"ncurses_enable_mouse=${if enableMouse then "true" else "false"}"
"ncurses_change_colors=${if changeColors then "true" else "false"}"
"${optionalString (wheelDownButton != null)
- "ncurses_wheel_down_button=${wheelDownButton}"}"
+ "ncurses_wheel_down_button=${wheelDownButton}"}"
"${optionalString (wheelUpButton != null)
- "ncurses_wheel_up_button=${wheelUpButton}"}"
+ "ncurses_wheel_up_button=${wheelUpButton}"}"
"${optionalString (shiftFunctionKeys != null)
- "ncurses_shift_function_key=${toString shiftFunctionKeys}"}"
- "ncurses_builtin_key_parser=${if useBuiltinKeyParser then "true" else "false"}"
+ "ncurses_shift_function_key=${toString shiftFunctionKeys}"}"
+ "ncurses_builtin_key_parser=${
+ if useBuiltinKeyParser then "true" else "false"
+ }"
];
- keyMappingString = km: concatStringsSep " " [
+ keyMappingString = km:
+ concatStringsSep " " [
"map global"
"${km.mode} ${km.key} '${km.effect}'"
- "${optionalString (km.docstring != null) "-docstring '${km.docstring}'"}"
+ "${optionalString (km.docstring != null)
+ "-docstring '${km.docstring}'"}"
];
- hookString = h: concatStringsSep " " [
- "hook" "${optionalString (h.group != null) "-group ${group}"}"
- "${optionalString (h.once) "-once"}" "global"
- "${h.name}" "${optionalString (h.option != null) h.option}"
+ hookString = h:
+ concatStringsSep " " [
+ "hook"
+ "${optionalString (h.group != null) "-group ${group}"}"
+ "${optionalString (h.once) "-once"}"
+ "global"
+ "${h.name}"
+ "${optionalString (h.option != null) h.option}"
"%{ ${h.commands} }"
];
- cfgStr = with cfg.config; concatStringsSep "\n" (
- [ "# Generated by home-manager" ]
+ cfgStr = with cfg.config;
+ concatStringsSep "\n" ([ "# Generated by home-manager" ]
++ optional (colorScheme != null) "colorscheme ${colorScheme}"
- ++ optional (tabStop != null) "set-option global tabstop ${toString tabStop}"
- ++ optional (indentWidth != null) "set-option global indentwidth ${toString indentWidth}"
+ ++ optional (tabStop != null)
+ "set-option global tabstop ${toString tabStop}"
+ ++ optional (indentWidth != null)
+ "set-option global indentwidth ${toString indentWidth}"
++ optional (!incrementalSearch) "set-option global incsearch false"
++ optional (alignWithTabs) "set-option global aligntab true"
- ++ optional (autoInfo != null) "set-option global autoinfo ${concatStringsSep "|" autoInfo}"
- ++ optional (autoComplete != null) "set-option global autocomplete ${concatStringsSep "|" autoComplete}"
- ++ optional (autoReload != null) "set-option global/ autoreload ${autoReload}"
- ++ optional (wrapLines != null && wrapLines.enable) "add-highlighter global/ wrap${wrapOptions}"
+ ++ optional (autoInfo != null)
+ "set-option global autoinfo ${concatStringsSep "|" autoInfo}"
+ ++ optional (autoComplete != null)
+ "set-option global autocomplete ${concatStringsSep "|" autoComplete}"
+ ++ optional (autoReload != null)
+ "set-option global/ autoreload ${autoReload}"
+ ++ optional (wrapLines != null && wrapLines.enable)
+ "add-highlighter global/ wrap${wrapOptions}"
++ optional (numberLines != null && numberLines.enable)
- "add-highlighter global/ number-lines${numberLinesOptions}"
+ "add-highlighter global/ number-lines${numberLinesOptions}"
++ optional showMatching "add-highlighter global/ show-matching"
++ optional (scrollOff != null)
- "set-option global scrolloff ${toString scrollOff.lines},${toString scrollOff.columns}"
+ "set-option global scrolloff ${toString scrollOff.lines},${
+ toString scrollOff.columns
+ }"
++ [ "# UI options" ]
++ optional (ui != null) "set-option global ui_options ${uiOptions}"
- ++ [ "# Key mappings" ]
- ++ map keyMappingString keyMappings
+ ++ [ "# Key mappings" ] ++ map keyMappingString keyMappings
- ++ [ "# Hooks" ]
- ++ map hookString hooks
- );
- in
- pkgs.writeText "kakrc" (
- optionalString (cfg.config != null) cfgStr
- + "\n"
- + cfg.extraConfig
- );
+ ++ [ "# Hooks" ] ++ map hookString hooks);
+ in pkgs.writeText "kakrc"
+ (optionalString (cfg.config != null) cfgStr + "\n" + cfg.extraConfig);
-in
-
-{
+in {
options = {
programs.kakoune = {
enable = mkEnableOption "the kakoune text editor";
config = mkOption {
type = types.nullOr configModule;
- default = {};
+ default = { };
description = "kakoune configuration options.";
};
diff --git a/home-manager/modules/programs/keychain.nix b/home-manager/modules/programs/keychain.nix
index 6dbf83a872e..6e26bd232ce 100644
--- a/home-manager/modules/programs/keychain.nix
+++ b/home-manager/modules/programs/keychain.nix
@@ -6,17 +6,16 @@ let
cfg = config.programs.keychain;
- flags = cfg.extraFlags
- ++ optional (cfg.agents != []) "--agents ${concatStringsSep "," cfg.agents}"
+ flags = cfg.extraFlags ++ optional (cfg.agents != [ ])
+ "--agents ${concatStringsSep "," cfg.agents}"
++ optional (cfg.inheritType != null) "--inherit ${cfg.inheritType}";
- shellCommand = ''
- eval "$(${cfg.package}/bin/keychain --eval ${concatStringsSep " " flags} ${concatStringsSep " " cfg.keys})"
- '';
+ shellCommand =
+ "${cfg.package}/bin/keychain --eval ${concatStringsSep " " flags} ${
+ concatStringsSep " " cfg.keys
+ }";
-in
-
-{
+in {
meta.maintainers = [ maintainers.marsam ];
options.programs.keychain = {
@@ -41,14 +40,15 @@ in
agents = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
description = ''
Agents to add.
'';
};
inheritType = mkOption {
- type = types.nullOr (types.enum ["local" "any" "local-once" "any-once"]);
+ type =
+ types.nullOr (types.enum [ "local" "any" "local-once" "any-once" ]);
default = null;
description = ''
Inherit type to attempt from agent variables from the environment.
@@ -71,6 +71,14 @@ in
'';
};
+ enableFishIntegration = mkOption {
+ default = true;
+ type = types.bool;
+ description = ''
+ Whether to enable Fish integration.
+ '';
+ };
+
enableZshIntegration = mkOption {
default = true;
type = types.bool;
@@ -78,11 +86,30 @@ in
Whether to enable Zsh integration.
'';
};
+
+ enableXsessionIntegration = mkOption {
+ default = true;
+ type = types.bool;
+ visible = pkgs.stdenv.hostPlatform.isLinux;
+ description = ''
+ Whether to run keychain from your <filename>~/.xsession</filename>.
+ '';
+ };
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
- programs.bash.initExtra = mkIf cfg.enableBashIntegration shellCommand;
- programs.zsh.initExtra = mkIf cfg.enableZshIntegration shellCommand;
+ programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
+ eval "$(${shellCommand})"
+ '';
+ programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
+ eval (${shellCommand})
+ '';
+ programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
+ eval "$(${shellCommand})"
+ '';
+ xsession.initExtra = mkIf cfg.enableXsessionIntegration ''
+ eval "$(${shellCommand})"
+ '';
};
}
diff --git a/home-manager/modules/programs/lsd.nix b/home-manager/modules/programs/lsd.nix
index 5e145e8c69b..ab1880ff828 100644
--- a/home-manager/modules/programs/lsd.nix
+++ b/home-manager/modules/programs/lsd.nix
@@ -11,12 +11,10 @@ let
ll = "ls -l";
la = "ls -a";
lt = "ls --tree";
- lla ="ls -la";
+ lla = "ls -la";
};
-in
-
-{
+in {
meta.maintainers = [ maintainers.marsam ];
options.programs.lsd = {
@@ -37,5 +35,7 @@ in
programs.bash.shellAliases = mkIf cfg.enableAliases aliases;
programs.zsh.shellAliases = mkIf cfg.enableAliases aliases;
+
+ programs.fish.shellAliases = mkIf cfg.enableAliases aliases;
};
}
diff --git a/home-manager/modules/programs/matplotlib.nix b/home-manager/modules/programs/matplotlib.nix
index 48ff6e60d68..da80c116770 100644
--- a/home-manager/modules/programs/matplotlib.nix
+++ b/home-manager/modules/programs/matplotlib.nix
@@ -9,16 +9,13 @@ let
formatLine = o: n: v:
let
formatValue = v:
- if isBool v then (if v then "True" else "False")
- else toString v;
- in
- if isAttrs v
- then concatStringsSep "\n" (mapAttrsToList (formatLine "${o}${n}.") v)
- else (if v == "" then "" else "${o}${n}: ${formatValue v}");
+ if isBool v then (if v then "True" else "False") else toString v;
+ in if isAttrs v then
+ concatStringsSep "\n" (mapAttrsToList (formatLine "${o}${n}.") v)
+ else
+ (if v == "" then "" else "${o}${n}: ${formatValue v}");
-in
-
-{
+in {
meta.maintainers = [ maintainers.rprospero ];
options.programs.matplotlib = {
@@ -31,7 +28,7 @@ in
Add terms to the <filename>matplotlibrc</filename> file to
control the default matplotlib behavior.
'';
- example = literalExample ''
+ example = literalExample ''
{
backend = "Qt5Agg";
axes = {
@@ -55,10 +52,8 @@ in
};
config = mkIf cfg.enable {
- xdg.configFile."matplotlib/matplotlibrc".text =
- concatStringsSep "\n" ([]
- ++ mapAttrsToList (formatLine "") cfg.config
- ++ optional (cfg.extraConfig != "") cfg.extraConfig
- ) + "\n";
+ xdg.configFile."matplotlib/matplotlibrc".text = concatStringsSep "\n" ([ ]
+ ++ mapAttrsToList (formatLine "") cfg.config
+ ++ optional (cfg.extraConfig != "") cfg.extraConfig) + "\n";
};
}
diff --git a/home-manager/modules/programs/mbsync-accounts.nix b/home-manager/modules/programs/mbsync-accounts.nix
index c586481df4d..4de1965fe3f 100644
--- a/home-manager/modules/programs/mbsync-accounts.nix
+++ b/home-manager/modules/programs/mbsync-accounts.nix
@@ -6,9 +6,7 @@ let
extraConfigType = with lib.types; attrsOf (either (either str int) bool);
-in
-
-{
+in {
options.mbsync = {
enable = mkEnableOption "synchronization using mbsync";
@@ -62,7 +60,7 @@ in
extraConfig.channel = mkOption {
type = extraConfigType;
- default = {};
+ default = { };
example = literalExample ''
{
MaxMessages = 10000;
@@ -76,7 +74,7 @@ in
extraConfig.local = mkOption {
type = extraConfigType;
- default = {};
+ default = { };
description = ''
Local store extra configuration.
'';
@@ -84,7 +82,7 @@ in
extraConfig.remote = mkOption {
type = extraConfigType;
- default = {};
+ default = { };
description = ''
Remote store extra configuration.
'';
@@ -92,7 +90,7 @@ in
extraConfig.account = mkOption {
type = extraConfigType;
- default = {};
+ default = { };
example = literalExample ''
{
PipelineDepth = 10;
diff --git a/home-manager/modules/programs/mbsync.nix b/home-manager/modules/programs/mbsync.nix
index 908a1add715..6ade10986fe 100644
--- a/home-manager/modules/programs/mbsync.nix
+++ b/home-manager/modules/programs/mbsync.nix
@@ -4,22 +4,21 @@ with lib;
let
- dag = config.lib.dag;
-
cfg = config.programs.mbsync;
# Accounts for which mbsync is enabled.
mbsyncAccounts =
filter (a: a.mbsync.enable) (attrValues config.accounts.email.accounts);
- genTlsConfig = tls: {
- SSLType =
- if !tls.enable then "None"
- else if tls.useStartTls then "STARTTLS"
- else "IMAPS";
- }
- //
- optionalAttrs (tls.enable && tls.certificatesFile != null) {
+ genTlsConfig = tls:
+ {
+ SSLType = if !tls.enable then
+ "None"
+ else if tls.useStartTls then
+ "STARTTLS"
+ else
+ "IMAPS";
+ } // optionalAttrs (tls.enable && tls.certificatesFile != null) {
CertificateFile = toString tls.certificatesFile;
};
@@ -32,79 +31,61 @@ let
genSection = header: entries:
let
- escapeValue = escape [ "\"" ];
+ escapeValue = escape [ ''"'' ];
hasSpace = v: builtins.match ".* .*" v != null;
genValue = n: v:
- if isList v
- then concatMapStringsSep " " (genValue n) v
- else if isBool v then (if v then "yes" else "no")
- else if isInt v then toString v
- else if isString v && hasSpace v then "\"${escapeValue v}\""
- else if isString v then v
+ if isList v then
+ concatMapStringsSep " " (genValue n) v
+ else if isBool v then
+ (if v then "yes" else "no")
+ else if isInt v then
+ toString v
+ else if isString v && hasSpace v then
+ ''"${escapeValue v}"''
+ else if isString v then
+ v
else
- let prettyV = lib.generators.toPretty {} v;
- in throw "mbsync: unexpected value for option ${n}: '${prettyV}'";
- in
- ''
- ${header}
- ${concatStringsSep "\n"
- (mapAttrsToList (n: v: "${n} ${genValue n v}") entries)}
- '';
-
- genAccountConfig = account: with account;
- genSection "IMAPAccount ${name}" (
- {
- Host = imap.host;
- User = userName;
- PassCmd = toString passwordCommand;
- }
- // genTlsConfig imap.tls
- // optionalAttrs (imap.port != null) { Port = toString imap.port; }
- // mbsync.extraConfig.account
- )
- + "\n"
- + genSection "IMAPStore ${name}-remote" (
- {
- Account = name;
- }
- // mbsync.extraConfig.remote
- )
- + "\n"
- + genSection "MaildirStore ${name}-local" (
- {
- Path = "${maildir.absPath}/";
- Inbox = "${maildir.absPath}/${folders.inbox}";
- SubFolders = "Verbatim";
- }
- // optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
- // mbsync.extraConfig.local
- )
- + "\n"
- + genSection "Channel ${name}" (
- {
- Master = ":${name}-remote:";
- Slave = ":${name}-local:";
- Patterns = mbsync.patterns;
- Create = masterSlaveMapping.${mbsync.create};
- Remove = masterSlaveMapping.${mbsync.remove};
- Expunge = masterSlaveMapping.${mbsync.expunge};
- SyncState = "*";
- }
- // mbsync.extraConfig.channel
- )
- + "\n";
+ let prettyV = lib.generators.toPretty { } v;
+ in throw "mbsync: unexpected value for option ${n}: '${prettyV}'";
+ in ''
+ ${header}
+ ${concatStringsSep "\n"
+ (mapAttrsToList (n: v: "${n} ${genValue n v}") entries)}
+ '';
+
+ genAccountConfig = account:
+ with account;
+ genSection "IMAPAccount ${name}" ({
+ Host = imap.host;
+ User = userName;
+ PassCmd = toString passwordCommand;
+ } // genTlsConfig imap.tls
+ // optionalAttrs (imap.port != null) { Port = toString imap.port; }
+ // mbsync.extraConfig.account) + "\n"
+ + genSection "IMAPStore ${name}-remote"
+ ({ Account = name; } // mbsync.extraConfig.remote) + "\n"
+ + genSection "MaildirStore ${name}-local" ({
+ Path = "${maildir.absPath}/";
+ Inbox = "${maildir.absPath}/${folders.inbox}";
+ SubFolders = "Verbatim";
+ } // optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
+ // mbsync.extraConfig.local) + "\n" + genSection "Channel ${name}" ({
+ Master = ":${name}-remote:";
+ Slave = ":${name}-local:";
+ Patterns = mbsync.patterns;
+ Create = masterSlaveMapping.${mbsync.create};
+ Remove = masterSlaveMapping.${mbsync.remove};
+ Expunge = masterSlaveMapping.${mbsync.expunge};
+ SyncState = "*";
+ } // mbsync.extraConfig.channel) + "\n";
genGroupConfig = name: channels:
let
genGroupChannel = n: boxes: "Channel ${n}:${concatStringsSep "," boxes}";
- in
- concatStringsSep "\n" (
- [ "Group ${name}" ] ++ mapAttrsToList genGroupChannel channels
- );
-
-in
+ in concatStringsSep "\n"
+ ([ "Group ${name}" ] ++ mapAttrsToList genGroupChannel channels);
-{
+in {
options = {
programs.mbsync = {
enable = mkEnableOption "mbsync IMAP4 and Maildir mailbox synchronizer";
@@ -119,7 +100,7 @@ in
groups = mkOption {
type = types.attrsOf (types.attrsOf (types.listOf types.str));
- default = {};
+ default = { };
example = literalExample ''
{
inboxes = {
@@ -144,45 +125,40 @@ in
};
config = mkIf cfg.enable {
- assertions =
- let
- checkAccounts = pred: msg:
- let
- badAccounts = filter pred mbsyncAccounts;
- in {
- assertion = badAccounts == [];
- message = "mbsync: ${msg} for accounts: "
- + concatMapStringsSep ", " (a: a.name) badAccounts;
- };
- in
- [
- (checkAccounts (a: a.maildir == null) "Missing maildir configuration")
- (checkAccounts (a: a.imap == null) "Missing IMAP configuration")
- (checkAccounts (a: a.passwordCommand == null) "Missing passwordCommand")
- (checkAccounts (a: a.userName == null) "Missing username")
- ];
+ assertions = let
+ checkAccounts = pred: msg:
+ let badAccounts = filter pred mbsyncAccounts;
+ in {
+ assertion = badAccounts == [ ];
+ message = "mbsync: ${msg} for accounts: "
+ + concatMapStringsSep ", " (a: a.name) badAccounts;
+ };
+ in [
+ (checkAccounts (a: a.maildir == null) "Missing maildir configuration")
+ (checkAccounts (a: a.imap == null) "Missing IMAP configuration")
+ (checkAccounts (a: a.passwordCommand == null) "Missing passwordCommand")
+ (checkAccounts (a: a.userName == null) "Missing username")
+ ];
home.packages = [ cfg.package ];
programs.notmuch.new.ignore = [ ".uidvalidity" ".mbsyncstate" ];
- home.file.".mbsyncrc".text =
- let
- accountsConfig = map genAccountConfig mbsyncAccounts;
- groupsConfig = mapAttrsToList genGroupConfig cfg.groups;
- in
- concatStringsSep "\n" (
- [ "# Generated by Home Manager.\n" ]
- ++ optional (cfg.extraConfig != "") cfg.extraConfig
- ++ accountsConfig
- ++ groupsConfig
- ) + "\n";
-
- home.activation.createMaildir =
- dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
- $DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG ${
- concatMapStringsSep " " (a: a.maildir.absPath) mbsyncAccounts
- }
- '';
+ home.file.".mbsyncrc".text = let
+ accountsConfig = map genAccountConfig mbsyncAccounts;
+ groupsConfig = mapAttrsToList genGroupConfig cfg.groups;
+ in concatStringsSep "\n" ([''
+ # Generated by Home Manager.
+ ''] ++ optional (cfg.extraConfig != "") cfg.extraConfig ++ accountsConfig
+ ++ groupsConfig) + "\n";
+
+ home.activation = mkIf (mbsyncAccounts != [ ]) {
+ createMaildir =
+ hm.dag.entryBetween [ "linkGeneration" ] [ "writeBoundary" ] ''
+ $DRY_RUN_CMD mkdir -m700 -p $VERBOSE_ARG ${
+ concatMapStringsSep " " (a: a.maildir.absPath) mbsyncAccounts
+ }
+ '';
+ };
};
}
diff --git a/home-manager/modules/programs/mercurial.nix b/home-manager/modules/programs/mercurial.nix
index fa6e7b3e5ba..8e9a3befbaf 100644
--- a/home-manager/modules/programs/mercurial.nix
+++ b/home-manager/modules/programs/mercurial.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.mercurial;
-in
-
-{
+in {
options = {
programs.mercurial = {
@@ -33,13 +31,13 @@ in
aliases = mkOption {
type = types.attrs;
- default = {};
+ default = { };
description = "Mercurial aliases to define.";
};
extraConfig = mkOption {
type = types.either types.attrs types.lines;
- default = {};
+ default = { };
description = "Additional configuration to add.";
};
@@ -50,53 +48,53 @@ in
ignores = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "*~" "*.swp" ];
description = "List of globs for files to be globally ignored.";
};
ignoresRegexp = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "^.*~$" "^.*\\.swp$" ];
description =
- "List of regular expressions for files to be globally ignored.";
+ "List of regular expressions for files to be globally ignored.";
};
};
};
- config = mkIf cfg.enable (
- mkMerge [
- {
- home.packages = [ cfg.package ];
+ config = mkIf cfg.enable (mkMerge [
+ {
+ home.packages = [ cfg.package ];
- programs.mercurial.iniContent.ui = {
- username = cfg.userName + " <" + cfg.userEmail + ">";
- };
+ programs.mercurial.iniContent.ui = {
+ username = cfg.userName + " <" + cfg.userEmail + ">";
+ };
- xdg.configFile."hg/hgrc".text = generators.toINI {} cfg.iniContent;
- }
+ xdg.configFile."hg/hgrc".text = generators.toINI { } cfg.iniContent;
+ }
- (mkIf (cfg.ignores != [] || cfg.ignoresRegexp != []) {
- programs.mercurial.iniContent.ui.ignore =
- "${config.xdg.configHome}/hg/hgignore_global";
+ (mkIf (cfg.ignores != [ ] || cfg.ignoresRegexp != [ ]) {
+ programs.mercurial.iniContent.ui.ignore =
+ "${config.xdg.configHome}/hg/hgignore_global";
- xdg.configFile."hg/hgignore_global".text =
- "syntax: glob\n" + concatStringsSep "\n" cfg.ignores + "\n" +
- "syntax: regexp\n" + concatStringsSep "\n" cfg.ignoresRegexp + "\n";
- })
+ xdg.configFile."hg/hgignore_global".text = ''
+ syntax: glob
+ '' + concatStringsSep "\n" cfg.ignores + "\n" + ''
+ syntax: regexp
+ '' + concatStringsSep "\n" cfg.ignoresRegexp + "\n";
+ })
- (mkIf (cfg.aliases != {}) {
- programs.mercurial.iniContent.alias = cfg.aliases;
- })
+ (mkIf (cfg.aliases != { }) {
+ programs.mercurial.iniContent.alias = cfg.aliases;
+ })
- (mkIf (lib.isAttrs cfg.extraConfig) {
- programs.mercurial.iniContent = cfg.extraConfig;
- })
+ (mkIf (lib.isAttrs cfg.extraConfig) {
+ programs.mercurial.iniContent = cfg.extraConfig;
+ })
- (mkIf (lib.isString cfg.extraConfig) {
- xdg.configFile."hg/hgrc".text = cfg.extraConfig;
- })
- ]
- );
+ (mkIf (lib.isString cfg.extraConfig) {
+ xdg.configFile."hg/hgrc".text = cfg.extraConfig;
+ })
+ ]);
}
diff --git a/home-manager/modules/programs/mpv.nix b/home-manager/modules/programs/mpv.nix
index 1051f71ccd6..3a4e5092f9a 100644
--- a/home-manager/modules/programs/mpv.nix
+++ b/home-manager/modules/programs/mpv.nix
@@ -23,31 +23,21 @@ let
}.${typeOf option};
renderOptions = options:
- concatStringsSep "\n"
- (mapAttrsToList
- (name: value:
- let
- rendered = renderOption value;
- length = toString (stringLength rendered);
- in
- "${name}=%${length}%${rendered}")
- options);
+ concatStringsSep "\n" (mapAttrsToList (name: value:
+ let
+ rendered = renderOption value;
+ length = toString (stringLength rendered);
+ in "${name}=%${length}%${rendered}") options);
renderProfiles = profiles:
- concatStringsSep "\n"
- (mapAttrsToList
- (name: value: ''
- [${name}]
- ${renderOptions value}
- '')
- profiles);
+ concatStringsSep "\n" (mapAttrsToList (name: value: ''
+ [${name}]
+ ${renderOptions value}
+ '') profiles);
renderBindings = bindings:
concatStringsSep "\n"
- (mapAttrsToList
- (name: value:
- "${name} ${value}")
- bindings);
+ (mapAttrsToList (name: value: "${name} ${value}") bindings);
in {
options = {
@@ -55,8 +45,8 @@ in {
enable = mkEnableOption "mpv";
scripts = mkOption {
- type = types.listOf types.package;
- default = [];
+ type = with types; listOf (either package str);
+ default = [ ];
example = literalExample "[ pkgs.mpvScripts.mpris ]";
description = ''
List of scripts to use with mpv.
@@ -74,7 +64,7 @@ in {
for the full list of options.
'';
type = mpvOptions;
- default = {};
+ default = { };
example = literalExample ''
{
profile = "gpu-hq";
@@ -92,7 +82,7 @@ in {
<option>programs.mpv.config</option> for more information.
'';
type = mpvProfiles;
- default = {};
+ default = { };
example = literalExample ''
{
fast = {
@@ -117,7 +107,7 @@ in {
for the full list of options.
'';
type = mpvBindings;
- default = {};
+ default = { };
example = literalExample ''
{
WHEEL_UP = "seek 10";
@@ -131,19 +121,20 @@ in {
config = mkIf cfg.enable (mkMerge [
{
- home.packages = [(
- if cfg.scripts == []
- then pkgs.mpv
- else pkgs.mpv-with-scripts.override { scripts = cfg.scripts; }
- )];
+ home.packages = [
+ (if cfg.scripts == [ ] then
+ pkgs.mpv
+ else
+ pkgs.mpv-with-scripts.override { scripts = cfg.scripts; })
+ ];
}
- (mkIf (cfg.config != {} || cfg.profiles != {}) {
+ (mkIf (cfg.config != { } || cfg.profiles != { }) {
xdg.configFile."mpv/mpv.conf".text = ''
- ${optionalString (cfg.config != {}) (renderOptions cfg.config)}
- ${optionalString (cfg.profiles != {}) (renderProfiles cfg.profiles)}
+ ${optionalString (cfg.config != { }) (renderOptions cfg.config)}
+ ${optionalString (cfg.profiles != { }) (renderProfiles cfg.profiles)}
'';
})
- (mkIf (cfg.bindings != {}) {
+ (mkIf (cfg.bindings != { }) {
xdg.configFile."mpv/input.conf".text = renderBindings cfg.bindings;
})
]);
diff --git a/home-manager/modules/programs/msmtp-accounts.nix b/home-manager/modules/programs/msmtp-accounts.nix
index 277710f4cba..894cef51742 100644
--- a/home-manager/modules/programs/msmtp-accounts.nix
+++ b/home-manager/modules/programs/msmtp-accounts.nix
@@ -23,7 +23,8 @@ with lib;
};
tls.fingerprint = mkOption {
- type = types.nullOr (types.strMatching "([[:alnum:]]{2}\:)+[[:alnum:]]{2}");
+ type =
+ types.nullOr (types.strMatching "([[:alnum:]]{2}:)+[[:alnum:]]{2}");
default = null;
example = "my:SH:a2:56:ha:sh";
description = ''
diff --git a/home-manager/modules/programs/msmtp.nix b/home-manager/modules/programs/msmtp.nix
index 1ff3139ef36..f34fd72f8b1 100644
--- a/home-manager/modules/programs/msmtp.nix
+++ b/home-manager/modules/programs/msmtp.nix
@@ -6,38 +6,32 @@ let
cfg = config.programs.msmtp;
- msmtpAccounts = filter (a: a.msmtp.enable)
- (attrValues config.accounts.email.accounts);
+ msmtpAccounts =
+ filter (a: a.msmtp.enable) (attrValues config.accounts.email.accounts);
onOff = p: if p then "on" else "off";
- accountStr = account: with account;
- concatStringsSep "\n" (
- [ "account ${name}" ]
- ++ mapAttrsToList (n: v: n + " " + v) (
- {
- host = smtp.host;
- from = address;
- auth = "on";
- user = userName;
- tls = onOff smtp.tls.enable;
- tls_starttls = onOff smtp.tls.useStartTls;
- tls_trust_file = smtp.tls.certificatesFile;
- }
- // optionalAttrs (msmtp.tls.fingerprint != null) {
- tls_fingerprint = msmtp.tls.fingerprint;
- }
- // optionalAttrs (smtp.port != null) {
- port = toString smtp.port;
- }
+ accountStr = account:
+ with account;
+ concatStringsSep "\n" ([ "account ${name}" ]
+ ++ mapAttrsToList (n: v: n + " " + v) ({
+ host = smtp.host;
+ from = address;
+ auth = "on";
+ user = userName;
+ tls = onOff smtp.tls.enable;
+ tls_starttls = onOff smtp.tls.useStartTls;
+ tls_trust_file = smtp.tls.certificatesFile;
+ } // optionalAttrs (msmtp.tls.fingerprint != null) {
+ tls_fingerprint = msmtp.tls.fingerprint;
+ } // optionalAttrs (smtp.port != null) { port = toString smtp.port; }
// optionalAttrs (passwordCommand != null) {
# msmtp requires the password to finish with a newline.
- passwordeval = ''${pkgs.bash}/bin/bash -c "${toString passwordCommand}; echo"'';
- }
- // msmtp.extraConfig
- )
- ++ optional primary "\naccount default : ${name}"
- );
+ passwordeval =
+ ''${pkgs.bash}/bin/bash -c "${toString passwordCommand}; echo"'';
+ } // msmtp.extraConfig) ++ optional primary ''
+
+ account default : ${name}'');
configFile = mailAccounts: ''
# Generated by Home Manager.
@@ -47,9 +41,7 @@ let
${concatStringsSep "\n\n" (map accountStr mailAccounts)}
'';
-in
-
-{
+in {
options = {
programs.msmtp = {
@@ -71,7 +63,7 @@ in
xdg.configFile."msmtp/config".text = configFile msmtpAccounts;
- home.sessionVariables = {
+ home.sessionVariables = {
MSMTP_QUEUE = "${config.xdg.dataHome}/msmtp/queue";
MSMTP_LOG = "${config.xdg.dataHome}/msmtp/queue.log";
};
diff --git a/home-manager/modules/programs/neomutt-accounts.nix b/home-manager/modules/programs/neomutt-accounts.nix
new file mode 100644
index 00000000000..033db38eb0a
--- /dev/null
+++ b/home-manager/modules/programs/neomutt-accounts.nix
@@ -0,0 +1,34 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+ options.neomutt = {
+ enable = mkEnableOption "NeoMutt";
+
+ sendMailCommand = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "msmtpq --read-envelope-from --read-recipients";
+ description = ''
+ Command to send a mail. If not set, neomutt will be in charge of sending mails.
+ '';
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ example = "color status cyan default";
+ description = ''
+ Extra lines to add to the folder hook for this account.
+ '';
+ };
+ };
+
+ config = mkIf config.neomutt.enable {
+ neomutt.sendMailCommand = mkOptionDefault (if config.msmtp.enable then
+ "msmtpq --read-envelope-from --read-recipients"
+ else
+ null);
+ };
+}
diff --git a/home-manager/modules/programs/neomutt.nix b/home-manager/modules/programs/neomutt.nix
new file mode 100644
index 00000000000..85af0353b6c
--- /dev/null
+++ b/home-manager/modules/programs/neomutt.nix
@@ -0,0 +1,302 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.programs.neomutt;
+
+ neomuttAccounts =
+ filter (a: a.neomutt.enable) (attrValues config.accounts.email.accounts);
+
+ sidebarModule = types.submodule {
+ options = {
+ enable = mkEnableOption "sidebar support";
+
+ width = mkOption {
+ type = types.int;
+ default = 22;
+ description = "Width of the sidebar";
+ };
+
+ shortPath = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ By default sidebar shows the full path of the mailbox, but
+ with this enabled only the relative name is shown.
+ '';
+ };
+
+ format = mkOption {
+ type = types.str;
+ default = "%B%?F? [%F]?%* %?N?%N/?%S";
+ description = ''
+ Sidebar format. Check neomutt documentation for details.
+ '';
+ };
+ };
+ };
+
+ bindModule = types.submodule {
+ options = {
+ map = mkOption {
+ type = types.enum [
+ "alias"
+ "attach"
+ "browser"
+ "compose"
+ "editor"
+ "generic"
+ "index"
+ "mix"
+ "pager"
+ "pgp"
+ "postpone"
+ "query"
+ "smime"
+ ];
+ default = "index";
+ description = "Select the menu to bind the command to.";
+ };
+
+ key = mkOption {
+ type = types.str;
+ example = "<left>";
+ description = "The key to bind.";
+ };
+
+ action = mkOption {
+ type = types.str;
+ example = "<enter-command>toggle sidebar_visible<enter><refresh>";
+ description = "Specify the action to take.";
+ };
+ };
+ };
+
+ yesno = x: if x then "yes" else "no";
+ setOption = n: v: if v == null then "unset ${n}" else "set ${n}=${v}";
+ escape = replaceStrings [ "%" ] [ "%25" ];
+
+ accountFilename = account: config.xdg.configHome + "/neomutt/" + account.name;
+
+ genCommonFolderHooks = account:
+ with account; {
+ from = "'${address}'";
+ realname = "'${realName}'";
+ spoolfile = "'+${folders.inbox}'";
+ record = if folders.sent == null then null else "'+${folders.sent}'";
+ postponed = "'+${folders.drafts}'";
+ trash = "'+${folders.trash}'";
+ };
+
+ mtaSection = account:
+ with account;
+ let passCmd = concatStringsSep " " passwordCommand;
+ in if neomutt.sendMailCommand != null then {
+ sendmail = "'${neomutt.sendMailCommand}'";
+ } else
+ let
+ smtpProto = if smtp.tls.enable then "smtps" else "smtp";
+ smtpBaseUrl = "${smtpProto}://${escape userName}@${smtp.host}";
+ in {
+ smtp_url = "'${smtpBaseUrl}'";
+ smtp_pass = "'`${passCmd}`'";
+ };
+
+ genMaildirAccountConfig = account:
+ with account;
+ let
+ folderHook = mapAttrsToList setOption (genCommonFolderHooks account // {
+ folder = "'${account.maildir.absPath}'";
+ }) ++ optional (neomutt.extraConfig != "") neomutt.extraConfig;
+ in ''
+ ${concatStringsSep "\n" folderHook}
+ '';
+
+ registerAccount = account:
+ with account; ''
+ # register account ${name}
+ mailboxes "${account.maildir.absPath}/${folders.inbox}"
+ folder-hook ${account.maildir.absPath}/ " \
+ source ${accountFilename account} "
+ '';
+
+ mraSection = account:
+ with account;
+ if account.maildir != null then
+ genMaildirAccountConfig account
+ else
+ throw "Only maildir is supported at the moment";
+
+ optionsStr = attrs: concatStringsSep "\n" (mapAttrsToList setOption attrs);
+
+ sidebarSection = ''
+ # Sidebar
+ set sidebar_visible = yes
+ set sidebar_short_path = ${yesno cfg.sidebar.shortPath}
+ set sidebar_width = ${toString cfg.sidebar.width}
+ set sidebar_format = '${cfg.sidebar.format}'
+ '';
+
+ bindSection = concatMapStringsSep "\n"
+ (bind: ''bind ${bind.map} ${bind.key} "${bind.action}"'') cfg.binds;
+
+ macroSection = concatMapStringsSep "\n"
+ (bind: ''macro ${bind.map} ${bind.key} "${bind.action}"'') cfg.macros;
+
+ mailCheckSection = ''
+ set mail_check_stats
+ set mail_check_stats_interval = ${toString cfg.checkStatsInterval}
+ '';
+
+ notmuchSection = account:
+ with account; ''
+ # notmuch section
+ set nm_default_uri = "notmuch://${config.accounts.email.maildirBasePath}"
+ virtual-mailboxes "My INBOX" "notmuch://?query=tag:inbox"
+ '';
+
+ accountStr = account:
+ with account;
+ ''
+ # Generated by Home Manager.
+ set ssl_force_tls = yes
+ set certificate_file=${config.accounts.email.certificatesFile}
+
+ # GPG section
+ set crypt_use_gpgme = yes
+ set crypt_autosign = ${yesno (gpg.signByDefault or false)}
+ set pgp_use_gpg_agent = yes
+ set mbox_type = ${if maildir != null then "Maildir" else "mbox"}
+ set sort = "${cfg.sort}"
+
+ # MTA section
+ ${optionsStr (mtaSection account)}
+
+ ${optionalString (cfg.checkStatsInterval != null) mailCheckSection}
+
+ ${optionalString cfg.sidebar.enable sidebarSection}
+
+ # MRA section
+ ${mraSection account}
+
+ # Extra configuration
+ ${account.neomutt.extraConfig}
+ '' + optionalString (account.signature.showSignature != "none") ''
+ set signature = ${pkgs.writeText "signature.txt" account.signature.text}
+ '' + optionalString account.notmuch.enable (notmuchSection account);
+
+in {
+ options = {
+ programs.neomutt = {
+ enable = mkEnableOption "the NeoMutt mail client";
+
+ sidebar = mkOption {
+ type = sidebarModule;
+ default = { };
+ description = "Options related to the sidebar.";
+ };
+
+ binds = mkOption {
+ type = types.listOf bindModule;
+ default = [ ];
+ description = "List of keybindings.";
+ };
+
+ macros = mkOption {
+ type = types.listOf bindModule;
+ default = [ ];
+ description = "List of macros.";
+ };
+
+ sort = mkOption {
+ type = types.enum [
+ "date"
+ "date-received"
+ "from"
+ "mailbox-order"
+ "score"
+ "size"
+ "spam"
+ "subject"
+ "threads"
+ "to"
+ ];
+ default = "threads";
+ description = "Sorting method on messages.";
+ };
+
+ vimKeys = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Enable vim-like bindings.";
+ };
+
+ checkStatsInterval = mkOption {
+ type = types.nullOr types.int;
+ default = null;
+ example = 60;
+ description = "Enable and set the interval of automatic mail check.";
+ };
+
+ editor = mkOption {
+ type = types.str;
+ default = "$EDITOR";
+ description = "Select the editor used for writing mail.";
+ };
+
+ settings = mkOption {
+ type = types.attrsOf types.str;
+ default = { };
+ description = "Extra configuration appended to the end.";
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = "Extra configuration appended to the end.";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = [ pkgs.neomutt ];
+ home.file = let
+ rcFile = account: {
+ "${accountFilename account}".text = accountStr account;
+ };
+ in foldl' (a: b: a // b) { } (map rcFile neomuttAccounts);
+
+ xdg.configFile."neomutt/neomuttrc" = mkIf (neomuttAccounts != [ ]) {
+ text = let primary = filter (a: a.primary) neomuttAccounts;
+ in ''
+ # Generated by Home Manager.
+ set header_cache = "${config.xdg.cacheHome}/neomutt/headers/"
+ set message_cachedir = "${config.xdg.cacheHome}/neomutt/messages/"
+ set editor = "${cfg.editor}"
+ set implicit_autoview = yes
+
+ alternative_order text/enriched text/plain text
+
+ set delete = yes
+
+ # Binds
+ ${bindSection}
+
+ # Macros
+ ${macroSection}
+
+ ${optionalString cfg.vimKeys
+ "source ${pkgs.neomutt}/share/doc/neomutt/vim-keys/vim-keys.rc"}
+
+ # Extra configuration
+ ${optionsStr cfg.settings}
+
+ ${cfg.extraConfig}
+ '' + concatMapStringsSep "\n" registerAccount neomuttAccounts +
+ # source primary account
+ "source ${accountFilename (builtins.head primary)}";
+ };
+ };
+}
diff --git a/home-manager/modules/programs/neovim.nix b/home-manager/modules/programs/neovim.nix
index dadda2c7118..4101dc0f4e7 100644
--- a/home-manager/modules/programs/neovim.nix
+++ b/home-manager/modules/programs/neovim.nix
@@ -148,8 +148,8 @@ in
</para><para>
- This option is deprecated. Please use the options <varname>extraConfig</varname>
- and <varname>plugins</varname> which are mutually exclusive with this option.
+ This option is mutually exclusive with <varname>extraConfig</varname>
+ and <varname>plugins</varname>.
'';
};
@@ -193,11 +193,6 @@ in
}
];
- warnings = optional (cfg.configure != {}) ''
- The programs.neovim.configure option is deprecated. Please use
- extraConfig and package option.
- '';
-
home.packages = [ cfg.finalPackage ];
programs.neovim.finalPackage = pkgs.wrapNeovim cfg.package {
diff --git a/home-manager/modules/programs/newsboat.nix b/home-manager/modules/programs/newsboat.nix
index 19fec642d21..6b59ed713d8 100644
--- a/home-manager/modules/programs/newsboat.nix
+++ b/home-manager/modules/programs/newsboat.nix
@@ -4,11 +4,9 @@ with lib;
let
cfg = config.programs.newsboat;
- wrapQuote = x: "\"${x}\"";
+ wrapQuote = x: ''"${x}"'';
-in
-
-{
+in {
options = {
programs.newsboat = {
enable = mkEnableOption "the Newsboat feed reader";
@@ -24,8 +22,8 @@ in
tags = mkOption {
type = types.listOf types.str;
- default = [];
- example = ["foo" "bar"];
+ default = [ ];
+ example = [ "foo" "bar" ];
description = "Feed tags.";
};
@@ -37,8 +35,11 @@ in
};
};
});
- default = [];
- example = [{url = "http://example.com"; tags = ["foo" "bar"];}];
+ default = [ ];
+ example = [{
+ url = "http://example.com";
+ tags = [ "foo" "bar" ];
+ }];
description = "List of news feeds.";
};
@@ -57,7 +58,9 @@ in
autoReload = mkOption {
type = types.bool;
default = false;
- description = "Whether to enable automatic reloading while newsboat is running.";
+ description = ''
+ Whether to enable automatic reloading while newsboat is running.
+ '';
};
reloadTime = mkOption {
@@ -74,43 +77,40 @@ in
queries = mkOption {
type = types.attrsOf types.str;
- default = {};
- example = {
- "foo" = "rssurl =~ \"example.com\"";
- };
+ default = { };
+ example = { "foo" = ''rssurl =~ "example.com"''; };
description = "A list of queries to use.";
};
extraConfig = mkOption {
type = types.lines;
default = "";
- description = "Extra configuration values that will be appended to the end.";
+ description = ''
+ Extra configuration values that will be appended to the end.
+ '';
};
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.newsboat ];
- home.file.".newsboat/urls".text =
- let
- mkUrlEntry = u: concatStringsSep " " (
- [u.url]
- ++ map wrapQuote u.tags
- ++ optional (u.title != null) (wrapQuote "~${u.title}")
- );
- urls = map mkUrlEntry cfg.urls;
-
- mkQueryEntry = n: v: "\"query:${n}:${escape ["\""] v}\"";
- queries = mapAttrsToList mkQueryEntry cfg.queries;
- in
- concatStringsSep "\n" (urls ++ queries) + "\n";
+ home.file.".newsboat/urls".text = let
+ mkUrlEntry = u:
+ concatStringsSep " " ([ u.url ] ++ map wrapQuote u.tags
+ ++ optional (u.title != null) (wrapQuote "~${u.title}"));
+ urls = map mkUrlEntry cfg.urls;
+
+ mkQueryEntry = n: v: ''"query:${n}:${escape [ ''"'' ] v}"'';
+ queries = mapAttrsToList mkQueryEntry cfg.queries;
+ in concatStringsSep "\n" (urls ++ queries) + "\n";
home.file.".newsboat/config".text = ''
max-items ${toString cfg.maxItems}
browser ${cfg.browser}
reload-threads ${toString cfg.reloadThreads}
auto-reload ${if cfg.autoReload then "yes" else "no"}
- ${optionalString (cfg.reloadTime != null) (toString "reload-time ${toString cfg.reloadTime}")}
+ ${optionalString (cfg.reloadTime != null)
+ (toString "reload-time ${toString cfg.reloadTime}")}
prepopulate-query-feeds yes
${cfg.extraConfig}
diff --git a/home-manager/modules/programs/noti.nix b/home-manager/modules/programs/noti.nix
index 476c2eb1978..348555eef51 100644
--- a/home-manager/modules/programs/noti.nix
+++ b/home-manager/modules/programs/noti.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ...}:
+{ config, lib, pkgs, ... }:
with lib;
@@ -6,9 +6,7 @@ let
cfg = config.programs.noti;
-in
-
-{
+in {
meta.maintainers = [ maintainers.marsam ];
options.programs.noti = {
@@ -16,7 +14,7 @@ in
settings = mkOption {
type = types.attrsOf (types.attrsOf types.str);
- default = {};
+ default = { };
description = ''
Configuration written to
<filename>~/.config/noti/noti.yaml</filename>.
@@ -45,9 +43,8 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.noti ];
- xdg.configFile."noti/noti.yaml" = mkIf (cfg.settings != {}) {
- text = generators.toYAML {} cfg.settings;
- };
+ xdg.configFile."noti/noti.yaml" =
+ mkIf (cfg.settings != { }) { text = generators.toYAML { } cfg.settings; };
};
}
diff --git a/home-manager/modules/programs/notmuch-accounts.nix b/home-manager/modules/programs/notmuch-accounts.nix
index 7c9c93d3f95..fd4a811d73d 100644
--- a/home-manager/modules/programs/notmuch-accounts.nix
+++ b/home-manager/modules/programs/notmuch-accounts.nix
@@ -1,7 +1,5 @@
{ lib, ... }:
{
- options.notmuch = {
- enable = lib.mkEnableOption "notmuch indexing";
- };
+ options.notmuch = { enable = lib.mkEnableOption "notmuch indexing"; };
}
diff --git a/home-manager/modules/programs/notmuch.nix b/home-manager/modules/programs/notmuch.nix
index cd0b1384ad9..7e7a140b20c 100644
--- a/home-manager/modules/programs/notmuch.nix
+++ b/home-manager/modules/programs/notmuch.nix
@@ -9,53 +9,42 @@ let
mkIniKeyValue = key: value:
let
tweakVal = v:
- if isString v then v
- else if isList v then concatMapStringsSep ";" tweakVal v
- else if isBool v then (if v then "true" else "false")
- else toString v;
- in
- "${key}=${tweakVal value}";
-
- notmuchIni =
- recursiveUpdate
- {
- database = {
- path = config.accounts.email.maildirBasePath;
- };
-
- maildir = {
- synchronize_flags = cfg.maildir.synchronizeFlags;
- };
-
- new = {
- ignore = cfg.new.ignore;
- tags = cfg.new.tags;
- };
-
- user =
- let
- accounts =
- filter (a: a.notmuch.enable)
- (attrValues config.accounts.email.accounts);
- primary = filter (a: a.primary) accounts;
- secondaries = filter (a: !a.primary) accounts;
- in {
- name = catAttrs "realName" primary;
- primary_email = catAttrs "address" primary;
- other_email = catAttrs "aliases" primary
- ++ catAttrs "address" secondaries
- ++ catAttrs "aliases" secondaries;
- };
+ if isString v then
+ v
+ else if isList v then
+ concatMapStringsSep ";" tweakVal v
+ else if isBool v then
+ (if v then "true" else "false")
+ else
+ toString v;
+ in "${key}=${tweakVal value}";
+
+ notmuchIni = recursiveUpdate {
+ database = { path = config.accounts.email.maildirBasePath; };
+
+ maildir = { synchronize_flags = cfg.maildir.synchronizeFlags; };
+
+ new = {
+ ignore = cfg.new.ignore;
+ tags = cfg.new.tags;
+ };
- search = {
- exclude_tags = cfg.search.excludeTags;
- };
- }
- cfg.extraConfig;
+ user = let
+ accounts = filter (a: a.notmuch.enable)
+ (attrValues config.accounts.email.accounts);
+ primary = filter (a: a.primary) accounts;
+ secondaries = filter (a: !a.primary) accounts;
+ in {
+ name = catAttrs "realName" primary;
+ primary_email = catAttrs "address" primary;
+ other_email = catAttrs "aliases" primary ++ catAttrs "address" secondaries
+ ++ catAttrs "aliases" secondaries;
+ };
-in
+ search = { exclude_tags = cfg.search.excludeTags; };
+ } cfg.extraConfig;
-{
+in {
options = {
programs.notmuch = {
enable = mkEnableOption "Notmuch mail indexer";
@@ -65,7 +54,7 @@ in
options = {
ignore = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
description = ''
A list to specify files and directories that will not be
searched for messages by <command>notmuch new</command>.
@@ -83,7 +72,7 @@ in
};
};
};
- default = {};
+ default = { };
description = ''
Options related to email processing performed by
<command>notmuch new</command>.
@@ -92,7 +81,7 @@ in
extraConfig = mkOption {
type = types.attrsOf (types.attrsOf types.str);
- default = {};
+ default = { };
description = ''
Options that should be appended to the notmuch configuration file.
'';
@@ -159,11 +148,11 @@ in
config = mkIf cfg.enable {
assertions = [
{
- assertion = notmuchIni.user.name != [];
+ assertion = notmuchIni.user.name != [ ];
message = "notmuch: Must have a user name set.";
}
{
- assertion = notmuchIni.user.primary_email != [];
+ assertion = notmuchIni.user.primary_email != [ ];
message = "notmuch: Must have a user primary email address set.";
}
];
@@ -176,36 +165,27 @@ in
};
xdg.configFile."notmuch/notmuchrc".text =
- let
- toIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
- in
- "# Generated by Home Manager.\n\n"
- + toIni notmuchIni;
-
- home.file =
- let
- hook = name: cmds:
- {
- target = "${notmuchIni.database.path}/.notmuch/hooks/${name}";
- source = pkgs.writeScript name ''
- #!${pkgs.runtimeShell}
-
- export PATH="${pkgs.notmuch}/bin''${PATH:+:}$PATH"
- export NOTMUCH_CONFIG="${config.xdg.configHome}/notmuch/notmuchrc"
- export NMBGIT="${config.xdg.dataHome}/notmuch/nmbug"
-
- ${cmds}
- '';
- executable = true;
- };
- in
- optional (cfg.hooks.preNew != "")
- (hook "pre-new" cfg.hooks.preNew)
- ++
- optional (cfg.hooks.postNew != "")
- (hook "post-new" cfg.hooks.postNew)
- ++
- optional (cfg.hooks.postInsert != "")
- (hook "post-insert" cfg.hooks.postInsert);
+ let toIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
+ in ''
+ # Generated by Home Manager.
+
+ '' + toIni notmuchIni;
+
+ home.file = let
+ hook = name: cmds: {
+ "${notmuchIni.database.path}/.notmuch/hooks/${name}".source =
+ pkgs.writeShellScript name ''
+ export PATH="${pkgs.notmuch}/bin''${PATH:+:}$PATH"
+ export NOTMUCH_CONFIG="${config.xdg.configHome}/notmuch/notmuchrc"
+ export NMBGIT="${config.xdg.dataHome}/notmuch/nmbug"
+
+ ${cmds}
+ '';
+ };
+ in optionalAttrs (cfg.hooks.preNew != "") (hook "pre-new" cfg.hooks.preNew)
+ // optionalAttrs (cfg.hooks.postNew != "")
+ (hook "post-new" cfg.hooks.postNew)
+ // optionalAttrs (cfg.hooks.postInsert != "")
+ (hook "post-insert" cfg.hooks.postInsert);
};
}
diff --git a/home-manager/modules/programs/obs-studio.nix b/home-manager/modules/programs/obs-studio.nix
index f0dfecb63cc..6df5978384c 100644
--- a/home-manager/modules/programs/obs-studio.nix
+++ b/home-manager/modules/programs/obs-studio.nix
@@ -11,23 +11,18 @@ let
let
pluginDirs = map (pkg: "${pkg}/share/obs/obs-plugins") packages;
plugins = concatMapStringsSep " " (p: "${p}/*") pluginDirs;
- in
- pkgs.runCommand "obs-studio-plugins"
- {
- preferLocalBuild = true;
- allowSubstitutes = false;
- }
- ''
- mkdir $out
- [[ '${plugins}' ]] || exit 0
- for plugin in ${plugins}; do
- ln -s "$plugin" $out/
- done
- '';
-
-in
-
-{
+ in pkgs.runCommand "obs-studio-plugins" {
+ preferLocalBuild = true;
+ allowSubstitutes = false;
+ } ''
+ mkdir $out
+ [[ '${plugins}' ]] || exit 0
+ for plugin in ${plugins}; do
+ ln -s "$plugin" $out/
+ done
+ '';
+
+in {
meta.maintainers = [ maintainers.adisbladis ];
options = {
@@ -35,7 +30,7 @@ in
enable = mkEnableOption "obs-studio";
plugins = mkOption {
- default = [];
+ default = [ ];
example = literalExample "[ pkgs.obs-linuxbrowser ]";
description = "Optional OBS plugins.";
type = types.listOf types.package;
@@ -46,8 +41,7 @@ in
config = mkIf cfg.enable {
home.packages = [ package ];
- xdg.configFile."obs-studio/plugins" = mkIf (cfg.plugins != []) {
- source = mkPluginEnv cfg.plugins;
- };
+ xdg.configFile."obs-studio/plugins" =
+ mkIf (cfg.plugins != [ ]) { source = mkPluginEnv cfg.plugins; };
};
}
diff --git a/home-manager/modules/programs/offlineimap-accounts.nix b/home-manager/modules/programs/offlineimap-accounts.nix
index 015a5974ab3..afc7a019972 100644
--- a/home-manager/modules/programs/offlineimap-accounts.nix
+++ b/home-manager/modules/programs/offlineimap-accounts.nix
@@ -6,18 +6,14 @@ let
extraConfigType = with types; attrsOf (either (either str int) bool);
-in
-
-{
+in {
options.offlineimap = {
enable = mkEnableOption "OfflineIMAP";
extraConfig.account = mkOption {
type = extraConfigType;
- default = {};
- example = {
- autorefresh = 20;
- };
+ default = { };
+ example = { autorefresh = 20; };
description = ''
Extra configuration options to add to the account section.
'';
@@ -25,10 +21,8 @@ in
extraConfig.local = mkOption {
type = extraConfigType;
- default = {};
- example = {
- sync_deletes = true;
- };
+ default = { };
+ example = { sync_deletes = true; };
description = ''
Extra configuration options to add to the local account
section.
@@ -37,7 +31,7 @@ in
extraConfig.remote = mkOption {
type = extraConfigType;
- default = {};
+ default = { };
example = {
maxconnections = 2;
expunge = false;
diff --git a/home-manager/modules/programs/offlineimap.nix b/home-manager/modules/programs/offlineimap.nix
index 82143b630ad..4ce12ec0a61 100644
--- a/home-manager/modules/programs/offlineimap.nix
+++ b/home-manager/modules/programs/offlineimap.nix
@@ -12,11 +12,11 @@ let
toIni = generators.toINI {
mkKeyValue = key: value:
let
- value' =
- if isBool value then (if value then "yes" else "no")
- else toString value;
- in
- "${key} = ${value'}";
+ value' = if isBool value then
+ (if value then "yes" else "no")
+ else
+ toString value;
+ in "${key} = ${value'}";
};
# Generates a script to fetch only a specific account.
@@ -29,90 +29,65 @@ let
# Something like
#
# $ email <account name> <program name> <program args>
- genOfflineImapScript = account: with account;
+ genOfflineImapScript = account:
+ with account;
pkgs.writeShellScriptBin "offlineimap-${name}" ''
exec ${pkgs.offlineimap}/bin/offlineimap -a${account.name} "$@"
'';
- accountStr = account: with account;
+ accountStr = account:
+ with account;
let
postSyncHook = optionalAttrs (offlineimap.postSyncHookCommand != "") {
- postsynchook =
- pkgs.writeShellScriptBin
- "postsynchook"
- offlineimap.postSyncHookCommand
- + "/bin/postsynchook";
+ postsynchook = pkgs.writeShellScriptBin "postsynchook"
+ offlineimap.postSyncHookCommand + "/bin/postsynchook";
};
localType =
- if account.flavor == "gmail.com"
- then "GmailMaildir"
- else "Maildir";
+ if account.flavor == "gmail.com" then "GmailMaildir" else "Maildir";
- remoteType =
- if account.flavor == "gmail.com"
- then "Gmail"
- else "IMAP";
+ remoteType = if account.flavor == "gmail.com" then "Gmail" else "IMAP";
- remoteHost = optionalAttrs (imap.host != null) {
- remotehost = imap.host;
- };
+ remoteHost =
+ optionalAttrs (imap.host != null) { remotehost = imap.host; };
- remotePort = optionalAttrs ((imap.port or null) != null) {
- remoteport = imap.port;
- };
+ remotePort =
+ optionalAttrs ((imap.port or null) != null) { remoteport = imap.port; };
- ssl =
- if imap.tls.enable
- then
- {
- ssl = true;
- sslcacertfile = imap.tls.certificatesFile;
- starttls = imap.tls.useStartTls;
- }
- else
- {
- ssl = false;
- };
+ ssl = if imap.tls.enable then {
+ ssl = true;
+ sslcacertfile = imap.tls.certificatesFile;
+ starttls = imap.tls.useStartTls;
+ } else {
+ ssl = false;
+ };
remotePassEval =
- let
- arglist = concatMapStringsSep "," (x: "'${x}'") passwordCommand;
- in
- optionalAttrs (passwordCommand != null) {
- remotepasseval = ''get_pass("${name}", [${arglist}])'';
- };
- in
- toIni {
- "Account ${name}" = {
- localrepository = "${name}-local";
- remoterepository = "${name}-remote";
- }
- // postSyncHook
- // offlineimap.extraConfig.account;
-
- "Repository ${name}-local" = {
- type = localType;
- localfolders = maildir.absPath;
- }
- // offlineimap.extraConfig.local;
-
- "Repository ${name}-remote" = {
- type = remoteType;
- remoteuser = userName;
- }
- // remoteHost
- // remotePort
- // remotePassEval
- // ssl
+ let arglist = concatMapStringsSep "," (x: "'${x}'") passwordCommand;
+ in optionalAttrs (passwordCommand != null) {
+ remotepasseval = ''get_pass("${name}", [${arglist}])'';
+ };
+ in toIni {
+ "Account ${name}" = {
+ localrepository = "${name}-local";
+ remoterepository = "${name}-remote";
+ } // postSyncHook // offlineimap.extraConfig.account;
+
+ "Repository ${name}-local" = {
+ type = localType;
+ localfolders = maildir.absPath;
+ } // offlineimap.extraConfig.local;
+
+ "Repository ${name}-remote" = {
+ type = remoteType;
+ remoteuser = userName;
+ } // remoteHost // remotePort // remotePassEval // ssl
// offlineimap.extraConfig.remote;
- };
+ };
extraConfigType = with types; attrsOf (either (either str int) bool);
-in
-
-{
+in {
options = {
programs.offlineimap = {
enable = mkEnableOption "OfflineIMAP";
@@ -133,7 +108,7 @@ in
extraConfig.general = mkOption {
type = extraConfigType;
- default = {};
+ default = { };
example = {
maxage = 30;
ui = "blinkenlights";
@@ -146,10 +121,8 @@ in
extraConfig.default = mkOption {
type = extraConfigType;
- default = {};
- example = {
- gmailtrashfolder = "[Gmail]/Papierkorb";
- };
+ default = { };
+ example = { gmailtrashfolder = "[Gmail]/Papierkorb"; };
description = ''
Extra configuration options added to the
<option>DEFAULT</option> section.
@@ -158,7 +131,7 @@ in
extraConfig.mbnames = mkOption {
type = extraConfigType;
- default = {};
+ default = { };
example = literalExample ''
{
filename = "~/.config/mutt/mailboxes";
@@ -181,27 +154,20 @@ in
xdg.configFile."offlineimap/get_settings.py".text = cfg.pythonFile;
- 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 = concatMapStringsSep "," (a: a.name) accounts;
- pythonfile = "${config.xdg.configHome}/offlineimap/get_settings.py";
- metadata = "${config.xdg.dataHome}/offlineimap";
- }
- // cfg.extraConfig.general;
- }
- // optionalAttrs (cfg.extraConfig.mbnames != {}) {
- mbnames = { enabled = true; } // cfg.extraConfig.mbnames;
- }
- // optionalAttrs (cfg.extraConfig.default != {}) {
- DEFAULT = cfg.extraConfig.default;
- })
- + "\n"
- + concatStringsSep "\n" (map accountStr accounts);
+ 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 = concatMapStringsSep "," (a: a.name) accounts;
+ pythonfile = "${config.xdg.configHome}/offlineimap/get_settings.py";
+ metadata = "${config.xdg.dataHome}/offlineimap";
+ } // cfg.extraConfig.general;
+ } // optionalAttrs (cfg.extraConfig.mbnames != { }) {
+ mbnames = { enabled = true; } // cfg.extraConfig.mbnames;
+ } // optionalAttrs (cfg.extraConfig.default != { }) {
+ DEFAULT = cfg.extraConfig.default;
+ }) + "\n" + concatStringsSep "\n" (map accountStr accounts);
};
}
diff --git a/home-manager/modules/programs/opam.nix b/home-manager/modules/programs/opam.nix
index 4de2e82da55..a61ff7878df 100644
--- a/home-manager/modules/programs/opam.nix
+++ b/home-manager/modules/programs/opam.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.opam;
-in
-
-{
+in {
meta.maintainers = [ maintainers.marsam ];
options.programs.opam = {
diff --git a/home-manager/modules/programs/password-store.nix b/home-manager/modules/programs/password-store.nix
new file mode 100644
index 00000000000..db31146a1ba
--- /dev/null
+++ b/home-manager/modules/programs/password-store.nix
@@ -0,0 +1,62 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.programs.password-store;
+
+in {
+ meta.maintainers = with maintainers; [ pacien ];
+
+ options.programs.password-store = {
+ enable = mkEnableOption "Password store";
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.pass;
+ defaultText = literalExample "pkgs.pass";
+ example = literalExample ''
+ pkgs.pass.withExtensions (exts: [ exts.pass-otp ])
+ '';
+ description = ''
+ The <literal>pass</literal> package to use.
+ Can be used to specify extensions.
+ '';
+ };
+
+ settings = mkOption rec {
+ type = with types; attrsOf str;
+ apply = mergeAttrs default;
+ default = {
+ PASSWORD_STORE_DIR = "${config.xdg.dataHome}/password-store";
+ };
+ defaultText = literalExample ''
+ { PASSWORD_STORE_DIR = "$XDG_DATA_HOME/password-store"; }
+ '';
+ example = literalExample ''
+ {
+ PASSWORD_STORE_DIR = "/some/directory";
+ PASSWORD_STORE_KEY = "12345678";
+ PASSWORD_STORE_CLIP_TIME = "60";
+ }
+ '';
+ description = ''
+ The <literal>pass</literal> environment variables dictionary.
+ </para><para>
+ See the "Environment variables" section of
+ <citerefentry>
+ <refentrytitle>pass</refentrytitle>
+ <manvolnum>1</manvolnum>
+ </citerefentry>
+ and the extension man pages for more information about the
+ available keys.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = [ cfg.package ];
+ home.sessionVariables = cfg.settings;
+ };
+}
diff --git a/home-manager/modules/programs/pazi.nix b/home-manager/modules/programs/pazi.nix
new file mode 100644
index 00000000000..e1a08eb615a
--- /dev/null
+++ b/home-manager/modules/programs/pazi.nix
@@ -0,0 +1,55 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.programs.pazi;
+
+in {
+ meta.maintainers = [ maintainers.marsam ];
+
+ options.programs.pazi = {
+ enable = mkEnableOption "pazi";
+
+ enableBashIntegration = mkOption {
+ default = true;
+ type = types.bool;
+ description = ''
+ Whether to enable Bash integration.
+ '';
+ };
+
+ enableZshIntegration = mkOption {
+ default = true;
+ type = types.bool;
+ description = ''
+ Whether to enable Zsh integration.
+ '';
+ };
+
+ enableFishIntegration = mkOption {
+ default = true;
+ type = types.bool;
+ description = ''
+ Whether to enable Fish integration.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.packages = [ pkgs.pazi ];
+
+ programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
+ eval "$(${pkgs.pazi}/bin/pazi init bash)"
+ '';
+
+ programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
+ eval "$(${pkgs.pazi}/bin/pazi init zsh)"
+ '';
+
+ programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
+ ${pkgs.pazi}/bin/pazi init fish | source
+ '';
+ };
+}
diff --git a/home-manager/modules/programs/pidgin.nix b/home-manager/modules/programs/pidgin.nix
index 8dcb2122172..a375fd1b2bd 100644
--- a/home-manager/modules/programs/pidgin.nix
+++ b/home-manager/modules/programs/pidgin.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.pidgin;
-in
-
-{
+in {
meta.maintainers = [ maintainers.rycee ];
options = {
@@ -23,7 +21,7 @@ in
};
plugins = mkOption {
- default = [];
+ default = [ ];
example = literalExample "[ pkgs.pidgin-otr pkgs.pidgin-osd ]";
description = "Plugins that should be available to Pidgin.";
};
diff --git a/home-manager/modules/programs/readline.nix b/home-manager/modules/programs/readline.nix
new file mode 100644
index 00000000000..2f79df6e103
--- /dev/null
+++ b/home-manager/modules/programs/readline.nix
@@ -0,0 +1,77 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.programs.readline;
+
+ mkSetVariableStr = n: v:
+ let
+ mkValueStr = v:
+ if v == true then
+ "on"
+ else if v == false then
+ "off"
+ else if isInt v then
+ toString v
+ else if isString v then
+ v
+ else
+ abort ("values ${toPretty v} is of unsupported type");
+ in "set ${n} ${mkValueStr v}";
+
+ mkBindingStr = k: v: ''"${k}": ${v}'';
+
+in {
+ options.programs.readline = {
+ enable = mkEnableOption "readline";
+
+ bindings = mkOption {
+ default = { };
+ type = types.attrsOf types.str;
+ example = literalExample ''
+ { "\\C-h" = "backward-kill-word"; }
+ '';
+ description = "Readline bindings.";
+ };
+
+ variables = mkOption {
+ type = with types; attrsOf (either str (either int bool));
+ default = { };
+ example = { expand-tilde = true; };
+ description = ''
+ Readline customization variable assignments.
+ '';
+ };
+
+ includeSystemConfig = mkOption {
+ type = types.bool;
+ default = true;
+ description = "Whether to include the system-wide configuration.";
+ };
+
+ extraConfig = mkOption {
+ type = types.lines;
+ default = "";
+ description = ''
+ Configuration lines appended unchanged to the end of the
+ <filename>~/.inputrc</filename> file.
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ home.file.".inputrc".text = let
+ configStr = concatStringsSep "\n"
+ (optional cfg.includeSystemConfig "$include /etc/inputrc"
+ ++ mapAttrsToList mkSetVariableStr cfg.variables
+ ++ mapAttrsToList mkBindingStr cfg.bindings);
+ in ''
+ # Generated by Home Manager.
+
+ ${configStr}
+ ${cfg.extraConfig}
+ '';
+ };
+}
diff --git a/home-manager/modules/programs/rofi.nix b/home-manager/modules/programs/rofi.nix
index e64e5d4782e..f344e88e2ff 100644
--- a/home-manager/modules/programs/rofi.nix
+++ b/home-manager/modules/programs/rofi.nix
@@ -7,10 +7,11 @@ let
cfg = config.programs.rofi;
- colorOption = description: mkOption {
- type = types.str;
- description = description;
- };
+ colorOption = description:
+ mkOption {
+ type = types.str;
+ description = description;
+ };
rowColorSubmodule = types.submodule {
options = {
@@ -71,72 +72,64 @@ let
};
valueToString = value:
- if isBool value
- then (if value then "true" else "else")
- else toString value;
+ if isBool value then (if value then "true" else "else") else toString value;
- windowColorsToString = window: concatStringsSep ", " (with window; [
- background
- border
- separator
- ]);
+ windowColorsToString = window:
+ concatStringsSep ", " (with window; [ background border separator ]);
rowsColorsToString = rows: ''
- ${optionalString
- (rows.normal != null)
- (setOption "color-normal" (rowColorsToString rows.normal))}
- ${optionalString
- (rows.active != null)
- (setOption "color-active" (rowColorsToString rows.active))}
- ${optionalString
- (rows.urgent != null)
- (setOption "color-urgent" (rowColorsToString rows.urgent))}
+ ${optionalString (rows.normal != null)
+ (setOption "color-normal" (rowColorsToString rows.normal))}
+ ${optionalString (rows.active != null)
+ (setOption "color-active" (rowColorsToString rows.active))}
+ ${optionalString (rows.urgent != null)
+ (setOption "color-urgent" (rowColorsToString rows.urgent))}
'';
- rowColorsToString = row: concatStringsSep ", " (with row; [
- background
- foreground
- backgroundAlt
- highlight.background
- highlight.foreground
- ]);
+ rowColorsToString = row:
+ concatStringsSep ", " (with row; [
+ background
+ foreground
+ backgroundAlt
+ highlight.background
+ highlight.foreground
+ ]);
setOption = name: value:
optionalString (value != null) "rofi.${name}: ${valueToString value}";
- setColorScheme = colors: optionalString (colors != null) ''
- ${optionalString
- (colors.window != null)
- setOption "color-window" (windowColorsToString colors.window)}
- ${optionalString
- (colors.rows != null)
- (rowsColorsToString colors.rows)}
- '';
+ setColorScheme = colors:
+ optionalString (colors != null) ''
+ ${optionalString (colors.window != null) setOption "color-window"
+ (windowColorsToString colors.window)}
+ ${optionalString (colors.rows != null) (rowsColorsToString colors.rows)}
+ '';
locationsMap = {
- center = 0;
- top-left = 1;
- top = 2;
- top-right = 3;
- right = 4;
+ center = 0;
+ top-left = 1;
+ top = 2;
+ top-right = 3;
+ right = 4;
bottom-right = 5;
- bottom = 6;
- bottom-left = 7;
- left = 8;
+ bottom = 6;
+ bottom-left = 7;
+ left = 8;
};
- themeName =
- if (cfg.theme == null) then null
- else if (lib.isString cfg.theme) then cfg.theme
- else lib.removeSuffix ".rasi" (baseNameOf cfg.theme);
+ themeName = if (cfg.theme == null) then
+ null
+ else if (lib.isString cfg.theme) then
+ cfg.theme
+ else
+ lib.removeSuffix ".rasi" (baseNameOf cfg.theme);
themePath = if (lib.isString cfg.theme) then null else cfg.theme;
-in
-
-{
+in {
options.programs.rofi = {
- enable = mkEnableOption "Rofi: A window switcher, application launcher and dmenu replacement";
+ enable = mkEnableOption
+ "Rofi: A window switcher, application launcher and dmenu replacement";
width = mkOption {
default = null;
@@ -295,14 +288,12 @@ in
};
config = mkIf cfg.enable {
- assertions = [
- {
- assertion = cfg.theme == null || cfg.colors == null;
- message = ''
- Cannot use the rofi options 'theme' and 'colors' simultaneously.
- '';
- }
- ];
+ assertions = [{
+ assertion = cfg.theme == null || cfg.colors == null;
+ message = ''
+ Cannot use the rofi options 'theme' and 'colors' simultaneously.
+ '';
+ }];
home.packages = [ pkgs.rofi ];
@@ -314,11 +305,8 @@ in
${setOption "eh" cfg.rowHeight}
${setOption "padding" cfg.padding}
${setOption "separator-style" cfg.separator}
- ${setOption "hide-scrollbar" (
- if (cfg.scrollbar != null)
- then (! cfg.scrollbar)
- else cfg.scrollbar
- )}
+ ${setOption "hide-scrollbar"
+ (if (cfg.scrollbar != null) then (!cfg.scrollbar) else cfg.scrollbar)}
${setOption "terminal" cfg.terminal}
${setOption "cycle" cfg.cycle}
${setOption "fullscreen" cfg.fullscreen}
@@ -333,7 +321,7 @@ in
'';
xdg.dataFile = mkIf (themePath != null) {
- "rofi/themes/${themeName}.rasi".source = themePath;
+ "rofi/themes/${themeName}.rasi".source = themePath;
};
};
}
diff --git a/home-manager/modules/programs/rtorrent.nix b/home-manager/modules/programs/rtorrent.nix
index 6300969a519..7beeb2e4221 100644
--- a/home-manager/modules/programs/rtorrent.nix
+++ b/home-manager/modules/programs/rtorrent.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.rtorrent;
-in
-
-{
+in {
meta.maintainers = [ maintainers.marsam ];
options.programs.rtorrent = {
@@ -30,8 +28,7 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.rtorrent ];
- xdg.configFile."rtorrent/rtorrent.rc" = mkIf (cfg.settings != "") {
- text = cfg.settings;
- };
+ xdg.configFile."rtorrent/rtorrent.rc" =
+ mkIf (cfg.settings != "") { text = cfg.settings; };
};
}
diff --git a/home-manager/modules/programs/skim.nix b/home-manager/modules/programs/skim.nix
index de1bff30fce..c90fe1b1a35 100644
--- a/home-manager/modules/programs/skim.nix
+++ b/home-manager/modules/programs/skim.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.skim;
-in
-
-{
+in {
options.programs.skim = {
enable = mkEnableOption "skim - a command-line fuzzy finder";
@@ -24,7 +22,7 @@ in
defaultOptions = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "--height 40%" "--prompt ⟫" ];
description = ''
Extra command line options given to skim by default.
@@ -43,7 +41,7 @@ in
fileWidgetOptions = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "--preview 'head {}'" ];
description = ''
Command line options for the CTRL-T keybinding.
@@ -53,7 +51,7 @@ in
changeDirWidgetCommand = mkOption {
type = types.nullOr types.str;
default = null;
- example = "fd --type d" ;
+ example = "fd --type d";
description = ''
The command that gets executed as the source for skim for the
ALT-C keybinding.
@@ -62,7 +60,7 @@ in
changeDirWidgetOptions = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "--preview 'tree -C {} | head -200'" ];
description = ''
Command line options for the ALT-C keybinding.
@@ -71,7 +69,7 @@ in
historyWidgetOptions = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "--tac" "--exact" ];
description = ''
Command line options for the CTRL-R keybinding.
@@ -98,18 +96,16 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.skim ];
- home.sessionVariables =
- mapAttrs (n: v: toString v) (
- filterAttrs (n: v: v != [] && v != null) {
- SKIM_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
- SKIM_ALT_C_OPTS = cfg.changeDirWidgetOptions;
- SKIM_CTRL_R_OPTS = cfg.historyWidgetOptions;
- SKIM_CTRL_T_COMMAND = cfg.fileWidgetCommand;
- SKIM_CTRL_T_OPTS = cfg.fileWidgetOptions;
- SKIM_DEFAULT_COMMAND = cfg.defaultCommand;
- SKIM_DEFAULT_OPTIONS = cfg.defaultOptions;
- }
- );
+ home.sessionVariables = mapAttrs (n: v: toString v)
+ (filterAttrs (n: v: v != [ ] && v != null) {
+ SKIM_ALT_C_COMMAND = cfg.changeDirWidgetCommand;
+ SKIM_ALT_C_OPTS = cfg.changeDirWidgetOptions;
+ SKIM_CTRL_R_OPTS = cfg.historyWidgetOptions;
+ SKIM_CTRL_T_COMMAND = cfg.fileWidgetCommand;
+ SKIM_CTRL_T_OPTS = cfg.fileWidgetOptions;
+ SKIM_DEFAULT_COMMAND = cfg.defaultCommand;
+ SKIM_DEFAULT_OPTIONS = cfg.defaultOptions;
+ });
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
if [[ :$SHELLOPTS: =~ :(vi|emacs): ]]; then
diff --git a/home-manager/modules/programs/ssh.nix b/home-manager/modules/programs/ssh.nix
index ab61c0dcbc4..6b0747dd9b1 100644
--- a/home-manager/modules/programs/ssh.nix
+++ b/home-manager/modules/programs/ssh.nix
@@ -183,10 +183,14 @@ let
};
certificateFile = mkOption {
- type = types.nullOr types.path;
- default = null;
+ type = with types; either (listOf str) (nullOr str);
+ default = [];
+ apply = p:
+ if p == null then []
+ else if isString p then [p]
+ else p;
description = ''
- Specifies a file from which the user certificate is read.
+ Specifies files from which the user certificate is read.
'';
};
@@ -273,7 +277,6 @@ let
++ optional cf.forwardX11Trusted " ForwardX11Trusted yes"
++ optional cf.identitiesOnly " IdentitiesOnly yes"
++ optional (cf.user != null) " User ${cf.user}"
- ++ optional (cf.certificateFile != null) " CertificateFile ${cf.certificateFile}"
++ optional (cf.hostname != null) " HostName ${cf.hostname}"
++ optional (cf.addressFamily != null) " AddressFamily ${cf.addressFamily}"
++ optional (cf.sendEnv != []) " SendEnv ${unwords cf.sendEnv}"
@@ -284,6 +287,7 @@ let
++ optional (cf.proxyCommand != null) " ProxyCommand ${cf.proxyCommand}"
++ optional (cf.proxyJump != null) " ProxyJump ${cf.proxyJump}"
++ map (file: " IdentityFile ${file}") cf.identityFile
+ ++ map (file: " CertificateFile ${file}") cf.certificateFile
++ map (f: " LocalForward" + addressPort f.bind + addressPort f.host) cf.localForwards
++ map (f: " RemoteForward" + addressPort f.bind + addressPort f.host) cf.remoteForwards
++ map (f: " DynamicForward" + addressPort f) cf.dynamicForwards
diff --git a/home-manager/modules/programs/starship.nix b/home-manager/modules/programs/starship.nix
index 81793c7a6f6..7c7819865f7 100644
--- a/home-manager/modules/programs/starship.nix
+++ b/home-manager/modules/programs/starship.nix
@@ -7,28 +7,32 @@ let
cfg = config.programs.starship;
configFile = config:
- pkgs.runCommand "config.toml"
- {
- buildInputs = [ pkgs.remarshal ];
- preferLocalBuild = true;
- allowSubstitutes = false;
- }
- ''
- remarshal -if json -of toml \
- < ${pkgs.writeText "config.json" (builtins.toJSON config)} \
- > $out
- '';
-in
+ pkgs.runCommand "config.toml" {
+ buildInputs = [ pkgs.remarshal ];
+ preferLocalBuild = true;
+ allowSubstitutes = false;
+ } ''
+ remarshal -if json -of toml \
+ < ${pkgs.writeText "config.json" (builtins.toJSON config)} \
+ > $out
+ '';
-{
+in {
meta.maintainers = [ maintainers.marsam ];
options.programs.starship = {
enable = mkEnableOption "starship";
+ package = mkOption {
+ type = types.package;
+ default = pkgs.starship;
+ defaultText = literalExample "pkgs.starship";
+ description = "The package to use for the starship binary.";
+ };
+
settings = mkOption {
type = types.attrs;
- default = {};
+ default = { };
description = ''
Configuration written to
<filename>~/.config/starship.toml</filename>.
@@ -64,27 +68,26 @@ in
};
config = mkIf cfg.enable {
- home.packages = [ pkgs.starship ];
+ home.packages = [ cfg.package ];
- xdg.configFile."starship.toml" = mkIf (cfg.settings != {}) {
- source = configFile cfg.settings;
- };
+ xdg.configFile."starship.toml" =
+ mkIf (cfg.settings != { }) { source = configFile cfg.settings; };
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
if [[ -z $INSIDE_EMACS ]]; then
- eval "$(${pkgs.starship}/bin/starship init bash)"
+ eval "$(${cfg.package}/bin/starship init bash)"
fi
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
if [ -z "$INSIDE_EMACS" ]; then
- eval "$(${pkgs.starship}/bin/starship init zsh)"
+ eval "$(${cfg.package}/bin/starship init zsh)"
fi
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
if test -z "$INSIDE_EMACS"
- eval (${pkgs.starship}/bin/starship init fish)
+ eval (${cfg.package}/bin/starship init fish)
end
'';
};
diff --git a/home-manager/modules/programs/taskwarrior.nix b/home-manager/modules/programs/taskwarrior.nix
index eeacc77da29..cf95511f8ef 100644
--- a/home-manager/modules/programs/taskwarrior.nix
+++ b/home-manager/modules/programs/taskwarrior.nix
@@ -9,38 +9,39 @@ let
themePath = theme: "${pkgs.taskwarrior}/share/doc/task/rc/${theme}.theme";
includeTheme = location:
- if location == null then ""
- else if isString location then "include ${themePath location}"
- else "include ${location}";
+ if location == null then
+ ""
+ else if isString location then
+ "include ${themePath location}"
+ else
+ "include ${location}";
formatValue = value:
- if isBool value then if value then "true" else "false"
- else if isList value then concatMapStringsSep "," formatValue value
- else toString value;
+ if isBool value then
+ if value then "true" else "false"
+ else if isList value then
+ concatMapStringsSep "," formatValue value
+ else
+ toString value;
- formatLine = key: value:
- "${key}=${formatValue value}";
+ formatLine = key: value: "${key}=${formatValue value}";
formatSet = key: values:
(concatStringsSep "\n"
- (mapAttrsToList
- (subKey: subValue: formatPair "${key}.${subKey}" subValue)
+ (mapAttrsToList (subKey: subValue: formatPair "${key}.${subKey}" subValue)
values));
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;
-in
-
-{
+in {
options = {
programs.taskwarrior = {
enable = mkEnableOption "Task Warrior";
config = mkOption {
type = types.attrs;
- default = {};
+ default = { };
example = literalExample ''
{
confirmation = false;
@@ -103,8 +104,7 @@ in
data.location=${cfg.dataLocation}
${includeTheme cfg.colorTheme}
- ${concatStringsSep "\n" (
- mapAttrsToList formatPair cfg.config)}
+ ${concatStringsSep "\n" (mapAttrsToList formatPair cfg.config)}
${cfg.extraConfig}
'';
diff --git a/home-manager/modules/programs/termite.nix b/home-manager/modules/programs/termite.nix
index a5b1cebe775..8a05db03558 100644
--- a/home-manager/modules/programs/termite.nix
+++ b/home-manager/modules/programs/termite.nix
@@ -13,9 +13,7 @@ let
fi
'';
-in
-
-{
+in {
options = {
programs.termite = {
enable = mkEnableOption "Termite VTE-based terminal";
@@ -61,7 +59,9 @@ in
mouseAutohide = mkOption {
default = null;
type = types.nullOr types.bool;
- description = "Automatically hide the mouse pointer when you start typing.";
+ description = ''
+ Automatically hide the mouse pointer when you start typing.
+ '';
};
scrollOnOutput = mkOption {
@@ -73,7 +73,9 @@ in
scrollOnKeystroke = mkOption {
default = null;
type = types.nullOr types.bool;
- description = "Scroll to the bottom automatically when a key is pressed.";
+ description = ''
+ Scroll to the bottom automatically when a key is pressed.
+ '';
};
searchWrap = mkOption {
@@ -106,14 +108,16 @@ in
default = null;
example = "terminal";
type = types.nullOr types.str;
- description = "The name of the icon to be used for the terminal process.";
+ description =
+ "The name of the icon to be used for the terminal process.";
};
scrollbackLines = mkOption {
default = null;
example = 10000;
type = types.nullOr types.int;
- description = "Set the number of lines to limit the terminal's scrollback.";
+ description =
+ "Set the number of lines to limit the terminal's scrollback.";
};
browser = mkOption {
@@ -149,7 +153,8 @@ in
filterUnmatchedUrls = mkOption {
default = null;
type = types.nullOr types.bool;
- description = "Whether to hide url hints not matching input in url hints mode.";
+ description =
+ "Whether to hide url hints not matching input in url hints mode.";
};
modifyOtherKeys = mkOption {
@@ -178,7 +183,7 @@ in
scrollbar = mkOption {
default = null;
type = types.nullOr (types.enum [ "off" "left" "right" ]);
- description = "Scroll to the bottom when the shell generates output.";
+ description = "Scrollbar position.";
};
backgroundColor = mkOption {
@@ -290,7 +295,8 @@ in
default = "";
example = "fullscreen = true";
type = types.lines;
- description = "Extra options that should be added to [options] section.";
+ description =
+ "Extra options that should be added to [options] section.";
};
colorsExtra = mkOption {
@@ -301,78 +307,81 @@ in
color2 = #60b48a
'';
type = types.lines;
- description = "Extra colors options that should be added to [colors] section.";
+ description =
+ "Extra colors options that should be added to [colors] section.";
};
hintsExtra = mkOption {
default = "";
example = "border = #3f3f3f";
type = types.lines;
- description = "Extra hints options that should be added to [hints] section.";
+ description =
+ "Extra hints options that should be added to [hints] section.";
};
};
};
- config = (
- let
- boolToString = v: if v then "true" else "false";
- optionalBoolean = name: val: lib.optionalString (val != null) "${name} = ${boolToString val}";
- optionalInteger = name: val: lib.optionalString (val != null) "${name} = ${toString val}";
- optionalString = name: val: lib.optionalString (val != null) "${name} = ${val}";
- in mkIf cfg.enable {
- home.packages = [ pkgs.termite ];
- xdg.configFile."termite/config".text = ''
- [options]
- ${optionalBoolean "allow_bold" cfg.allowBold}
- ${optionalBoolean "audible_bell" cfg.audibleBell}
- ${optionalString "browser" cfg.browser}
- ${optionalBoolean "clickable_url" cfg.clickableUrl}
- ${optionalString "cursor_blink" cfg.cursorBlink}
- ${optionalString "cursor_shape" cfg.cursorShape}
- ${optionalBoolean "dynamic_title" cfg.dynamicTitle}
- ${optionalBoolean "filter_unmatched_urls" cfg.filterUnmatchedUrls}
- ${optionalString "font" cfg.font}
- ${optionalBoolean "fullscreen" cfg.fullscreen}
- ${optionalString "geometry" cfg.geometry}
- ${optionalString "icon_name" cfg.iconName}
- ${optionalBoolean "modify_other_keys" cfg.modifyOtherKeys}
- ${optionalBoolean "mouse_autohide" cfg.mouseAutohide}
- ${optionalBoolean "scroll_on_keystroke" cfg.scrollOnKeystroke}
- ${optionalBoolean "scroll_on_output" cfg.scrollOnOutput}
- ${optionalInteger "scrollback_lines" cfg.scrollbackLines}
- ${optionalString "scrollbar" cfg.scrollbar}
- ${optionalBoolean "search_wrap" cfg.searchWrap}
- ${optionalBoolean "size_hints" cfg.sizeHints}
- ${optionalBoolean "urgent_on_bell" cfg.urgentOnBell}
-
- ${cfg.optionsExtra}
-
- [colors]
- ${optionalString "background" cfg.backgroundColor}
- ${optionalString "cursor" cfg.cursorColor}
- ${optionalString "cursor_foreground" cfg.cursorForegroundColor}
- ${optionalString "foreground" cfg.foregroundColor}
- ${optionalString "foregroundBold" cfg.foregroundBoldColor}
- ${optionalString "highlight" cfg.highlightColor}
-
- ${cfg.colorsExtra}
-
- [hints]
- ${optionalString "active_background" cfg.hintsActiveBackgroundColor}
- ${optionalString "active_foreground" cfg.hintsActiveForegroundColor}
- ${optionalString "background" cfg.hintsBackgroundColor}
- ${optionalString "border" cfg.hintsBorderColor}
- ${optionalInteger "border_width" cfg.hintsBorderWidth}
- ${optionalString "font" cfg.hintsFont}
- ${optionalString "foreground" cfg.hintsForegroundColor}
- ${optionalInteger "padding" cfg.hintsPadding}
- ${optionalInteger "roundness" cfg.hintsRoundness}
-
- ${cfg.hintsExtra}
- '';
-
- programs.bash.initExtra = vteInitStr;
- programs.zsh.initExtra = vteInitStr;
- }
- );
+ config = (let
+ boolToString = v: if v then "true" else "false";
+ optionalBoolean = name: val:
+ lib.optionalString (val != null) "${name} = ${boolToString val}";
+ optionalInteger = name: val:
+ lib.optionalString (val != null) "${name} = ${toString val}";
+ optionalString = name: val:
+ lib.optionalString (val != null) "${name} = ${val}";
+ in mkIf cfg.enable {
+ home.packages = [ pkgs.termite ];
+ xdg.configFile."termite/config".text = ''
+ [options]
+ ${optionalBoolean "allow_bold" cfg.allowBold}
+ ${optionalBoolean "audible_bell" cfg.audibleBell}
+ ${optionalString "browser" cfg.browser}
+ ${optionalBoolean "clickable_url" cfg.clickableUrl}
+ ${optionalString "cursor_blink" cfg.cursorBlink}
+ ${optionalString "cursor_shape" cfg.cursorShape}
+ ${optionalBoolean "dynamic_title" cfg.dynamicTitle}
+ ${optionalBoolean "filter_unmatched_urls" cfg.filterUnmatchedUrls}
+ ${optionalString "font" cfg.font}
+ ${optionalBoolean "fullscreen" cfg.fullscreen}
+ ${optionalString "geometry" cfg.geometry}
+ ${optionalString "icon_name" cfg.iconName}
+ ${optionalBoolean "modify_other_keys" cfg.modifyOtherKeys}
+ ${optionalBoolean "mouse_autohide" cfg.mouseAutohide}
+ ${optionalBoolean "scroll_on_keystroke" cfg.scrollOnKeystroke}
+ ${optionalBoolean "scroll_on_output" cfg.scrollOnOutput}
+ ${optionalInteger "scrollback_lines" cfg.scrollbackLines}
+ ${optionalString "scrollbar" cfg.scrollbar}
+ ${optionalBoolean "search_wrap" cfg.searchWrap}
+ ${optionalBoolean "size_hints" cfg.sizeHints}
+ ${optionalBoolean "urgent_on_bell" cfg.urgentOnBell}
+
+ ${cfg.optionsExtra}
+
+ [colors]
+ ${optionalString "background" cfg.backgroundColor}
+ ${optionalString "cursor" cfg.cursorColor}
+ ${optionalString "cursor_foreground" cfg.cursorForegroundColor}
+ ${optionalString "foreground" cfg.foregroundColor}
+ ${optionalString "foregroundBold" cfg.foregroundBoldColor}
+ ${optionalString "highlight" cfg.highlightColor}
+
+ ${cfg.colorsExtra}
+
+ [hints]
+ ${optionalString "active_background" cfg.hintsActiveBackgroundColor}
+ ${optionalString "active_foreground" cfg.hintsActiveForegroundColor}
+ ${optionalString "background" cfg.hintsBackgroundColor}
+ ${optionalString "border" cfg.hintsBorderColor}
+ ${optionalInteger "border_width" cfg.hintsBorderWidth}
+ ${optionalString "font" cfg.hintsFont}
+ ${optionalString "foreground" cfg.hintsForegroundColor}
+ ${optionalInteger "padding" cfg.hintsPadding}
+ ${optionalInteger "roundness" cfg.hintsRoundness}
+
+ ${cfg.hintsExtra}
+ '';
+
+ programs.bash.initExtra = vteInitStr;
+ programs.zsh.initExtra = vteInitStr;
+ });
}
diff --git a/home-manager/modules/programs/texlive.nix b/home-manager/modules/programs/texlive.nix
index 0f8953e9f91..08a376d654a 100644
--- a/home-manager/modules/programs/texlive.nix
+++ b/home-manager/modules/programs/texlive.nix
@@ -8,9 +8,7 @@ let
texlivePkgs = cfg.extraPackages pkgs.texlive;
-in
-
-{
+in {
meta.maintainers = [ maintainers.rycee ];
options = {
@@ -35,13 +33,11 @@ in
};
config = mkIf cfg.enable {
- assertions = [
- {
- assertion = texlivePkgs != {};
- message = "Must provide at least one extra package in"
- + " 'programs.texlive.extraPackages'.";
- }
- ];
+ assertions = [{
+ assertion = texlivePkgs != { };
+ message = "Must provide at least one extra package in"
+ + " 'programs.texlive.extraPackages'.";
+ }];
home.packages = [ cfg.package ];
diff --git a/home-manager/modules/programs/urxvt.nix b/home-manager/modules/programs/urxvt.nix
index 6f4eb3ff7ba..e4c72bfe272 100644
--- a/home-manager/modules/programs/urxvt.nix
+++ b/home-manager/modules/programs/urxvt.nix
@@ -6,9 +6,7 @@ let
cfg = config.programs.urxvt;
-in
-
-{
+in {
options.programs.urxvt = {
enable = mkEnableOption "rxvt-unicode terminal emulator";
@@ -21,14 +19,14 @@ in
fonts = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
description = "List of fonts to be used.";
example = [ "xft:Droid Sans Mono Nerd Font:size=9" ];
};
keybindings = mkOption {
type = types.attrsOf types.str;
- default = {};
+ default = { };
description = "Mapping of keybindings to actions";
example = literalExample ''
{
@@ -41,7 +39,8 @@ in
iso14755 = mkOption {
type = types.bool;
default = true;
- description = "ISO14755 support for viewing and entering unicode characters.";
+ description =
+ "ISO14755 support for viewing and entering unicode characters.";
};
scroll = {
@@ -75,11 +74,12 @@ in
floating = mkOption {
type = types.bool;
default = true;
- description = "Whether to display an rxvt scrollbar without a trough.";
+ description =
+ "Whether to display an rxvt scrollbar without a trough.";
};
};
};
- default = {};
+ default = { };
description = "Scrollbar settings.";
};
@@ -92,7 +92,8 @@ in
keepPosition = mkOption {
type = types.bool;
default = true;
- description = "Whether to keep a scroll position when TTY receives new lines.";
+ description =
+ "Whether to keep a scroll position when TTY receives new lines.";
};
scrollOnKeystroke = mkOption {
@@ -117,11 +118,12 @@ in
shading = mkOption {
type = types.ints.between 0 200;
default = 100;
- description = "Darken (0 .. 99) or lighten (101 .. 200) the transparent background.";
+ description =
+ "Darken (0 .. 99) or lighten (101 .. 200) the transparent background.";
};
extraConfig = mkOption {
- default = {};
+ default = { };
type = types.attrs;
description = "Additional configuration to add.";
example = { "shading" = 15; };
@@ -145,12 +147,10 @@ in
"URxvt.transparent" = cfg.transparent;
"URxvt.shading" = cfg.shading;
"URxvt.iso14755" = cfg.iso14755;
- } // flip mapAttrs' cfg.keybindings (kb: action:
- nameValuePair "URxvt.keysym.${kb}" action
- ) // optionalAttrs (cfg.fonts != []) {
- "URxvt.font" = concatStringsSep "," cfg.fonts;
- } // flip mapAttrs' cfg.extraConfig (k: v:
- nameValuePair "URxvt.${k}" v
- );
+ } // flip mapAttrs' cfg.keybindings
+ (kb: action: nameValuePair "URxvt.keysym.${kb}" action)
+ // optionalAttrs (cfg.fonts != [ ]) {
+ "URxvt.font" = concatStringsSep "," cfg.fonts;
+ } // flip mapAttrs' cfg.extraConfig (k: v: nameValuePair "URxvt.${k}" v);
};
}
diff --git a/home-manager/modules/programs/vim.nix b/home-manager/modules/programs/vim.nix
index a14a9562ac1..39826a9a5d6 100644
--- a/home-manager/modules/programs/vim.nix
+++ b/home-manager/modules/programs/vim.nix
@@ -31,43 +31,36 @@ let
};
vimSettingsType = types.submodule {
- options =
- let
- opt = name: type: mkOption {
+ options = let
+ opt = name: type:
+ mkOption {
type = types.nullOr type;
default = null;
visible = false;
};
- in
- mapAttrs opt knownSettings;
+ in mapAttrs opt knownSettings;
};
setExpr = name: value:
let
- v =
- if isBool value then (if value then "" else "no") + name
- else
- "${name}=${
- if isList value
- then concatStringsSep "," value
- else toString value
- }";
- in
- optionalString (value != null) ("set " + v);
-
- plugins =
- let
- vpkgs = pkgs.vimPlugins;
- getPkg = p:
- if isDerivation p
- then [ p ]
- else optional (isString p && hasAttr p vpkgs) vpkgs.${p};
- in
- concatMap getPkg cfg.plugins;
-
-in
-
-{
+ v = if isBool value then
+ (if value then "" else "no") + name
+ else
+ "${name}=${
+ if isList value then concatStringsSep "," value else toString value
+ }";
+ in optionalString (value != null) ("set " + v);
+
+ plugins = let
+ vpkgs = pkgs.vimPlugins;
+ getPkg = p:
+ if isDerivation p then
+ [ p ]
+ else
+ optional (isString p && hasAttr p vpkgs) vpkgs.${p};
+ in concatMap getPkg cfg.plugins;
+
+in {
options = {
programs.vim = {
enable = mkEnableOption "Vim";
@@ -75,7 +68,7 @@ in
plugins = mkOption {
type = with types; listOf (either str package);
default = defaultPlugins;
- example = literalExample ''[ pkgs.vimPlugins.YankRing ]'';
+ example = literalExample "[ pkgs.vimPlugins.YankRing ]";
description = ''
List of vim plugins to install. To get a list of supported plugins run:
<command>nix-env -f '&lt;nixpkgs&gt;' -qaP -A vimPlugins</command>.
@@ -88,7 +81,7 @@ in
settings = mkOption {
type = vimSettingsType;
- default = {};
+ default = { };
example = literalExample ''
{
expandtab = true;
@@ -102,14 +95,12 @@ in
options.
<informaltable frame="none"><tgroup cols="1"><tbody>
- ${concatStringsSep "\n" (
- mapAttrsToList (n: v: ''
- <row>
- <entry><varname>${n}</varname></entry>
- <entry>${v.description}</entry>
- </row>
- '') knownSettings
- )}
+ ${concatStringsSep "\n" (mapAttrsToList (n: v: ''
+ <row>
+ <entry><varname>${n}</varname></entry>
+ <entry>${v.description}</entry>
+ </row>
+ '') knownSettings)}
</tbody></tgroup></informaltable>
See the Vim documentation for detailed descriptions of these
@@ -136,56 +127,45 @@ in
};
};
- config = (
- let
- customRC = ''
- ${concatStringsSep "\n" (
- filter (v: v != "") (
- mapAttrsToList setExpr (
- builtins.intersectAttrs knownSettings cfg.settings)))}
+ config = (let
+ customRC = ''
+ ${concatStringsSep "\n" (filter (v: v != "") (mapAttrsToList setExpr
+ (builtins.intersectAttrs knownSettings cfg.settings)))}
- ${cfg.extraConfig}
- '';
+ ${cfg.extraConfig}
+ '';
- vim = pkgs.vim_configurable.customize {
- name = "vim";
- vimrcConfig = {
- inherit customRC;
+ vim = pkgs.vim_configurable.customize {
+ name = "vim";
+ vimrcConfig = {
+ inherit customRC;
- packages.home-manager.start = plugins;
- };
+ packages.home-manager.start = plugins;
};
- in
- mkIf cfg.enable {
- assertions =
- let
- packagesNotFound = filter (p: isString p && (!hasAttr p pkgs.vimPlugins)) cfg.plugins;
- in
- [
- {
- assertion = packagesNotFound == [];
- message = "Following VIM plugin not found in pkgs.vimPlugins: ${
- concatMapStringsSep ", " (p: ''"${p}"'') packagesNotFound
- }";
- }
- ];
-
- warnings =
- let
- stringPlugins = filter isString cfg.plugins;
- in
- optional (stringPlugins != []) ''
- Specifying VIM plugins using strings is deprecated, found ${
- concatMapStringsSep ", " (p: ''"${p}"'') stringPlugins
- } as strings.
- '';
-
- home.packages = [ cfg.package ];
-
- programs.vim = {
- package = vim;
- plugins = defaultPlugins;
- };
- }
- );
+ };
+ in mkIf cfg.enable {
+ assertions = let
+ packagesNotFound =
+ filter (p: isString p && (!hasAttr p pkgs.vimPlugins)) cfg.plugins;
+ in [{
+ assertion = packagesNotFound == [ ];
+ message = "Following VIM plugin not found in pkgs.vimPlugins: ${
+ concatMapStringsSep ", " (p: ''"${p}"'') packagesNotFound
+ }";
+ }];
+
+ warnings = let stringPlugins = filter isString cfg.plugins;
+ in optional (stringPlugins != [ ]) ''
+ Specifying VIM plugins using strings is deprecated, found ${
+ concatMapStringsSep ", " (p: ''"${p}"'') stringPlugins
+ } as strings.
+ '';
+
+ home.packages = [ cfg.package ];
+
+ programs.vim = {
+ package = vim;
+ plugins = defaultPlugins;
+ };
+ });
}
diff --git a/home-manager/modules/programs/vscode.nix b/home-manager/modules/programs/vscode.nix
index fdaea0ba4fe..cf7ac722210 100644
--- a/home-manager/modules/programs/vscode.nix
+++ b/home-manager/modules/programs/vscode.nix
@@ -11,7 +11,13 @@ let
configDir = {
"vscode" = "Code";
"vscode-insiders" = "Code - Insiders";
- "vscodium" = "Codium";
+ "vscodium" = "VSCodium";
+ }.${vscodePname};
+
+ extensionDir = {
+ "vscode" = "vscode";
+ "vscode-insiders" = "vscode-insiders";
+ "vscodium" = "vscode-oss";
}.${vscodePname};
configFilePath =
@@ -21,7 +27,7 @@ let
"${config.xdg.configHome}/${configDir}/User/settings.json";
# TODO: On Darwin where are the extensions?
- extensionPath = ".${vscodePname}/extensions";
+ extensionPath = ".${extensionDir}/extensions";
in
{
@@ -71,18 +77,24 @@ in
# Adapted from https://discourse.nixos.org/t/vscode-extensions-setup/1801/2
home.file =
let
- toPaths = p:
- # Links every dir in p to the extension path.
- mapAttrsToList (k: v:
- {
- "${extensionPath}/${k}".source = "${p}/${k}";
- }) (builtins.readDir p);
+ toPaths = path:
+ let
+ p = "${path}/share/vscode/extensions";
+ in
+ # Links every dir in p to the extension path.
+ mapAttrsToList (k: v:
+ {
+ "${extensionPath}/${k}".source = "${p}/${k}";
+ }) (builtins.readDir p);
toSymlink = concatMap toPaths cfg.extensions;
in
foldr
(a: b: a // b)
{
- "${configFilePath}".text = builtins.toJSON cfg.userSettings;
+ "${configFilePath}" =
+ mkIf (cfg.userSettings != {}) {
+ text = builtins.toJSON cfg.userSettings;
+ };
}
toSymlink;
};
diff --git a/home-manager/modules/programs/vscode/haskell.nix b/home-manager/modules/programs/vscode/haskell.nix
index c8ea10d473e..ee84e707102 100644
--- a/home-manager/modules/programs/vscode/haskell.nix
+++ b/home-manager/modules/programs/vscode/haskell.nix
@@ -7,8 +7,8 @@ let
cfg = config.programs.vscode.haskell;
defaultHieNixExe = hie-nix.hies + "/bin/hie-wrapper";
- defaultHieNixExeText = literalExample
- "\"\${pkgs.hie-nix.hies}/bin/hie-wrapper\"";
+ defaultHieNixExeText =
+ literalExample ''"''${pkgs.hie-nix.hies}/bin/hie-wrapper"'';
hie-nix = pkgs.hie-nix or (abort ''
vscode.haskell: pkgs.hie-nix missing. Please add an overlay such as:
@@ -21,9 +21,7 @@ let
]
'';
-in
-
-{
+in {
options.programs.vscode.haskell = {
enable = mkEnableOption "Haskell integration for Visual Studio Code";
@@ -57,10 +55,8 @@ in
};
programs.vscode.extensions =
- [
- pkgs.vscode-extensions.justusadam.language-haskell
- ]
+ [ pkgs.vscode-extensions.justusadam.language-haskell ]
++ lib.optional cfg.hie.enable
- pkgs.vscode-extensions.alanz.vscode-hie-server;
+ pkgs.vscode-extensions.alanz.vscode-hie-server;
};
}
diff --git a/home-manager/modules/programs/z-lua.nix b/home-manager/modules/programs/z-lua.nix
index 245eff6a51e..d722ac6a2f0 100644
--- a/home-manager/modules/programs/z-lua.nix
+++ b/home-manager/modules/programs/z-lua.nix
@@ -7,16 +7,14 @@ let
cfg = config.programs.z-lua;
aliases = {
- zz = "z -c"; # restrict matches to subdirs of $PWD
- zi = "z -i"; # cd with interactive selection
- zf = "z -I"; # use fzf to select in multiple matches
- zb = "z -b"; # quickly cd to the parent directory
- zh = "z -I -t ."; # fzf
+ zz = "z -c"; # restrict matches to subdirs of $PWD
+ zi = "z -i"; # cd with interactive selection
+ zf = "z -I"; # use fzf to select in multiple matches
+ zb = "z -b"; # quickly cd to the parent directory
+ zh = "z -I -t ."; # fzf
};
-in
-
-{
+in {
meta.maintainers = [ maintainers.marsam ];
options.programs.z-lua = {
@@ -24,7 +22,7 @@ in
options = mkOption {
type = types.listOf types.str;
- default = [];
+ default = [ ];
example = [ "enhanced" "once" "fzf" ];
description = ''
List of options to pass to z.lua.
@@ -68,15 +66,21 @@ in
home.packages = [ pkgs.z-lua ];
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
- eval "$(${pkgs.z-lua}/bin/z --init bash ${concatStringsSep " " cfg.options})"
+ eval "$(${pkgs.z-lua}/bin/z --init bash ${
+ concatStringsSep " " cfg.options
+ })"
'';
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
- eval "$(${pkgs.z-lua}/bin/z --init zsh ${concatStringsSep " " cfg.options})"
+ eval "$(${pkgs.z-lua}/bin/z --init zsh ${
+ concatStringsSep " " cfg.options
+ })"
'';
programs.fish.shellInit = mkIf cfg.enableFishIntegration ''
- source (${pkgs.z-lua}/bin/z --init fish ${concatStringsSep " " cfg.options} | psub)
+ source (${pkgs.z-lua}/bin/z --init fish ${
+ concatStringsSep " " cfg.options
+ } | psub)
'';
programs.bash.shellAliases = mkIf cfg.enableAliases aliases;
diff --git a/home-manager/modules/programs/zathura.nix b/home-manager/modules/programs/zathura.nix
index f01bd501c39..d9f3c1af1fd 100644
--- a/home-manager/modules/programs/zathura.nix
+++ b/home-manager/modules/programs/zathura.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ...}:
+{ config, lib, pkgs, ... }:
with lib;
@@ -9,14 +9,10 @@ let
formatLine = n: v:
let
formatValue = v:
- if isBool v then (if v then "true" else "false")
- else toString v;
- in
- "set ${n}\t\"${formatValue v}\"";
+ if isBool v then (if v then "true" else "false") else toString v;
+ in ''set ${n} "${formatValue v}"'';
-in
-
-{
+in {
meta.maintainers = [ maintainers.rprospero ];
options.programs.zathura = {
@@ -25,7 +21,7 @@ in
focused on keyboard interaction'';
options = mkOption {
- default = {};
+ default = { };
type = with types; attrsOf (either str (either bool int));
description = ''
Add <option>:set</option> command options to zathura and make
@@ -36,7 +32,10 @@ in
</citerefentry>
for the full list of options.
'';
- example = { default-bg = "#000000"; default-fg = "#FFFFFF"; };
+ example = {
+ default-bg = "#000000";
+ default-fg = "#FFFFFF";
+ };
};
extraConfig = mkOption {
@@ -52,10 +51,8 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.zathura ];
- xdg.configFile."zathura/zathurarc".text =
- concatStringsSep "\n" ([]
- ++ optional (cfg.extraConfig != "") cfg.extraConfig
- ++ mapAttrsToList formatLine cfg.options
- ) + "\n";
+ xdg.configFile."zathura/zathurarc".text = concatStringsSep "\n" ([ ]
+ ++ optional (cfg.extraConfig != "") cfg.extraConfig
+ ++ mapAttrsToList formatLine cfg.options) + "\n";
};
}
diff --git a/home-manager/modules/programs/zsh.nix b/home-manager/modules/programs/zsh.nix
index ffe5f4960b6..c5694e1f704 100644
--- a/home-manager/modules/programs/zsh.nix
+++ b/home-manager/modules/programs/zsh.nix
@@ -26,6 +26,8 @@ let
vicmd = "bindkey -a";
};
+ stateVersion = config.home.stateVersion;
+
historyModule = types.submodule ({ config, ... }: {
options = {
size = mkOption {
@@ -43,8 +45,10 @@ let
path = mkOption {
type = types.str;
- default = relToDotDir ".zsh_history";
- defaultText = ".zsh_history";
+ default = if versionAtLeast stateVersion "20.03"
+ then "$HOME/.zsh_history"
+ else relToDotDir ".zsh_history";
+ example = literalExample ''"''${config.xdg.dataHome}/zsh/zsh_history"'';
description = "History file location";
};
@@ -57,6 +61,15 @@ let
'';
};
+ ignoreSpace = mkOption {
+ type = types.bool;
+ default = true;
+ description = ''
+ Do not enter command lines into the history list
+ if the first character is a space.
+ '';
+ };
+
expireDuplicatesFirst = mkOption {
type = types.bool;
default = false;
@@ -402,11 +415,15 @@ in
# History options should be set in .zshrc and after oh-my-zsh sourcing.
# See https://github.com/rycee/home-manager/issues/177.
HISTSIZE="${toString cfg.history.size}"
- HISTFILE="$HOME/${cfg.history.path}"
SAVEHIST="${toString cfg.history.save}"
+ ${if versionAtLeast config.home.stateVersion "20.03"
+ then ''HISTFILE="${cfg.history.path}"''
+ else ''HISTFILE="$HOME/${cfg.history.path}"''}
+ mkdir -p "$(dirname "$HISTFILE")"
setopt HIST_FCNTL_LOCK
${if cfg.history.ignoreDups then "setopt" else "unsetopt"} HIST_IGNORE_DUPS
+ ${if cfg.history.ignoreSpace then "setopt" else "unsetopt"} HIST_IGNORE_SPACE
${if cfg.history.expireDuplicatesFirst then "setopt" else "unsetopt"} HIST_EXPIRE_DUPS_FIRST
${if cfg.history.share then "setopt" else "unsetopt"} SHARE_HISTORY
${if cfg.history.extended then "setopt" else "unsetopt"} EXTENDED_HISTORY
@@ -430,10 +447,10 @@ in
# but allow the user to opt out.
programs.zsh.enableCompletion = mkDefault true;
- home.file = map (plugin: {
- target = "${pluginsDir}/${plugin.name}";
- source = plugin.src;
- }) cfg.plugins;
+ home.file =
+ foldl' (a: b: a // b) {}
+ (map (plugin: { "${pluginsDir}/${plugin.name}".source = plugin.src; })
+ cfg.plugins);
})
]);
}