1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2025-03-21 05:15:09 +01:00

Merge branch 'nix-community:master' into master

This commit is contained in:
cbarrete 2023-07-09 17:55:24 -04:00 committed by GitHub
commit e8dd9771a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 1033 additions and 396 deletions

View file

@ -40,3 +40,10 @@ Also make sure to read the guidelines found at
- If this PR adds a new module - If this PR adds a new module
- [ ] Added myself as module maintainer. See [example](https://github.com/nix-community/home-manager/blob/068ff76a10e95820f886ac46957edcff4e44621d/modules/programs/lesspipe.nix#L6). - [ ] Added myself as module maintainer. See [example](https://github.com/nix-community/home-manager/blob/068ff76a10e95820f886ac46957edcff4e44621d/modules/programs/lesspipe.nix#L6).
#### Maintainer CC
<!--
If you are updating a module, please @ people who are in its `meta.maintainers` list.
If in doubt, check `git blame` for whoever last touched something.
-->

6
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1688049487, "lastModified": 1688679045,
"narHash": "sha256-100g4iaKC9MalDjUW9iN6Jl/OocTDtXdeAj7pEGIRh4=", "narHash": "sha256-t3xGEfYIwhaLTPU8FLtN/pLPytNeDwbLI6a7XFFBlGo=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4bc72cae107788bf3f24f30db2e2f685c9298dc9", "rev": "3c7487575d9445185249a159046cc02ff364bff8",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -156,7 +156,7 @@ function setFlakeAttribute() {
fi fi
if [[ -v configFlake ]]; then if [[ -v configFlake ]]; then
FLAKE_ARG="$(dirname "$(readlink -f "$configFlake")")" FLAKE_ARG="path:$(dirname "$(readlink -f "$configFlake")")"
fi fi
fi fi

View file

@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: Home Manager\n" "Project-Id-Version: Home Manager\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" "Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2023-05-27 09:08+0200\n" "POT-Creation-Date: 2023-05-27 09:08+0200\n"
"PO-Revision-Date: 2023-06-22 09:51+0000\n" "PO-Revision-Date: 2023-07-01 13:50+0000\n"
"Last-Translator: Abdul V Vahry <cyberaioff@gmail.com>\n" "Last-Translator: Reza Almanda <rezaalmanda27@gmail.com>\n"
"Language-Team: Indonesian <https://hosted.weblate.org/projects/home-manager/" "Language-Team: Indonesian <https://hosted.weblate.org/projects/home-manager/"
"cli/id/>\n" "cli/id/>\n"
"Language: id\n" "Language: id\n"
@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n" "Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 4.18.1\n" "X-Generator: Weblate 5.0-dev\n"
#: home-manager/home-manager:71 #: home-manager/home-manager:71
msgid "No configuration file found at %s" msgid "No configuration file found at %s"
@ -27,12 +27,11 @@ msgstr "Tidak ada file konfigurasi yang ditemukan di %s"
#. 'home.nix' or 'flake.nix'. #. 'home.nix' or 'flake.nix'.
#: home-manager/home-manager:88 home-manager/home-manager:92 #: home-manager/home-manager:88 home-manager/home-manager:92
#: home-manager/home-manager:154 #: home-manager/home-manager:154
#, fuzzy
msgid "" msgid ""
"Keeping your Home Manager %s in %s is deprecated,\n" "Keeping your Home Manager %s in %s is deprecated,\n"
"please move it to %s" "please move it to %s"
msgstr "" msgstr ""
"Mempertahankan Pengelola Rumah Anda %s di %s tidak digunakan lagi,\n" "Mempertahankan Pengelola Beranda Anda %s di %s tidak digunakan lagi,\n"
"tolong pindahkan ke %s" "tolong pindahkan ke %s"
#: home-manager/home-manager:99 #: home-manager/home-manager:99
@ -45,9 +44,8 @@ msgstr "Tidak dapat menemukan direktori profil yang sesuai, mencoba %s dan %s"
#. translators: Here "flake" is a noun that refers to the Nix Flakes feature. #. translators: Here "flake" is a noun that refers to the Nix Flakes feature.
#: home-manager/home-manager:191 #: home-manager/home-manager:191
#, fuzzy
msgid "Can't inspect options of a flake configuration" msgid "Can't inspect options of a flake configuration"
msgstr "Tidak dapat memeriksa opsi konfigurasi serpih" msgstr "Tidak dapat memeriksa opsi konfigurasi flake"
#: home-manager/home-manager:253 home-manager/home-manager:276 #: home-manager/home-manager:253 home-manager/home-manager:276
#: home-manager/home-manager:973 #: home-manager/home-manager:973
@ -56,7 +54,7 @@ msgstr "%s: opsi tidak diketahui '%s'"
#: home-manager/home-manager:258 home-manager/home-manager:974 #: home-manager/home-manager:258 home-manager/home-manager:974
msgid "Run '%s --help' for usage help" msgid "Run '%s --help' for usage help"
msgstr "" msgstr "Jalankan '%s --help' untuk bantuan penggunaan"
#: home-manager/home-manager:284 home-manager/home-manager:383 #: home-manager/home-manager:284 home-manager/home-manager:383
msgid "The file %s already exists, leaving it unchanged..." msgid "The file %s already exists, leaving it unchanged..."

View file

@ -12,7 +12,7 @@ let
path = mkOption { path = mkOption {
type = types.str; type = types.str;
default = "${cfg.basePath}/${name}"; default = "${cfg.basePath}/${name}";
defaultText = "accounts.contact.basePath/name"; defaultText = "accounts.calendar.basePath/name";
description = "The path of the storage."; description = "The path of the storage.";
}; };

View file

@ -15,15 +15,16 @@
# below for changes: # below for changes:
# https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/development/libraries/glibc/nix-locale-archive.patch # https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/development/libraries/glibc/nix-locale-archive.patch
{ lib, pkgs, ... }: { lib, pkgs, config, ... }:
with lib; with lib;
let let
inherit (config.i18n) glibcLocales;
inherit (pkgs.glibcLocales) version; inherit (glibcLocales) version;
archivePath = "${pkgs.glibcLocales}/lib/locale/locale-archive"; archivePath = "${glibcLocales}/lib/locale/locale-archive";
# lookup the version of glibcLocales and set the appropriate environment vars # lookup the version of glibcLocales and set the appropriate environment vars
localeVars = if versionAtLeast version "2.27" then { localeVars = if versionAtLeast version "2.27" then {
@ -36,6 +37,31 @@ let
in { in {
meta.maintainers = with maintainers; [ midchildan ]; meta.maintainers = with maintainers; [ midchildan ];
options = {
i18n.glibcLocales = mkOption {
type = types.path;
description = ''
Customized <literal>glibcLocales</literal> package providing
the <literal>LOCALE_ARCHIVE_*</literal> environment variable.
</para><para>
This option only applies to the Linux platform.
</para><para>
When Home Manager is configured with NixOS, the default value
will be set to <varname>i18n.glibcLocales</varname> from the
system configuration.
'';
example = literalExpression ''
pkgs.glibcLocales.override {
allLocales = false;
locales = [ "en_US.UTF-8/UTF-8" ];
}
'';
# NB. See nixos/default.nix for NixOS default.
default = pkgs.glibcLocales;
defaultText = literalExpression "pkgs.glibcLocales";
};
};
config = mkIf pkgs.stdenv.hostPlatform.isLinux { config = mkIf pkgs.stdenv.hostPlatform.isLinux {
# For shell sessions. # For shell sessions.
home.sessionVariables = localeVars; home.sessionVariables = localeVars;

View file

@ -1143,6 +1143,28 @@ in
A new module is available: 'services.ssh-agent' A new module is available: 'services.ssh-agent'
''; '';
} }
{
time = "2023-07-08T08:27:41+00:00";
message = ''
A new modules is available: 'programs.darcs'
'';
}
{
time = "2023-07-08T09:21:06+00:00";
message = ''
A new module is available: 'programs.pyenv'.
'';
}
{
time = "2023-07-08T09:44:56+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.swayosd'
'';
}
]; ];
}; };
} }

View file

@ -76,7 +76,7 @@ in {
settings = mkOption { settings = mkOption {
type = with types; type = with types;
# xfIntVariant must come AFTER str; otherwise strings are treated as submodule imports... # xfIntVariant must come AFTER str; otherwise strings are treated as submodule imports...
let value = oneOf [ bool int float str xfIntVariant ]; let value = nullOr (oneOf [ bool int float str xfIntVariant ]);
in attrsOf (attrsOf (either value (listOf value))) // { in attrsOf (attrsOf (either value (listOf value))) // {
description = "xfconf settings"; description = "xfconf settings";
}; };
@ -108,8 +108,11 @@ in {
mkCommand = channel: property: value: '' mkCommand = channel: property: value: ''
$DRY_RUN_CMD ${pkgs.xfce.xfconf}/bin/xfconf-query \ $DRY_RUN_CMD ${pkgs.xfce.xfconf}/bin/xfconf-query \
${ ${
escapeShellArgs escapeShellArgs ([ "-c" channel "-p" "/${property}" ]
([ "-n" "-c" channel "-p" "/${property}" ] ++ withType value) ++ (if value == null then
[ "-r" ]
else
[ "-n" ] ++ withType value))
} }
''; '';

View file

@ -70,6 +70,7 @@ let
./programs/chromium.nix ./programs/chromium.nix
./programs/command-not-found/command-not-found.nix ./programs/command-not-found/command-not-found.nix
./programs/comodoro.nix ./programs/comodoro.nix
./programs/darcs.nix
./programs/dircolors.nix ./programs/dircolors.nix
./programs/direnv.nix ./programs/direnv.nix
./programs/discocss.nix ./programs/discocss.nix
@ -168,6 +169,7 @@ let
./programs/pls.nix ./programs/pls.nix
./programs/powerline-go.nix ./programs/powerline-go.nix
./programs/pubs.nix ./programs/pubs.nix
./programs/pyenv.nix
./programs/pylint.nix ./programs/pylint.nix
./programs/qutebrowser.nix ./programs/qutebrowser.nix
./programs/rbw.nix ./programs/rbw.nix
@ -310,6 +312,7 @@ let
./services/stalonetray.nix ./services/stalonetray.nix
./services/status-notifier-watcher.nix ./services/status-notifier-watcher.nix
./services/swayidle.nix ./services/swayidle.nix
./services/swayosd.nix
./services/sxhkd.nix ./services/sxhkd.nix
./services/syncthing.nix ./services/syncthing.nix
./services/systembus-notify.nix ./services/systembus-notify.nix

View file

@ -8,17 +8,20 @@ msgstr ""
"Project-Id-Version: Home Manager Modules\n" "Project-Id-Version: Home Manager Modules\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" "Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2023-05-27 09:08+0200\n" "POT-Creation-Date: 2023-05-27 09:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: 2023-07-01 13:50+0000\n"
"Last-Translator: Automatically generated\n" "Last-Translator: Reza Almanda <rezaalmanda27@gmail.com>\n"
"Language-Team: none\n" "Language-Team: Indonesian <https://hosted.weblate.org/projects/home-manager/"
"modules/id/>\n"
"Language: id\n" "Language: id\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Weblate 5.0-dev\n"
#: modules/files.nix:234 #: modules/files.nix:234
msgid "Creating home file links in %s" msgid "Creating home file links in %s"
msgstr "" msgstr "Membuat tautan file beranda dalam %s"
#: modules/files.nix:247 #: modules/files.nix:247
msgid "Cleaning up orphan links from %s" msgid "Cleaning up orphan links from %s"
@ -26,11 +29,11 @@ msgstr ""
#: modules/files.nix:263 #: modules/files.nix:263
msgid "Creating profile generation %s" msgid "Creating profile generation %s"
msgstr "" msgstr "Membuat profil %s"
#: modules/files.nix:280 #: modules/files.nix:280
msgid "No change so reusing latest profile generation %s" msgid "No change so reusing latest profile generation %s"
msgstr "" msgstr "Tidak ada perubahan, jadi gunakan kembali pembuatan profil terbaru %s%s"
#: modules/home-environment.nix:627 #: modules/home-environment.nix:627
msgid "" msgid ""
@ -50,11 +53,11 @@ msgstr ""
#: modules/home-environment.nix:660 #: modules/home-environment.nix:660
msgid "Activating %s" msgid "Activating %s"
msgstr "" msgstr "Mengaktifkan %s"
#: modules/lib-bash/activation-init.sh:22 #: modules/lib-bash/activation-init.sh:22
msgid "Migrating profile from %s to %s" msgid "Migrating profile from %s to %s"
msgstr "" msgstr "Memigrasi profil dari %s ke %s"
#: modules/lib-bash/activation-init.sh:53 #: modules/lib-bash/activation-init.sh:53
msgid "Could not find suitable profile directory, tried %s and %s" msgid "Could not find suitable profile directory, tried %s and %s"

View file

@ -8,11 +8,13 @@ let
(optionalString (config.programs.zsh.dotDir != null) (optionalString (config.programs.zsh.dotDir != null)
(config.programs.zsh.dotDir + "/")) + file; (config.programs.zsh.dotDir + "/")) + file;
zPluginStr = with lib; zPluginStr = (pluginNames:
(pluginNames:
optionalString (pluginNames != [ ]) "${concatStrings (map (name: '' optionalString (pluginNames != [ ]) "${concatStrings (map (name: ''
${name} ${name}
'') pluginNames)}"); '') pluginNames)}");
parseHashId = path:
elemAt (builtins.match "/nix/store/([a-zA-Z0-9]+)-.*" path) 0;
in { in {
meta.maintainers = [ maintainers.hitsmaxft ]; meta.maintainers = [ maintainers.hitsmaxft ];
@ -33,20 +35,24 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ cfg.package ]; home.packages = [ cfg.package ];
programs.zsh.initExtraBeforeCompInit = let
home.file."${relToDotDir ".zsh_plugins.txt"}".text = zPluginStr cfg.plugins; configFiles = pkgs.runCommand "hm_antidote-files" { } ''
echo "${zPluginStr cfg.plugins}" > $out
### move zsh_plugins.txt '';
programs.zsh.initExtraBeforeCompInit = '' hashId = parseHashId "${configFiles}";
in ''
## home-manager/antidote begin : ## home-manager/antidote begin :
source ${cfg.package}/share/antidote/antidote.zsh source ${cfg.package}/share/antidote/antidote.zsh
${optionalString cfg.useFriendlyNames ${optionalString cfg.useFriendlyNames
"zstyle ':antidote:bundle' use-friendly-names 'yes'"} "zstyle ':antidote:bundle' use-friendly-names 'yes'"}
bundlefile=$HOME/${relToDotDir ".zsh_plugins.txt"}
bundlefile=${configFiles}
zstyle ':antidote:bundle' file $bundlefile zstyle ':antidote:bundle' file $bundlefile
staticfile=$HOME/${relToDotDir ".zsh_plugins.zsh"} staticfile=/tmp/tmp_hm_zsh_plugins.zsh-${hashId}
zstyle ':antidote:static' file $staticfile zstyle ':antidote:static' file $staticfile
antidote load $bundlefile $staticfile antidote load $bundlefile $staticfile
## home-manager/antidote end ## home-manager/antidote end
''; '';
}; };

View file

@ -0,0 +1,52 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.darcs;
in {
meta.maintainers = with maintainers; [ chris-martin ];
options = {
programs.darcs = {
enable = mkEnableOption "darcs";
package = mkPackageOption pkgs "darcs" { };
author = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "Fred Bloggs <fred@example.net>" ];
description = ''
If this list has a single entry, it will be used as the author
when you record a patch. If there are multiple entries, Darcs
will prompt you to choose one of them.
'';
};
boring = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "^.idea$" ".iml$" "^.stack-work$" ];
description = "File patterns to ignore";
};
};
};
config = mkIf cfg.enable (mkMerge [
{ home.packages = [ cfg.package ]; }
(mkIf (cfg.author != [ ]) {
home.file.".darcs/author".text =
concatMapStrings (x: x + "\n") cfg.author;
})
(mkIf (cfg.boring != [ ]) {
home.file.".darcs/boring".text =
concatMapStrings (x: x + "\n") cfg.boring;
})
]);
}

View file

@ -8,14 +8,18 @@ let
# attrs util that removes entries containing a null value # attrs util that removes entries containing a null value
compactAttrs = lib.filterAttrs (_: val: !isNull val); compactAttrs = lib.filterAttrs (_: val: !isNull val);
# Needed for notmuch config, because the DB is here, and not in each account's dir
maildirBasePath = config.accounts.email.maildirBasePath;
# make a himalaya config from a home-manager email account config # make a himalaya config from a home-manager email account config
mkAccountConfig = _: account: mkAccountConfig = _: account:
let let
imapEnabled = !isNull account.imap; # Use notmuch if it's enabled, otherwise fallback to IMAP then maildir
maildirEnabled = !imapEnabled && !isNull account.maildir # Maildir is always set, so there's no easy way to detect if it's being used
&& !account.notmuch.enable; notmuchEnabled = account.notmuch.enable;
notmuchEnabled = !imapEnabled && !isNull account.maildir imapEnabled = !isNull account.imap && !notmuchEnabled;
&& account.notmuch.enable; maildirEnabled = !isNull account.maildir && !imapEnabled
&& !notmuchEnabled;
globalConfig = { globalConfig = {
email = account.address; email = account.address;
@ -55,7 +59,7 @@ let
notmuchConfig = lib.optionalAttrs notmuchEnabled (compactAttrs { notmuchConfig = lib.optionalAttrs notmuchEnabled (compactAttrs {
backend = "notmuch"; backend = "notmuch";
notmuch-db-path = account.maildir.absPath; notmuch-db-path = maildirBasePath;
}); });
smtpConfig = lib.optionalAttrs (!isNull account.smtp) (compactAttrs { smtpConfig = lib.optionalAttrs (!isNull account.smtp) (compactAttrs {

View file

@ -25,7 +25,6 @@ let
genCalendarStr = name: value: genCalendarStr = name: value:
concatStringsSep "\n" ([ concatStringsSep "\n" ([
"[[${name}]]" "[[${name}]]"
"highlight_event_days = True"
"path = ${ "path = ${
value.local.path + "/" value.local.path + "/"
+ (optionalString (value.khal.type == "discover") value.khal.glob) + (optionalString (value.khal.type == "discover") value.khal.glob)
@ -158,6 +157,7 @@ in {
# locale = definedAttrs (cfg.locale // { _module = null; }); # locale = definedAttrs (cfg.locale // { _module = null; });
default = optionalAttrs (!isNull primaryAccount) { default = optionalAttrs (!isNull primaryAccount) {
highlight_event_days = true;
default_calendar = if isNull primaryAccount.primaryCollection then default_calendar = if isNull primaryAccount.primaryCollection then
primaryAccount.name primaryAccount.name
else else

View file

@ -96,6 +96,23 @@ in {
''; '';
}; };
loginFile = mkOption {
type = types.nullOr (linesOrSource "login.nu");
default = null;
example = ''
# Prints "Hello, World" upon logging into tty1
if (tty) == "/dev/tty1" {
echo "Hello, World"
}
'';
description = ''
The login file to be used for nushell upon logging in.
</para>
<para>
See <link xlink:href="https://www.nushell.sh/book/configuration.html#configuring-nu-as-a-login-shell" /> for more information.
'';
};
extraConfig = mkOption { extraConfig = mkOption {
type = types.lines; type = types.lines;
default = ""; default = "";
@ -112,6 +129,14 @@ in {
''; '';
}; };
extraLogin = mkOption {
type = types.lines;
default = "";
description = ''
Additional configuration to add to the nushell login file.
'';
};
shellAliases = mkOption { shellAliases = mkOption {
type = types.attrsOf types.str; type = types.attrsOf types.str;
default = { }; default = { };
@ -161,6 +186,12 @@ in {
envVarsStr envVarsStr
]; ];
}) })
(mkIf (cfg.loginFile != null || cfg.extraLogin != "") {
"${configDir}/login.nu".text = mkMerge [
(mkIf (cfg.loginFile != null) cfg.loginFile.text)
cfg.extraLogin
];
})
]; ];
}; };
} }

View file

@ -0,0 +1,79 @@
{ config, pkgs, lib, ... }:
let
cfg = config.programs.pyenv;
tomlFormat = pkgs.formats.toml { };
in {
meta.maintainers = with lib.maintainers; [ tmarkus ];
options.programs.pyenv = {
enable = lib.mkEnableOption "pyenv";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.pyenv;
defaultText = lib.literalExpression "pkgs.pyenv";
description = "The package to use for pyenv.";
};
enableBashIntegration = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to enable pyenv's Bash integration.
'';
};
enableZshIntegration = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to enable pyenv's Zsh integration.
'';
};
enableFishIntegration = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to enable pyenv's Fish integration.
'';
};
rootDirectory = lib.mkOption {
type = lib.types.path;
apply = toString;
default = "${config.xdg.dataHome}/pyenv";
defaultText = "\${config.xdg.dataHome}/pyenv";
description = ''
The pyenv root directory (PYENV_ROOT).
</para><para>
Note: Deviating from upstream which uses `$HOME/.pyenv`,
the default path is set according to the XDG base directory specification.
'';
};
};
config = lib.mkIf cfg.enable {
# Always add the configured `pyenv` package.
home.packages = [ cfg.package ];
programs.bash.initExtra = lib.mkIf cfg.enableBashIntegration ''
export PYENV_ROOT="${cfg.rootDirectory}"
eval "$(${lib.getExe cfg.package} init - bash)"
'';
programs.zsh.initExtra = lib.mkIf cfg.enableZshIntegration ''
export PYENV_ROOT="${cfg.rootDirectory}"
eval "$(${lib.getExe cfg.package} init - zsh)"
'';
programs.fish.interactiveShellInit = lib.mkIf cfg.enableFishIntegration ''
set -Ux PYENV_ROOT "${cfg.rootDirectory}"
${lib.getExe cfg.package} init - fish | source
'';
};
}

View file

@ -8,6 +8,8 @@ let
safeName = lib.replaceStrings [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]; safeName = lib.replaceStrings [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ];
configName = account: "imapnotify-${safeName account.name}-config.json";
imapnotifyAccounts = imapnotifyAccounts =
filter (a: a.imapnotify.enable) (attrValues config.accounts.email.accounts); filter (a: a.imapnotify.enable) (attrValues config.accounts.email.accounts);
@ -19,9 +21,9 @@ let
Unit = { Description = "imapnotify for ${name}"; }; Unit = { Description = "imapnotify for ${name}"; };
Service = { Service = {
ExecStart = "${pkgs.goimapnotify}/bin/goimapnotify -conf ${ # Use the nix store path for config to ensure service restarts when it changes
genAccountConfig account ExecStart =
}"; "${getExe cfg.package} -conf '${genAccountConfig account}'";
Restart = "always"; Restart = "always";
RestartSec = 30; RestartSec = 30;
Type = "simple"; Type = "simple";
@ -34,8 +36,30 @@ let
}; };
}; };
genAccountAgent = account:
let name = safeName account.name;
in {
name = "imapnotify-${name}";
value = {
enable = true;
config = {
# Use the nix store path for config to ensure service restarts when it changes
ProgramArguments =
[ "${getExe cfg.package}" "-conf" "${genAccountConfig account}" ];
KeepAlive = true;
ThrottleInterval = 30;
ExitTimeOut = 0;
ProcessType = "Background";
RunAtLoad = true;
} // optionalAttrs account.notmuch.enable {
EnvironmentVariables.NOTMUCH_CONFIG =
"${config.xdg.configHome}/notmuch/default/config";
};
};
};
genAccountConfig = account: genAccountConfig = account:
pkgs.writeText "imapnotify-${safeName account.name}-config.json" (let pkgs.writeText (configName account) (let
port = if account.imap.port != null then port = if account.imap.port != null then
account.imap.port account.imap.port
else if account.imap.tls.enable then else if account.imap.tls.enable then
@ -62,7 +86,17 @@ in {
meta.maintainers = [ maintainers.nickhu ]; meta.maintainers = [ maintainers.nickhu ];
options = { options = {
services.imapnotify = { enable = mkEnableOption "imapnotify"; }; services.imapnotify = {
enable = mkEnableOption "imapnotify";
package = mkOption {
type = types.package;
default = pkgs.goimapnotify;
defaultText = literalExpression "pkgs.goimapnotify";
example = literalExpression "pkgs.imapnotify";
description = "The imapnotify package to use";
};
};
accounts.email.accounts = mkOption { accounts.email.accounts = mkOption {
type = with types; attrsOf (submodule (import ./imapnotify-accounts.nix)); type = with types; attrsOf (submodule (import ./imapnotify-accounts.nix));
@ -79,8 +113,6 @@ in {
+ concatMapStringsSep ", " (a: a.name) badAccounts; + concatMapStringsSep ", " (a: a.name) badAccounts;
}; };
in [ in [
(lib.hm.assertions.assertPlatform "services.imapnotify" pkgs
lib.platforms.linux)
(checkAccounts (a: a.maildir == null) "maildir configuration") (checkAccounts (a: a.maildir == null) "maildir configuration")
(checkAccounts (a: a.imap == null) "IMAP configuration") (checkAccounts (a: a.imap == null) "IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "password command") (checkAccounts (a: a.passwordCommand == null) "password command")
@ -88,5 +120,12 @@ in {
]; ];
systemd.user.services = listToAttrs (map genAccountUnit imapnotifyAccounts); systemd.user.services = listToAttrs (map genAccountUnit imapnotifyAccounts);
launchd.agents = listToAttrs (map genAccountAgent imapnotifyAccounts);
xdg.configFile = listToAttrs (map (account: {
name = "imapnotify/${configName account}";
value.source = genAccountConfig account;
}) imapnotifyAccounts);
}; };
} }

View file

@ -0,0 +1,58 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.swayosd;
in {
meta.maintainers = [ hm.maintainers.pltanton ];
options.services.swayosd = {
enable = mkEnableOption ''
swayosd, a GTK based on screen display for keyboard shortcuts like
caps-lock and volume'';
package = mkPackageOption pkgs "swayosd" { };
maxVolume = mkOption {
type = types.nullOr types.ints.unsigned;
default = null;
example = 120;
description = ''
Sets the maximum volume.
'';
};
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "services.swayosd" pkgs platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user = {
services.swayosd = {
Unit = {
Description = "Volume/backlight OSD indicator";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
ConditionEnvironment = "WAYLAND_DISPLAY";
Documentation = "man:swayosd(1)";
};
Service = {
Type = "simple";
ExecStart = "${cfg.package}/bin/swayosd"
+ (optionalString (cfg.maxVolume != null)
" --max-volume ${toString cfg.maxVolume}");
Restart = "always";
};
Install = { WantedBy = [ "graphical-session.target" ]; };
};
};
};
}

View file

@ -22,7 +22,7 @@ let
}; };
commandOptions = mkOption rec { commandOptions = mkOption rec {
type = with types; attrsOf str; type = with types; attrsOf (either str (listOf str));
apply = mergeAttrs default; apply = mergeAttrs default;
default = { default = {
repeat = "watch"; repeat = "watch";
@ -36,6 +36,8 @@ let
Additional command line options as a dictionary to pass to the Additional command line options as a dictionary to pass to the
<literal>unison</literal> program. <literal>unison</literal> program.
</para><para> </para><para>
Use a list of strings to declare the same option multiple times.
</para><para>
See See
<citerefentry> <citerefentry>
<refentrytitle>unison</refentrytitle> <refentrytitle>unison</refentrytitle>
@ -60,7 +62,9 @@ let
}; };
}; };
serialiseArg = key: val: escapeShellArg "-${key}=${escape [ "=" ] val}"; serialiseArg = key: val:
concatStringsSep " "
(forEach (toList val) (x: escapeShellArg "-${key}=${escape [ "=" ] x}"));
serialiseArgs = args: concatStringsSep " " (mapAttrsToList serialiseArg args); serialiseArgs = args: concatStringsSep " " (mapAttrsToList serialiseArg args);

View file

@ -67,9 +67,11 @@ in {
Service = { Service = {
Type = "oneshot"; Type = "oneshot";
# TODO `vdirsyncer discover` # TODO `vdirsyncer discover`
ExecStart = "${cfg.package}/bin/vdirsyncer ${ ExecStart = let optStr = concatStringsSep " " vdirsyncerOptions;
concatStringsSep " " vdirsyncerOptions in [
} sync"; "${cfg.package}/bin/vdirsyncer ${optStr} metasync"
"${cfg.package}/bin/vdirsyncer ${optStr} sync"
];
}; };
}; };

View file

@ -770,7 +770,7 @@ in {
[ [
{ command = "systemctl --user restart polybar"; always = true; notification = false; } { command = "systemctl --user restart polybar"; always = true; notification = false; }
{ command = "dropbox start"; notification = false; } { command = "dropbox start"; notification = false; }
{ command = "firefox"; workspace = "1: web"; } { command = "firefox"; }
]; ];
'' ''
else else

View file

@ -23,6 +23,9 @@ in {
# fontconfig by default. # fontconfig by default.
fonts.fontconfig.enable = lib.mkDefault fonts.fontconfig.enable = lib.mkDefault
(cfg.useUserPackages && config.fonts.fontconfig.enable); (cfg.useUserPackages && config.fonts.fontconfig.enable);
# Inherit glibcLocales setting from NixOS.
i18n.glibcLocales = lib.mkDefault config.i18n.glibcLocales;
}]; }];
}; };
} }

View file

@ -68,6 +68,7 @@ import nmt {
./modules/programs/browserpass ./modules/programs/browserpass
./modules/programs/btop ./modules/programs/btop
./modules/programs/comodoro ./modules/programs/comodoro
./modules/programs/darcs
./modules/programs/dircolors ./modules/programs/dircolors
./modules/programs/direnv ./modules/programs/direnv
./modules/programs/emacs ./modules/programs/emacs
@ -88,6 +89,7 @@ import nmt {
./modules/programs/k9s ./modules/programs/k9s
./modules/programs/kakoune ./modules/programs/kakoune
./modules/programs/kitty ./modules/programs/kitty
./modules/programs/khal
./modules/programs/ledger ./modules/programs/ledger
./modules/programs/less ./modules/programs/less
./modules/programs/lf ./modules/programs/lf
@ -115,6 +117,7 @@ import nmt {
./modules/programs/pls ./modules/programs/pls
./modules/programs/powerline-go ./modules/programs/powerline-go
./modules/programs/pubs ./modules/programs/pubs
./modules/programs/pyenv
./modules/programs/qutebrowser ./modules/programs/qutebrowser
./modules/programs/readline ./modules/programs/readline
./modules/programs/ripgrep ./modules/programs/ripgrep
@ -143,6 +146,7 @@ import nmt {
./modules/xresources ./modules/xresources
] ++ lib.optionals isDarwin [ ] ++ lib.optionals isDarwin [
./modules/launchd ./modules/launchd
./modules/services/imapnotify-darwin
./modules/targets-darwin ./modules/targets-darwin
] ++ lib.optionals isLinux [ ] ++ lib.optionals isLinux [
./modules/config/i18n ./modules/config/i18n
@ -201,6 +205,7 @@ import nmt {
./modules/services/gpg-agent ./modules/services/gpg-agent
./modules/services/gromit-mpx ./modules/services/gromit-mpx
./modules/services/home-manager-auto-upgrade ./modules/services/home-manager-auto-upgrade
./modules/services/imapnotify
./modules/services/kanshi ./modules/services/kanshi
./modules/services/lieer ./modules/services/lieer
./modules/services/mopidy ./modules/services/mopidy
@ -218,6 +223,7 @@ import nmt {
./modules/services/redshift-gammastep ./modules/services/redshift-gammastep
./modules/services/screen-locker ./modules/services/screen-locker
./modules/services/swayidle ./modules/services/swayidle
./modules/services/swayosd
./modules/services/sxhkd ./modules/services/sxhkd
./modules/services/syncthing/linux ./modules/services/syncthing/linux
./modules/services/trayer ./modules/services/trayer

View file

@ -14,4 +14,26 @@
''; '';
}; };
}; };
i18n-custom-locales = { pkgs, ... }: {
config = let stub = pkgs.glibcLocalesCustom;
in {
test.stubs.glibcLocalesCustom = {
inherit (pkgs.glibcLocales) version;
outPath = null; # we need a real path for this stub
};
i18n.glibcLocales = stub;
nmt.script = ''
hmEnvFile=home-path/etc/profile.d/hm-session-vars.sh
assertFileExists $hmEnvFile
assertFileRegex $hmEnvFile 'LOCALE_ARCHIVE_.*${stub}'
envFile=home-files/.config/environment.d/10-home-manager.conf
assertFileExists $envFile
assertFileRegex $envFile 'LOCALE_ARCHIVE_.*${stub}'
'';
};
};
} }

View file

@ -9,7 +9,7 @@ let
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
export __HM_SESS_VARS_SOURCED=1 export __HM_SESS_VARS_SOURCED=1
export LOCALE_ARCHIVE_2_27="${pkgs.glibcLocales}/lib/locale/locale-archive" export LOCALE_ARCHIVE_2_27="${config.i18n.glibcLocales}/lib/locale/locale-archive"
export V1="v1" export V1="v1"
export V2="v2-v1" export V2="v2-v1"
export XDG_CACHE_HOME="/home/hm-user/.cache" export XDG_CACHE_HOME="/home/hm-user/.cache"

View file

@ -10,7 +10,7 @@
assertFileExists $envFile assertFileExists $envFile
assertFileContent $envFile ${ assertFileContent $envFile ${
pkgs.writeText "expected" '' pkgs.writeText "expected" ''
LOCALE_ARCHIVE_2_27=${pkgs.glibcLocales}/lib/locale/locale-archive LOCALE_ARCHIVE_2_27=${config.i18n.glibcLocales}/lib/locale/locale-archive
XDG_CACHE_HOME=/home/hm-user/.cache XDG_CACHE_HOME=/home/hm-user/.cache
XDG_CONFIG_DIRS=/etc/xdg:/foo/bar''${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS} XDG_CONFIG_DIRS=/etc/xdg:/foo/bar''${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}
XDG_CONFIG_HOME=/home/hm-user/.config XDG_CONFIG_HOME=/home/hm-user/.config

View file

@ -24,7 +24,5 @@ in {
'antidote load' 'antidote load'
assertFileContains home-files/${relToDotDirCustom}/.zshrc \ assertFileContains home-files/${relToDotDirCustom}/.zshrc \
"zstyle ':antidote:bundle' use-friendly-names 'yes'" "zstyle ':antidote:bundle' use-friendly-names 'yes'"
assertFileContains home-files/${relToDotDirCustom}/.zsh_plugins.txt \
'zsh-users/zsh-autosuggestions'
''; '';
} }

View file

@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }: { config, ... }:
{ {
config = {
home.stateVersion = "23.05"; home.stateVersion = "23.05";
programs.beets = { programs.beets = {
@ -25,5 +24,4 @@
home-files/.config/systemd/user/beets-mpdstats.service \ home-files/.config/systemd/user/beets-mpdstats.service \
${./mpdstats-external-expected.service} ${./mpdstats-external-expected.service}
''; '';
};
} }

View file

@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }: { config, ... }:
{ {
config = {
home.stateVersion = "23.05"; home.stateVersion = "23.05";
services.mpd = { services.mpd = {
@ -27,5 +26,4 @@
home-files/.config/systemd/user/beets-mpdstats.service \ home-files/.config/systemd/user/beets-mpdstats.service \
${./mpdstats-expected.service} ${./mpdstats-expected.service}
''; '';
};
} }

View file

@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }: { config, ... }:
{ {
config = {
home.stateVersion = "23.05"; home.stateVersion = "23.05";
programs.beets = { programs.beets = {
@ -16,5 +15,4 @@
home-files/.config/beets/config.yaml \ home-files/.config/beets/config.yaml \
${./mpdupdate-expected.yaml} ${./mpdupdate-expected.yaml}
''; '';
};
} }

View file

@ -0,0 +1,2 @@
Real Person <personal@example.com>
Real Person <corporate@example.com>

View file

@ -0,0 +1,17 @@
{ pkgs, ... }:
{
config = {
programs.darcs = {
enable = true;
author = [
"Real Person <personal@example.com>"
"Real Person <corporate@example.com>"
];
};
nmt.script = ''
assertFileContent home-files/.darcs/author ${./author-expected.txt}
'';
};
}

View file

@ -0,0 +1,3 @@
^.idea$
.iml$
^.stack-work$

View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
config = {
programs.darcs = {
enable = true;
boring = [ "^.idea$" ".iml$" "^.stack-work$" ];
};
nmt.script = ''
assertFileContent home-files/.darcs/boring ${./boring-expected.txt}
'';
};
}

View file

@ -0,0 +1,4 @@
{
darcs-author = ./author.nix;
darcs-boring = ./boring.nix;
}

View file

@ -5,7 +5,7 @@ backend = "notmuch"
default = true default = true
display-name = "H. M. Test" display-name = "H. M. Test"
email = "hm@example.com" email = "hm@example.com"
notmuch-db-path = "/home/hm-user/Maildir/hm@example.com" notmuch-db-path = "/home/hm-user/Maildir"
sender = "sendmail" sender = "sendmail"
sendmail-cmd = "msmtp" sendmail-cmd = "msmtp"

View file

@ -0,0 +1,32 @@
{ ... }:
{
programs.khal.enable = true;
accounts.calendar = {
basePath = "$XDG_CONFIG_HOME/cal";
accounts = {
test = {
primary = true;
primaryCollection = "test";
khal = {
enable = true;
readOnly = true;
type = "calendar";
};
local.type = "filesystem";
local.fileExt = ".ics";
name = "test";
remote = {
type = "http";
url = "https://example.com/events.ical";
};
};
};
};
test.stubs = { khal = { }; };
nmt.script = ''
assertFileExists home-files/.config/khal/config
'';
}

View file

@ -0,0 +1 @@
{ khal-config = ./config.nix; }

View file

@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }: { pkgs, ... }:
{ {
config = {
programs.nnn = { programs.nnn = {
enable = true; enable = true;
bookmarks = { bookmarks = {
@ -51,5 +50,4 @@
done done
''; '';
}; };
};
} }

View file

@ -16,6 +16,13 @@
let-env FOO = 'BAR' let-env FOO = 'BAR'
''; '';
loginFile.text = ''
# Prints "Hello, World" upon logging into tty1
if (tty) == "/dev/tty1" {
echo "Hello, World"
}
'';
shellAliases = { shellAliases = {
"lsname" = "(ls | get name)"; "lsname" = "(ls | get name)";
"ll" = "ls -a"; "ll" = "ls -a";
@ -38,5 +45,8 @@
assertFileContent \ assertFileContent \
"${configDir}/env.nu" \ "${configDir}/env.nu" \
${./env-expected.nu} ${./env-expected.nu}
assertFileContent \
"${configDir}/login.nu" \
${./login-expected.nu}
''; '';
} }

View file

@ -0,0 +1,5 @@
# Prints "Hello, World" upon logging into tty1
if (tty) == "/dev/tty1" {
echo "Hello, World"
}

View file

@ -0,0 +1,17 @@
{ ... }:
{
programs = {
bash.enable = true;
pyenv.enable = true;
};
test.stubs.pyenv = { name = "pyenv"; };
nmt.script = ''
assertFileExists home-files/.bashrc
assertFileContains \
home-files/.bashrc \
'eval "$(@pyenv@/bin/pyenv init - bash)"'
'';
}

View file

@ -0,0 +1,5 @@
{
pyenv-bash = ./bash.nix;
pyenv-zsh = ./zsh.nix;
pyenv-fish = ./fish.nix;
}

View file

@ -0,0 +1,17 @@
{ ... }:
{
programs = {
fish.enable = true;
pyenv.enable = true;
};
test.stubs.pyenv = { name = "pyenv"; };
nmt.script = ''
assertFileExists home-files/.config/fish/config.fish
assertFileContains \
home-files/.config/fish/config.fish \
'@pyenv@/bin/pyenv init - fish | source'
'';
}

View file

@ -0,0 +1,17 @@
{ ... }:
{
programs = {
zsh.enable = true;
pyenv.enable = true;
};
test.stubs.pyenv = { name = "pyenv"; };
nmt.script = ''
assertFileExists home-files/.zshrc
assertFileContains \
home-files/.zshrc \
'eval "$(@pyenv@/bin/pyenv init - zsh)"'
'';
}

View file

@ -1,9 +1,6 @@
{ config, lib, pkgs, ... }: { lib, pkgs, ... }:
with lib;
{ {
config = {
programs.qutebrowser = { programs.qutebrowser = {
enable = true; enable = true;
@ -13,7 +10,7 @@ with lib;
normal = { normal = {
"<Ctrl-v>" = "spawn mpv {url}"; "<Ctrl-v>" = "spawn mpv {url}";
",l" = ''config-cycle spellcheck.languages ["en-GB"] ["en-US"]''; ",l" = ''config-cycle spellcheck.languages ["en-GB"] ["en-US"]'';
"<F1>" = mkMerge [ "<F1>" = lib.mkMerge [
"config-cycle tabs.show never always" "config-cycle tabs.show never always"
"config-cycle statusbar.show in-mode always" "config-cycle statusbar.show in-mode always"
"config-cycle scrolling.bar never always" "config-cycle scrolling.bar never always"
@ -43,5 +40,4 @@ with lib;
config.bind("<Ctrl-y>", "prompt-yes", mode="prompt")'' config.bind("<Ctrl-y>", "prompt-yes", mode="prompt")''
} }
''; '';
};
} }

View file

@ -1,9 +1,6 @@
{ config, lib, pkgs, ... }: { pkgs, ... }:
with lib;
{ {
config = {
programs.qutebrowser = { programs.qutebrowser = {
enable = true; enable = true;
@ -29,5 +26,4 @@ with lib;
nixpkgs https://github.com/NixOS/nixpkgs'' nixpkgs https://github.com/NixOS/nixpkgs''
} }
''; '';
};
} }

View file

@ -1,9 +1,6 @@
{ config, lib, pkgs, ... }: { pkgs, ... }:
with lib;
{ {
config = {
programs.qutebrowser = { programs.qutebrowser = {
enable = true; enable = true;
@ -46,5 +43,4 @@ with lib;
'' ''
} }
''; '';
};
} }

View file

@ -1,5 +1,6 @@
{ config, lib, pkgs, ... }: { { pkgs, ... }:
config = {
{
programs.terminator = { programs.terminator = {
enable = true; enable = true;
config = { config = {
@ -20,5 +21,4 @@
background_color = "#002b36"'' background_color = "#002b36"''
} }
''; '';
};
} }

View file

@ -1,13 +1,10 @@
{ config, lib, pkgs, ... }: { lib, ... }:
with lib;
{ {
config = {
programs.topgrade = { programs.topgrade = {
enable = true; enable = true;
settings = mkMerge [ settings = lib.mkMerge [
{ {
disable = [ "sdkman" "flutter" "node" "nix" "home_manager" ]; disable = [ "sdkman" "flutter" "node" "nix" "home_manager" ];
@ -32,5 +29,4 @@ with lib;
home-files/.config/topgrade.toml \ home-files/.config/topgrade.toml \
${./settings-expected.toml} ${./settings-expected.toml}
''; '';
};
} }

View file

@ -1,7 +1,5 @@
# Test that keybindings.json is created correctly. # Test that keybindings.json is created correctly.
{ config, lib, pkgs, ... }: { pkgs, ... }:
with lib;
let let
bindings = [ bindings = [
@ -65,7 +63,6 @@ let
''; '';
in { in {
config = {
programs.vscode = { programs.vscode = {
enable = true; enable = true;
keybindings = bindings; keybindings = bindings;
@ -78,5 +75,4 @@ in {
assertPathNotExists "home-files/${settingsPath}" assertPathNotExists "home-files/${settingsPath}"
''; '';
};
} }

View file

@ -1,4 +1,4 @@
{ pkgs, config, ... }: { pkgs, ... }:
let let

View file

@ -1,9 +1,6 @@
{ config, lib, pkgs, ... }: { config, pkgs, ... }:
with lib;
{ {
config = {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
zplug = { zplug = {
@ -48,5 +45,4 @@ with lib;
assertFileContains home-files/.zshrc \ assertFileContains home-files/.zshrc \
'export ZPLUG_HOME=${config.programs.zsh.zplug.zplugHome}' 'export ZPLUG_HOME=${config.programs.zsh.zplug.zplugHome}'
''; '';
};
} }

View file

@ -0,0 +1 @@
{ imapnotify-launchd = ./launchd.nix; }

View file

@ -0,0 +1,41 @@
{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
accounts.email.accounts = {
"hm@example.com" = {
notmuch.enable = true;
imap.port = 993;
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
onNotify = ''
${pkgs.notmuch}/bin/notmuch new
'';
};
};
};
services.imapnotify = {
enable = true;
package = (config.lib.test.mkStubPackage {
name = "goimapnotify";
outPath = "@goimapnotify@";
});
};
test.stubs.notmuch = { };
nmt.script = let
serviceFileName = "org.nix-community.home.imapnotify-hm-example.com.plist";
in ''
serviceFile="LaunchAgents/${serviceFileName}"
serviceFileNormalized="$(normalizeStorePaths "$serviceFile")"
assertFileExists $serviceFile
assertFileContent $serviceFileNormalized ${./launchd.plist}
'';
}

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>NOTMUCH_CONFIG</key>
<string>/home/hm-user/.config/notmuch/default/config</string>
</dict>
<key>ExitTimeOut</key>
<integer>0</integer>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.nix-community.home.imapnotify-hm-example.com</string>
<key>ProcessType</key>
<string>Background</string>
<key>ProgramArguments</key>
<array>
<string>@goimapnotify@/bin/goimapnotify</string>
<string>-conf</string>
<string>/nix/store/00000000000000000000000000000000-imapnotify-hm-example.com-config.json</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ThrottleInterval</key>
<integer>30</integer>
</dict>
</plist>

View file

@ -0,0 +1 @@
{ imapnotify = ./imapnotify.nix; }

View file

@ -0,0 +1,39 @@
{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ../../accounts/email-test-accounts.nix ];
accounts.email.accounts = {
"hm@example.com" = {
notmuch.enable = true;
imap.port = 993;
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
onNotify = ''
${pkgs.notmuch}/bin/notmuch new
'';
};
};
};
services.imapnotify = {
enable = true;
package = (config.lib.test.mkStubPackage {
name = "goimapnotify";
outPath = "@goimapnotify@";
});
};
test.stubs.notmuch = { };
nmt.script = ''
serviceFile="home-files/.config/systemd/user/imapnotify-hm-example.com.service"
serviceFileNormalized="$(normalizeStorePaths "$serviceFile")"
assertFileExists $serviceFile
assertFileContent $serviceFileNormalized ${./imapnotify.service}
'';
}

View file

@ -0,0 +1,12 @@
[Install]
WantedBy=default.target
[Service]
Environment=NOTMUCH_CONFIG=/home/hm-user/.config/notmuch/default/config
ExecStart=@goimapnotify@/bin/goimapnotify -conf '/nix/store/00000000000000000000000000000000-imapnotify-hm-example.com-config.json'
Restart=always
RestartSec=30
Type=simple
[Unit]
Description=imapnotify for hm-example.com

View file

@ -0,0 +1 @@
{ swayosd = ./swayosd.nix; }

View file

@ -0,0 +1,35 @@
{ config, ... }:
{
services.swayosd = {
enable = true;
package = config.lib.test.mkStubPackage {
name = "swayosd";
outPath = "@swayosd@";
};
maxVolume = 10;
};
nmt.script = ''
assertFileContent \
home-files/.config/systemd/user/swayosd.service \
${
builtins.toFile "swayosd.service" ''
[Install]
WantedBy=graphical-session.target
[Service]
ExecStart=@swayosd@/bin/swayosd --max-volume 10
Restart=always
Type=simple
[Unit]
After=graphical-session.target
ConditionEnvironment=WAYLAND_DISPLAY
Description=Volume/backlight OSD indicator
Documentation=man:swayosd(1)
PartOf=graphical-session.target
''
}
'';
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { config, pkgs, ... }:
{ {
systemd.user.sessionVariables = { systemd.user.sessionVariables = {
@ -11,7 +11,7 @@
assertFileExists $envFile assertFileExists $envFile
assertFileContent $envFile ${ assertFileContent $envFile ${
pkgs.writeText "expected" '' pkgs.writeText "expected" ''
LOCALE_ARCHIVE_2_27=${pkgs.glibcLocales}/lib/locale/locale-archive LOCALE_ARCHIVE_2_27=${config.i18n.glibcLocales}/lib/locale/locale-archive
V_int=1 V_int=1
V_str=2 V_str=2
XDG_CACHE_HOME=/home/hm-user/.cache XDG_CACHE_HOME=/home/hm-user/.cache