1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-14 02:33:38 +02: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
- [ ] 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.
-->

View File

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

View File

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

View File

@ -8,8 +8,8 @@ msgstr ""
"Project-Id-Version: Home Manager\n"
"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n"
"POT-Creation-Date: 2023-05-27 09:08+0200\n"
"PO-Revision-Date: 2023-06-22 09:51+0000\n"
"Last-Translator: Abdul V Vahry <cyberaioff@gmail.com>\n"
"PO-Revision-Date: 2023-07-01 13:50+0000\n"
"Last-Translator: Reza Almanda <rezaalmanda27@gmail.com>\n"
"Language-Team: Indonesian <https://hosted.weblate.org/projects/home-manager/"
"cli/id/>\n"
"Language: id\n"
@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\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
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-manager/home-manager:88 home-manager/home-manager:92
#: home-manager/home-manager:154
#, fuzzy
msgid ""
"Keeping your Home Manager %s in %s is deprecated,\n"
"please move it to %s"
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"
#: 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.
#: home-manager/home-manager:191
#, fuzzy
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:973
@ -56,7 +54,7 @@ msgstr "%s: opsi tidak diketahui '%s'"
#: home-manager/home-manager:258 home-manager/home-manager:974
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
msgid "The file %s already exists, leaving it unchanged..."

View File

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

View File

@ -15,15 +15,16 @@
# below for changes:
# https://github.com/NixOS/nixpkgs/blob/nixpkgs-unstable/pkgs/development/libraries/glibc/nix-locale-archive.patch
{ lib, pkgs, ... }:
{ lib, pkgs, config, ... }:
with lib;
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
localeVars = if versionAtLeast version "2.27" then {
@ -36,6 +37,31 @@ let
in {
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 {
# For shell sessions.
home.sessionVariables = localeVars;

View File

@ -1143,6 +1143,28 @@ in
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 {
type = with types;
# 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))) // {
description = "xfconf settings";
};
@ -108,8 +108,11 @@ in {
mkCommand = channel: property: value: ''
$DRY_RUN_CMD ${pkgs.xfce.xfconf}/bin/xfconf-query \
${
escapeShellArgs
([ "-n" "-c" channel "-p" "/${property}" ] ++ withType value)
escapeShellArgs ([ "-c" channel "-p" "/${property}" ]
++ (if value == null then
[ "-r" ]
else
[ "-n" ] ++ withType value))
}
'';

View File

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

View File

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

View File

@ -8,11 +8,13 @@ let
(optionalString (config.programs.zsh.dotDir != null)
(config.programs.zsh.dotDir + "/")) + file;
zPluginStr = with lib;
(pluginNames:
optionalString (pluginNames != [ ]) "${concatStrings (map (name: ''
${name}
'') pluginNames)}");
zPluginStr = (pluginNames:
optionalString (pluginNames != [ ]) "${concatStrings (map (name: ''
${name}
'') pluginNames)}");
parseHashId = path:
elemAt (builtins.match "/nix/store/([a-zA-Z0-9]+)-.*" path) 0;
in {
meta.maintainers = [ maintainers.hitsmaxft ];
@ -33,20 +35,24 @@ in {
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file."${relToDotDir ".zsh_plugins.txt"}".text = zPluginStr cfg.plugins;
### move zsh_plugins.txt
programs.zsh.initExtraBeforeCompInit = ''
programs.zsh.initExtraBeforeCompInit = let
configFiles = pkgs.runCommand "hm_antidote-files" { } ''
echo "${zPluginStr cfg.plugins}" > $out
'';
hashId = parseHashId "${configFiles}";
in ''
## home-manager/antidote begin :
source ${cfg.package}/share/antidote/antidote.zsh
${optionalString cfg.useFriendlyNames
"zstyle ':antidote:bundle' use-friendly-names 'yes'"}
bundlefile=$HOME/${relToDotDir ".zsh_plugins.txt"}
bundlefile=${configFiles}
zstyle ':antidote:bundle' file $bundlefile
staticfile=$HOME/${relToDotDir ".zsh_plugins.zsh"}
staticfile=/tmp/tmp_hm_zsh_plugins.zsh-${hashId}
zstyle ':antidote:static' file $staticfile
antidote load $bundlefile $staticfile
## 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
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
mkAccountConfig = _: account:
let
imapEnabled = !isNull account.imap;
maildirEnabled = !imapEnabled && !isNull account.maildir
&& !account.notmuch.enable;
notmuchEnabled = !imapEnabled && !isNull account.maildir
&& account.notmuch.enable;
# Use notmuch if it's enabled, otherwise fallback to IMAP then maildir
# Maildir is always set, so there's no easy way to detect if it's being used
notmuchEnabled = account.notmuch.enable;
imapEnabled = !isNull account.imap && !notmuchEnabled;
maildirEnabled = !isNull account.maildir && !imapEnabled
&& !notmuchEnabled;
globalConfig = {
email = account.address;
@ -55,7 +59,7 @@ let
notmuchConfig = lib.optionalAttrs notmuchEnabled (compactAttrs {
backend = "notmuch";
notmuch-db-path = account.maildir.absPath;
notmuch-db-path = maildirBasePath;
});
smtpConfig = lib.optionalAttrs (!isNull account.smtp) (compactAttrs {

View File

@ -25,7 +25,6 @@ let
genCalendarStr = name: value:
concatStringsSep "\n" ([
"[[${name}]]"
"highlight_event_days = True"
"path = ${
value.local.path + "/"
+ (optionalString (value.khal.type == "discover") value.khal.glob)
@ -158,6 +157,7 @@ in {
# locale = definedAttrs (cfg.locale // { _module = null; });
default = optionalAttrs (!isNull primaryAccount) {
highlight_event_days = true;
default_calendar = if isNull primaryAccount.primaryCollection then
primaryAccount.name
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 {
type = types.lines;
default = "";
@ -112,6 +129,14 @@ in {
'';
};
extraLogin = mkOption {
type = types.lines;
default = "";
description = ''
Additional configuration to add to the nushell login file.
'';
};
shellAliases = mkOption {
type = types.attrsOf types.str;
default = { };
@ -161,6 +186,12 @@ in {
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 [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ];
configName = account: "imapnotify-${safeName account.name}-config.json";
imapnotifyAccounts =
filter (a: a.imapnotify.enable) (attrValues config.accounts.email.accounts);
@ -19,9 +21,9 @@ let
Unit = { Description = "imapnotify for ${name}"; };
Service = {
ExecStart = "${pkgs.goimapnotify}/bin/goimapnotify -conf ${
genAccountConfig account
}";
# Use the nix store path for config to ensure service restarts when it changes
ExecStart =
"${getExe cfg.package} -conf '${genAccountConfig account}'";
Restart = "always";
RestartSec = 30;
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:
pkgs.writeText "imapnotify-${safeName account.name}-config.json" (let
pkgs.writeText (configName account) (let
port = if account.imap.port != null then
account.imap.port
else if account.imap.tls.enable then
@ -62,7 +86,17 @@ in {
meta.maintainers = [ maintainers.nickhu ];
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 {
type = with types; attrsOf (submodule (import ./imapnotify-accounts.nix));
@ -79,8 +113,6 @@ in {
+ concatMapStringsSep ", " (a: a.name) badAccounts;
};
in [
(lib.hm.assertions.assertPlatform "services.imapnotify" pkgs
lib.platforms.linux)
(checkAccounts (a: a.maildir == null) "maildir configuration")
(checkAccounts (a: a.imap == null) "IMAP configuration")
(checkAccounts (a: a.passwordCommand == null) "password command")
@ -88,5 +120,12 @@ in {
];
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 {
type = with types; attrsOf str;
type = with types; attrsOf (either str (listOf str));
apply = mergeAttrs default;
default = {
repeat = "watch";
@ -36,6 +36,8 @@ let
Additional command line options as a dictionary to pass to the
<literal>unison</literal> program.
</para><para>
Use a list of strings to declare the same option multiple times.
</para><para>
See
<citerefentry>
<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);

View File

@ -67,9 +67,11 @@ in {
Service = {
Type = "oneshot";
# TODO `vdirsyncer discover`
ExecStart = "${cfg.package}/bin/vdirsyncer ${
concatStringsSep " " vdirsyncerOptions
} sync";
ExecStart = let optStr = concatStringsSep " " vdirsyncerOptions;
in [
"${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 = "dropbox start"; notification = false; }
{ command = "firefox"; workspace = "1: web"; }
{ command = "firefox"; }
];
''
else

View File

@ -23,6 +23,9 @@ in {
# fontconfig by default.
fonts.fontconfig.enable = lib.mkDefault
(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/btop
./modules/programs/comodoro
./modules/programs/darcs
./modules/programs/dircolors
./modules/programs/direnv
./modules/programs/emacs
@ -88,6 +89,7 @@ import nmt {
./modules/programs/k9s
./modules/programs/kakoune
./modules/programs/kitty
./modules/programs/khal
./modules/programs/ledger
./modules/programs/less
./modules/programs/lf
@ -115,6 +117,7 @@ import nmt {
./modules/programs/pls
./modules/programs/powerline-go
./modules/programs/pubs
./modules/programs/pyenv
./modules/programs/qutebrowser
./modules/programs/readline
./modules/programs/ripgrep
@ -143,6 +146,7 @@ import nmt {
./modules/xresources
] ++ lib.optionals isDarwin [
./modules/launchd
./modules/services/imapnotify-darwin
./modules/targets-darwin
] ++ lib.optionals isLinux [
./modules/config/i18n
@ -201,6 +205,7 @@ import nmt {
./modules/services/gpg-agent
./modules/services/gromit-mpx
./modules/services/home-manager-auto-upgrade
./modules/services/imapnotify
./modules/services/kanshi
./modules/services/lieer
./modules/services/mopidy
@ -218,6 +223,7 @@ import nmt {
./modules/services/redshift-gammastep
./modules/services/screen-locker
./modules/services/swayidle
./modules/services/swayosd
./modules/services/sxhkd
./modules/services/syncthing/linux
./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
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 V2="v2-v1"
export XDG_CACHE_HOME="/home/hm-user/.cache"

View File

@ -10,7 +10,7 @@
assertFileExists $envFile
assertFileContent $envFile ${
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_CONFIG_DIRS=/etc/xdg:/foo/bar''${XDG_CONFIG_DIRS:+:$XDG_CONFIG_DIRS}
XDG_CONFIG_HOME=/home/hm-user/.config

View File

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

View File

@ -1,29 +1,27 @@
{ config, lib, pkgs, ... }:
{ config, ... }:
{
config = {
home.stateVersion = "23.05";
home.stateVersion = "23.05";
programs.beets = {
enable = true;
package = config.lib.test.mkStubPackage { outPath = "@beets@"; };
mpdIntegration = {
enableStats = true;
host = "10.0.0.42";
port = 6601;
};
programs.beets = {
enable = true;
package = config.lib.test.mkStubPackage { outPath = "@beets@"; };
mpdIntegration = {
enableStats = true;
host = "10.0.0.42";
port = 6601;
};
nmt.script = ''
assertFileExists home-files/.config/beets/config.yaml
assertFileContent \
home-files/.config/beets/config.yaml \
${./mpdstats-external-expected.yaml}
assertFileExists home-files/.config/systemd/user/beets-mpdstats.service
assertFileContent \
home-files/.config/systemd/user/beets-mpdstats.service \
${./mpdstats-external-expected.service}
'';
};
nmt.script = ''
assertFileExists home-files/.config/beets/config.yaml
assertFileContent \
home-files/.config/beets/config.yaml \
${./mpdstats-external-expected.yaml}
assertFileExists home-files/.config/systemd/user/beets-mpdstats.service
assertFileContent \
home-files/.config/systemd/user/beets-mpdstats.service \
${./mpdstats-external-expected.service}
'';
}

View File

@ -1,31 +1,29 @@
{ config, lib, pkgs, ... }:
{ config, ... }:
{
config = {
home.stateVersion = "23.05";
home.stateVersion = "23.05";
services.mpd = {
enable = true;
musicDirectory = "/my/music/dir";
network.port = 4242;
};
programs.beets = {
enable = true;
package = config.lib.test.mkStubPackage { outPath = "@beets@"; };
mpdIntegration.enableStats = true;
};
nmt.script = ''
assertFileExists home-files/.config/beets/config.yaml
assertFileContent \
home-files/.config/beets/config.yaml \
${./mpdstats-expected.yaml}
assertFileExists home-files/.config/systemd/user/beets-mpdstats.service
assertFileContent \
home-files/.config/systemd/user/beets-mpdstats.service \
${./mpdstats-expected.service}
'';
services.mpd = {
enable = true;
musicDirectory = "/my/music/dir";
network.port = 4242;
};
programs.beets = {
enable = true;
package = config.lib.test.mkStubPackage { outPath = "@beets@"; };
mpdIntegration.enableStats = true;
};
nmt.script = ''
assertFileExists home-files/.config/beets/config.yaml
assertFileContent \
home-files/.config/beets/config.yaml \
${./mpdstats-expected.yaml}
assertFileExists home-files/.config/systemd/user/beets-mpdstats.service
assertFileContent \
home-files/.config/systemd/user/beets-mpdstats.service \
${./mpdstats-expected.service}
'';
}

View File

@ -1,20 +1,18 @@
{ config, lib, pkgs, ... }:
{ config, ... }:
{
config = {
home.stateVersion = "23.05";
home.stateVersion = "23.05";
programs.beets = {
enable = true;
package = config.lib.test.mkStubPackage { outPath = "@beets@"; };
mpdIntegration.enableUpdate = true;
};
nmt.script = ''
assertFileExists home-files/.config/beets/config.yaml
assertFileContent \
home-files/.config/beets/config.yaml \
${./mpdupdate-expected.yaml}
'';
programs.beets = {
enable = true;
package = config.lib.test.mkStubPackage { outPath = "@beets@"; };
mpdIntegration.enableUpdate = true;
};
nmt.script = ''
assertFileExists home-files/.config/beets/config.yaml
assertFileContent \
home-files/.config/beets/config.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
display-name = "H. M. Test"
email = "hm@example.com"
notmuch-db-path = "/home/hm-user/Maildir/hm@example.com"
notmuch-db-path = "/home/hm-user/Maildir"
sender = "sendmail"
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,55 +1,53 @@
{ config, lib, pkgs, ... }:
{ pkgs, ... }:
{
config = {
programs.nnn = {
enable = true;
bookmarks = {
d = "~/Documents";
D = "~/Downloads";
p = "~/Pictures";
v = "~/Videos";
};
package = pkgs.nnnDummy;
extraPackages = with pkgs; [ foo bar ];
plugins = {
src = ./plugins;
mappings = {
c = "fzcd";
f = "finder";
v = "imgview";
};
};
programs.nnn = {
enable = true;
bookmarks = {
d = "~/Documents";
D = "~/Downloads";
p = "~/Pictures";
v = "~/Videos";
};
test.stubs = {
nnnDummy.buildScript = ''
runHook preInstall
mkdir -p "$out/bin"
touch "$out/bin/nnn"
chmod +x "$out/bin/nnn"
runHook postInstall
'';
foo = { name = "foo"; };
bar = { name = "bar"; };
};
nmt = {
description =
"Check if the binary is correctly wrapped and if the symlinks are made";
script = ''
assertDirectoryExists home-files/.config/nnn/plugins
for bookmark in 'export NNN_BMS' '~/Downloads' '~/Documents' '~/Pictures' '~/Videos'; do
assertFileRegex home-path/bin/nnn "$bookmark"
done
for plugin in 'export NNN_PLUG' 'fzcd' 'finder' 'imgview'; do
assertFileRegex home-path/bin/nnn "$plugin"
done
'';
package = pkgs.nnnDummy;
extraPackages = with pkgs; [ foo bar ];
plugins = {
src = ./plugins;
mappings = {
c = "fzcd";
f = "finder";
v = "imgview";
};
};
};
test.stubs = {
nnnDummy.buildScript = ''
runHook preInstall
mkdir -p "$out/bin"
touch "$out/bin/nnn"
chmod +x "$out/bin/nnn"
runHook postInstall
'';
foo = { name = "foo"; };
bar = { name = "bar"; };
};
nmt = {
description =
"Check if the binary is correctly wrapped and if the symlinks are made";
script = ''
assertDirectoryExists home-files/.config/nnn/plugins
for bookmark in 'export NNN_BMS' '~/Downloads' '~/Documents' '~/Pictures' '~/Videos'; do
assertFileRegex home-path/bin/nnn "$bookmark"
done
for plugin in 'export NNN_PLUG' 'fzcd' 'finder' 'imgview'; do
assertFileRegex home-path/bin/nnn "$plugin"
done
'';
};
}

View File

@ -16,6 +16,13 @@
let-env FOO = 'BAR'
'';
loginFile.text = ''
# Prints "Hello, World" upon logging into tty1
if (tty) == "/dev/tty1" {
echo "Hello, World"
}
'';
shellAliases = {
"lsname" = "(ls | get name)";
"ll" = "ls -a";
@ -38,5 +45,8 @@
assertFileContent \
"${configDir}/env.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,47 +1,43 @@
{ config, lib, pkgs, ... }:
with lib;
{ lib, pkgs, ... }:
{
config = {
programs.qutebrowser = {
enable = true;
programs.qutebrowser = {
enable = true;
enableDefaultBindings = false;
enableDefaultBindings = false;
keyBindings = {
normal = {
"<Ctrl-v>" = "spawn mpv {url}";
",l" = ''config-cycle spellcheck.languages ["en-GB"] ["en-US"]'';
"<F1>" = mkMerge [
"config-cycle tabs.show never always"
"config-cycle statusbar.show in-mode always"
"config-cycle scrolling.bar never always"
];
};
prompt = { "<Ctrl-y>" = "prompt-yes"; };
keyBindings = {
normal = {
"<Ctrl-v>" = "spawn mpv {url}";
",l" = ''config-cycle spellcheck.languages ["en-GB"] ["en-US"]'';
"<F1>" = lib.mkMerge [
"config-cycle tabs.show never always"
"config-cycle statusbar.show in-mode always"
"config-cycle scrolling.bar never always"
];
};
prompt = { "<Ctrl-y>" = "prompt-yes"; };
};
test.stubs.qutebrowser = { };
nmt.script = let
qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then
".qutebrowser/config.py"
else
".config/qutebrowser/config.py";
in ''
assertFileContent \
home-files/${qutebrowserConfig} \
${
pkgs.writeText "qutebrowser-expected-config.py" ''
config.load_autoconfig(False)
c.bindings.default = {}
config.bind(",l", "config-cycle spellcheck.languages [\"en-GB\"] [\"en-US\"]", mode="normal")
config.bind("<Ctrl-v>", "spawn mpv {url}", mode="normal")
config.bind("<F1>", "config-cycle tabs.show never always ;; config-cycle statusbar.show in-mode always ;; config-cycle scrolling.bar never always", mode="normal")
config.bind("<Ctrl-y>", "prompt-yes", mode="prompt")''
}
'';
};
test.stubs.qutebrowser = { };
nmt.script = let
qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then
".qutebrowser/config.py"
else
".config/qutebrowser/config.py";
in ''
assertFileContent \
home-files/${qutebrowserConfig} \
${
pkgs.writeText "qutebrowser-expected-config.py" ''
config.load_autoconfig(False)
c.bindings.default = {}
config.bind(",l", "config-cycle spellcheck.languages [\"en-GB\"] [\"en-US\"]", mode="normal")
config.bind("<Ctrl-v>", "spawn mpv {url}", mode="normal")
config.bind("<F1>", "config-cycle tabs.show never always ;; config-cycle statusbar.show in-mode always ;; config-cycle scrolling.bar never always", mode="normal")
config.bind("<Ctrl-y>", "prompt-yes", mode="prompt")''
}
'';
}

View File

@ -1,33 +1,29 @@
{ config, lib, pkgs, ... }:
with lib;
{ pkgs, ... }:
{
config = {
programs.qutebrowser = {
enable = true;
programs.qutebrowser = {
enable = true;
quickmarks = {
nixpkgs = "https://github.com/NixOS/nixpkgs";
home-manager = "https://github.com/nix-community/home-manager";
};
quickmarks = {
nixpkgs = "https://github.com/NixOS/nixpkgs";
home-manager = "https://github.com/nix-community/home-manager";
};
test.stubs.qutebrowser = { };
nmt.script = let
quickmarksFile = if pkgs.stdenv.hostPlatform.isDarwin then
".qutebrowser/quickmarks"
else
".config/qutebrowser/quickmarks";
in ''
assertFileContent \
home-files/${quickmarksFile} \
${
pkgs.writeText "qutebrowser-expected-quickmarks" ''
home-manager https://github.com/nix-community/home-manager
nixpkgs https://github.com/NixOS/nixpkgs''
}
'';
};
test.stubs.qutebrowser = { };
nmt.script = let
quickmarksFile = if pkgs.stdenv.hostPlatform.isDarwin then
".qutebrowser/quickmarks"
else
".config/qutebrowser/quickmarks";
in ''
assertFileContent \
home-files/${quickmarksFile} \
${
pkgs.writeText "qutebrowser-expected-quickmarks" ''
home-manager https://github.com/nix-community/home-manager
nixpkgs https://github.com/NixOS/nixpkgs''
}
'';
}

View File

@ -1,50 +1,46 @@
{ config, lib, pkgs, ... }:
with lib;
{ pkgs, ... }:
{
config = {
programs.qutebrowser = {
enable = true;
programs.qutebrowser = {
enable = true;
settings = {
colors = {
hints = {
bg = "#000000";
fg = "#ffffff";
};
tabs.bar.bg = "#000000";
settings = {
colors = {
hints = {
bg = "#000000";
fg = "#ffffff";
};
spellcheck.languages = [ "en-US" "sv-SE" ];
tabs.tabs_are_windows = true;
tabs.bar.bg = "#000000";
};
extraConfig = ''
# Extra qutebrowser configuration.
'';
spellcheck.languages = [ "en-US" "sv-SE" ];
tabs.tabs_are_windows = true;
};
test.stubs.qutebrowser = { };
nmt.script = let
qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then
".qutebrowser/config.py"
else
".config/qutebrowser/config.py";
in ''
assertFileContent \
home-files/${qutebrowserConfig} \
${
pkgs.writeText "qutebrowser-expected-config.py" ''
config.load_autoconfig(False)
c.colors.hints.bg = "#000000"
c.colors.hints.fg = "#ffffff"
c.colors.tabs.bar.bg = "#000000"
c.spellcheck.languages = ["en-US", "sv-SE"]
c.tabs.tabs_are_windows = True
# Extra qutebrowser configuration.
''
}
extraConfig = ''
# Extra qutebrowser configuration.
'';
};
test.stubs.qutebrowser = { };
nmt.script = let
qutebrowserConfig = if pkgs.stdenv.hostPlatform.isDarwin then
".qutebrowser/config.py"
else
".config/qutebrowser/config.py";
in ''
assertFileContent \
home-files/${qutebrowserConfig} \
${
pkgs.writeText "qutebrowser-expected-config.py" ''
config.load_autoconfig(False)
c.colors.hints.bg = "#000000"
c.colors.hints.fg = "#ffffff"
c.colors.tabs.bar.bg = "#000000"
c.spellcheck.languages = ["en-US", "sv-SE"]
c.tabs.tabs_are_windows = True
# Extra qutebrowser configuration.
''
}
'';
}

View File

@ -1,24 +1,24 @@
{ config, lib, pkgs, ... }: {
config = {
programs.terminator = {
enable = true;
config = {
global_config.borderless = true;
profiles.default.background_color = "#002b36";
};
{ pkgs, ... }:
{
programs.terminator = {
enable = true;
config = {
global_config.borderless = true;
profiles.default.background_color = "#002b36";
};
test.stubs.terminator = { };
nmt.script = ''
assertFileContent home-files/.config/terminator/config ${
pkgs.writeText "expected" ''
[global_config]
borderless = True
[profiles]
[[default]]
background_color = "#002b36"''
}
'';
};
test.stubs.terminator = { };
nmt.script = ''
assertFileContent home-files/.config/terminator/config ${
pkgs.writeText "expected" ''
[global_config]
borderless = True
[profiles]
[[default]]
background_color = "#002b36"''
}
'';
}

View File

@ -1,36 +1,32 @@
{ config, lib, pkgs, ... }:
with lib;
{ lib, ... }:
{
config = {
programs.topgrade = {
enable = true;
programs.topgrade = {
enable = true;
settings = mkMerge [
{
disable = [ "sdkman" "flutter" "node" "nix" "home_manager" ];
settings = lib.mkMerge [
{
disable = [ "sdkman" "flutter" "node" "nix" "home_manager" ];
remote_topgrades = [ "backup" "ci" ];
remote_topgrades = [ "backup" "ci" ];
remote_topgrade_path = "bin/topgrade";
}
remote_topgrade_path = "bin/topgrade";
}
{
set_title = false;
cleanup = true;
{
set_title = false;
cleanup = true;
commands = { "Purge unused APT packages" = "sudo apt autoremove"; };
}
];
};
test.stubs.topgrade = { };
nmt.script = ''
assertFileContent \
home-files/.config/topgrade.toml \
${./settings-expected.toml}
'';
commands = { "Purge unused APT packages" = "sudo apt autoremove"; };
}
];
};
test.stubs.topgrade = { };
nmt.script = ''
assertFileContent \
home-files/.config/topgrade.toml \
${./settings-expected.toml}
'';
}

View File

@ -1,7 +1,5 @@
# Test that keybindings.json is created correctly.
{ config, lib, pkgs, ... }:
with lib;
{ pkgs, ... }:
let
bindings = [
@ -65,18 +63,16 @@ let
'';
in {
config = {
programs.vscode = {
enable = true;
keybindings = bindings;
package = pkgs.writeScriptBin "vscode" "" // { pname = "vscode"; };
};
nmt.script = ''
assertFileExists "home-files/${keybindingsPath}"
assertFileContent "home-files/${keybindingsPath}" "${expectedKeybindings}"
assertPathNotExists "home-files/${settingsPath}"
'';
programs.vscode = {
enable = true;
keybindings = bindings;
package = pkgs.writeScriptBin "vscode" "" // { pname = "vscode"; };
};
nmt.script = ''
assertFileExists "home-files/${keybindingsPath}"
assertFileContent "home-files/${keybindingsPath}" "${expectedKeybindings}"
assertPathNotExists "home-files/${settingsPath}"
'';
}

View File

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

View File

@ -1,52 +1,48 @@
{ config, lib, pkgs, ... }:
with lib;
{ config, pkgs, ... }:
{
config = {
programs.zsh = {
programs.zsh = {
enable = true;
zplug = {
enable = true;
zplug = {
enable = true;
zplugHome = pkgs.emptyDirectory;
plugins = [
{
name = "plugins/git";
tags = [ "from:oh-my-zsh" ];
}
{
name = "lib/clipboard";
tags = [ "from:oh-my-zsh" ''if:"[[ $OSTYPE == *darwin* ]]"'' ];
}
];
};
zplugHome = pkgs.emptyDirectory;
plugins = [
{
name = "plugins/git";
tags = [ "from:oh-my-zsh" ];
}
{
name = "lib/clipboard";
tags = [ "from:oh-my-zsh" ''if:"[[ $OSTYPE == *darwin* ]]"'' ];
}
];
};
test.stubs = {
zplug = { };
zsh = { };
};
nmt.script = ''
assertFileContains home-files/.zshrc \
'source @zplug@/share/zplug/init.zsh'
assertFileContains home-files/.zshrc \
'zplug "plugins/git", from:oh-my-zsh'
assertFileContains home-files/.zshrc \
'zplug "lib/clipboard", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]"'
assertFileContains home-files/.zshrc \
'if ! zplug check; then
zplug install
fi'
assertFileRegex home-files/.zshrc \
'^zplug load$'
assertFileContains home-files/.zshrc \
'export ZPLUG_HOME=${config.programs.zsh.zplug.zplugHome}'
'';
};
test.stubs = {
zplug = { };
zsh = { };
};
nmt.script = ''
assertFileContains home-files/.zshrc \
'source @zplug@/share/zplug/init.zsh'
assertFileContains home-files/.zshrc \
'zplug "plugins/git", from:oh-my-zsh'
assertFileContains home-files/.zshrc \
'zplug "lib/clipboard", from:oh-my-zsh, if:"[[ $OSTYPE == *darwin* ]]"'
assertFileContains home-files/.zshrc \
'if ! zplug check; then
zplug install
fi'
assertFileRegex home-files/.zshrc \
'^zplug load$'
assertFileContains home-files/.zshrc \
'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 = {
@ -11,7 +11,7 @@
assertFileExists $envFile
assertFileContent $envFile ${
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_str=2
XDG_CACHE_HOME=/home/hm-user/.cache