diff options
author | Katharina Fey <kookie@spacekookie.de> | 2021-03-09 22:55:09 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2021-03-09 22:55:09 +0100 |
commit | b9f9cf2b582ab13bc2c0d654babf9c604ec49459 (patch) | |
tree | 52992666dc58b17f85036deb40ce10de1669b2a3 | |
parent | fdbac8e7d0e1930c5658061a816d671268f65997 (diff) | |
parent | 57a7e5e2c53de58215fdac1910470bef36dd30cd (diff) |
Merge commit '57a7e5e2c53de58215fdac1910470bef36dd30cd'
47 files changed, 585 insertions, 77 deletions
diff --git a/infra/libkookie/home-manager/doc/contributing.adoc b/infra/libkookie/home-manager/doc/contributing.adoc index 6222591d56ee..4babb93f5249 100644 --- a/infra/libkookie/home-manager/doc/contributing.adoc +++ b/infra/libkookie/home-manager/doc/contributing.adoc @@ -91,7 +91,7 @@ All contributed code _must_ pass the test suite. ==== Add relevant documentation :docbook: https://tdg.docbook.org/ :asciidoc: https://asciidoc.org/ -:docbook-rocks: https://docbook.rocks/ +:docbook-rocks: https://berbiche.github.io/docbook.rocks/ Many code changes require changing the documentation as well. Module options should be documented with DocBook. See {docbook-rocks}[DocBook rocks!] for a quick introduction and {docbook}[DocBook 5: The Definitive Guide] for in-depth information of DocBook. Home Manager is itself documented using a combination of DocBook and {asciidoc}[AsciiDoc]. All text is hosted in Home Manager's Git repository. diff --git a/infra/libkookie/home-manager/doc/release-notes/rl-2105.adoc b/infra/libkookie/home-manager/doc/release-notes/rl-2105.adoc index 4fe8953ae0ec..2cda4a3d99cd 100644 --- a/infra/libkookie/home-manager/doc/release-notes/rl-2105.adoc +++ b/infra/libkookie/home-manager/doc/release-notes/rl-2105.adoc @@ -50,8 +50,8 @@ As a result of this change, <<opt-programs.mpv.package>> is no longer the resulting derivation. Use the newly introduced `programs.mpv.finalPackage` instead. -* The <<opt-programs.rofi.extraConfig>> option is now an attrset rather -than a string. To migrate, move the each line into the attrset, +* The <<opt-programs.rofi.extraConfig>> option is now an attribute set rather +than a string. To migrate, move each line into the attribute set, removing the `rofi.` prefix from the keys. For example, + [source,nix] @@ -71,6 +71,34 @@ programs.rofi.extraConfig = { modi = "drun,emoji,ssh"; }; ---- ++ +* The <<opt-programs.rofi.theme>> option now supports defining a theme +using an attribute set, the following configuration is now possible: ++ +[source,nix] +---- +programs.rofi.theme = let + # Necessary to avoid quoting non-string values + inherit (config.lib.formats.rasi) mkLiteral; +in { + "@import" = "~/.config/rofi/theme.rasi"; + + "*" = { + background-color = mkLiteral "#000000"; + foreground-color = mkLiteral "rgba ( 250, 251, 252, 100 % )"; + border-color = mkLiteral "#FFFFFF"; + width = 512; + }; + + "#textbox-prompt-colon" = { + expand = false; + str = ":"; + margin = mkLiteral "0px 0.3em 0em 0em"; + text-color = mkLiteral "@foreground-color"; + }; +}; +---- + * The `services.redshift.extraOptions` and `services.gammastep.extraOptions` options were removed in favor of <<opt-services.redshift.settings>> and @@ -101,6 +129,35 @@ https://github.com/jonls/redshift/blob/master/redshift.conf.sample[redshift.conf https://gitlab.com/chinstrap/gammastep/-/blob/master/gammastep.conf.sample[gammastep.conf.sample] for the available additional options in each program. +* The `programs.neovim.configure` is deprecated in favor of other `programs.neovim` options; +please use the other options at your disposal: ++ +[source,nix] +---- +configure.packages.*.opt -> programs.neovim.plugins = [ { plugin = ...; optional = true; }] +configure.packages.*.start -> programs.neovim.plugins = [ { plugin = ...; }] +configure.customRC -> programs.neovim.extraConfig +---- + +* Home Manager now respects the `NO_COLOR` environment variable as per +https://no-color.org/[]. + +* Qt module now supports <<opt-qt.style.name>> to specify a theme name and +<<opt-qt.style.package>> to specify a theme package. If you have set +<<opt-qt.platformTheme>> to `gnome`, a <<opt-qt.style.package>> compatible +with both Qt and Gtk is now required to be set. For instance: ++ +[source,nix] +---- +qt = { + platformTheme = "gnome"; + style = { + name = "adwaita-dark"; + package = pkgs.adwaita-qt; + }; +}; +---- + [[sec-release-21.05-state-version-changes]] === State Version Changes diff --git a/infra/libkookie/home-manager/home-manager/home-manager b/infra/libkookie/home-manager/home-manager/home-manager index fb9f440c4ec3..56caebeb0aea 100644 --- a/infra/libkookie/home-manager/home-manager/home-manager +++ b/infra/libkookie/home-manager/home-manager/home-manager @@ -221,7 +221,7 @@ function doSwitch() { function doListGens() { # Whether to colorize the generations output. local color="never" - if [[ -t 1 ]]; then + if [[ ! -v NO_COLOR && -t 1 ]]; then color="always" fi diff --git a/infra/libkookie/home-manager/modules/lib-bash/color-echo.sh b/infra/libkookie/home-manager/modules/lib-bash/color-echo.sh index ef708b29c4db..ac36cedc6e86 100644 --- a/infra/libkookie/home-manager/modules/lib-bash/color-echo.sh +++ b/infra/libkookie/home-manager/modules/lib-bash/color-echo.sh @@ -1,5 +1,7 @@ # The check for terminal output and color support is heavily inspired # by https://unix.stackexchange.com/a/10065. +# +# Allow opt out by respecting the `NO_COLOR` environment variable. function setupColors() { normalColor="" @@ -7,8 +9,8 @@ function setupColors() { warnColor="" noteColor="" - # Check if stdout is a terminal. - if [[ -t 1 ]]; then + # Enable colors for terminals, and allow opting out. + if [[ ! -v NO_COLOR && -t 1 ]]; then # See if it supports colors. local ncolors ncolors=$(tput colors) diff --git a/infra/libkookie/home-manager/modules/misc/news.nix b/infra/libkookie/home-manager/modules/misc/news.nix index 0791c0fd9212..301136441b21 100644 --- a/infra/libkookie/home-manager/modules/misc/news.nix +++ b/infra/libkookie/home-manager/modules/misc/news.nix @@ -1852,6 +1852,34 @@ in A new module is available: 'programs.sbt'. ''; } + + { + time = "2021-02-20T00:00:00+00:00"; + condition = config.services.polybar.enable; + message = '' + The polybar configuration can now be written in a more nix-friendly format. + The new 'services.polybar.settings' option is an alternative to + 'services.polybar.config' that supports nested keys and converts nix + lists to polybar-style 'foo-0, foo-1, ...' lists. + ''; + } + { + time = "2021-02-25T22:36:43+00:00"; + condition = config.programs.git.enable && any (msmtp: msmtp.enable) + (mapAttrsToList (name: account: account.msmtp) + config.accounts.email.accounts); + message = '' + Git will now defer to msmtp for sending emails if + 'accounts.email.accounts.<name>.msmtp.enable' is true. + ''; + } + { + time = "2021-03-03T22:16:05+00:00"; + message = '' + Home Manager now respects the 'NO_COLOR' environment variable as per + https://no-color.org/. + ''; + } ]; }; } diff --git a/infra/libkookie/home-manager/modules/misc/qt.nix b/infra/libkookie/home-manager/modules/misc/qt.nix index ff38f842c810..1fdaf9f9b949 100644 --- a/infra/libkookie/home-manager/modules/misc/qt.nix +++ b/infra/libkookie/home-manager/modules/misc/qt.nix @@ -44,19 +44,72 @@ in { </variablelist> ''; }; + + style = { + name = mkOption { + type = types.nullOr types.str; + default = null; + example = "adwaita-dark"; + relatedPackages = [ "adwaita-qt" [ "libsForQt5" "qtstyleplugins" ] ]; + description = '' + Selects the style to use for Qt5 applications.</para> + <para>The options are + <variablelist> + <varlistentry> + <term><literal>adwaita</literal></term> + <term><literal>adwaita-dark</literal></term> + <listitem><para>Use Adwaita Qt style with + <link xlink:href="https://github.com/FedoraQt/adwaita-qt">adwaita</link> + </para></listitem> + </varlistentry> + <varlistentry> + <term><literal>cleanlooks</literal></term> + <term><literal>gtk2</literal></term> + <term><literal>motif</literal></term> + <term><literal>plastique</literal></term> + <listitem><para>Use styles from + <link xlink:href="https://github.com/qt/qtstyleplugins">qtstyleplugins</link> + </para></listitem> + </varlistentry> + </variablelist> + ''; + }; + + package = mkOption { + type = types.nullOr types.package; + default = null; + example = literalExample "pkgs.adwaita-qt"; + description = "Theme package to be used in Qt5 applications."; + }; + }; }; }; config = mkIf (cfg.enable && cfg.platformTheme != null) { - home.sessionVariables.QT_QPA_PLATFORMTHEME = - if cfg.platformTheme == "gnome" then "gnome" else "gtk2"; + assertions = [{ + assertion = (cfg.platformTheme == "gnome") + -> ((cfg.style.name != null) && (cfg.style.package != null)); + message = '' + `qt.platformTheme` "gnome" must have `qt.style` set to a theme that + supports both Qt and Gtk, for example "adwaita" or "adwaita-dark". + ''; + }]; + + # Necessary because home.sessionVariables is of types.attrs + home.sessionVariables = (filterAttrs (n: v: v != null) { + QT_QPA_PLATFORMTHEME = + if cfg.platformTheme == "gnome" then "gnome" else "gtk2"; + QT_STYLE_OVERRIDE = cfg.style.name; + }); home.packages = if cfg.platformTheme == "gnome" then [ pkgs.qgnomeplatform ] + ++ lib.optionals (cfg.style.package != null) [ cfg.style.package ] else [ pkgs.libsForQt5.qtstyleplugins ]; - xsession.importedVariables = [ "QT_QPA_PLATFORMTHEME" ]; + xsession.importedVariables = [ "QT_QPA_PLATFORMTHEME" ] + ++ lib.optionals (cfg.style != null) [ "QT_STYLE_OVERRIDE" ]; # Enable GTK+ style for Qt4 in either case. # It doesnβt support the platform theme packages. diff --git a/infra/libkookie/home-manager/modules/programs/alot.nix b/infra/libkookie/home-manager/modules/programs/alot.nix index e907cd3e0ac5..b3abf1f7dab3 100644 --- a/infra/libkookie/home-manager/modules/programs/alot.nix +++ b/infra/libkookie/home-manager/modules/programs/alot.nix @@ -7,9 +7,12 @@ let cfg = config.programs.alot; - alotAccounts = + enabledAccounts = filter (a: a.notmuch.enable) (attrValues config.accounts.email.accounts); + # sorted: primary first + alotAccounts = sort (a: b: !(a.primary -> b.primary)) enabledAccounts; + boolStr = v: if v then "True" else "False"; mkKeyValue = key: value: diff --git a/infra/libkookie/home-manager/modules/programs/fzf.nix b/infra/libkookie/home-manager/modules/programs/fzf.nix index b0a0766bae7a..f945c7d4da5d 100644 --- a/infra/libkookie/home-manager/modules/programs/fzf.nix +++ b/infra/libkookie/home-manager/modules/programs/fzf.nix @@ -7,6 +7,11 @@ let cfg = config.programs.fzf; in { + imports = [ + (mkRemovedOptionModule [ "programs" "fzf" "historyWidgetCommand" ] + "This option is no longer supported by fzf.") + ]; + options.programs.fzf = { enable = mkEnableOption "fzf - a command-line fuzzy finder"; @@ -74,15 +79,6 @@ in { ''; }; - historyWidgetCommand = mkOption { - type = types.nullOr types.str; - default = null; - description = '' - The command that gets executed as the source for fzf for the - CTRL-R keybinding. - ''; - }; - historyWidgetOptions = mkOption { type = types.listOf types.str; default = [ ]; @@ -124,7 +120,6 @@ in { (filterAttrs (n: v: v != [ ] && v != null) { FZF_ALT_C_COMMAND = cfg.changeDirWidgetCommand; FZF_ALT_C_OPTS = cfg.changeDirWidgetOptions; - FZF_CTRL_R_COMMAND = cfg.historyWidgetCommand; FZF_CTRL_R_OPTS = cfg.historyWidgetOptions; FZF_CTRL_T_COMMAND = cfg.fileWidgetCommand; FZF_CTRL_T_OPTS = cfg.fileWidgetOptions; diff --git a/infra/libkookie/home-manager/modules/programs/getmail.nix b/infra/libkookie/home-manager/modules/programs/getmail.nix index f83c469ff245..eaf297cf2af0 100644 --- a/infra/libkookie/home-manager/modules/programs/getmail.nix +++ b/infra/libkookie/home-manager/modules/programs/getmail.nix @@ -11,8 +11,7 @@ let with account; let passCmd = concatMapStringsSep ", " (x: "'${x}'") passwordCommand; - renderedMailboxes = - concatMapStringsSep ", " (x: "'${x}'") getmail.mailboxes; + renderedMailboxes = concatMapStrings (x: "'${x}', ") getmail.mailboxes; retrieverType = if imap.tls.enable then "SimpleIMAPSSLRetriever" else diff --git a/infra/libkookie/home-manager/modules/programs/gh.nix b/infra/libkookie/home-manager/modules/programs/gh.nix index a4f4e17c9f63..4cda4eab34b0 100644 --- a/infra/libkookie/home-manager/modules/programs/gh.nix +++ b/infra/libkookie/home-manager/modules/programs/gh.nix @@ -47,7 +47,9 @@ in { config = mkIf cfg.enable { home.packages = [ pkgs.gh ]; - xdg.configFile."gh/config.yml".text = - builtins.toJSON { inherit (cfg) aliases editor gitProtocol; }; + xdg.configFile."gh/config.yml".text = builtins.toJSON { + inherit (cfg) aliases editor; + git_protocol = cfg.gitProtocol; + }; }; } diff --git a/infra/libkookie/home-manager/modules/programs/git.nix b/infra/libkookie/home-manager/modules/programs/git.nix index 4b2912e65d79..d5f1bfeea6cf 100644 --- a/infra/libkookie/home-manager/modules/programs/git.nix +++ b/infra/libkookie/home-manager/modules/programs/git.nix @@ -276,21 +276,27 @@ in { genIdentity = name: account: with account; - nameValuePair "sendemail.${name}" ({ - smtpEncryption = if smtp.tls.enable then - (if smtp.tls.useStartTls - || versionOlder config.home.stateVersion "20.09" then - "tls" - else - "ssl") - else - ""; - smtpServer = smtp.host; - smtpUser = userName; + nameValuePair "sendemail.${name}" (if account.msmtp.enable then { + smtpServer = "${pkgs.msmtp}/bin/msmtp"; + envelopeSender = "auto"; from = address; - } // optionalAttrs (smtp.port != null) { - smtpServerPort = smtp.port; - }); + } else + { + smtpEncryption = if smtp.tls.enable then + (if smtp.tls.useStartTls + || versionOlder config.home.stateVersion "20.09" then + "tls" + else + "ssl") + else + ""; + smtpSslCertPath = mkIf smtp.tls.enable smtp.tls.certificatesFile; + smtpServer = smtp.host; + smtpUser = userName; + from = address; + } // optionalAttrs (smtp.port != null) { + smtpServerPort = smtp.port; + }); in mapAttrs' genIdentity (filterAttrs hasSmtp config.accounts.email.accounts); } diff --git a/infra/libkookie/home-manager/modules/programs/gpg.nix b/infra/libkookie/home-manager/modules/programs/gpg.nix index 4588c59c8829..1c77d871e532 100644 --- a/infra/libkookie/home-manager/modules/programs/gpg.nix +++ b/infra/libkookie/home-manager/modules/programs/gpg.nix @@ -5,25 +5,30 @@ with lib; let cfg = config.programs.gpg; - cfgText = - concatStringsSep "\n" - (attrValues - (mapAttrs (key: value: - if isString value - then "${key} ${value}" - else optionalString value key) - cfg.settings)); - -in { + mkKeyValue = key: value: + if isString value + then "${key} ${value}" + else optionalString value key; + + cfgText = generators.toKeyValue { + inherit mkKeyValue; + listsAsDuplicateKeys = true; + } cfg.settings; + + primitiveType = types.oneOf [ types.str types.bool ]; +in +{ options.programs.gpg = { enable = mkEnableOption "GnuPG"; settings = mkOption { - type = types.attrsOf (types.either types.str types.bool); - example = { - no-comments = false; - s2k-cipher-algo = "AES128"; - }; + type = types.attrsOf (types.either primitiveType (types.listOf types.str)); + example = literalExample '' + { + no-comments = false; + s2k-cipher-algo = "AES128"; + } + ''; description = '' GnuPG configuration options. Available options are described in the gpg manpage: diff --git a/infra/libkookie/home-manager/modules/programs/kakoune.nix b/infra/libkookie/home-manager/modules/programs/kakoune.nix index 6db311a13767..01b30167da56 100644 --- a/infra/libkookie/home-manager/modules/programs/kakoune.nix +++ b/infra/libkookie/home-manager/modules/programs/kakoune.nix @@ -574,7 +574,7 @@ let hookString = h: concatStringsSep " " [ "hook" - "${optionalString (h.group != null) "-group ${group}"}" + "${optionalString (h.group != null) "-group ${h.group}"}" "${optionalString (h.once) "-once"}" "global" "${h.name}" diff --git a/infra/libkookie/home-manager/modules/programs/neovim.nix b/infra/libkookie/home-manager/modules/programs/neovim.nix index 78f54ed662b4..4390654b2ac4 100644 --- a/infra/libkookie/home-manager/modules/programs/neovim.nix +++ b/infra/libkookie/home-manager/modules/programs/neovim.nix @@ -183,6 +183,8 @@ in { }; ''; description = '' + Deprecated. Please use the other options. + Generate your init file from your list of plugins and custom commands, and loads it from the store via <command>nvim -u /nix/store/hash-vimrc</command> @@ -250,11 +252,14 @@ in { }; in mkIf cfg.enable { - assertions = [{ - assertion = cfg.configure == { } || moduleConfigure == { }; - message = "The programs.neovim option configure is mutually exclusive" - + " with extraConfig and plugins."; - }]; + warnings = optional (cfg.configure != { }) '' + programs.neovim.configure is deprecated. + Other programs.neovim options can override its settings or ignore them. + Please use the other options at your disposal: + configure.packages.*.opt -> programs.neovim.plugins = [ { plugin = ...; optional = true; }] + configure.packages.*.start -> programs.neovim.plugins = [ { plugin = ...; }] + configure.customRC -> programs.neovim.extraConfig + ''; home.packages = [ cfg.finalPackage ]; diff --git a/infra/libkookie/home-manager/modules/programs/offlineimap.nix b/infra/libkookie/home-manager/modules/programs/offlineimap.nix index b6ba847e9b79..177c0ca5e7b2 100644 --- a/infra/libkookie/home-manager/modules/programs/offlineimap.nix +++ b/infra/libkookie/home-manager/modules/programs/offlineimap.nix @@ -158,6 +158,17 @@ in { home.packages = [ pkgs.offlineimap ]; xdg.configFile."offlineimap/get_settings.py".text = cfg.pythonFile; + xdg.configFile."offlineimap/get_settings.pyc".source = "${ + pkgs.runCommandLocal "get_settings-compile" { + nativeBuildInputs = [ pkgs.python2 ]; + pythonFile = cfg.pythonFile; + passAsFile = [ "pythonFile" ]; + } '' + mkdir -p $out/bin + cp $pythonFilePath $out/bin/get_settings.py + python2 -m py_compile $out/bin/get_settings.py + '' + }/bin/get_settings.pyc"; xdg.configFile."offlineimap/config".text = '' # Generated by Home Manager. diff --git a/infra/libkookie/home-manager/modules/programs/qutebrowser.nix b/infra/libkookie/home-manager/modules/programs/qutebrowser.nix index 282861d90f89..9521dc2a4812 100644 --- a/infra/libkookie/home-manager/modules/programs/qutebrowser.nix +++ b/infra/libkookie/home-manager/modules/programs/qutebrowser.nix @@ -51,6 +51,14 @@ in { ''; }; + loadAutoconfig = mkOption { + type = types.bool; + default = false; + description = '' + Load settings configured via the GUI. + ''; + }; + searchEngines = mkOption { type = types.attrsOf types.str; default = { }; @@ -256,7 +264,12 @@ in { home.packages = [ cfg.package ]; xdg.configFile."qutebrowser/config.py".text = concatStringsSep "\n" ([ ] - ++ mapAttrsToList (formatLine "c.") cfg.settings + ++ [ + "${if cfg.loadAutoconfig then + "config.load_autoconfig()" + else + "config.load_autoconfig(False)"}" + ] ++ mapAttrsToList (formatLine "c.") cfg.settings ++ mapAttrsToList (formatDictLine "c.aliases") cfg.aliases ++ mapAttrsToList (formatDictLine "c.url.searchengines") cfg.searchEngines ++ mapAttrsToList (formatDictLine "c.bindings.key_mappings") diff --git a/infra/libkookie/home-manager/modules/programs/starship.nix b/infra/libkookie/home-manager/modules/programs/starship.nix index 99a1fa8e90db..12a0b88fad07 100644 --- a/infra/libkookie/home-manager/modules/programs/starship.nix +++ b/infra/libkookie/home-manager/modules/programs/starship.nix @@ -103,7 +103,7 @@ in { ''; programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' - if [ -z "$INSIDE_EMACS" ]; then + if [[ $TERM != "dumb" && (-z $INSIDE_EMACS || $INSIDE_EMACS == "vterm") ]]; then eval "$(${cfg.package}/bin/starship init zsh)" fi ''; diff --git a/infra/libkookie/home-manager/modules/programs/waybar.nix b/infra/libkookie/home-manager/modules/programs/waybar.nix index 5472a0ef463d..bf63dcc7b420 100644 --- a/infra/libkookie/home-manager/modules/programs/waybar.nix +++ b/infra/libkookie/home-manager/modules/programs/waybar.nix @@ -378,6 +378,7 @@ in { ExecStart = "${cfg.package}/bin/waybar"; Restart = "always"; RestartSec = "1sec"; + KillMode = "mixed"; }; Install = { WantedBy = [ "graphical-session.target" ]; }; diff --git a/infra/libkookie/home-manager/modules/services/gpg-agent.nix b/infra/libkookie/home-manager/modules/services/gpg-agent.nix index 16a4723fea7d..8237c6f7b8f5 100644 --- a/infra/libkookie/home-manager/modules/services/gpg-agent.nix +++ b/infra/libkookie/home-manager/modules/services/gpg-agent.nix @@ -186,6 +186,9 @@ in programs.bash.initExtra = gpgInitStr; programs.zsh.initExtra = gpgInitStr; + programs.fish.interactiveShellInit = '' + set -gx GPG_TTY (tty) + ''; } (mkIf (cfg.sshKeys != null) { diff --git a/infra/libkookie/home-manager/modules/services/polybar.nix b/infra/libkookie/home-manager/modules/services/polybar.nix index 934a990638f9..720f9c6fb5cd 100644 --- a/infra/libkookie/home-manager/modules/services/polybar.nix +++ b/infra/libkookie/home-manager/modules/services/polybar.nix @@ -9,6 +9,36 @@ let eitherStrBoolIntList = with types; either str (either bool (either int (listOf str))); + # Convert a key/val pair to the insane format that polybar uses. + # Each input key/val pair may return several output key/val pairs. + convertPolybarKeyVal = key: val: + # Convert { foo = [ "a" "b" ]; } + # to { + # foo-0 = "a"; + # foo-1 = "b"; + # } + if isList val then + concatLists (imap0 (i: convertPolybarKeyVal "${key}-${toString i}") val) + # Convert { + # foo.text = "a"; + # foo.font = 1; + # } to { + # foo = "a"; + # foo-font = 1; + # } + else if isAttrs val && !lib.isDerivation val then + concatLists (mapAttrsToList + (k: convertPolybarKeyVal (if k == "text" then key else "${key}-${k}")) + val) + # Base case + else + [ (nameValuePair key val) ]; + + convertPolybarSection = _: attrs: + listToAttrs (concatLists (mapAttrsToList convertPolybarKeyVal attrs)); + + # Converts an attrset to INI text, quoting values as expected by polybar. + # This does no more fancy conversion. toPolybarIni = generators.toINI { mkKeyValue = key: value: let @@ -24,8 +54,11 @@ let in "${key}=${value'}"; }; - configFile = pkgs.writeText "polybar.conf" - (toPolybarIni cfg.config + "\n" + cfg.extraConfig); + configFile = pkgs.writeText "polybar.conf" '' + ${toPolybarIni cfg.config} + ${toPolybarIni (mapAttrs convertPolybarSection cfg.settings)} + ${cfg.extraConfig} + ''; in { options = { @@ -54,6 +87,7 @@ in { description = '' Polybar configuration. Can be either path to a file, or set of attributes that will be used to create the final configuration. + See also <option>services.polybar.settings</option> for a more nix-friendly format. ''; default = { }; example = literalExample '' @@ -77,6 +111,56 @@ in { ''; }; + settings = mkOption { + type = types.attrsOf types.attrs; + description = '' + Polybar configuration. This takes a nix attrset and converts it to the + strange data format that polybar uses. + Each entry will be converted to a section in the output file. + Several things are treated specially: nested keys are converted + to dash-separated keys; the special <literal>text</literal> key is ignored as a nested key, + to allow mixing different levels of nesting; and lists are converted to + polybar's <literal>foo-0, foo-1, ...</literal> format. + </para><para> + For example: + <programlisting language="nix"> + "module/volume" = { + type = "internal/pulseaudio"; + format.volume = "<ramp-volume> <label-volume>"; + label.muted.text = "π"; + label.muted.foreground = "#666"; + ramp.volume = ["π" "π" "π"]; + click.right = "pavucontrol &"; + } + </programlisting> + becomes: + <programlisting language="ini"> + [module/volume] + type=internal/pulseaudio + format-volume=<ramp-volume> <label-volume> + label-muted=π + label-muted-foreground=#666 + ramp-volume-0=π + ramp-volume-1=π + ramp-volume-2=π + click-right=pavucontrol & + </programlisting> + ''; + default = { }; + example = literalExample '' + { + "module/volume" = { + type = "internal/pulseaudio"; + format.volume = "<ramp-volume> <label-volume>"; + label.muted.text = "π"; + label.muted.foreground = "#666"; + ramp.volume = ["π" "π" "π"]; + click.right = "pavucontrol &"; + }; + } + ''; + }; + extraConfig = mkOption { type = types.lines; description = "Additional configuration to add."; diff --git a/infra/libkookie/home-manager/modules/services/pulseeffects.nix b/infra/libkookie/home-manager/modules/services/pulseeffects.nix index 445b1c0a1f87..89a7fef81f48 100644 --- a/infra/libkookie/home-manager/modules/services/pulseeffects.nix +++ b/infra/libkookie/home-manager/modules/services/pulseeffects.nix @@ -14,6 +14,14 @@ in { options.services.pulseeffects = { enable = mkEnableOption "Pulseeffects daemon"; + package = mkOption { + type = types.package; + default = pkgs.pulseeffects; + defaultText = literalExample "pkgs.pulseeffects"; + description = "Pulseeffects package to use."; + example = literalExample "pkgs.pulseeffects-pw"; + }; + preset = mkOption { type = types.str; default = ""; @@ -28,7 +36,7 @@ in { # running pulseeffects will just attach itself to gapplication service # at-spi2-core is to minimize journalctl noise of: # "AT-SPI: Error retrieving accessibility bus address: org.freedesktop.DBus.Error.ServiceUnknown: The name org.a11y.Bus was not provided by any .service files" - home.packages = [ pkgs.pulseeffects pkgs.at-spi2-core ]; + home.packages = [ cfg.package pkgs.at-spi2-core ]; # Will need to add `services.dbus.packages = with pkgs; [ gnome3.dconf ];` # to /etc/nixos/configuration.nix for daemon to work correctly @@ -45,8 +53,8 @@ in { Service = { ExecStart = - "${pkgs.pulseeffects}/bin/pulseeffects --gapplication-service ${presetOpts}"; - ExecStop = "${pkgs.pulseeffects}/bin/pulseeffects --quit"; + "${cfg.package}/bin/pulseeffects --gapplication-service ${presetOpts}"; + ExecStop = "${cfg.package}/bin/pulseeffects --quit"; Restart = "on-failure"; RestartSec = 5; }; diff --git a/infra/libkookie/home-manager/modules/services/redshift-gammastep/gammastep.nix b/infra/libkookie/home-manager/modules/services/redshift-gammastep/gammastep.nix index d83836926a0b..0a7f785a2494 100644 --- a/infra/libkookie/home-manager/modules/services/redshift-gammastep/gammastep.nix +++ b/infra/libkookie/home-manager/modules/services/redshift-gammastep/gammastep.nix @@ -19,7 +19,7 @@ let }; in { - meta = commonOptions.meta; + inherit (commonOptions) imports meta; options.services.gammastep = commonOptions.options; config = mkIf config.services.gammastep.enable commonOptions.config; } diff --git a/infra/libkookie/home-manager/modules/services/redshift-gammastep/redshift.nix b/infra/libkookie/home-manager/modules/services/redshift-gammastep/redshift.nix index d65227ca13de..ffccb35cec6b 100644 --- a/infra/libkookie/home-manager/modules/services/redshift-gammastep/redshift.nix +++ b/infra/libkookie/home-manager/modules/services/redshift-gammastep/redshift.nix @@ -18,7 +18,7 @@ let }; in { - meta = commonOptions.meta; + inherit (commonOptions) imports meta; options.services.redshift = commonOptions.options; config = mkIf config.services.redshift.enable commonOptions.config; } diff --git a/infra/libkookie/home-manager/modules/targets/darwin/default.nix b/infra/libkookie/home-manager/modules/targets/darwin/default.nix index 961c8667e2a8..b971e18d2179 100644 --- a/infra/libkookie/home-manager/modules/targets/darwin/default.nix +++ b/infra/libkookie/home-manager/modules/targets/darwin/default.nix @@ -19,7 +19,7 @@ let writableDefaults = filterAttrs (domain: attrs: attrs != { }) nonNullDefaults; activationCmds = mapAttrsToList toActivationCmd writableDefaults; in { - imports = [ ./keybindings.nix ./linkapps.nix ./search.nix ]; + imports = [ ./fonts.nix ./keybindings.nix ./linkapps.nix ./search.nix ]; options.targets.darwin.defaults = mkOption { type = types.submodule ./options.nix; diff --git a/infra/libkookie/home-manager/modules/targets/darwin/fonts.nix b/infra/libkookie/home-manager/modules/targets/darwin/fonts.nix new file mode 100644 index 000000000000..bc4042a8d739 --- /dev/null +++ b/infra/libkookie/home-manager/modules/targets/darwin/fonts.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + homeDir = config.home.homeDirectory; + fontsEnv = pkgs.buildEnv { + name = "home-manager-fonts"; + paths = config.home.packages; + pathsToLink = "/share/fonts"; + }; + fonts = "${fontsEnv}/share/fonts"; +in { + # macOS won't recognize symlinked fonts + config.home.activation.copyFonts = hm.dag.entryAfter [ "writeBoundary" ] '' + copyFonts() { + rm -rf ${homeDir}/Library/Fonts/HomeManager || : + + local f + find -L "${fonts}" -type f -printf '%P\0' | while IFS= read -rd "" f; do + $DRY_RUN_CMD install $VERBOSE_ARG -Dm644 -T \ + "${fonts}/$f" "${homeDir}/Library/Fonts/HomeManager/$f" + done + } + copyFonts + ''; +} diff --git a/infra/libkookie/home-manager/modules/targets/generic-linux.nix b/infra/libkookie/home-manager/modules/targets/generic-linux.nix index cf6b2bd87a94..a6486d7343bc 100644 --- a/infra/libkookie/home-manager/modules/targets/generic-linux.nix +++ b/infra/libkookie/home-manager/modules/targets/generic-linux.nix @@ -32,10 +32,27 @@ in { dataDirs = concatStringsSep ":" (map (profile: "${profile}/share") profiles ++ config.targets.genericLinux.extraXdgDataDirs); - in { XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"; }; + + # https://github.com/archlinux/svntogit-packages/blob/packages/ncurses/trunk/PKGBUILD + # https://salsa.debian.org/debian/ncurses/-/blob/master/debian/rules + # https://src.fedoraproject.org/rpms/ncurses/blob/main/f/ncurses.spec + # https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/ncurses/ncurses-6.2-r1.ebuild + distroTerminfoDirs = concatStringsSep ":" [ + "/etc/terminfo" # debian, fedora, gentoo + "/lib/terminfo" # debian + "/usr/share/terminfo" # package default, all distros + ]; + in { + XDG_DATA_DIRS = "${dataDirs}\${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"; + TERMINFO_DIRS = + "${profileDirectory}/share/terminfo:$TERMINFO_DIRS\${TERMINFO_DIRS:+:}${distroTerminfoDirs}"; + }; home.sessionVariablesExtra = '' . "${pkgs.nix}/etc/profile.d/nix.sh" + + # reset TERM with new TERMINFO available (if any) + export TERM="$TERM" ''; # We need to source both nix.sh and hm-session-vars.sh as noted in diff --git a/infra/libkookie/home-manager/nix-darwin/default.nix b/infra/libkookie/home-manager/nix-darwin/default.nix index 956695926007..83e0ba3142bd 100644 --- a/infra/libkookie/home-manager/nix-darwin/default.nix +++ b/infra/libkookie/home-manager/nix-darwin/default.nix @@ -9,7 +9,10 @@ let extendedLib = import ../modules/lib/stdlib-extended.nix pkgs.lib; hmModule = types.submoduleWith { - specialArgs = { lib = extendedLib; }; + specialArgs = { + lib = extendedLib; + darwinConfig = config; + } // cfg.extraSpecialArgs; modules = [ ({ name, ... }: { imports = import ../modules/modules.nix { @@ -26,7 +29,7 @@ let home.homeDirectory = config.users.users.${name}.home; }; }) - ]; + ] ++ cfg.sharedModules; }; in @@ -55,6 +58,24 @@ in ''; }; + extraSpecialArgs = mkOption { + type = types.attrs; + default = { }; + example = literalExample "{ modulesPath = ../modules; }"; + description = '' + Extra <literal>specialArgs</literal> passed to Home Manager. + ''; + }; + + sharedModules = mkOption { + type = with types; listOf (oneOf [ attrs (functionTo attrs) path ]); + default = [ ]; + example = literalExample "[ { home.packages = [ nixpkgs-fmt ]; } ]"; + description = '' + Extra modules added to all users. + ''; + }; + verbose = mkEnableOption "verbose output on activation"; users = mkOption { diff --git a/infra/libkookie/home-manager/nixos/default.nix b/infra/libkookie/home-manager/nixos/default.nix index 6645b9068c0a..4b58d154cd43 100644 --- a/infra/libkookie/home-manager/nixos/default.nix +++ b/infra/libkookie/home-manager/nixos/default.nix @@ -12,7 +12,7 @@ let specialArgs = { lib = extendedLib; nixosConfig = config; - }; + } // cfg.extraSpecialArgs; modules = [ ({ name, ... }: { imports = import ../modules/modules.nix { @@ -34,7 +34,7 @@ let home.homeDirectory = config.users.users.${name}.home; }; }) - ]; + ] ++ cfg.sharedModules; }; serviceEnvironment = optionalAttrs (cfg.backupFileExtension != null) { @@ -65,6 +65,24 @@ in { ''; }; + extraSpecialArgs = mkOption { + type = types.attrs; + default = { }; + example = literalExample "{ modulesPath = ../modules; }"; + description = '' + Extra <literal>specialArgs</literal> passed to Home Manager. + ''; + }; + + sharedModules = mkOption { + type = with types; listOf (oneOf [ attrs (functionTo attrs) path ]); + default = [ ]; + example = literalExample "[ { home.packages = [ nixpkgs-fmt ]; } ]"; + description = '' + Extra modules added to all users. + ''; + }; + verbose = mkEnableOption "verbose output on activation"; users = mkOption { diff --git a/infra/libkookie/home-manager/tests/default.nix b/infra/libkookie/home-manager/tests/default.nix index ba5de77f29c1..50bd590ffdaf 100644 --- a/infra/libkookie/home-manager/tests/default.nix +++ b/infra/libkookie/home-manager/tests/default.nix @@ -84,6 +84,7 @@ import nmt { ./modules/misc/debug ./modules/misc/numlock ./modules/misc/pam + ./modules/misc/qt ./modules/misc/xdg ./modules/misc/xsession ./modules/programs/abook diff --git a/infra/libkookie/home-manager/tests/modules/misc/qt/default.nix b/infra/libkookie/home-manager/tests/modules/misc/qt/default.nix new file mode 100644 index 000000000000..c676b784e550 --- /dev/null +++ b/infra/libkookie/home-manager/tests/modules/misc/qt/default.nix @@ -0,0 +1,4 @@ +{ + qt-platform-theme-gtk = ./qt-platform-theme-gtk.nix; + qt-platform-theme-gnome = ./qt-platform-theme-gnome.nix; +} diff --git a/infra/libkookie/home-manager/tests/modules/misc/qt/qt-platform-theme-gnome.nix b/infra/libkookie/home-manager/tests/modules/misc/qt/qt-platform-theme-gnome.nix new file mode 100644 index 000000000000..e9aa1a250632 --- /dev/null +++ b/infra/libkookie/home-manager/tests/modules/misc/qt/qt-platform-theme-gnome.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +{ + config = { + qt = { + enable = true; + platformTheme = "gnome"; + style = { + name = "adwaita"; + package = pkgs.dummyTheme; + }; + }; + + nixpkgs.overlays = [ + (self: super: { + dummyTheme = pkgs.runCommandLocal "theme" { } "mkdir $out"; + }) + ]; + + nmt.script = '' + assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ + 'QT_QPA_PLATFORMTHEME="gnome"' + assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ + 'QT_STYLE_OVERRIDE="adwaita"' + ''; + }; +} diff --git a/infra/libkookie/home-manager/tests/modules/misc/qt/qt-platform-theme-gtk.nix b/infra/libkookie/home-manager/tests/modules/misc/qt/qt-platform-theme-gtk.nix new file mode 100644 index 000000000000..d332465283ad --- /dev/null +++ b/infra/libkookie/home-manager/tests/modules/misc/qt/qt-platform-theme-gtk.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: + +{ + config = { + qt = { + enable = true; + platformTheme = "gtk"; + }; + + nmt.script = '' + assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ + 'QT_QPA_PLATFORMTHEME="gtk2"' + ''; + }; +} diff --git a/infra/libkookie/home-manager/tests/modules/programs/getmail/getmail-expected.conf b/infra/libkookie/home-manager/tests/modules/programs/getmail/getmail-expected.conf index 90dc963e5742..a91522a5deb6 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/getmail/getmail-expected.conf +++ b/infra/libkookie/home-manager/tests/modules/programs/getmail/getmail-expected.conf @@ -5,7 +5,7 @@ server = imap.example.com port = 993 username = home.manager password_command = ('password-command') -mailboxes = ( 'INBOX', 'Sent', 'Work' ) +mailboxes = ( 'INBOX', 'Sent', 'Work', ) [destination] type = MDA_external diff --git a/infra/libkookie/home-manager/tests/modules/programs/gh/config-file.nix b/infra/libkookie/home-manager/tests/modules/programs/gh/config-file.nix index 8d8f95fdd7f8..71fd74d32e73 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/gh/config-file.nix +++ b/infra/libkookie/home-manager/tests/modules/programs/gh/config-file.nix @@ -15,7 +15,7 @@ assertFileExists home-files/.config/gh/config.yml assertFileContent home-files/.config/gh/config.yml ${ builtins.toFile "config-file.yml" '' - {"aliases":{"co":"pr checkout"},"editor":"vim","gitProtocol":"https"}'' + {"aliases":{"co":"pr checkout"},"editor":"vim","git_protocol":"https"}'' } ''; }; diff --git a/infra/libkookie/home-manager/tests/modules/programs/git/default.nix b/infra/libkookie/home-manager/tests/modules/programs/git/default.nix index 45aface8d268..d5a6b4ee16ab 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/git/default.nix +++ b/infra/libkookie/home-manager/tests/modules/programs/git/default.nix @@ -1,5 +1,6 @@ { git-with-email = ./git-with-email.nix; git-with-most-options = ./git.nix; + git-with-msmtp = ./git-with-msmtp.nix; git-with-str-extra-config = ./git-with-str-extra-config.nix; } diff --git a/infra/libkookie/home-manager/tests/modules/programs/git/git-with-email-expected.conf b/infra/libkookie/home-manager/tests/modules/programs/git/git-with-email-expected.conf index f48b7c33334d..c34ab1d79e32 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/git/git-with-email-expected.conf +++ b/infra/libkookie/home-manager/tests/modules/programs/git/git-with-email-expected.conf @@ -2,12 +2,14 @@ from = "hm@example.org" smtpEncryption = "tls" smtpServer = "smtp.example.org" + smtpSslCertPath = "/etc/test/certificates.crt" smtpUser = "home.manager.jr" [sendemail "hm@example.com"] from = "hm@example.com" smtpEncryption = "ssl" smtpServer = "smtp.example.com" + smtpSslCertPath = "/etc/ssl/certs/ca-certificates.crt" smtpUser = "home.manager" [user] diff --git a/infra/libkookie/home-manager/tests/modules/programs/git/git-with-email.nix b/infra/libkookie/home-manager/tests/modules/programs/git/git-with-email.nix index 49089a97a0c1..ec18ecb92e04 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/git/git-with-email.nix +++ b/infra/libkookie/home-manager/tests/modules/programs/git/git-with-email.nix @@ -6,6 +6,8 @@ with lib; imports = [ ../../accounts/email-test-accounts.nix ]; config = { + accounts.email.accounts.hm-account.smtp.tls.certificatesFile = + "/etc/test/certificates.crt"; programs.git = { enable = true; package = pkgs.gitMinimal; diff --git a/infra/libkookie/home-manager/tests/modules/programs/git/git-with-msmtp-expected.conf b/infra/libkookie/home-manager/tests/modules/programs/git/git-with-msmtp-expected.conf new file mode 100644 index 000000000000..1f2c7b794b97 --- /dev/null +++ b/infra/libkookie/home-manager/tests/modules/programs/git/git-with-msmtp-expected.conf @@ -0,0 +1,15 @@ +[sendemail "hm-account"] + from = "hm@example.org" + smtpEncryption = "tls" + smtpServer = "smtp.example.org" + smtpSslCertPath = "/etc/ssl/certs/ca-certificates.crt" + smtpUser = "home.manager.jr" + +[sendemail "hm@example.com"] + envelopeSender = "auto" + from = "hm@example.com" + smtpServer = "@msmtp@/bin/msmtp" + +[user] + email = "hm@example.com" + name = "H. M. Test" diff --git a/infra/libkookie/home-manager/tests/modules/programs/git/git-with-msmtp.nix b/infra/libkookie/home-manager/tests/modules/programs/git/git-with-msmtp.nix new file mode 100644 index 000000000000..abe32af8ecb3 --- /dev/null +++ b/infra/libkookie/home-manager/tests/modules/programs/git/git-with-msmtp.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + config = { + accounts.email.accounts."hm@example.com".msmtp.enable = true; + programs.git = { + enable = true; + package = pkgs.gitMinimal; + userEmail = "hm@example.com"; + userName = "H. M. Test"; + }; + + home.stateVersion = "20.09"; + + nmt.script = '' + function assertGitConfig() { + local value + value=$(${pkgs.gitMinimal}/bin/git config \ + --file $TESTED/home-files/.config/git/config \ + --get $1) + if [[ $value != $2 ]]; then + fail "Expected option '$1' to have value '$2' but it was '$value'" + fi + } + + assertFileExists home-files/.config/git/config + assertFileContent home-files/.config/git/config \ + ${ + pkgs.substituteAll { + inherit (pkgs) msmtp; + src = ./git-with-msmtp-expected.conf; + } + } + + assertGitConfig "sendemail.hm@example.com.from" "hm@example.com" + assertGitConfig "sendemail.hm-account.from" "hm@example.org" + assertGitConfig "sendemail.hm@example.com.smtpServer" "${pkgs.msmtp}/bin/msmtp" + assertGitConfig "sendemail.hm@example.com.envelopeSender" "auto" + ''; + }; +} diff --git a/infra/libkookie/home-manager/tests/modules/programs/gpg/override-defaults-expected.conf b/infra/libkookie/home-manager/tests/modules/programs/gpg/override-defaults-expected.conf index 3198183f7234..4b4f132d0024 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/gpg/override-defaults-expected.conf +++ b/infra/libkookie/home-manager/tests/modules/programs/gpg/override-defaults-expected.conf @@ -14,6 +14,8 @@ require-cross-certification s2k-cipher-algo AES128 s2k-digest-algo SHA512 throw-keyids +trusted-key 0xXXXXXXXXXXXXX +trusted-key 0xYYYYYYYYYYYYY use-agent verify-options show-uid-validity -with-fingerprint
\ No newline at end of file +with-fingerprint diff --git a/infra/libkookie/home-manager/tests/modules/programs/gpg/override-defaults.nix b/infra/libkookie/home-manager/tests/modules/programs/gpg/override-defaults.nix index 850334dc589e..905b984c5254 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/gpg/override-defaults.nix +++ b/infra/libkookie/home-manager/tests/modules/programs/gpg/override-defaults.nix @@ -11,6 +11,10 @@ with lib; no-comments = false; s2k-cipher-algo = "AES128"; throw-keyids = true; + trusted-key = [ + "0xXXXXXXXXXXXXX" + "0xYYYYYYYYYYYYY" + ]; }; }; diff --git a/infra/libkookie/home-manager/tests/modules/programs/qutebrowser/keybindings.nix b/infra/libkookie/home-manager/tests/modules/programs/qutebrowser/keybindings.nix index e89e44b46d90..917bf9baa24b 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/qutebrowser/keybindings.nix +++ b/infra/libkookie/home-manager/tests/modules/programs/qutebrowser/keybindings.nix @@ -29,6 +29,7 @@ with lib; home-files/.config/qutebrowser/config.py \ ${ 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") diff --git a/infra/libkookie/home-manager/tests/modules/programs/qutebrowser/settings.nix b/infra/libkookie/home-manager/tests/modules/programs/qutebrowser/settings.nix index 1f0f5db049b1..0eda01710902 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/qutebrowser/settings.nix +++ b/infra/libkookie/home-manager/tests/modules/programs/qutebrowser/settings.nix @@ -35,6 +35,7 @@ with lib; home-files/.config/qutebrowser/config.py \ ${ 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" diff --git a/infra/libkookie/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.service b/infra/libkookie/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.service index 64c89f93d755..9bdcf78c42a6 100644 --- a/infra/libkookie/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.service +++ b/infra/libkookie/home-manager/tests/modules/programs/waybar/systemd-with-graphical-session-target.service @@ -4,6 +4,7 @@ WantedBy=graphical-session.target [Service] BusName=fr.arouillard.waybar ExecStart=@waybar@/bin/waybar +KillMode=mixed Restart=always RestartSec=1sec Type=dbus diff --git a/infra/libkookie/home-manager/tests/modules/services/polybar/basic-configuration.conf b/infra/libkookie/home-manager/tests/modules/services/polybar/basic-configuration.conf index 54448a705fcc..10ea0f076ea0 100644 --- a/infra/libkookie/home-manager/tests/modules/services/polybar/basic-configuration.conf +++ b/infra/libkookie/home-manager/tests/modules/services/polybar/basic-configuration.conf @@ -12,6 +12,16 @@ label=%time% %date% time=%H:%M type=internal/date +[module/volume] +click-right=pavucontrol & +format-volume=<ramp-volume> <label-volume> +label-muted=π +label-muted-foreground=#666 +ramp-volume-0=π +ramp-volume-1=π +ramp-volume-2=π +type=internal/pulseaudio + [module/date] type = internal/date interval = 5 @@ -19,3 +29,4 @@ date = "%d.%m.%y" time = %H:%M format-prefix-foreground = ${colors.foreground-alt} label = %time% %date% + diff --git a/infra/libkookie/home-manager/tests/modules/services/polybar/basic-configuration.nix b/infra/libkookie/home-manager/tests/modules/services/polybar/basic-configuration.nix index a8886dab6d5c..fd23256c3de8 100644 --- a/infra/libkookie/home-manager/tests/modules/services/polybar/basic-configuration.nix +++ b/infra/libkookie/home-manager/tests/modules/services/polybar/basic-configuration.nix @@ -22,6 +22,16 @@ label = "%time% %date%"; }; }; + settings = { + "module/volume" = { + type = "internal/pulseaudio"; + format.volume = "<ramp-volume> <label-volume>"; + label.muted.text = "π"; + label.muted.foreground = "#666"; + ramp.volume = [ "π" "π" "π" ]; + click.right = "pavucontrol &"; + }; + }; extraConfig = '' [module/date] type = internal/date diff --git a/infra/libkookie/home-manager/tests/modules/targets-linux/generic-linux.nix b/infra/libkookie/home-manager/tests/modules/targets-linux/generic-linux.nix index 10481b5e9887..530137cfbe75 100644 --- a/infra/libkookie/home-manager/tests/modules/targets-linux/generic-linux.nix +++ b/infra/libkookie/home-manager/tests/modules/targets-linux/generic-linux.nix @@ -11,12 +11,20 @@ with lib; nmt.script = '' assertFileExists home-path/etc/profile.d/hm-session-vars.sh + assertFileContains \ home-path/etc/profile.d/hm-session-vars.sh \ 'export XDG_DATA_DIRS="''${NIX_STATE_DIR:-/nix/var/nix}/profiles/default/share:/home/hm-user/.nix-profile/share:/foo''${XDG_DATA_DIRS:+:}$XDG_DATA_DIRS"' assertFileContains \ home-path/etc/profile.d/hm-session-vars.sh \ '. "${pkgs.nix}/etc/profile.d/nix.sh"' + + assertFileContains \ + home-path/etc/profile.d/hm-session-vars.sh \ + 'export TERMINFO_DIRS="/home/hm-user/.nix-profile/share/terminfo:$TERMINFO_DIRS''${TERMINFO_DIRS:+:}/etc/terminfo:/lib/terminfo:/usr/share/terminfo"' + assertFileContains \ + home-path/etc/profile.d/hm-session-vars.sh \ + 'export TERM="$TERM"' ''; }; } |