aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xformat6
-rw-r--r--modules/accounts/email.nix64
-rw-r--r--modules/lib/types.nix55
-rw-r--r--modules/programs/broot.nix4
-rw-r--r--modules/programs/direnv.nix4
-rw-r--r--tests/modules/programs/tmux/disable-confirmation-prompt.nix4
-rw-r--r--tests/modules/programs/tmux/secure-socket-enabled.nix4
7 files changed, 55 insertions, 86 deletions
diff --git a/format b/format
index 8fe8c2e615d..5828f60d41e 100755
--- a/format
+++ b/format
@@ -1,5 +1,5 @@
#! /usr/bin/env nix-shell
-#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/b0bbacb52134a7e731e549f4c0a7a2a39ca6b481.tar.gz -i bash -p findutils nixfmt
+#! nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/05f0934825c2a0750d4888c4735f9420c906b388.tar.gz -i bash -p findutils nixfmt
CHECK_ARG=
@@ -20,13 +20,11 @@ find . -name '*.nix' \
\
! -path ./home-manager/default.nix \
! -path ./home-manager/home-manager.nix \
- ! -path ./modules/accounts/email.nix \
! -path ./modules/default.nix \
! -path ./modules/files.nix \
! -path ./modules/home-environment.nix \
! -path ./modules/lib/default.nix \
! -path ./modules/lib/file-type.nix \
- ! -path ./modules/lib/types.nix \
! -path ./modules/manual.nix \
! -path ./modules/misc/dconf.nix \
! -path ./modules/misc/gtk.nix \
@@ -59,8 +57,6 @@ find . -name '*.nix' \
! -path ./tests/modules/home-environment/session-variables.nix \
! -path ./tests/modules/programs/gpg/override-defaults.nix \
! -path ./tests/modules/programs/tmux/default.nix \
- ! -path ./tests/modules/programs/tmux/disable-confirmation-prompt.nix \
- ! -path ./tests/modules/programs/tmux/secure-socket-enabled.nix \
! -path ./tests/modules/programs/zsh/session-variables.nix \
! -path ./tests/modules/services/sxhkd/service.nix \
! -path ./tests/modules/systemd/default.nix \
diff --git a/modules/accounts/email.nix b/modules/accounts/email.nix
index b347e5bb1a2..a1970667b47 100644
--- a/modules/accounts/email.nix
+++ b/modules/accounts/email.nix
@@ -106,7 +106,7 @@ let
tls = mkOption {
type = tlsModule;
- default = {};
+ default = { };
description = ''
Configuration for secure connections.
'';
@@ -136,7 +136,7 @@ let
tls = mkOption {
type = tlsModule;
- default = {};
+ default = { };
description = ''
Configuration for secure connections.
'';
@@ -209,7 +209,7 @@ let
aliases = mkOption {
type = types.listOf (types.strMatching ".*@.*");
- default = [];
+ default = [ ];
example = [ "webmaster@example.org" "admin@example.org" ];
description = "Alternative email addresses of this account.";
};
@@ -276,7 +276,7 @@ let
};
};
};
- default = {};
+ default = { };
description = ''
Standard email folders.
'';
@@ -292,7 +292,7 @@ let
signature = mkOption {
type = signatureModule;
- default = {};
+ default = { };
description = ''
Signature configuration.
'';
@@ -332,9 +332,7 @@ let
(mkIf (config.flavor == "gmail.com") {
userName = mkDefault config.address;
- imap = {
- host = "imap.gmail.com";
- };
+ imap = { host = "imap.gmail.com"; };
smtp = {
host = "smtp.gmail.com";
@@ -343,20 +341,14 @@ let
})
(mkIf (config.flavor == "runbox.com") {
- imap = {
- host = "mail.runbox.com";
- };
+ imap = { host = "mail.runbox.com"; };
- smtp = {
- host = "mail.runbox.com";
- };
+ smtp = { host = "mail.runbox.com"; };
})
];
};
-in
-
-{
+in {
options.accounts.email = {
certificatesFile = mkOption {
type = types.path;
@@ -373,9 +365,7 @@ in
default = "${config.home.homeDirectory}/Maildir";
defaultText = "$HOME/Maildir";
apply = p:
- if hasPrefix "/" p
- then p
- else "${config.home.homeDirectory}/${p}";
+ if hasPrefix "/" p then p else "${config.home.homeDirectory}/${p}";
description = ''
The base directory for account maildir directories. May be a
relative path, in which case it is relative the home
@@ -395,32 +385,24 @@ in
(import ../programs/neomutt-accounts.nix)
(import ../programs/notmuch-accounts.nix)
(import ../programs/offlineimap-accounts.nix)
- ] ++ optionals pkgs.stdenv.hostPlatform.isLinux [
- (import ../services/lieer-accounts.nix)
- ]));
- default = {};
+ ] ++ optionals pkgs.stdenv.hostPlatform.isLinux
+ [ (import ../services/lieer-accounts.nix) ]));
+ default = { };
description = "List of email accounts.";
};
};
- config = mkIf (cfg.accounts != {}) {
+ config = mkIf (cfg.accounts != { }) {
assertions = [
- (
- let
- primaries =
- catAttrs "name"
- (filter (a: a.primary)
- (attrValues cfg.accounts));
- in
- {
- assertion = length primaries == 1;
- message =
- "Must have exactly one primary mail account but found "
- + toString (length primaries)
- + optionalString (length primaries > 1)
- (", namely " + concatStringsSep ", " primaries);
- }
- )
+ (let
+ primaries =
+ catAttrs "name" (filter (a: a.primary) (attrValues cfg.accounts));
+ in {
+ assertion = length primaries == 1;
+ message = "Must have exactly one primary mail account but found "
+ + toString (length primaries) + optionalString (length primaries > 1)
+ (", namely " + concatStringsSep ", " primaries);
+ })
];
};
}
diff --git a/modules/lib/types.nix b/modules/lib/types.nix
index f47f717c843..46db1157d90 100644
--- a/modules/lib/types.nix
+++ b/modules/lib/types.nix
@@ -1,7 +1,5 @@
-{ lib
-, dag ? import ./dag.nix { inherit lib; }
-, gvariant ? import ./gvariant.nix { inherit lib; }
-}:
+{ lib, dag ? import ./dag.nix { inherit lib; }
+, gvariant ? import ./gvariant.nix { inherit lib; } }:
with lib;
@@ -13,31 +11,25 @@ let
# must refer back to the type.
gvar = gvariant;
-in
-
-rec {
+in rec {
inherit (typesDag) dagOf listOrDagOf;
selectorFunction = mkOptionType {
name = "selectorFunction";
- description =
- "Function that takes an attribute set and returns a list"
+ description = "Function that takes an attribute set and returns a list"
+ " containing a selection of the values of the input set";
check = isFunction;
- merge = _loc: defs:
- as: concatMap (select: select as) (getValues defs);
+ merge = _loc: defs: as: concatMap (select: select as) (getValues defs);
};
overlayFunction = mkOptionType {
name = "overlayFunction";
- description =
- "An overlay function, takes self and super and returns"
+ description = "An overlay function, takes self and super and returns"
+ " an attribute set overriding the desired attributes.";
check = isFunction;
- merge = _loc: defs:
- self: super:
- foldl' (res: def: mergeAttrs res (def.value self super)) {} defs;
+ merge = _loc: defs: self: super:
+ foldl' (res: def: mergeAttrs res (def.value self super)) { } defs;
};
fontType = types.submodule {
@@ -76,22 +68,21 @@ rec {
# A bit naive to just check the first entry…
sharedDefType = foldl' sameOrNull (head defTypes) defTypes;
allChecked = all (x: check x) vals;
- in
- if sharedDefType == null then
- throw ("Cannot merge definitions of `${showOption loc}' with"
- + " mismatched GVariant types given in"
- + " ${showFiles (getFiles defs)}.")
- else if gvar.isArray sharedDefType && allChecked then
- (types.listOf gvariant).merge
- loc (map (d: d // { value = d.value.value; } ) vdefs)
- else if gvar.isTuple sharedDefType && allChecked then
- mergeOneOption loc defs
- else if gvar.type.string == sharedDefType && allChecked then
- types.str.merge loc defs
- else if gvar.type.double == sharedDefType && allChecked then
- types.float.merge loc defs
- else
- mergeDefaultOption loc defs;
+ in if sharedDefType == null then
+ throw ("Cannot merge definitions of `${showOption loc}' with"
+ + " mismatched GVariant types given in"
+ + " ${showFiles (getFiles defs)}.")
+ else if gvar.isArray sharedDefType && allChecked then
+ (types.listOf gvariant).merge loc
+ (map (d: d // { value = d.value.value; }) vdefs)
+ else if gvar.isTuple sharedDefType && allChecked then
+ mergeOneOption loc defs
+ else if gvar.type.string == sharedDefType && allChecked then
+ types.str.merge loc defs
+ else if gvar.type.double == sharedDefType && allChecked then
+ types.float.merge loc defs
+ else
+ mergeDefaultOption loc defs;
};
}
diff --git a/modules/programs/broot.nix b/modules/programs/broot.nix
index eac31b56801..f0e1afee29d 100644
--- a/modules/programs/broot.nix
+++ b/modules/programs/broot.nix
@@ -175,8 +175,8 @@ in {
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.
+ # 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
diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix
index beb40a96261..de57727fd46 100644
--- a/modules/programs/direnv.nix
+++ b/modules/programs/direnv.nix
@@ -82,8 +82,8 @@ in {
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.
+ # Using mkAfter to make it more likely to appear after other
+ # manipulations of the prompt.
mkAfter ''
eval "$(${pkgs.direnv}/bin/direnv hook bash)"
'');
diff --git a/tests/modules/programs/tmux/disable-confirmation-prompt.nix b/tests/modules/programs/tmux/disable-confirmation-prompt.nix
index e3d13a4b1b2..9c65ad6eee4 100644
--- a/tests/modules/programs/tmux/disable-confirmation-prompt.nix
+++ b/tests/modules/programs/tmux/disable-confirmation-prompt.nix
@@ -12,9 +12,7 @@ with lib;
nixpkgs.overlays = [
(self: super: {
tmuxPlugins = super.tmuxPlugins // {
- sensible = super.tmuxPlugins.sensible // {
- rtp = "@sensible_rtp@";
- };
+ sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; };
};
})
];
diff --git a/tests/modules/programs/tmux/secure-socket-enabled.nix b/tests/modules/programs/tmux/secure-socket-enabled.nix
index 34e9129c5a4..7e8c535c049 100644
--- a/tests/modules/programs/tmux/secure-socket-enabled.nix
+++ b/tests/modules/programs/tmux/secure-socket-enabled.nix
@@ -11,7 +11,9 @@ with lib;
nmt.script = ''
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
- assertFileContent home-path/etc/profile.d/hm-session-vars.sh ${./hm-session-vars.sh}
+ assertFileContent home-path/etc/profile.d/hm-session-vars.sh ${
+ ./hm-session-vars.sh
+ }
'';
};
}