Apply nixfmt on many files

This commit is contained in:
Robert Helgesson 2020-02-02 00:39:17 +01:00
parent 9799d3de2d
commit 45abf3d38a
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
177 changed files with 2850 additions and 3565 deletions

View file

@ -1,13 +1,10 @@
{ pkgs ? import <nixpkgs> { } }:
rec {
home-manager = pkgs.callPackage ./home-manager {
path = toString ./.;
};
home-manager = pkgs.callPackage ./home-manager { path = toString ./.; };
install = pkgs.callPackage ./home-manager/install.nix {
inherit home-manager;
};
install =
pkgs.callPackage ./home-manager/install.nix { inherit home-manager; };
nixos = import ./nixos;
}

View file

@ -1,8 +1,6 @@
{
# Note, this should be "the standard library" + HM extensions.
lib
, pkgs
}:
lib, pkgs }:
let
@ -19,23 +17,19 @@ let
# Make sure the used package is scrubbed to avoid actually
# instantiating derivations.
scrubbedPkgsModule = {
imports = [
{
imports = [{
_module.args = {
pkgs = lib.mkForce (nmd.scrubDerivations "pkgs" pkgs);
pkgs_i686 = lib.mkForce { };
};
}
];
}];
};
hmModulesDocs = nmd.buildModulesDocs {
modules =
import ../modules/modules.nix {
modules = import ../modules/modules.nix {
inherit lib pkgs;
check = false;
}
++ [ scrubbedPkgsModule ];
} ++ [ scrubbedPkgsModule ];
moduleRootPaths = [ ./.. ];
mkModuleUrl = path:
"https://github.com/rycee/home-manager/blob/master/${path}#blob-path";
@ -58,9 +52,7 @@ let
'';
};
in
{
in {
inherit nmdSrc;
options = {
@ -71,7 +63,5 @@ in
manPages = docs.manPages;
manual = {
inherit (docs) html htmlOpenTool;
};
manual = { inherit (docs) html htmlOpenTool; };
}

View file

@ -1,8 +1,6 @@
{ home-manager, runCommand }:
runCommand
"home-manager-install"
{
runCommand "home-manager-install" {
propagatedBuildInputs = [ home-manager ];
preferLocalBuild = true;
allowSubstitutes = false;
@ -63,8 +61,7 @@ runCommand
exit 1
fi
'';
}
''
} ''
echo This derivation is not buildable, instead run it using nix-shell.
exit 1
''

View file

@ -16,10 +16,8 @@ rec {
emptyDag = { };
isDag = dag:
let
isEntry = e: (e ? data) && (e ? after) && (e ? before);
in
builtins.isAttrs dag && all (x: x) (mapAttrsToList (n: isEntry) dag);
let isEntry = e: (e ? data) && (e ? after) && (e ? before);
in builtins.isAttrs dag && all (x: x) (mapAttrsToList (n: isEntry) dag);
# Takes an attribute set containing entries built by
# dagEntryAnywhere, dagEntryAfter, and dagEntryBefore to a
@ -80,21 +78,18 @@ rec {
dagTopoSort = dag:
let
dagBefore = dag: name:
mapAttrsToList (n: v: n) (
filterAttrs (n: v: any (a: a == name) v.before) dag
);
normalizedDag =
mapAttrs (n: v: {
mapAttrsToList (n: v: n)
(filterAttrs (n: v: any (a: a == name) v.before) dag);
normalizedDag = mapAttrs (n: v: {
name = n;
data = v.data;
after = v.after ++ dagBefore dag n;
}) dag;
before = a: b: any (c: a.name == c) b.after;
sorted = toposort before (mapAttrsToList (n: v: v) normalizedDag);
in
if sorted ? result then
{ result = map (v: { inherit (v) name data; }) sorted.result; }
else
in if sorted ? result then {
result = map (v: { inherit (v) name data; }) sorted.result;
} else
sorted;
# Applies a function to each element of the given DAG.
@ -107,9 +102,7 @@ rec {
after = [ ];
};
dagEntryBetween = before: after: data: {
inherit data before after;
};
dagEntryBetween = before: after: data: { inherit data before after; };
dagEntryAfter = after: data: {
inherit data after;

View file

@ -2,7 +2,7 @@
rec {
# Produces a Bourne shell like variable export statement.
export = n: v: "export ${n}=\"${toString v}\"";
export = n: v: ''export ${n}="${toString v}"'';
# Given an attribute set containing shell variable names and their
# assignment, this function produces a string containing an export

View file

@ -3,9 +3,5 @@
nixpkgsLib:
let
mkHmLib = import ./.;
in
nixpkgsLib.extend (self: super: {
hm = mkHmLib { lib = super; };
})
let mkHmLib = import ./.;
in nixpkgsLib.extend (self: super: { hm = mkHmLib { lib = super; }; })

View file

@ -9,19 +9,14 @@ with lib;
# All characters that are considered safe. Note "-" is not
# included to avoid "-" followed by digit being interpreted as a
# version.
safeChars =
[ "+" "." "_" "?" "=" ]
++ lowerChars
++ upperChars
safeChars = [ "+" "." "_" "?" "=" ] ++ lowerChars ++ upperChars
++ stringToCharacters "0123456789";
empties = l: genList (x: "") (length l);
unsafeInName = stringToCharacters (
replaceStrings safeChars (empties safeChars) path
);
unsafeInName =
stringToCharacters (replaceStrings safeChars (empties safeChars) path);
safeName = replaceStrings unsafeInName (empties unsafeInName) path;
in
"hm_" + safeName;
in "hm_" + safeName;
}

View file

@ -6,7 +6,8 @@ let
isDagEntry = e: isAttrs e && (e ? data) && (e ? after) && (e ? before);
dagContentType = elemType: types.submodule {
dagContentType = elemType:
types.submodule {
options = {
data = mkOption { type = elemType; };
after = mkOption { type = with types; uniq (listOf str); };
@ -14,24 +15,16 @@ let
};
};
in
{
in {
# A directed acyclic graph of some inner type.
dagOf = elemType:
let
convertAllToDags =
let
maybeConvert = n: v:
if isDagEntry v
then v
else dag.entryAnywhere v;
in
map (def: def // { value = mapAttrs maybeConvert def.value; });
convertAllToDags = let
maybeConvert = n: v: if isDagEntry v then v else dag.entryAnywhere v;
in map (def: def // { value = mapAttrs maybeConvert def.value; });
attrEquivalent = types.attrsOf (dagContentType elemType);
in
mkOptionType rec {
in mkOptionType rec {
name = "dagOf";
description = "DAG of ${elemType.description}s";
check = isAttrs;
@ -55,35 +48,30 @@ in
listOrDagOf = elemType:
let
paddedIndexStr = list: i:
let
padWidth = stringLength (toString (length list));
in
fixedWidthNumber padWidth i;
let padWidth = stringLength (toString (length list));
in fixedWidthNumber padWidth i;
convertAllToDags = defs:
let
convertAttrValue = n: v:
if isDagEntry v then v
else dag.entryAnywhere v;
if isDagEntry v then v else dag.entryAnywhere v;
convertListValue = namePrefix: vs:
let
pad = paddedIndexStr vs;
makeEntry = i: v:
nameValuePair "${namePrefix}.${pad i}" (dag.entryAnywhere v);
in
listToAttrs (imap1 makeEntry vs);
in listToAttrs (imap1 makeEntry vs);
convertValue = i: value:
if isList value
then convertListValue "unnamed-${paddedIndexStr defs i}" value
else mapAttrs convertAttrValue value;
in
imap1 (i: def: def // { value = convertValue i def.value; }) defs;
if isList value then
convertListValue "unnamed-${paddedIndexStr defs i}" value
else
mapAttrs convertAttrValue value;
in imap1 (i: def: def // { value = convertValue i def.value; }) defs;
attrEquivalent = types.attrsOf (dagContentType elemType);
in
mkOptionType rec {
in mkOptionType rec {
name = "dagOf";
description = "DAG of ${elemType.description}s";
check = x: isAttrs x || isList x;

View file

@ -2,13 +2,15 @@
rec {
# Produces a Zsh shell like value
toZshValue = v: if builtins.isBool v then
toZshValue = v:
if builtins.isBool v then
if v then "true" else "false"
else if builtins.isString v then
"\"${v}\""
''"${v}"''
else if builtins.isList v then
"(${lib.concatStringsSep " " (map toZshValue v)})"
else "\"${toString v}\"";
else
''"${toString v}"'';
# Produces a Zsh shell like definition statement
define = n: v: "${n}=${toZshValue v}";

View file

@ -8,15 +8,15 @@ let
profileDirectory = config.home.profileDirectory;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
imports = [
(mkRenamedOptionModule
[ "fonts" "fontconfig" "enableProfileFonts" ]
[ "fonts" "fontconfig" "enable" ])
(mkRenamedOptionModule [ "fonts" "fontconfig" "enableProfileFonts" ] [
"fonts"
"fontconfig"
"enable"
])
];
options = {

View file

@ -6,12 +6,8 @@ let
cfg = config.xsession.numlock;
in
{
options = {
xsession.numlock.enable = mkEnableOption "Num Lock";
};
in {
options = { xsession.numlock.enable = mkEnableOption "Num Lock"; };
config = mkIf cfg.enable {
systemd.user.services.numlockx = {
@ -27,9 +23,7 @@ in
ExecStart = "${pkgs.numlockx}/bin/numlockx";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}

View file

@ -6,9 +6,7 @@ let
vars = config.pam.sessionVariables;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -28,9 +26,7 @@ in
};
config = mkIf (vars != { }) {
home.file.".pam_environment".text =
concatStringsSep "\n" (
mapAttrsToList (n: v: "${n} OVERRIDE=\"${toString v}\"") vars
) + "\n";
home.file.".pam_environment".text = concatStringsSep "\n"
(mapAttrsToList (n: v: ''${n} OVERRIDE="${toString v}"'') vars) + "\n";
};
}

View file

@ -6,19 +6,13 @@ let
cfg = config.qt;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
imports = [
(mkChangedOptionModule
[ "qt" "useGtkTheme" ]
[ "qt" "platformTheme" ]
(mkChangedOptionModule [ "qt" "useGtkTheme" ] [ "qt" "platformTheme" ]
(config:
if getAttrFromPath [ "qt" "useGtkTheme" ] config
then "gtk"
else null))
if getAttrFromPath [ "qt" "useGtkTheme" ] config then "gtk" else null))
];
options = {
@ -29,10 +23,8 @@ in
type = types.nullOr (types.enum [ "gtk" "gnome" ]);
default = null;
example = "gnome";
relatedPackages = [
"qgnomeplatform"
["libsForQt5" "qtstyleplugins"]
];
relatedPackages =
[ "qgnomeplatform" [ "libsForQt5" "qtstyleplugins" ] ];
description = ''
Selects the platform theme to use for Qt applications.</para>
<para>The options are
@ -59,10 +51,10 @@ in
home.sessionVariables.QT_QPA_PLATFORMTHEME =
if cfg.platformTheme == "gnome" then "gnome" else "gtk2";
home.packages =
if cfg.platformTheme == "gnome"
then [ pkgs.qgnomeplatform ]
else [ pkgs.libsForQt5.qtstyleplugins ];
home.packages = if cfg.platformTheme == "gnome" then
[ pkgs.qgnomeplatform ]
else
[ pkgs.libsForQt5.qtstyleplugins ];
xsession.importedVariables = [ "QT_QPA_PLATFORMTHEME" ];

View file

@ -9,9 +9,7 @@ let
strListOrSingleton = with types;
coercedTo (either (listOf str) str) toList (listOf str);
in
{
in {
meta.maintainers = with maintainers; [ pacien ];
options.xdg.mimeApps = {
@ -80,10 +78,8 @@ in
config.xdg.configFile."mimeapps.list".source;
xdg.configFile."mimeapps.list".text =
let
joinValues = mapAttrs (n: concatStringsSep ";");
in
generators.toINI {} {
let joinValues = mapAttrs (n: concatStringsSep ";");
in generators.toINI { } {
"Added Associations" = joinValues cfg.associations.added;
"Removed Associations" = joinValues cfg.associations.removed;
"Default Applications" = joinValues cfg.defaultApplications;

View file

@ -6,9 +6,7 @@ let
cfg = config.xdg.mime;
in
{
in {
options = {
xdg.mime.enable = mkOption {
type = types.bool;

View file

@ -6,15 +6,15 @@ let
cfg = config.xdg.userDirs;
in
{
in {
meta.maintainers = with maintainers; [ pacien ];
imports = [
(mkRenamedOptionModule
[ "xdg" "userDirs" "publishShare" ]
[ "xdg" "userDirs" "publicShare" ])
(mkRenamedOptionModule [ "xdg" "userDirs" "publishShare" ] [
"xdg"
"userDirs"
"publicShare"
])
];
options.xdg.userDirs = {
@ -89,8 +89,7 @@ in
};
config = mkIf cfg.enable {
xdg.configFile."user-dirs.dirs".text = generators.toKeyValue {} (
{
xdg.configFile."user-dirs.dirs".text = generators.toKeyValue { } ({
XDG_DESKTOP_DIR = cfg.desktop;
XDG_DOCUMENTS_DIR = cfg.documents;
XDG_DOWNLOAD_DIR = cfg.download;
@ -99,8 +98,6 @@ in
XDG_PUBLICSHARE_DIR = cfg.publicShare;
XDG_TEMPLATES_DIR = cfg.templates;
XDG_VIDEOS_DIR = cfg.videos;
}
// cfg.extraConfig
);
} // cfg.extraConfig);
};
}

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.alacritty;
in
{
in {
options = {
programs.alacritty = {
enable = mkEnableOption "Alacritty";
@ -46,7 +44,8 @@ in
home.packages = [ pkgs.alacritty ];
xdg.configFile."alacritty/alacritty.yml" = mkIf (cfg.settings != { }) {
text = replaceStrings ["\\\\"] ["\\"] (builtins.toJSON cfg.settings);
text =
replaceStrings [ "\\\\" ] [ "\\" ] (builtins.toJSON cfg.settings);
};
})
];

View file

@ -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";
};
@ -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);
};
}

View file

@ -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");
};
}

View file

@ -8,13 +8,13 @@ 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; {
accountAttr = account:
with account;
{
email = address;
name = realName;
sendmail = astroid.sendMailCommand;
@ -24,19 +24,16 @@ let
save_sent = "true";
save_sent_to = "${maildir.absPath}/${folders.sent}";
select_query = "";
}
// optionalAttrs (signature.showSignature != "none") {
} // 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) {
} // optionalAttrs (gpg != null) {
always_gpg_sign = boolOpt gpg.signByDefault;
gpgkey = gpg.key;
}
// astroid.extraConfig;
} // 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:
@ -108,14 +103,11 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.astroid ];
xdg.configFile."astroid/config".source =
pkgs.runCommand "out.json"
{
xdg.configFile."astroid/config".source = pkgs.runCommand "out.json" {
json = configFile astroidAccounts;
preferLocalBuild = true;
allowSubstitutes = false;
}
''
} ''
echo -n "$json" | ${pkgs.jq}/bin/jq . > $out
'';

View file

@ -6,14 +6,15 @@ let
cfg = config.programs.autorandr;
matrixOf = n: m: elemType: mkOptionType rec {
matrixOf = n: m: elemType:
mkOptionType rec {
name = "matrixOf";
description = "${toString n}×${toString m} matrix of ${elemType.description}s";
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;
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;
@ -189,7 +190,9 @@ let
predetect = mkOption {
type = types.attrsOf hookType;
description = "Predetect hook executed before autorandr attempts to run xrandr.";
description = ''
Predetect hook executed before autorandr attempts to run xrandr.
'';
default = { };
};
};
@ -211,27 +214,37 @@ 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 ([
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);
"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) ]))
(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 ''
configToString = name: config:
if config.enable then ''
output ${name}
${optionalString (config.position != "") "pos ${config.position}"}
${optionalString config.primary "primary"}
@ -240,21 +253,17 @@ let
${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)
)}
${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
{
in {
options = {
programs.autorandr = {
enable = mkEnableOption "Autorandr";
@ -323,18 +332,15 @@ in
};
config = mkIf cfg.enable {
assertions = flatten (mapAttrsToList (
profile: { config, ... }: mapAttrsToList (
output: opts: {
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);
}) config) cfg.profiles);
home.packages = [ pkgs.autorandr ];
xdg.configFile = mkMerge ([

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.bat;
in
{
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.bat = {
@ -32,9 +30,8 @@ in
home.packages = [ pkgs.bat ];
xdg.configFile."bat/config" = mkIf (cfg.config != { }) {
text = concatStringsSep "\n" (
mapAttrsToList (n: v: ''--${n}="${v}"'') cfg.config
);
text = concatStringsSep "\n"
(mapAttrsToList (n: v: ''--${n}="${v}"'') cfg.config);
};
};
}

View file

@ -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
@ -32,7 +30,8 @@ in
type = types.package;
default = pkgs.beets;
defaultText = literalExample "pkgs.beets";
example = literalExample "(pkgs.beets.override { enableCheck = true; })";
example =
literalExample "(pkgs.beets.override { enableCheck = true; })";
description = ''
The <literal>beets</literal> package to use.
Can be used to specify extensions.

View file

@ -7,13 +7,11 @@ let
cfg = config.programs.broot;
configFile = config:
pkgs.runCommand "conf.toml"
{
pkgs.runCommand "conf.toml" {
buildInputs = [ pkgs.remarshal ];
preferLocalBuild = true;
allowSubstitutes = false;
}
''
} ''
remarshal -if json -of toml \
< ${pkgs.writeText "verbs.json" (builtins.toJSON config)} \
> $out
@ -21,15 +19,11 @@ let
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}"; };
};
@ -177,8 +174,7 @@ in
# Dummy file to prevent broot from trying to reinstall itself
xdg.configFile."broot/launcher/installed".text = "";
programs.bash.initExtra =
mkIf cfg.enableBashIntegration (
programs.bash.initExtra = mkIf cfg.enableBashIntegration (
# Using mkAfter to make it more likely to appear after other
# manipulations of the prompt.
mkAfter ''
@ -207,8 +203,7 @@ in
rm -f "$f"
eval "$d"
}
''
);
'');
programs.zsh.initExtra = mkIf cfg.enableZshIntegration ''
# This script was automatically generated by the broot function

View file

@ -2,13 +2,7 @@
with lib;
let
browsers = [
"chrome"
"chromium"
"firefox"
"vivaldi"
];
let browsers = [ "chrome" "chromium" "firefox" "vivaldi" ];
in {
options = {
programs.browserpass = {
@ -24,25 +18,26 @@ in {
};
config = mkIf config.programs.browserpass.enable {
home.file =
foldl' (a: b: a // b) {}
(concatMap (x: with pkgs.stdenv;
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 [
{
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 [
{
"${dir}/com.github.browserpass.native.json".source =
@ -54,28 +49,28 @@ in {
}
]
else if x == "firefox" then
let dir = if isDarwin
then "Library/Application Support/Mozilla/NativeMessagingHosts"
else ".mozilla/native-messaging-hosts";
in [
{
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 [
{
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
);
}]
else
throw "unknown browser ${x}") config.programs.browserpass.browsers);
};
}

View file

@ -5,10 +5,8 @@ with lib;
let
browserModule = defaultPkg: name: visible:
let
browser = (builtins.parseDrvName defaultPkg.name).name;
in
{
let browser = (builtins.parseDrvName defaultPkg.name).name;
in {
enable = mkOption {
inherit visible;
default = false;
@ -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: {
name = "${configDir}/External Extensions/${ext}.json";
value.text = builtins.toJSON {
external_update_url = "https://clients2.google.com/service/update2/crx";
external_update_url =
"https://clients2.google.com/service/update2/crx";
};
};
in
mkIf cfg.enable {
in mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file = listToAttrs (map extensionJson cfg.extensions);
};
in
{
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 [

View file

@ -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

View file

@ -6,21 +6,17 @@ let
cfg = config.programs.direnv;
configFile = config:
pkgs.runCommand "config.toml"
{
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
{
in {
meta.maintainers = [ maintainers.rycee ];
options.programs.direnv = {
@ -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 (
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)"

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.eclipse;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -43,9 +41,7 @@ in
home.packages = [
(pkgs.eclipses.eclipseWithPlugins {
eclipse = pkgs.eclipses.eclipse-platform;
jvmArgs =
cfg.jvmArgs
++ optional cfg.enableLombok
jvmArgs = cfg.jvmArgs ++ optional cfg.enableLombok
"-javaagent:${pkgs.lombok}/share/java/lombok.jar";
plugins = cfg.plugins;
})

View file

@ -9,16 +9,17 @@ let
disableBinding = func: key: func;
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"; };
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.
@ -30,7 +31,10 @@ in
keybindings = mkOption {
default = { };
type = types.attrsOf (types.nullOr types.str);
example = { zoom_in = "plus"; zoom_out = "minus"; };
example = {
zoom_in = "plus";
zoom_out = "minus";
};
description = ''
Override feh's default keybindings. If you want to disable a keybinding
set its value to null.
@ -41,23 +45,26 @@ in
};
config = mkIf cfg.enable {
assertions = [
{
assertions = [{
assertion = ((filterAttrs (n: v: v == "") cfg.keybindings) == { });
message = "To disable a keybinding, use `null` instead of an empty string.";
}
];
message =
"To disable a keybinding, use `null` instead of an empty string.";
}];
home.packages = [ pkgs.feh ];
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))}
${concatStringsSep "\n" (mapAttrsToList disableBinding
(filterAttrs (n: v: v == null) cfg.buttons))}
${concatStringsSep "\n" (mapAttrsToList enableBinding
(filterAttrs (n: v: v != null) cfg.buttons))}
'';
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))}
${concatStringsSep "\n" (mapAttrsToList disableBinding
(filterAttrs (n: v: v == null) cfg.keybindings))}
${concatStringsSep "\n" (mapAttrsToList enableBinding
(filterAttrs (n: v: v != null) cfg.keybindings))}
'';
};
}

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.fzf;
in
{
in {
options.programs.fzf = {
enable = mkEnableOption "fzf - a command-line fuzzy finder";
@ -107,9 +105,8 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.fzf ];
home.sessionVariables =
mapAttrs (n: v: toString v) (
filterAttrs (n: v: v != [] && v != null) {
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;
@ -118,8 +115,7 @@ in
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

View file

@ -4,24 +4,23 @@ 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
{
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
{
} else {
destinationType = "Maildir";
destinationPath = "${maildir.absPath}/";
};
@ -46,14 +45,12 @@ 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}";
renderConfigFilepath = a:
".getmail/getmail${if a.primary then "rc" else a.name}";
in
{
in {
config = mkIf getmailEnabled {
home.file =
foldl' (a: b: a // b) {}
home.file = foldl' (a: b: a // b) { }
(map (a: { "${renderConfigFilepath a}".text = renderAccountConfig a; })
accounts);
};

View file

@ -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
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));
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 = {
@ -105,14 +99,11 @@ let
};
};
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 = {
@ -217,8 +208,7 @@ in
};
};
config = mkIf cfg.enable (
mkMerge [
config = mkIf cfg.enable (mkMerge [
{
home.packages = [ cfg.package ];
@ -241,22 +231,20 @@ in
}
{
programs.git.iniContent =
let
programs.git.iniContent = let
hasSmtp = name: account: account.smtp != null;
genIdentity = name: account: with account;
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) {
} // optionalAttrs (smtp.port != null) {
smtpServerPort = smtp.port;
});
in
mapAttrs' genIdentity
in mapAttrs' genIdentity
(filterAttrs hasSmtp config.accounts.email.accounts);
}
@ -268,58 +256,48 @@ in
};
})
(mkIf (cfg.aliases != {}) {
programs.git.iniContent.alias = cfg.aliases;
})
(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 = [
''
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)));
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
{
let skipArg = optional cfg.lfs.skipSmudge "--skip";
in {
clean = "git-lfs clean -- %f";
process = concatStringsSep " " (
[ "git-lfs" "filter-process" ] ++ skipArg
);
process =
concatStringsSep " " ([ "git-lfs" "filter-process" ] ++ skipArg);
required = true;
smudge = concatStringsSep " " (
[ "git-lfs" "smudge" ] ++ skipArg ++ [ "--" "%f" ]
);
smudge = concatStringsSep " "
([ "git-lfs" "smudge" ] ++ skipArg ++ [ "--" "%f" ]);
};
})
]
);
]);
}

View file

@ -11,8 +11,7 @@ let
. ${pkgs.gnome3.vte}/etc/profile.d/vte.sh
'';
backForeSubModule = types.submodule (
{ ... }: {
backForeSubModule = types.submodule ({ ... }: {
options = {
foreground = mkOption {
type = types.str;
@ -24,11 +23,9 @@ let
description = "The background color.";
};
};
}
);
});
profileColorsSubModule = types.submodule (
{ ... }: {
profileColorsSubModule = types.submodule ({ ... }: {
options = {
foregroundColor = mkOption {
type = types.str;
@ -63,11 +60,9 @@ let
description = "The colors for the terminals highlighted area.";
};
};
}
);
});
profileSubModule = types.submodule (
{ name, config, ... }: {
profileSubModule = types.submodule ({ name, config, ... }: {
options = {
default = mkOption {
default = false;
@ -122,14 +117,12 @@ let
scrollbackLines = mkOption {
default = 10000;
type = types.nullOr types.int;
description =
''
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 (
{
} // (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) {
} // optionalAttrs (pcfg.allowBold != null) {
allow-bold = pcfg.allowBold;
}
// (
if (pcfg.colors.boldColor == null)
then { bold-color-same-as-fg = true; }
else {
} // (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 {
}) // (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 {
} 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; }
)
)
);
} else {
highlight-colors-set = false;
})));
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -216,11 +194,8 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.gnome3.gnome_terminal ];
dconf.settings =
let
dconfPath = "org/gnome/terminal/legacy";
in
{
dconf.settings = let dconfPath = "org/gnome/terminal/legacy";
in {
"${dconfPath}" = {
default-show-menubar = cfg.showMenubar;
theme-variant = cfg.themeVariant;
@ -231,10 +206,9 @@ in
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;
} // mapAttrs'
(n: v: nameValuePair ("${dconfPath}/profiles:/:${n}") (buildProfileSet v))
cfg.profile;
programs.bash.initExtra = mkBefore vteInitStr;
programs.zsh.initExtra = vteInitStr;

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.go;
in
{
in {
meta.maintainers = [ maintainers.rvolosatovs ];
options = {
@ -49,11 +47,8 @@ in
type = types.listOf types.str;
default = [ ];
example = [ "extraGoPath1" "extraGoPath2" ];
description =
let
goPathOpt = "programs.go.goPath";
in
''
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>,
@ -74,24 +69,21 @@ in
{
home.packages = [ cfg.package ];
home.file =
let
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);
in foldl' (a: b: a // b) { } (mapAttrsToList mkSrc cfg.packages);
}
(mkIf (cfg.goPath != null) {
home.sessionVariables.GOPATH =
concatStringsSep ":"
(map builtins.toPath
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}";
})
]);
}

View file

@ -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; }) ];
};
}

View file

@ -3,6 +3,7 @@
with lib;
let
cfg = config.programs.htop;
list = xs: concatMapStrings (x: "${toString x} ") xs;
@ -87,10 +88,9 @@ let
"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.";
};
@ -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;

View file

@ -34,9 +34,7 @@ let
# from this package in the activation script.
infoPkg = pkgs.texinfoInteractive;
in
{
in {
options = {
programs.info = {
enable = mkEnableOption "GNU Info";
@ -55,7 +53,8 @@ in
home.sessionVariables.INFOPATH =
"${cfg.homeInfoDirLocation}\${INFOPATH:+:}\${INFOPATH}";
home.activation.createHomeInfoDir = hm.dag.entryAfter ["installPackages"] ''
home.activation.createHomeInfoDir =
hm.dag.entryAfter [ "installPackages" ] ''
oPATH=$PATH
export PATH="${lib.makeBinPath [ pkgs.gzip ]}''${PATH:+:}$PATH"
$DRY_RUN_CMD mkdir -p "${cfg.homeInfoDirLocation}"

View file

@ -25,9 +25,7 @@ let
};
};
in
{
in {
options = {
programs.jq = {
enable = mkEnableOption "the jq command-line JSON processor";
@ -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}";
};
};
}

View file

@ -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 = ''
@ -468,24 +497,28 @@ 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"}"
@ -495,58 +528,65 @@ let
"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_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}"
++ 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";

View file

@ -6,15 +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 = "${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 = {
@ -46,7 +47,8 @@ in
};
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.

View file

@ -14,9 +14,7 @@ let
lla = "ls -la";
};
in
{
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.lsd = {

View file

@ -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 = {
@ -55,10 +52,8 @@ in
};
config = mkIf cfg.enable {
xdg.configFile."matplotlib/matplotlibrc".text =
concatStringsSep "\n" ([]
xdg.configFile."matplotlib/matplotlibrc".text = concatStringsSep "\n" ([ ]
++ mapAttrsToList (formatLine "") cfg.config
++ optional (cfg.extraConfig != "") cfg.extraConfig
) + "\n";
++ optional (cfg.extraConfig != "") cfg.extraConfig) + "\n";
};
}

View file

@ -6,9 +6,7 @@ let
extraConfigType = with lib.types; attrsOf (either (either str int) bool);
in
{
in {
options.mbsync = {
enable = mkEnableOption "synchronization using mbsync";

View file

@ -10,14 +10,15 @@ let
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;
};
@ -30,56 +31,45 @@ 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
''
in ''
${header}
${concatStringsSep "\n"
(mapAttrsToList (n: v: "${n} ${genValue n v}") entries)}
'';
genAccountConfig = account: with account;
genSection "IMAPAccount ${name}" (
{
genAccountConfig = account:
with account;
genSection "IMAPAccount ${name}" ({
Host = imap.host;
User = userName;
PassCmd = toString passwordCommand;
}
// genTlsConfig imap.tls
} // 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" (
{
// 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}" (
{
} // optionalAttrs (mbsync.flatten != null) { Flatten = mbsync.flatten; }
// mbsync.extraConfig.local) + "\n" + genSection "Channel ${name}" ({
Master = ":${name}-remote:";
Slave = ":${name}-local:";
Patterns = mbsync.patterns;
@ -87,22 +77,15 @@ let
Remove = masterSlaveMapping.${mbsync.remove};
Expunge = masterSlaveMapping.${mbsync.expunge};
SyncState = "*";
}
// mbsync.extraConfig.channel
)
+ "\n";
} // mbsync.extraConfig.channel) + "\n";
genGroupConfig = name: channels:
let
genGroupChannel = n: boxes: "Channel ${n}:${concatStringsSep "," boxes}";
in
concatStringsSep "\n" (
[ "Group ${name}" ] ++ mapAttrsToList genGroupChannel channels
);
in concatStringsSep "\n"
([ "Group ${name}" ] ++ mapAttrsToList genGroupChannel channels);
in
{
in {
options = {
programs.mbsync = {
enable = mkEnableOption "mbsync IMAP4 and Maildir mailbox synchronizer";
@ -142,18 +125,15 @@ in
};
config = mkIf cfg.enable {
assertions =
let
assertions = let
checkAccounts = pred: msg:
let
badAccounts = filter pred mbsyncAccounts;
let badAccounts = filter pred mbsyncAccounts;
in {
assertion = badAccounts == [ ];
message = "mbsync: ${msg} for accounts: "
+ concatMapStringsSep ", " (a: a.name) badAccounts;
};
in
[
in [
(checkAccounts (a: a.maildir == null) "Missing maildir configuration")
(checkAccounts (a: a.imap == null) "Missing IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "Missing passwordCommand")
@ -164,17 +144,13 @@ in
programs.notmuch.new.ignore = [ ".uidvalidity" ".mbsyncstate" ];
home.file.".mbsyncrc".text =
let
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";
in concatStringsSep "\n" ([''
# Generated by Home Manager.
''] ++ optional (cfg.extraConfig != "") cfg.extraConfig ++ accountsConfig
++ groupsConfig) + "\n";
home.activation = mkIf (mbsyncAccounts != [ ]) {
createMaildir =

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.mercurial;
in
{
in {
options = {
programs.mercurial = {
@ -65,8 +63,7 @@ in
};
};
config = mkIf cfg.enable (
mkMerge [
config = mkIf cfg.enable (mkMerge [
{
home.packages = [ cfg.package ];
@ -81,9 +78,11 @@ in
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 != { }) {
@ -97,6 +96,5 @@ in
(mkIf (lib.isString cfg.extraConfig) {
xdg.configFile."hg/hgrc".text = cfg.extraConfig;
})
]
);
]);
}

View file

@ -23,31 +23,21 @@ let
}.${typeOf option};
renderOptions = options:
concatStringsSep "\n"
(mapAttrsToList
(name: value:
concatStringsSep "\n" (mapAttrsToList (name: value:
let
rendered = renderOption value;
length = toString (stringLength rendered);
in
"${name}=%${length}%${rendered}")
options);
in "${name}=%${length}%${rendered}") options);
renderProfiles = profiles:
concatStringsSep "\n"
(mapAttrsToList
(name: value: ''
concatStringsSep "\n" (mapAttrsToList (name: value: ''
[${name}]
${renderOptions value}
'')
profiles);
'') profiles);
renderBindings = bindings:
concatStringsSep "\n"
(mapAttrsToList
(name: value:
"${name} ${value}")
bindings);
(mapAttrsToList (name: value: "${name} ${value}") bindings);
in {
options = {
@ -131,11 +121,12 @@ 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 != { }) {
xdg.configFile."mpv/mpv.conf".text = ''

View file

@ -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 = ''

View file

@ -6,16 +6,15 @@ 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) (
{
accountStr = account:
with account;
concatStringsSep "\n" ([ "account ${name}" ]
++ mapAttrsToList (n: v: n + " " + v) ({
host = smtp.host;
from = address;
auth = "on";
@ -23,21 +22,16 @@ let
tls = onOff smtp.tls.enable;
tls_starttls = onOff smtp.tls.useStartTls;
tls_trust_file = smtp.tls.certificatesFile;
}
// optionalAttrs (msmtp.tls.fingerprint != null) {
} // optionalAttrs (msmtp.tls.fingerprint != null) {
tls_fingerprint = msmtp.tls.fingerprint;
}
// optionalAttrs (smtp.port != null) {
port = toString smtp.port;
}
} // 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 = {

View file

@ -26,10 +26,9 @@ with lib;
};
config = mkIf config.neomutt.enable {
neomutt.sendMailCommand = mkOptionDefault (
if config.msmtp.enable
then "msmtpq --read-envelope-from --read-recipients"
else null
);
neomutt.sendMailCommand = mkOptionDefault (if config.msmtp.enable then
"msmtpq --read-envelope-from --read-recipients"
else
null);
};
}

View file

@ -6,8 +6,8 @@ let
cfg = config.programs.neomutt;
neomuttAccounts = filter (a: a.neomutt.enable)
(attrValues config.accounts.email.accounts);
neomuttAccounts =
filter (a: a.neomutt.enable) (attrValues config.accounts.email.accounts);
sidebarModule = types.submodule {
options = {
@ -78,11 +78,10 @@ let
setOption = n: v: if v == null then "unset ${n}" else "set ${n}=${v}";
escape = replaceStrings [ "%" ] [ "%25" ];
accountFilename = account:
config.xdg.configHome + "/neomutt/" + account.name;
accountFilename = account: config.xdg.configHome + "/neomutt/" + account.name;
genCommonFolderHooks = account: with account;
{
genCommonFolderHooks = account:
with account; {
from = "'${address}'";
realname = "'${realName}'";
spoolfile = "'+${folders.inbox}'";
@ -91,13 +90,13 @@ let
trash = "'+${folders.trash}'";
};
mtaSection = account: with account;
let
passCmd = concatStringsSep " " passwordCommand;
in
if neomutt.sendMailCommand != null then {
mtaSection = account:
with account;
let passCmd = concatStringsSep " " passwordCommand;
in if neomutt.sendMailCommand != null then {
sendmail = "'${neomutt.sendMailCommand}'";
} else let
} else
let
smtpProto = if smtp.tls.enable then "smtps" else "smtp";
smtpBaseUrl = "${smtpProto}://${escape userName}@${smtp.host}";
in {
@ -105,35 +104,32 @@ let
smtp_pass = "'`${passCmd}`'";
};
genMaildirAccountConfig = account: with account;
genMaildirAccountConfig = account:
with account;
let
folderHook =
mapAttrsToList setOption (
genCommonFolderHooks account
// { folder = "'${account.maildir.absPath}'"; }
)
++ optional (neomutt.extraConfig != "") neomutt.extraConfig;
in
''
folderHook = mapAttrsToList setOption (genCommonFolderHooks account // {
folder = "'${account.maildir.absPath}'";
}) ++ optional (neomutt.extraConfig != "") neomutt.extraConfig;
in ''
${concatStringsSep "\n" folderHook}
'';
registerAccount = account: with account;
''
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);
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
@ -143,30 +139,27 @@ let
set sidebar_format = '${cfg.sidebar.format}'
'';
bindSection =
concatMapStringsSep
"\n"
(bind: "bind ${bind.map} ${bind.key} \"${bind.action}\"")
cfg.binds;
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;
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; ''
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; ''
accountStr = account:
with account;
''
# Generated by Home Manager.
set ssl_force_tls = yes
set certificate_file=${config.accounts.email.certificatesFile}
@ -190,15 +183,11 @@ let
# Extra configuration
${account.neomutt.extraConfig}
''
+ optionalString (account.signature.showSignature != "none") ''
'' + optionalString (account.signature.showSignature != "none") ''
set signature = ${pkgs.writeText "signature.txt" account.signature.text}
''
+ optionalString account.notmuch.enable (notmuchSection account);
'' + optionalString account.notmuch.enable (notmuchSection account);
in
{
in {
options = {
programs.neomutt = {
enable = mkEnableOption "the NeoMutt mail client";
@ -277,15 +266,11 @@ in
rcFile = account: {
"${accountFilename account}".text = accountStr account;
};
in
foldl' (a: b: a // b) {} (map rcFile neomuttAccounts);
in foldl' (a: b: a // b) { } (map rcFile neomuttAccounts);
xdg.configFile."neomutt/neomuttrc" = mkIf (neomuttAccounts != [ ]) {
text =
let
primary = filter (a: a.primary) neomuttAccounts;
in
''
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/"
@ -302,16 +287,14 @@ in
# Macros
${macroSection}
${optionalString cfg.vimKeys "source ${pkgs.neomutt}/share/doc/neomutt/vim-keys/vim-keys.rc"}
${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
+
'' + concatMapStringsSep "\n" registerAccount neomuttAccounts +
# source primary account
"source ${accountFilename (builtins.head primary)}";
};

View file

@ -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";
@ -38,7 +36,10 @@ in
};
});
default = [ ];
example = [{url = "http://example.com"; tags = ["foo" "bar"];}];
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 {
@ -75,42 +78,39 @@ in
queries = mkOption {
type = types.attrsOf types.str;
default = { };
example = {
"foo" = "rssurl =~ \"example.com\"";
};
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}")
);
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}\"";
mkQueryEntry = n: v: ''"query:${n}:${escape [ ''"'' ] v}"'';
queries = mapAttrsToList mkQueryEntry cfg.queries;
in
concatStringsSep "\n" (urls ++ queries) + "\n";
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}

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.noti;
in
{
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.noti = {
@ -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; };
};
}

View file

@ -1,7 +1,5 @@
{ lib, ... }:
{
options.notmuch = {
enable = lib.mkEnableOption "notmuch indexing";
};
options.notmuch = { enable = lib.mkEnableOption "notmuch indexing"; };
}

View file

@ -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}";
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;
};
notmuchIni = recursiveUpdate {
database = { path = config.accounts.email.maildirBasePath; };
maildir = {
synchronize_flags = cfg.maildir.synchronizeFlags;
};
maildir = { synchronize_flags = cfg.maildir.synchronizeFlags; };
new = {
ignore = cfg.new.ignore;
tags = cfg.new.tags;
};
user =
let
accounts =
filter (a: a.notmuch.enable)
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
other_email = catAttrs "aliases" primary ++ catAttrs "address" secondaries
++ catAttrs "aliases" secondaries;
};
search = {
exclude_tags = cfg.search.excludeTags;
};
}
cfg.extraConfig;
search = { exclude_tags = cfg.search.excludeTags; };
} cfg.extraConfig;
in
{
in {
options = {
programs.notmuch = {
enable = mkEnableOption "Notmuch mail indexer";
@ -176,16 +165,14 @@ in
};
xdg.configFile."notmuch/notmuchrc".text =
let
toIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
in
"# Generated by Home Manager.\n\n"
+ toIni notmuchIni;
let toIni = generators.toINI { mkKeyValue = mkIniKeyValue; };
in ''
# Generated by Home Manager.
home.file =
let
hook = name: cmds:
{
'' + 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"
@ -195,14 +182,10 @@ in
${cmds}
'';
};
in
optionalAttrs (cfg.hooks.preNew != "")
(hook "pre-new" cfg.hooks.preNew)
//
optionalAttrs (cfg.hooks.postNew != "")
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 != "")
// optionalAttrs (cfg.hooks.postInsert != "")
(hook "post-insert" cfg.hooks.postInsert);
};
}

View file

@ -11,13 +11,10 @@ let
let
pluginDirs = map (pkg: "${pkg}/share/obs/obs-plugins") packages;
plugins = concatMapStringsSep " " (p: "${p}/*") pluginDirs;
in
pkgs.runCommand "obs-studio-plugins"
{
in pkgs.runCommand "obs-studio-plugins" {
preferLocalBuild = true;
allowSubstitutes = false;
}
''
} ''
mkdir $out
[[ '${plugins}' ]] || exit 0
for plugin in ${plugins}; do
@ -25,9 +22,7 @@ let
done
'';
in
{
in {
meta.maintainers = [ maintainers.adisbladis ];
options = {
@ -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; };
};
}

View file

@ -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;
};
example = { autorefresh = 20; };
description = ''
Extra configuration options to add to the account section.
'';
@ -26,9 +22,7 @@ in
extraConfig.local = mkOption {
type = extraConfigType;
default = { };
example = {
sync_deletes = true;
};
example = { sync_deletes = true; };
description = ''
Extra configuration options to add to the local account
section.

View file

@ -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 = if imap.tls.enable then {
ssl = true;
sslcacertfile = imap.tls.certificatesFile;
starttls = imap.tls.useStartTls;
}
else
{
} else {
ssl = false;
};
remotePassEval =
let
arglist = concatMapStringsSep "," (x: "'${x}'") passwordCommand;
in
optionalAttrs (passwordCommand != null) {
let arglist = concatMapStringsSep "," (x: "'${x}'") passwordCommand;
in optionalAttrs (passwordCommand != null) {
remotepasseval = ''get_pass("${name}", [${arglist}])'';
};
in
toIni {
in toIni {
"Account ${name}" = {
localrepository = "${name}-local";
remoterepository = "${name}-remote";
}
// postSyncHook
// offlineimap.extraConfig.account;
} // postSyncHook // offlineimap.extraConfig.account;
"Repository ${name}-local" = {
type = localType;
localfolders = maildir.absPath;
}
// offlineimap.extraConfig.local;
} // offlineimap.extraConfig.local;
"Repository ${name}-remote" = {
type = remoteType;
remoteuser = userName;
}
// remoteHost
// remotePort
// remotePassEval
// ssl
} // remoteHost // remotePort // remotePassEval // ssl
// offlineimap.extraConfig.remote;
};
extraConfigType = with types; attrsOf (either (either str int) bool);
in
{
in {
options = {
programs.offlineimap = {
enable = mkEnableOption "OfflineIMAP";
@ -147,9 +122,7 @@ in
extraConfig.default = mkOption {
type = extraConfigType;
default = { };
example = {
gmailtrashfolder = "[Gmail]/Papierkorb";
};
example = { gmailtrashfolder = "[Gmail]/Papierkorb"; };
description = ''
Extra configuration options added to the
<option>DEFAULT</option> section.
@ -181,27 +154,20 @@ in
xdg.configFile."offlineimap/get_settings.py".text = cfg.pythonFile;
xdg.configFile."offlineimap/config".text =
''
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 ({
'' + 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 != {}) {
} // cfg.extraConfig.general;
} // optionalAttrs (cfg.extraConfig.mbnames != { }) {
mbnames = { enabled = true; } // cfg.extraConfig.mbnames;
}
// optionalAttrs (cfg.extraConfig.default != {}) {
} // optionalAttrs (cfg.extraConfig.default != { }) {
DEFAULT = cfg.extraConfig.default;
})
+ "\n"
+ concatStringsSep "\n" (map accountStr accounts);
}) + "\n" + concatStringsSep "\n" (map accountStr accounts);
};
}

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.opam;
in
{
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.opam = {

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.password-store;
in
{
in {
meta.maintainers = with maintainers; [ pacien ];
options.programs.password-store = {

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.pazi;
in
{
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.pazi = {

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.pidgin;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {

View file

@ -9,26 +9,28 @@ let
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}";
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}";
mkBindingStr = k: v: ''"${k}": ${v}'';
in
{
in {
options.programs.readline = {
enable = mkEnableOption "readline";
bindings = mkOption {
default = { };
type = types.attrsOf types.str;
example = { "\C-h" = "backward-kill-word"; };
example = { "\\C-h" = "backward-kill-word"; };
description = "Readline bindings.";
};
@ -58,15 +60,12 @@ in
};
config = mkIf cfg.enable {
home.file.".inputrc".text =
let
configStr = concatStringsSep "\n" (
optional cfg.includeSystemConfig "$include /etc/inputrc"
home.file.".inputrc".text = let
configStr = concatStringsSep "\n"
(optional cfg.includeSystemConfig "$include /etc/inputrc"
++ mapAttrsToList mkSetVariableStr cfg.variables
++ mapAttrsToList mkBindingStr cfg.bindings
);
in
''
++ mapAttrsToList mkBindingStr cfg.bindings);
in ''
# Generated by Home Manager.
${configStr}

View file

@ -7,7 +7,8 @@ let
cfg = config.programs.rofi;
colorOption = description: mkOption {
colorOption = description:
mkOption {
type = types.str;
description = description;
};
@ -71,29 +72,22 @@ 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)
${optionalString (rows.normal != null)
(setOption "color-normal" (rowColorsToString rows.normal))}
${optionalString
(rows.active != null)
${optionalString (rows.active != null)
(setOption "color-active" (rowColorsToString rows.active))}
${optionalString
(rows.urgent != null)
${optionalString (rows.urgent != null)
(setOption "color-urgent" (rowColorsToString rows.urgent))}
'';
rowColorsToString = row: concatStringsSep ", " (with row; [
rowColorsToString = row:
concatStringsSep ", " (with row; [
background
foreground
backgroundAlt
@ -104,13 +98,11 @@ let
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 = {
@ -125,18 +117,19 @@ let
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 = [
{
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}

View file

@ -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; };
};
}

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.skim;
in
{
in {
options.programs.skim = {
enable = mkEnableOption "skim - a command-line fuzzy finder";
@ -98,9 +96,8 @@ in
config = mkIf cfg.enable {
home.packages = [ pkgs.skim ];
home.sessionVariables =
mapAttrs (n: v: toString v) (
filterAttrs (n: v: v != [] && v != null) {
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;
@ -108,8 +105,7 @@ in
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

View file

@ -7,20 +7,17 @@ let
cfg = config.programs.starship;
configFile = config:
pkgs.runCommand "config.toml"
{
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
{
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.starship = {
@ -73,9 +70,8 @@ in
config = mkIf cfg.enable {
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

View file

@ -9,31 +9,32 @@ 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";
@ -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}
'';

View file

@ -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 {
@ -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,24 +307,28 @@ 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
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}";
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 = ''
@ -373,6 +383,5 @@ in
programs.bash.initExtra = vteInitStr;
programs.zsh.initExtra = vteInitStr;
}
);
});
}

View file

@ -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 = [
{
assertions = [{
assertion = texlivePkgs != { };
message = "Must provide at least one extra package in"
+ " 'programs.texlive.extraPackages'.";
}
];
}];
home.packages = [ cfg.package ];

View file

@ -6,9 +6,7 @@ let
cfg = config.programs.urxvt;
in
{
in {
options.programs.urxvt = {
enable = mkEnableOption "rxvt-unicode terminal emulator";
@ -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,7 +74,8 @@ 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.";
};
};
};
@ -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,7 +118,8 @@ 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 {
@ -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 != []) {
} // 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.extraConfig (k: v: nameValuePair "URxvt.${k}" v);
};
}

View file

@ -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
v = if isBool value then
(if value then "" else "no") + name
else
"${name}=${
if isList value
then concatStringsSep "," value
else toString value
if isList value then concatStringsSep "," value else toString value
}";
in
optionalString (value != null) ("set " + v);
in optionalString (value != null) ("set " + v);
plugins =
let
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;
if isDerivation p then
[ p ]
else
optional (isString p && hasAttr p vpkgs) vpkgs.${p};
in concatMap getPkg cfg.plugins;
in
{
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>.
@ -102,14 +95,12 @@ in
options.
<informaltable frame="none"><tgroup cols="1"><tbody>
${concatStringsSep "\n" (
mapAttrsToList (n: v: ''
${concatStringsSep "\n" (mapAttrsToList (n: v: ''
<row>
<entry><varname>${n}</varname></entry>
<entry>${v.description}</entry>
</row>
'') knownSettings
)}
'') knownSettings)}
</tbody></tgroup></informaltable>
See the Vim documentation for detailed descriptions of these
@ -136,13 +127,10 @@ in
};
};
config = (
let
config = (let
customRC = ''
${concatStringsSep "\n" (
filter (v: v != "") (
mapAttrsToList setExpr (
builtins.intersectAttrs knownSettings cfg.settings)))}
${concatStringsSep "\n" (filter (v: v != "") (mapAttrsToList setExpr
(builtins.intersectAttrs knownSettings cfg.settings)))}
${cfg.extraConfig}
'';
@ -155,26 +143,19 @@ in
packages.home-manager.start = plugins;
};
};
in
mkIf cfg.enable {
assertions =
let
packagesNotFound = filter (p: isString p && (!hasAttr p pkgs.vimPlugins)) cfg.plugins;
in
[
{
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 != []) ''
warnings = let stringPlugins = filter isString cfg.plugins;
in optional (stringPlugins != [ ]) ''
Specifying VIM plugins using strings is deprecated, found ${
concatMapStringsSep ", " (p: ''"${p}"'') stringPlugins
} as strings.
@ -186,6 +167,5 @@ in
package = vim;
plugins = defaultPlugins;
};
}
);
});
}

View file

@ -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,9 +55,7 @@ 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;
};

View file

@ -14,9 +14,7 @@ let
zh = "z -I -t ."; # fzf
};
in
{
in {
meta.maintainers = [ maintainers.marsam ];
options.programs.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;

View file

@ -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 = {
@ -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" ([]
xdg.configFile."zathura/zathurarc".text = concatStringsSep "\n" ([ ]
++ optional (cfg.extraConfig != "") cfg.extraConfig
++ mapAttrsToList formatLine cfg.options
) + "\n";
++ mapAttrsToList formatLine cfg.options) + "\n";
};
}

View file

@ -28,13 +28,9 @@ with lib;
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${pkgs.blueman}/bin/blueman-applet";
};
Service = { ExecStart = "${pkgs.blueman}/bin/blueman-applet"; };
};
};
}

View file

@ -9,37 +9,24 @@ let
package = pkgs.cbatticon;
makeCommand = commandName: commandArg:
optional (commandArg != null) (
let
cmd = pkgs.writeShellScript commandName commandArg;
in
"--${commandName} ${cmd}"
);
optional (commandArg != null)
(let cmd = pkgs.writeShellScript commandName commandArg;
in "--${commandName} ${cmd}");
commandLine = concatStringsSep " " (
[ "${package}/bin/cbatticon" ]
commandLine = concatStringsSep " " ([ "${package}/bin/cbatticon" ]
++ makeCommand "command-critical-level" cfg.commandCriticalLevel
++ makeCommand "command-left-click" cfg.commandLeftClick
++ optional
(cfg.iconType != null)
"--icon-type ${cfg.iconType}"
++ optional
(cfg.lowLevelPercent != null)
++ optional (cfg.iconType != null) "--icon-type ${cfg.iconType}"
++ optional (cfg.lowLevelPercent != null)
"--low-level ${toString cfg.lowLevelPercent}"
++ optional
(cfg.criticalLevelPercent != null)
++ optional (cfg.criticalLevelPercent != null)
"--critical-level ${toString cfg.criticalLevelPercent}"
++ optional
(cfg.updateIntervalSeconds != null)
++ optional (cfg.updateIntervalSeconds != null)
"--update-interval ${toString cfg.updateIntervalSeconds}"
++ optional
(cfg.hideNotification != null && cfg.hideNotification)
"--hide-notification"
);
++ optional (cfg.hideNotification != null && cfg.hideNotification)
"--hide-notification");
in
{
in {
meta.maintainers = [ maintainers.pmiddend ];
options = {
@ -66,7 +53,8 @@ in
};
iconType = mkOption {
type = types.nullOr (types.enum [ "standard" "notification" "symbolic" ]);
type =
types.nullOr (types.enum [ "standard" "notification" "symbolic" ]);
default = null;
example = "symbolic";
description = "Icon type to display in the system tray.";
@ -119,9 +107,7 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = commandLine;

View file

@ -7,16 +7,14 @@ let
cfg = config.services.compton;
configFile = pkgs.writeText "compton.conf"
(optionalString cfg.fade ''
configFile = pkgs.writeText "compton.conf" (optionalString cfg.fade ''
# fading
fading = true;
fade-delta = ${toString cfg.fadeDelta};
fade-in-step = ${elemAt cfg.fadeSteps 0};
fade-out-step = ${elemAt cfg.fadeSteps 1};
fade-exclude = ${toJSON cfg.fadeExclude};
'' +
optionalString cfg.shadow ''
'' + optionalString cfg.shadow ''
# shadows
shadow = true;
@ -26,8 +24,7 @@ let
shadow-exclude = ${toJSON cfg.shadowExclude};
no-dock-shadow = ${toJSON cfg.noDockShadow};
no-dnd-shadow = ${toJSON cfg.noDNDShadow};
'' +
optionalString cfg.blur ''
'' + optionalString cfg.blur ''
# blur
blur-background = true;
@ -62,10 +59,7 @@ in {
blurExclude = mkOption {
type = types.listOf types.str;
default = [ ];
example = [
"class_g = 'slop'"
"class_i = 'polybar'"
];
example = [ "class_g = 'slop'" "class_i = 'polybar'" ];
description = ''
List of windows to exclude background blur.
See the
@ -106,11 +100,7 @@ in {
fadeExclude = mkOption {
type = types.listOf types.str;
default = [ ];
example = [
"window_type *= 'menu'"
"name ~= 'Firefox$'"
"focused = 1"
];
example = [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ];
description = ''
List of conditions of windows that should not be faded.
See the
@ -151,11 +141,7 @@ in {
shadowExclude = mkOption {
type = types.listOf types.str;
default = [ ];
example = [
"window_type *= 'menu'"
"name ~= 'Firefox$'"
"focused = 1"
];
example = [ "window_type *= 'menu'" "name ~= 'Firefox$'" "focused = 1" ];
description = ''
List of conditions of windows that should have no shadow.
See the
@ -213,10 +199,7 @@ in {
opacityRule = mkOption {
type = types.listOf types.str;
default = [ ];
example = [
"87:class_i ?= 'scratchpad'"
"91:class_i ?= 'xterm'"
];
example = [ "87:class_i ?= 'scratchpad'" "91:class_i ?= 'xterm'" ];
description = ''
List of opacity rules.
See the
@ -293,16 +276,13 @@ in {
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${cfg.package}/bin/compton --config ${configFile}";
Restart = "always";
RestartSec = 3;
}
// optionalAttrs (cfg.backend == "glx") {
} // optionalAttrs (cfg.backend == "glx") {
# Temporarily fixes corrupt colours with Mesa 18.
Environment = [ "allow_rgb10_configs=false" ];
};

View file

@ -6,17 +6,19 @@ let
cfg = config.services.dunst;
eitherStrBoolIntList = with types; either str (either bool (either int (listOf str)));
eitherStrBoolIntList = with types;
either str (either bool (either int (listOf str)));
toDunstIni = generators.toINI {
mkKeyValue = key: value:
let
value' =
if isBool value then (if value then "yes" else "no")
else if isString value then "\"${value}\""
else toString value;
in
"${key}=${value'}";
value' = if isBool value then
(if value then "yes" else "no")
else if isString value then
''"${value}"''
else
toString value;
in "${key}=${value'}";
};
themeType = types.submodule {
@ -48,9 +50,7 @@ let
size = "32x32";
};
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -87,18 +87,15 @@ in
};
};
config = mkIf cfg.enable (
mkMerge [
config = mkIf cfg.enable (mkMerge [
{
xdg.dataFile."dbus-1/services/org.knopwob.dunst.service".source =
"${pkgs.dunst}/share/dbus-1/services/org.knopwob.dunst.service";
services.dunst.settings.global.icon_path =
let
useCustomTheme =
cfg.iconTheme.package != hicolorTheme.package
|| cfg.iconTheme.name != hicolorTheme.name
|| cfg.iconTheme.size != hicolorTheme.size;
services.dunst.settings.global.icon_path = let
useCustomTheme = cfg.iconTheme.package != hicolorTheme.package
|| cfg.iconTheme.name != hicolorTheme.name || cfg.iconTheme.size
!= hicolorTheme.size;
basePaths = [
"/run/current-system/sw"
@ -106,12 +103,8 @@ in
cfg.iconTheme.package
] ++ optional useCustomTheme hicolorTheme.package;
themes =
[
cfg.iconTheme
] ++ optional useCustomTheme (
hicolorTheme // { size = cfg.iconTheme.size; }
);
themes = [ cfg.iconTheme ] ++ optional useCustomTheme
(hicolorTheme // { size = cfg.iconTheme.size; });
categories = [
"actions"
@ -128,16 +121,11 @@ in
"status"
"stock"
];
in
concatStringsSep ":" (
concatMap (theme:
in concatStringsSep ":" (concatMap (theme:
concatMap (basePath:
map (category:
"${basePath}/share/icons/${theme.name}/${theme.size}/${category}"
) categories
) basePaths
) themes
);
"${basePath}/share/icons/${theme.name}/${theme.size}/${category}")
categories) basePaths) themes);
systemd.user.services.dunst = {
Unit = {
@ -167,6 +155,5 @@ in
'';
};
})
]
);
]);
}

View file

@ -10,9 +10,8 @@ let
configText = builtins.toJSON ({ inherit (cfg) order; } // cfg.extraConfig);
configFile = pkgs.writeText "dwm-status.json" configText;
in
{
in {
options = {
services.dwm-status = {
enable = mkEnableOption "dwm-status user service";
@ -58,13 +57,9 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${cfg.package}/bin/dwm-status ${configFile}";
};
Service = { ExecStart = "${cfg.package}/bin/dwm-status ${configFile}"; };
};
};
}

View file

@ -8,26 +8,21 @@ let
emacsCfg = config.programs.emacs;
emacsBinPath = "${emacsCfg.finalPackage}/bin";
in
{
options.services.emacs = {
enable = mkEnableOption "the Emacs daemon";
};
in {
options.services.emacs = { enable = mkEnableOption "the Emacs daemon"; };
config = mkIf cfg.enable {
assertions = [
{
assertions = [{
assertion = emacsCfg.enable;
message = "The Emacs service module requires"
+ " 'programs.emacs.enable = true'.";
}
];
}];
systemd.user.services.emacs = {
Unit = {
Description = "Emacs: the extensible, self-documenting text editor";
Documentation = "info:emacs man:emacs(1) https://gnu.org/software/emacs/";
Documentation =
"info:emacs man:emacs(1) https://gnu.org/software/emacs/";
# Avoid killing the Emacs session, which may be full of
# unsaved buffers.
@ -35,14 +30,13 @@ in
};
Service = {
ExecStart = "${pkgs.runtimeShell} -l -c 'exec ${emacsBinPath}/emacs --fg-daemon'";
ExecStart =
"${pkgs.runtimeShell} -l -c 'exec ${emacsBinPath}/emacs --fg-daemon'";
ExecStop = "${emacsBinPath}/emacsclient --eval '(kill-emacs)'";
Restart = "on-failure";
};
Install = {
WantedBy = [ "default.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
};
};
}

View file

@ -7,16 +7,10 @@ let
cfg = config.services.flameshot;
package = pkgs.flameshot;
in
{
in {
meta.maintainers = [ maintainers.hamhut1066 ];
options = {
services.flameshot = {
enable = mkEnableOption "Flameshot";
};
};
options = { services.flameshot = { enable = mkEnableOption "Flameshot"; }; };
config = mkIf cfg.enable {
home.packages = [ package ];
@ -33,9 +27,7 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";

View file

@ -6,17 +6,19 @@ let
cfg = config.services.getmail;
accounts = filter (a: a.getmail.enable)
(attrValues config.accounts.email.accounts);
accounts =
filter (a: a.getmail.enable) (attrValues config.accounts.email.accounts);
# Note: The getmail service does not expect a path, but just the filename!
renderConfigFilepath = a: if a.primary then "getmailrc" else "getmail${a.name}";
configFiles = concatMapStringsSep " " (a: " --rcfile ${renderConfigFilepath a}") accounts;
in
{
renderConfigFilepath = a:
if a.primary then "getmailrc" else "getmail${a.name}";
configFiles =
concatMapStringsSep " " (a: " --rcfile ${renderConfigFilepath a}") accounts;
in {
options = {
services.getmail = {
enable = mkEnableOption "the getmail systemd service to automatically retrieve mail";
enable = mkEnableOption
"the getmail systemd service to automatically retrieve mail";
frequency = mkOption {
type = types.str;
@ -36,25 +38,17 @@ in
config = mkIf cfg.enable {
systemd.user.services.getmail = {
Unit = {
Description = "getmail email fetcher";
};
Service = {
ExecStart = "${pkgs.getmail}/bin/getmail ${configFiles}";
};
Unit = { Description = "getmail email fetcher"; };
Service = { ExecStart = "${pkgs.getmail}/bin/getmail ${configFiles}"; };
};
systemd.user.timers.getmail = {
Unit = {
Description = "getmail email fetcher";
};
Unit = { Description = "getmail email fetcher"; };
Timer = {
OnCalendar = "${cfg.frequency}";
Unit = "getmail.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
Install = { WantedBy = [ "timers.target" ]; };
};
};

View file

@ -6,9 +6,7 @@ let
cfg = config.services.gnome-keyring;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -34,22 +32,15 @@ in
};
Service = {
ExecStart =
let
args = concatStringsSep " " (
[ "--start" "--foreground" ]
++ optional (cfg.components != []) (
"--components=" + concatStringsSep "," cfg.components
)
);
in
"${pkgs.gnome3.gnome_keyring}/bin/gnome-keyring-daemon ${args}";
ExecStart = let
args = concatStringsSep " " ([ "--start" "--foreground" ]
++ optional (cfg.components != [ ])
("--components=" + concatStringsSep "," cfg.components));
in "${pkgs.gnome3.gnome_keyring}/bin/gnome-keyring-daemon ${args}";
Restart = "on-abort";
};
Install = {
WantedBy = [ "graphical-session-pre.target" ];
};
Install = { WantedBy = [ "graphical-session-pre.target" ]; };
};
};
}

View file

@ -6,12 +6,10 @@ let
cfg = config.services.grobi;
eitherStrBoolIntList =
with types; either str (either bool (either int (listOf str)));
eitherStrBoolIntList = with types;
either str (either bool (either int (listOf str)));
in
{
in {
meta.maintainers = [ maintainers.mbrgm ];
options = {
@ -88,9 +86,7 @@ in
Environment = "PATH=${pkgs.xorg.xrandr}/bin:${pkgs.bash}/bin";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
xdg.configFile."grobi.conf".text = builtins.toJSON {

View file

@ -6,23 +6,16 @@ let
cfg = config.services.hound;
configFile = pkgs.writeText "hound-config.json" (
builtins.toJSON {
configFile = pkgs.writeText "hound-config.json" (builtins.toJSON {
max-concurrent-indexers = cfg.maxConcurrentIndexers;
dbpath = cfg.databasePath;
repos = cfg.repositories;
health-check-url = "/healthz";
}
);
});
houndOptions = [
"--addr ${cfg.listenAddress}"
"--conf ${configFile}"
];
houndOptions = [ "--addr ${cfg.listenAddress}" "--conf ${configFile}" ];
in
{
in {
meta.maintainers = [ maintainers.adisbladis ];
options.services.hound = {
@ -37,7 +30,7 @@ in
databasePath = mkOption {
type = types.path;
default = "${config.xdg.dataHome}/hound";
defaultText = "\$XDG_DATA_HOME/hound";
defaultText = "$XDG_DATA_HOME/hound";
description = "The Hound database path.";
};
@ -67,17 +60,14 @@ in
home.packages = [ pkgs.hound ];
systemd.user.services.hound = {
Unit = {
Description = "Hound source code search engine";
};
Unit = { Description = "Hound source code search engine"; };
Install = {
WantedBy = [ "default.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
Service = {
Environment = "PATH=${makeBinPath [ pkgs.mercurial pkgs.git ]}";
ExecStart = "${pkgs.hound}/bin/houndd ${concatStringsSep " " houndOptions}";
ExecStart =
"${pkgs.hound}/bin/houndd ${concatStringsSep " " houndOptions}";
};
};
};

View file

@ -16,7 +16,10 @@ with lib;
onNotifyPost = mkOption {
type = with types; either str (attrsOf str);
default = "";
example = { mail = "\${pkgs.notmuch}/bin/notmuch new && \${pkgs.libnotify}/bin/notify-send 'New mail arrived'"; };
example = {
mail =
"\${pkgs.notmuch}/bin/notmuch new && \${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
};
description = "Shell commands to run after onNotify event.";
};

View file

@ -9,43 +9,38 @@ let
safeName = lib.replaceChars [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ];
imapnotifyAccounts =
filter (a: a.imapnotify.enable)
(attrValues config.accounts.email.accounts);
filter (a: a.imapnotify.enable) (attrValues config.accounts.email.accounts);
genAccountUnit = account:
let
name = safeName account.name;
in
{
let name = safeName account.name;
in {
name = "imapnotify-${name}";
value = {
Unit = {
Description = "imapnotify for ${name}";
};
Unit = { Description = "imapnotify for ${name}"; };
Service = {
ExecStart = "${pkgs.imapnotify}/bin/imapnotify -c ${genAccountConfig account}";
ExecStart =
"${pkgs.imapnotify}/bin/imapnotify -c ${genAccountConfig account}";
} // optionalAttrs account.notmuch.enable {
Environment = "NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc";
Environment =
"NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc";
};
Install = {
WantedBy = [ "default.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
};
};
genAccountConfig = account:
pkgs.writeText "imapnotify-${safeName account.name}-config.js" (
let
port =
if account.imap.port != null then account.imap.port
else if account.imap.tls.enable then 993
else 143;
pkgs.writeText "imapnotify-${safeName account.name}-config.js" (let
port = if account.imap.port != null then
account.imap.port
else if account.imap.tls.enable then
993
else
143;
toJSON = builtins.toJSON;
in
''
in ''
var child_process = require('child_process');
function getStdout(cmd) {
@ -61,47 +56,35 @@ let
exports.onNotify = ${toJSON account.imapnotify.onNotify};
exports.onNotifyPost = ${toJSON account.imapnotify.onNotifyPost};
exports.boxes = ${toJSON account.imapnotify.boxes};
''
);
'');
in
{
in {
meta.maintainers = [ maintainers.nickhu ];
options = {
services.imapnotify = {
enable = mkEnableOption "imapnotify";
};
services.imapnotify = { enable = mkEnableOption "imapnotify"; };
accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (
import ./imapnotify-accounts.nix
));
type = with types; attrsOf (submodule (import ./imapnotify-accounts.nix));
};
};
config = mkIf cfg.enable {
assertions =
let
assertions = let
checkAccounts = pred: msg:
let
badAccounts = filter pred imapnotifyAccounts;
in
{
let badAccounts = filter pred imapnotifyAccounts;
in {
assertion = badAccounts == [ ];
message = "imapnotify: Missing ${msg} for accounts: "
+ concatMapStringsSep ", " (a: a.name) badAccounts;
};
in
[
in [
(checkAccounts (a: a.maildir == null) "maildir configuration")
(checkAccounts (a: a.imap == null) "IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "password command")
(checkAccounts (a: a.userName == null) "username")
];
systemd.user.services =
listToAttrs (map genAccountUnit imapnotifyAccounts);
systemd.user.services = listToAttrs (map genAccountUnit imapnotifyAccounts);
};
}

View file

@ -7,9 +7,7 @@ let
cfg = config.services.kdeconnect;
package = pkgs.kdeconnect;
in
{
in {
meta.maintainers = [ maintainers.adisbladis ];
options = {
@ -31,14 +29,13 @@ in
systemd.user.services.kdeconnect = {
Unit = {
Description = "Adds communication between your desktop and your smartphone";
Description =
"Adds communication between your desktop and your smartphone";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";
@ -52,16 +49,16 @@ in
systemd.user.services.kdeconnect-indicator = {
Unit = {
Description = "kdeconnect-indicator";
After = [ "graphical-session-pre.target"
After = [
"graphical-session-pre.target"
"polybar.service"
"taffybar.service"
"stalonetray.service" ];
"stalonetray.service"
];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment = "PATH=${config.home.profileDirectory}/bin";

View file

@ -19,13 +19,9 @@ with lib;
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${pkgs.keepassx}/bin/keepassx -min -lock";
};
Service = { ExecStart = "${pkgs.keepassx}/bin/keepassx -min -lock"; };
};
};
}

View file

@ -6,14 +6,10 @@ let
cfg = config.services.lorri;
in
{
in {
meta.maintainers = [ maintainers.gerschtli ];
options = {
services.lorri.enable = mkEnableOption "lorri build daemon";
};
options = { services.lorri.enable = mkEnableOption "lorri build daemon"; };
config = mkIf cfg.enable {
home.packages = [ pkgs.lorri ];
@ -33,25 +29,22 @@ in
ProtectSystem = "strict";
ProtectHome = "read-only";
Restart = "on-failure";
Environment =
let path = with pkgs; makeSearchPath "bin" [ nix gitMinimal gnutar gzip ];
Environment = let
path = with pkgs;
makeSearchPath "bin" [ nix gitMinimal gnutar gzip ];
in "PATH=${path}";
};
};
sockets.lorri = {
Unit = {
Description = "Socket for lorri build daemon";
};
Unit = { Description = "Socket for lorri build daemon"; };
Socket = {
ListenStream = "%t/lorri/daemon.socket";
RuntimeDirectory = "lorri";
};
Install = {
WantedBy = [ "sockets.target" ];
};
Install = { WantedBy = [ "sockets.target" ]; };
};
};
};

View file

@ -6,14 +6,10 @@ let
cfg = config.services.mbsync;
mbsyncOptions =
[ "--all"
] ++ optional (cfg.verbose) "--verbose"
mbsyncOptions = [ "--all" ] ++ optional (cfg.verbose) "--verbose"
++ optional (cfg.configFile != null) "--config ${cfg.configFile}";
in
{
in {
meta.maintainers = [ maintainers.pjones ];
options.services.mbsync = {
@ -81,30 +77,28 @@ in
config = mkIf cfg.enable {
systemd.user.services.mbsync = {
Unit = {
Description = "mbsync mailbox synchronization";
};
Unit = { Description = "mbsync mailbox synchronization"; };
Service = {
Type = "oneshot";
ExecStart = "${cfg.package}/bin/mbsync ${concatStringsSep " " mbsyncOptions}";
} // (optionalAttrs (cfg.postExec != null) { ExecStartPost = cfg.postExec; })
// (optionalAttrs (cfg.preExec != null) { ExecStartPre = cfg.preExec; });
ExecStart =
"${cfg.package}/bin/mbsync ${concatStringsSep " " mbsyncOptions}";
} // (optionalAttrs (cfg.postExec != null) {
ExecStartPost = cfg.postExec;
}) // (optionalAttrs (cfg.preExec != null) {
ExecStartPre = cfg.preExec;
});
};
systemd.user.timers.mbsync = {
Unit = {
Description = "mbsync mailbox synchronization";
};
Unit = { Description = "mbsync mailbox synchronization"; };
Timer = {
OnCalendar = cfg.frequency;
Unit = "mbsync.service";
};
Install = {
WantedBy = [ "timers.target" ];
};
Install = { WantedBy = [ "timers.target" ]; };
};
};
}

View file

@ -9,11 +9,11 @@ let
toIni = generators.toINI {
mkKeyValue = key: value:
let
value' =
if isBool value then (if value then "True" else "False")
else toString value;
in
"${key} = ${value'}";
value' = if isBool value then
(if value then "True" else "False")
else
toString value;
in "${key} = ${value'}";
};
mpdris2Conf = {
@ -29,9 +29,7 @@ let
};
};
in
{
in {
meta.maintainers = [ maintainers.pjones ];
options.services.mpdris2 = {
@ -76,19 +74,15 @@ in
};
config = mkIf cfg.enable {
assertions = [
{
assertions = [{
assertion = config.services.mpd.enable;
message = "The mpdris2 module requires 'services.mpd.enable = true'.";
}
];
}];
xdg.configFile."mpDris2/mpDris2.conf".text = toIni mpdris2Conf;
systemd.user.services.mpdris2 = {
Install = {
WantedBy = [ "default.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
Unit = {
Description = "MPRIS 2 support for MPD";

View file

@ -150,23 +150,21 @@ in {
};
config = let
mapRemotes = gen: with attrsets; mapAttrs'
mapRemotes = gen:
with attrsets;
mapAttrs'
(name: remoteCfg: nameValuePair "muchsync-${name}" (gen name remoteCfg))
cfg.remotes;
in mkIf (cfg.remotes != { }) {
assertions = [
{
assertions = [{
assertion = config.programs.notmuch.enable;
message = ''
The muchsync module requires 'programs.notmuch.enable = true'.
'';
}
];
}];
systemd.user.services = mapRemotes (name: remoteCfg: {
Unit = {
Description = "muchsync sync service (${name})";
};
Unit = { Description = "muchsync sync service (${name})"; };
Service = {
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
@ -175,8 +173,7 @@ in {
''"NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"''
''"NMBGIT=${config.home.sessionVariables.NMBGIT}"''
];
ExecStart = concatStringsSep " " (
[ "${pkgs.muchsync}/bin/muchsync" ]
ExecStart = concatStringsSep " " ([ "${pkgs.muchsync}/bin/muchsync" ]
++ [ "-s ${escapeShellArg remoteCfg.sshCommand}" ]
++ optional (!remoteCfg.upload) "--noup"
@ -189,23 +186,18 @@ in {
++ optional (remoteCfg.remote.muchsyncPath != "")
"-r ${escapeShellArg remoteCfg.remote.muchsyncPath}"
++ optional remoteCfg.remote.checkForModifiedFiles "-F"
++ optional (!remoteCfg.remote.importNew) "--nonew"
);
++ optional (!remoteCfg.remote.importNew) "--nonew");
};
});
systemd.user.timers = mapRemotes (name: remoteCfg: {
Unit = {
Description = "muchsync periodic sync (${name})";
};
Unit = { Description = "muchsync periodic sync (${name})"; };
Timer = {
Unit = "muchsync-${name}.service";
OnCalendar = remoteCfg.frequency;
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
Install = { WantedBy = [ "timers.target" ]; };
});
};
}

View file

@ -6,9 +6,7 @@ let
cfg = config.services.network-manager-applet;
in
{
in {
meta.maintainers = [ maintainers.rycee ];
options = {
@ -25,17 +23,13 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = toString (
[
"${pkgs.networkmanagerapplet}/bin/nm-applet"
"--sm-disable"
] ++ optional config.xsession.preferStatusNotifierItems "--indicator"
);
ExecStart = toString
([ "${pkgs.networkmanagerapplet}/bin/nm-applet" "--sm-disable" ]
++ optional config.xsession.preferStatusNotifierItems
"--indicator");
};
};
};

View file

@ -4,9 +4,7 @@ with lib;
{
options = {
services.nextcloud-client = {
enable = mkEnableOption "Nextcloud Client";
};
services.nextcloud-client = { enable = mkEnableOption "Nextcloud Client"; };
};
config = mkIf config.services.nextcloud-client.enable {
@ -22,9 +20,7 @@ with lib;
ExecStart = "${pkgs.nextcloud-client}/bin/nextcloud";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}

View file

@ -4,9 +4,7 @@ with lib;
{
options = {
services.owncloud-client = {
enable = mkEnableOption "Owncloud Client";
};
services.owncloud-client = { enable = mkEnableOption "Owncloud Client"; };
};
config = mkIf config.services.owncloud-client.enable {
@ -22,9 +20,7 @@ with lib;
ExecStart = "${pkgs.owncloud-client}/bin/owncloud";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
}

View file

@ -7,15 +7,11 @@ let
cfg = config.services.parcellite;
package = pkgs.parcellite;
in
{
in {
meta.maintainers = [ maintainers.gleber ];
options = {
services.parcellite = {
enable = mkEnableOption "Parcellite";
};
services.parcellite = { enable = mkEnableOption "Parcellite"; };
};
config = mkIf cfg.enable {
@ -28,9 +24,7 @@ in
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
ExecStart = "${package}/bin/parcellite";

View file

@ -7,9 +7,7 @@ let
serviceCfg = config.services.password-store-sync;
programCfg = config.programs.password-store;
in
{
in {
meta.maintainers = with maintainers; [ pacien ];
options.services.password-store-sync = {
@ -35,28 +33,22 @@ in
};
config = mkIf serviceCfg.enable {
assertions = [
{
assertions = [{
assertion = programCfg.enable;
message = "The 'services.password-store-sync' module requires"
+ " 'programs.password-store.enable = true'.";
}
];
}];
systemd.user.services.password-store-sync = {
Unit = {
Description = "Password store sync";
};
Unit = { Description = "Password store sync"; };
Service = {
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
Environment =
let
Environment = let
makeEnvironmentPairs =
mapAttrsToList (key: value: "${key}=${builtins.toJSON value}");
in
makeEnvironmentPairs programCfg.settings;
in makeEnvironmentPairs programCfg.settings;
ExecStart = toString (pkgs.writeShellScript "password-store-sync" ''
${pkgs.pass}/bin/pass git pull --rebase && \
${pkgs.pass}/bin/pass git push
@ -65,9 +57,7 @@ in
};
systemd.user.timers.password-store-sync = {
Unit = {
Description = "Password store periodic sync";
};
Unit = { Description = "Password store periodic sync"; };
Timer = {
Unit = "password-store-sync.service";
@ -75,9 +65,7 @@ in
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
Install = { WantedBy = [ "timers.target" ]; };
};
};
}

View file

@ -6,9 +6,7 @@ with lib;
meta.maintainers = [ maintainers.pltanton ];
options = {
services.pasystray = {
enable = mkEnableOption "PulseAudio system tray";
};
services.pasystray = { enable = mkEnableOption "PulseAudio system tray"; };
};
config = mkIf config.services.pasystray.enable {
@ -19,16 +17,12 @@ with lib;
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
Service = {
Environment =
let
toolPaths = makeBinPath [ pkgs.paprefs pkgs.pavucontrol ];
in
[ "PATH=${toolPaths}" ];
let toolPaths = makeBinPath [ pkgs.paprefs pkgs.pavucontrol ];
in [ "PATH=${toolPaths}" ];
ExecStart = "${pkgs.pasystray}/bin/pasystray";
};
};

Some files were not shown because too many files have changed in this diff Show more