From 5ad12b6ea06b84e48f6b677957c74f32d47bdee0 Mon Sep 17 00:00:00 2001 From: home-manager-bot <106474382+home-manager-bot@users.noreply.github.com> Date: Sun, 5 Jan 2025 09:41:24 +0100 Subject: [PATCH 01/16] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/88195a94f390381c6afcdaa933c2f6ff93959cb4?narHash=sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs%3D' (2024-12-29) → 'github:NixOS/nixpkgs/6df24922a1400241dae323af55f30e4318a6ca65?narHash=sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk%3D' (2025-01-02) Co-authored-by: github-actions[bot] --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 119d99ff..7672c219 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1735471104, - "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", + "lastModified": 1735834308, + "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "rev": "6df24922a1400241dae323af55f30e4318a6ca65", "type": "github" }, "original": { From 4795ebe6cc6e5f60a3e66e3627b4f182ac4771b5 Mon Sep 17 00:00:00 2001 From: Dorian Burgun Date: Sun, 5 Jan 2025 16:00:50 +0100 Subject: [PATCH 02/16] Translate using Weblate (French) Currently translated at 100.0% (16 of 16 strings) Translate using Weblate (French) Currently translated at 100.0% (37 of 37 strings) Co-authored-by: Dorian Burgun Translate-URL: https://hosted.weblate.org/projects/home-manager/cli/fr/ Translate-URL: https://hosted.weblate.org/projects/home-manager/modules/fr/ Translation: Home Manager/Home Manager CLI Translation: Home Manager/Home Manager Modules --- home-manager/po/fr.po | 8 ++++---- modules/po/fr.po | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/home-manager/po/fr.po b/home-manager/po/fr.po index 9063df4e..af18581d 100644 --- a/home-manager/po/fr.po +++ b/home-manager/po/fr.po @@ -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: 2025-01-03 09:09+0100\n" -"PO-Revision-Date: 2024-04-29 18:07+0000\n" -"Last-Translator: Michael Thomas \n" +"PO-Revision-Date: 2025-01-05 15:00+0000\n" +"Last-Translator: Dorian Burgun \n" "Language-Team: French \n" "Language: fr\n" @@ -17,12 +17,12 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 5.5.2\n" +"X-Generator: Weblate 5.10-dev\n" #. translators: For example: "home-manager: missing argument for --cores" #: home-manager/home-manager:16 msgid "%s: missing argument for %s" -msgstr "%s : argument manquant pour %s" +msgstr "%s: argument manquant pour %s" #: home-manager/home-manager:69 msgid "No configuration file found at %s" diff --git a/modules/po/fr.po b/modules/po/fr.po index c95deeb0..f50a211f 100644 --- a/modules/po/fr.po +++ b/modules/po/fr.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: Home Manager Modules\n" "Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" "POT-Creation-Date: 2025-01-03 09:09+0100\n" -"PO-Revision-Date: 2023-07-15 14:49+0000\n" -"Last-Translator: swaps \n" +"PO-Revision-Date: 2025-01-05 15:00+0000\n" +"Last-Translator: Dorian Burgun \n" "Language-Team: French \n" "Language: fr\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" -"X-Generator: Weblate 5.0-dev\n" +"X-Generator: Weblate 5.10-dev\n" #: modules/files.nix:188 msgid "Creating home file links in %s" @@ -29,11 +29,11 @@ msgstr "Nettoyage des liens orphelins de %s" #: modules/home-environment.nix:591 msgid "Creating new profile generation" -msgstr "" +msgstr "Création d'une nouvelle génération de profil" #: modules/home-environment.nix:594 msgid "No change so reusing latest profile generation" -msgstr "" +msgstr "Aucun changement, donc réutilisation du dernier profil généré" #: modules/home-environment.nix:643 msgid "" From 172b91bfb2b7f5c4a8c6ceac29fd53a01ef07196 Mon Sep 17 00:00:00 2001 From: programmerlexi Date: Sun, 5 Jan 2025 16:00:50 +0100 Subject: [PATCH 03/16] Translate using Weblate (German) Currently translated at 100.0% (16 of 16 strings) Co-authored-by: programmerlexi Translate-URL: https://hosted.weblate.org/projects/home-manager/modules/de/ Translation: Home Manager/Home Manager Modules --- modules/po/de.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/po/de.po b/modules/po/de.po index d7aa42ed..18089f23 100644 --- a/modules/po/de.po +++ b/modules/po/de.po @@ -8,8 +8,8 @@ msgstr "" "Project-Id-Version: Home Manager Modules\n" "Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" "POT-Creation-Date: 2025-01-03 09:09+0100\n" -"PO-Revision-Date: 2024-10-15 21:37+0000\n" -"Last-Translator: Viktor Illmer \n" +"PO-Revision-Date: 2025-01-05 15:00+0000\n" +"Last-Translator: programmerlexi \n" "Language-Team: German \n" "Language: de\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.8-rc\n" +"X-Generator: Weblate 5.10-dev\n" #: modules/files.nix:188 msgid "Creating home file links in %s" @@ -29,11 +29,11 @@ msgstr "Bereinige verwaiste Links unter %s" #: modules/home-environment.nix:591 msgid "Creating new profile generation" -msgstr "" +msgstr "Erstelle neue Profilgeneration" #: modules/home-environment.nix:594 msgid "No change so reusing latest profile generation" -msgstr "" +msgstr "Keine Änderung, verwende letzte Profilgeneration" #: modules/home-environment.nix:643 msgid "" @@ -80,11 +80,11 @@ msgstr "" #: modules/lib-bash/activation-init.sh:106 msgid "Error: USER is set to \"%s\" but we expect \"%s\"" -msgstr "Fehler: USER ist auf \"%s\" gesetzt, aber wir erwarten \"%s\"" +msgstr "Fehler: USER ist auf \"%s\" gesetzt, aber es wird \"%s\" erwartet" #: modules/lib-bash/activation-init.sh:115 msgid "Error: HOME is set to \"%s\" but we expect \"%s\"" -msgstr "Fehler: HOME ist auf \"%s\" gesetzt, aber wir erwarten \"%s\"" +msgstr "Fehler: HOME ist auf \"%s\" gesetzt, aber es wird \"%s\" erwartet" #: modules/lib-bash/activation-init.sh:132 msgid "Starting Home Manager activation" From 20665c6efa83d71020c8730f26706258ba5c6b2a Mon Sep 17 00:00:00 2001 From: Carl Dong Date: Mon, 6 Jan 2025 18:01:32 -0500 Subject: [PATCH 04/16] home-manager: remove path: URI type for flake default This reverts commit 536b3fb883ddb6aa75756755f61b76806fe71009. --- home-manager/home-manager | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home-manager/home-manager b/home-manager/home-manager index c9186a6e..e64bb884 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -191,7 +191,7 @@ function setFlakeAttribute() { fi if [[ -v configFlake ]]; then - FLAKE_ARG="path:$(dirname "$(readlink -f "$configFlake")")" + FLAKE_ARG="$(dirname "$(readlink -f "$configFlake")")" fi fi From 5c4302313d9207f7ec0886d68f8ff4a3c71209a1 Mon Sep 17 00:00:00 2001 From: Batuhan Baserdem <19315586+bbaserdem@users.noreply.github.com> Date: Tue, 7 Jan 2025 14:16:55 -0500 Subject: [PATCH 05/16] neomutt: added missing sort options (#6283) * neovim: add valid sort options Neomutt added a new prefix for sort options in 2022. Added the new possible prefixes to the neomutt module. --- modules/programs/neomutt.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/programs/neomutt.nix b/modules/programs/neomutt.nix index 15cda630..b513939d 100644 --- a/modules/programs/neomutt.nix +++ b/modules/programs/neomutt.nix @@ -372,7 +372,12 @@ in { sort = mkOption { # allow users to choose any option from sortOptions, or any option prefixed with "reverse-" type = types.enum - (sortOptions ++ (map (option: "reverse-" + option) sortOptions)); + (builtins.concatMap (_pre: map (_opt: _pre + _opt) sortOptions) [ + "" + "reverse-" + "last-" + "reverse-last-" + ]); default = "threads"; description = "Sorting method on messages."; }; From 45bcdbc910dc5131943bb6f7edb156617898fd1a Mon Sep 17 00:00:00 2001 From: DDoSolitary Date: Wed, 8 Jan 2025 19:37:59 +0800 Subject: [PATCH 06/16] gpg-agent: fix compatibility with sh when enableSshSupport (#6287) Co-authored-by: sunqiancheng --- modules/services/gpg-agent.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/gpg-agent.nix b/modules/services/gpg-agent.nix index 6bb19abe..edb87a9d 100644 --- a/modules/services/gpg-agent.nix +++ b/modules/services/gpg-agent.nix @@ -282,7 +282,7 @@ in { ++ [ cfg.extraConfig ]); home.sessionVariablesExtra = optionalString cfg.enableSshSupport '' - if [[ -z "$SSH_AUTH_SOCK" ]]; then + if [ -z "$SSH_AUTH_SOCK" ]; then export SSH_AUTH_SOCK="$(${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)" fi ''; From 456e599f9101ed153dde268b4401c5d294ba6c8c Mon Sep 17 00:00:00 2001 From: 1444 <54070204+0x5a4@users.noreply.github.com> Date: Wed, 8 Jan 2025 16:18:57 +0100 Subject: [PATCH 07/16] wayfire: add module (#6066) Adds a Module for the Wayfire Compositor. Also allows managing the wf-shell configuration. --- modules/misc/news.nix | 15 +- modules/modules.nix | 1 + modules/services/window-managers/wayfire.nix | 200 ++++++++++++++++++ tests/default.nix | 1 + .../window-managers/wayfire/configuration.ini | 10 + .../window-managers/wayfire/configuration.nix | 22 ++ .../window-managers/wayfire/default.nix | 4 + .../window-managers/wayfire/wf-shell.ini | 3 + .../window-managers/wayfire/wf-shell.nix | 25 +++ 9 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 modules/services/window-managers/wayfire.nix create mode 100644 tests/modules/services/window-managers/wayfire/configuration.ini create mode 100644 tests/modules/services/window-managers/wayfire/configuration.nix create mode 100644 tests/modules/services/window-managers/wayfire/default.nix create mode 100644 tests/modules/services/window-managers/wayfire/wf-shell.ini create mode 100644 tests/modules/services/window-managers/wayfire/wf-shell.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 699398de..7a3604be 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1861,7 +1861,6 @@ in { Some plugins require this to be set to 'false' to function correctly. ''; } - { time = "2024-12-08T17:22:13+00:00"; condition = let @@ -1947,6 +1946,20 @@ in { speed, features, or native UIs. Ghostty provides all three. ''; } + { + time = "2025-01-04T15:00:00+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'wayland.windowManager.wayfire'. + + Wayfire is a 3D Wayland compositor, inspired by Compiz and based on + wlroots. It aims to create a customizable, extendable and lightweight + environment without sacrificing its appearance. + + This Home Manager module allows you to configure both wayfire itself, + as well as wf-shell. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 3c422eb5..2aae09eb 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -405,6 +405,7 @@ let ./services/window-managers/i3-sway/swaynag.nix ./services/window-managers/river.nix ./services/window-managers/spectrwm.nix + ./services/window-managers/wayfire.nix ./services/window-managers/xmonad.nix ./services/wlsunset.nix ./services/wob.nix diff --git a/modules/services/window-managers/wayfire.nix b/modules/services/window-managers/wayfire.nix new file mode 100644 index 00000000..c551eb05 --- /dev/null +++ b/modules/services/window-managers/wayfire.nix @@ -0,0 +1,200 @@ +{ lib, pkgs, config, ... }: { + meta.maintainers = [ lib.maintainers._0x5a4 ]; + + options.wayland.windowManager.wayfire = let + types = lib.types; + + configIniType = with types; + let + primitiveType = either str (either bool number); + sectionType = attrsOf primitiveType; + in attrsOf sectionType; + in { + enable = + lib.mkEnableOption "Wayfire, a wayland compositor based on wlroots"; + + package = lib.mkPackageOption pkgs "wayfire" { + nullable = true; + extraDescription = '' + Set to `null` to not add any wayfire package to your path. + This should be done if you want to use the NixOS wayfire module to install wayfire. + ''; + }; + + plugins = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = with pkgs.wayfirePlugins; [ wf-shell ]; + defaultText = + lib.literalExpression "with pkgs.wayfirePlugins; [ wf-shell ]"; + example = lib.literalExpression '' + with pkgs.wayfirePlugins; [ + wcm + wf-shell + wayfire-plugins-extra + ]; + ''; + description = '' + Additional plugins to use with wayfire + ''; + }; + + xwayland.enable = lib.mkEnableOption "XWayland" // { default = true; }; + + settings = lib.mkOption { + type = types.submodule { + freeformType = configIniType; + + options.core.plugins = lib.mkOption { + type = types.separatedString " "; + description = "Load the specified plugins"; + }; + }; + default = { }; + description = '' + Wayfire configuration written in Nix. + + See + ''; + example = lib.literalExpression '' + { + core.plugins = "command expo cube"; + command = { + binding_terminal = "alacritty"; + command_terminal = "alacritty"; + }; + } + ''; + }; + + wf-shell = { + enable = lib.mkEnableOption "Manage wf-shell Configuration"; + + package = lib.mkPackageOption pkgs.wayfirePlugins "wf-shell" { }; + + settings = lib.mkOption { + type = configIniType; + default = { }; + description = '' + Wf-shell configuration written in Nix. + + See + ''; + example = lib.literalExpression '' + { + panel = { + widgets_left = "menu spacing4 launchers window-list"; + autohide = true; + }; + } + ''; + }; + }; + + systemd = { + enable = lib.mkEnableOption null // { + default = true; + description = '' + Whether to enable {file}`wayfire-session.target` on + wayfire startup. This links to {file}`graphical-session.target`}. + Some important environment variables will be imported to systemd + and D-Bus user environment before reaching the target, including + - `DISPLAY` + - `WAYLAND_DISPLAY` + - `XDG_CURRENT_DESKTOP` + - `NIXOS_OZONE_WL` + - `XCURSOR_THEME` + - `XCURSOR_SIZE` + ''; + }; + + variables = lib.mkOption { + type = types.listOf types.str; + default = [ + "DISPLAY" + "WAYLAND_DISPLAY" + "XDG_CURRENT_DESKTOP" + "NIXOS_OZONE_WL" + "XCURSOR_THEME" + "XCURSOR_SIZE" + ]; + example = [ "-all" ]; + description = '' + Environment variables to be imported in the systemd & D-Bus user + environment. + ''; + }; + + extraCommands = lib.mkOption { + type = types.listOf types.str; + default = [ + "systemctl --user stop wayfire-session.target" + "systemctl --user start wayfire-session.target" + ]; + description = "Extra commands to be run after D-Bus activation."; + }; + }; + }; + + config = let + cfg = config.wayland.windowManager.wayfire; + + variables = builtins.concatStringsSep " " cfg.systemd.variables; + extraCommands = builtins.concatStringsSep " " + (map (f: "&& ${f}") cfg.systemd.extraCommands); + systemdActivation = + "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd ${variables} ${extraCommands}"; + + finalPackage = pkgs.wayfire-with-plugins.override { + wayfire = cfg.package; + plugins = cfg.plugins; + }; + in lib.mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "wayland.windowManager.wayfire" pkgs + lib.platforms.linux) + ]; + + home.packages = lib.mkIf (cfg.package != null) (lib.concatLists [ + (lib.singleton finalPackage) + (lib.optional (cfg.xwayland.enable) pkgs.xwayland) + ]); + + wayland.windowManager.wayfire = { + settings = { + autostart = lib.mkIf cfg.systemd.enable { inherit systemdActivation; }; + core = { + plugins = lib.concatStringsSep " " (lib.concatLists [ + (lib.optional (cfg.systemd.enable) "autostart") + (lib.optional (cfg.wf-shell.enable) "wayfire-shell") + ]); + xwayland = cfg.xwayland.enable; + }; + }; + + plugins = lib.optional cfg.wf-shell.enable cfg.wf-shell.package; + }; + + xdg.configFile."wayfire.ini".text = lib.generators.toINI { } cfg.settings; + + xdg.configFile."wf-shell.ini" = lib.mkIf cfg.wf-shell.enable { + text = lib.generators.toINI { } cfg.wf-shell.settings; + }; + + systemd.user.targets.wayfire-session = lib.mkIf cfg.systemd.enable { + Unit = { + Description = "wayfire compositor session"; + Documentation = [ "man:systemd.special(7)" ]; + BindsTo = [ "graphical-session.target" ]; + Wants = [ "graphical-session-pre.target" ]; + After = [ "graphical-session-pre.target" ]; + }; + }; + + systemd.user.targets.tray = { + Unit = { + Description = "Home Manager System Tray"; + Requires = [ "graphical-session-pre.target" ]; + }; + }; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 3530138d..b95cd16a 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -302,6 +302,7 @@ in import nmtSrc { ./modules/services/window-managers/river ./modules/services/window-managers/spectrwm ./modules/services/window-managers/sway + ./modules/services/window-managers/wayfire ./modules/services/wlsunset ./modules/services/wob ./modules/services/xsettingsd diff --git a/tests/modules/services/window-managers/wayfire/configuration.ini b/tests/modules/services/window-managers/wayfire/configuration.ini new file mode 100644 index 00000000..a4048041 --- /dev/null +++ b/tests/modules/services/window-managers/wayfire/configuration.ini @@ -0,0 +1,10 @@ +[autostart] +systemdActivation=/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP NIXOS_OZONE_WL XCURSOR_THEME XCURSOR_SIZE && systemctl --user stop wayfire-session.target && systemctl --user start wayfire-session.target + +[command] +binding_terminal=alacritty +command_terminal=alacritty + +[core] +plugins=command expo cube autostart +xwayland=true diff --git a/tests/modules/services/window-managers/wayfire/configuration.nix b/tests/modules/services/window-managers/wayfire/configuration.nix new file mode 100644 index 00000000..07042329 --- /dev/null +++ b/tests/modules/services/window-managers/wayfire/configuration.nix @@ -0,0 +1,22 @@ +{ ... }: { + wayland.windowManager.wayfire = { + enable = true; + package = null; + settings = { + core.plugins = "command expo cube"; + command = { + binding_terminal = "alacritty"; + command_terminal = "alacritty"; + }; + }; + }; + + nmt.script = '' + wayfireConfig=home-files/.config/wayfire.ini + + assertFileExists "$wayfireConfig" + + normalizedConfig=$(normalizeStorePaths "$wayfireConfig") + assertFileContent "$normalizedConfig" "${./configuration.ini}" + ''; +} diff --git a/tests/modules/services/window-managers/wayfire/default.nix b/tests/modules/services/window-managers/wayfire/default.nix new file mode 100644 index 00000000..0e252bb1 --- /dev/null +++ b/tests/modules/services/window-managers/wayfire/default.nix @@ -0,0 +1,4 @@ +{ + wayfire-configuration = ./configuration.nix; + wayfire-wf-shell = ./wf-shell.nix; +} diff --git a/tests/modules/services/window-managers/wayfire/wf-shell.ini b/tests/modules/services/window-managers/wayfire/wf-shell.ini new file mode 100644 index 00000000..02472a68 --- /dev/null +++ b/tests/modules/services/window-managers/wayfire/wf-shell.ini @@ -0,0 +1,3 @@ +[panel] +autohide=true +widgets_left=menu spacing4 launchers window-list diff --git a/tests/modules/services/window-managers/wayfire/wf-shell.nix b/tests/modules/services/window-managers/wayfire/wf-shell.nix new file mode 100644 index 00000000..2c8221d8 --- /dev/null +++ b/tests/modules/services/window-managers/wayfire/wf-shell.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: { + wayland.windowManager.wayfire = { + enable = true; + package = null; + wf-shell = { + enable = true; + package = pkgs.mkStubPackage { }; + settings = { + panel = { + widgets_left = "menu spacing4 launchers window-list"; + autohide = true; + }; + }; + }; + }; + + nmt.script = '' + wfShellConfig=home-files/.config/wf-shell.ini + + assertFileExists "$wfShellConfig" + + normalizedConfig=$(normalizeStorePaths "$wfShellConfig") + assertFileContent "$normalizedConfig" "${./wf-shell.ini}" + ''; +} From fcc4259cdbcb76138b48ed36b4f41c521910db0d Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Wed, 8 Jan 2025 15:24:04 +0000 Subject: [PATCH 08/16] treewide: stub tests (#6275) * ranger: stub tests * alacritty: stub tests * broot: stub tests * zsh: stub tests * vim-vint: stub tests --- modules/programs/ranger.nix | 2 +- tests/modules/programs/alacritty/default.nix | 2 +- .../programs/alacritty/example-settings.nix | 2 ++ .../programs/alacritty/settings-merging.nix | 2 ++ .../{toml_config.nix => toml-config.nix} | 2 ++ tests/modules/programs/broot/broot.nix | 5 +++++ .../modules/programs/ranger/configuration.nix | 2 ++ .../programs/vim-vint/basic-configuration.nix | 4 +++- .../programs/zsh/history-ignore-pattern.nix | 7 ++---- .../programs/zsh/history-path-new-custom.nix | 8 +++---- .../programs/zsh/history-path-new-default.nix | 8 +++---- .../programs/zsh/history-path-old-custom.nix | 8 +++---- .../programs/zsh/history-path-old-default.nix | 8 +++---- .../programs/zsh/history-substring-search.nix | 8 +++---- tests/modules/programs/zsh/prezto.nix | 17 +++----------- .../programs/zsh/session-variables.nix | 8 +++---- .../programs/zsh/syntax-highlighting.nix | 8 +++---- tests/modules/programs/zsh/zsh-abbr.nix | 4 ++-- tests/modules/programs/zsh/zsh-stubs.nix | 22 +++++++++++++++++++ 19 files changed, 68 insertions(+), 59 deletions(-) rename tests/modules/programs/alacritty/{toml_config.nix => toml-config.nix} (94%) create mode 100644 tests/modules/programs/zsh/zsh-stubs.nix diff --git a/modules/programs/ranger.nix b/modules/programs/ranger.nix index 63d33fad..378db5f3 100644 --- a/modules/programs/ranger.nix +++ b/modules/programs/ranger.nix @@ -142,7 +142,7 @@ in { config = mkIf cfg.enable (mkMerge [ { programs.ranger.finalPackage = cfg.package.overrideAttrs (oldAttrs: { - propagatedBuildInputs = oldAttrs.propagatedBuildInputs + propagatedBuildInputs = (oldAttrs.propagatedBuildInputs or [ ]) ++ cfg.extraPackages; }); diff --git a/tests/modules/programs/alacritty/default.nix b/tests/modules/programs/alacritty/default.nix index e5445439..7f70628b 100644 --- a/tests/modules/programs/alacritty/default.nix +++ b/tests/modules/programs/alacritty/default.nix @@ -2,5 +2,5 @@ alacritty-example-settings = ./example-settings.nix; alacritty-empty-settings = ./empty-settings.nix; alacritty-merging-settings = ./settings-merging.nix; - alacritty-toml-config = ./toml_config.nix; + alacritty-toml-config = ./toml-config.nix; } diff --git a/tests/modules/programs/alacritty/example-settings.nix b/tests/modules/programs/alacritty/example-settings.nix index c8ecb206..ccda3b2c 100644 --- a/tests/modules/programs/alacritty/example-settings.nix +++ b/tests/modules/programs/alacritty/example-settings.nix @@ -20,6 +20,8 @@ }; }; + test.stubs = { alacritty = { }; }; + nmt.script = '' assertFileContent \ home-files/.config/alacritty/alacritty.toml \ diff --git a/tests/modules/programs/alacritty/settings-merging.nix b/tests/modules/programs/alacritty/settings-merging.nix index e08c96eb..1d47b77a 100644 --- a/tests/modules/programs/alacritty/settings-merging.nix +++ b/tests/modules/programs/alacritty/settings-merging.nix @@ -28,6 +28,8 @@ }; }; + test.stubs = { alacritty = { }; }; + nmt.script = '' assertFileContent \ home-files/.config/alacritty/alacritty.toml \ diff --git a/tests/modules/programs/alacritty/toml_config.nix b/tests/modules/programs/alacritty/toml-config.nix similarity index 94% rename from tests/modules/programs/alacritty/toml_config.nix rename to tests/modules/programs/alacritty/toml-config.nix index 7094f9a9..8235d44c 100644 --- a/tests/modules/programs/alacritty/toml_config.nix +++ b/tests/modules/programs/alacritty/toml-config.nix @@ -25,6 +25,8 @@ }; }; + test.stubs = { alacritty = { }; }; + nmt.script = '' assertFileContent \ home-files/.config/alacritty/alacritty.toml \ diff --git a/tests/modules/programs/broot/broot.nix b/tests/modules/programs/broot/broot.nix index 17577f6f..8bb7c02c 100644 --- a/tests/modules/programs/broot/broot.nix +++ b/tests/modules/programs/broot/broot.nix @@ -6,6 +6,11 @@ settings.modal = true; }; + tests.stubs = { + broot = { }; + hjson = { }; + }; + nmt.script = '' assertFileExists home-files/.config/broot/conf.toml assertFileContains home-files/.config/broot/conf.toml 'modal = true' diff --git a/tests/modules/programs/ranger/configuration.nix b/tests/modules/programs/ranger/configuration.nix index 5d534e49..90541ac3 100644 --- a/tests/modules/programs/ranger/configuration.nix +++ b/tests/modules/programs/ranger/configuration.nix @@ -31,6 +31,8 @@ ]; }; + test.stubs = { ranger = { }; }; + nmt.script = '' assertFileExists home-files/.config/ranger/rc.conf assertFileContent home-files/.config/ranger/rc.conf \ diff --git a/tests/modules/programs/vim-vint/basic-configuration.nix b/tests/modules/programs/vim-vint/basic-configuration.nix index 59bfafa5..2e538f37 100644 --- a/tests/modules/programs/vim-vint/basic-configuration.nix +++ b/tests/modules/programs/vim-vint/basic-configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, xdg, ... }: +{ ... }: { programs.vim-vint = { @@ -19,6 +19,8 @@ }; }; + test.stubs = { vim-vint = { }; }; + nmt.script = '' assertFileContent home-files/.config/.vintrc.yaml ${ ./basic-configuration.yaml diff --git a/tests/modules/programs/zsh/history-ignore-pattern.nix b/tests/modules/programs/zsh/history-ignore-pattern.nix index 68be58fe..49865e84 100644 --- a/tests/modules/programs/zsh/history-ignore-pattern.nix +++ b/tests/modules/programs/zsh/history-ignore-pattern.nix @@ -1,9 +1,8 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ ... }: { imports = [ + ./zsh-stubs.nix ({ ... }: { config.programs.zsh.history.ignorePatterns = [ "echo *" ]; }) ({ ... }: { config.programs.zsh.history.ignorePatterns = [ "rm *" ]; }) ]; @@ -11,8 +10,6 @@ with lib; config = { programs.zsh.enable = true; - test.stubs.zsh = { }; - nmt.script = '' assertFileContains home-files/.zshrc "HISTORY_IGNORE='(echo *|rm *)'" ''; diff --git a/tests/modules/programs/zsh/history-path-new-custom.nix b/tests/modules/programs/zsh/history-path-new-custom.nix index 1a691f1c..ee6deb88 100644 --- a/tests/modules/programs/zsh/history-path-new-custom.nix +++ b/tests/modules/programs/zsh/history-path-new-custom.nix @@ -1,8 +1,8 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ ... }: { + imports = [ ./zsh-stubs.nix ]; + config = { home.stateVersion = "20.03"; programs.zsh = { @@ -10,8 +10,6 @@ with lib; history.path = "$HOME/some/directory/zsh_history"; }; - test.stubs.zsh = { }; - nmt.script = '' assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/some/directory/zsh_history"$' ''; diff --git a/tests/modules/programs/zsh/history-path-new-default.nix b/tests/modules/programs/zsh/history-path-new-default.nix index 06fe88d0..3ead9759 100644 --- a/tests/modules/programs/zsh/history-path-new-default.nix +++ b/tests/modules/programs/zsh/history-path-new-default.nix @@ -1,14 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ ... }: { + imports = [ ./zsh-stubs.nix ]; + config = { home.stateVersion = "20.03"; programs.zsh.enable = true; - test.stubs.zsh = { }; - nmt.script = '' assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/.zsh_history"$' ''; diff --git a/tests/modules/programs/zsh/history-path-old-custom.nix b/tests/modules/programs/zsh/history-path-old-custom.nix index 42a85d00..25a2babf 100644 --- a/tests/modules/programs/zsh/history-path-old-custom.nix +++ b/tests/modules/programs/zsh/history-path-old-custom.nix @@ -1,8 +1,8 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ ... }: { + imports = [ ./zsh-stubs.nix ]; + config = { home.stateVersion = "19.09"; programs.zsh = { @@ -10,8 +10,6 @@ with lib; history.path = "some/directory/zsh_history"; }; - test.stubs.zsh = { }; - nmt.script = '' assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/some/directory/zsh_history"$' ''; diff --git a/tests/modules/programs/zsh/history-path-old-default.nix b/tests/modules/programs/zsh/history-path-old-default.nix index 490a2715..b988ddb6 100644 --- a/tests/modules/programs/zsh/history-path-old-default.nix +++ b/tests/modules/programs/zsh/history-path-old-default.nix @@ -1,14 +1,12 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ ... }: { + imports = [ ./zsh-stubs.nix ]; + config = { home.stateVersion = "19.03"; programs.zsh.enable = true; - test.stubs.zsh = { }; - nmt.script = '' assertFileRegex home-files/.zshrc '^HISTFILE="$HOME/.zsh_history"$' ''; diff --git a/tests/modules/programs/zsh/history-substring-search.nix b/tests/modules/programs/zsh/history-substring-search.nix index 10560b9f..a5f28b72 100644 --- a/tests/modules/programs/zsh/history-substring-search.nix +++ b/tests/modules/programs/zsh/history-substring-search.nix @@ -1,8 +1,8 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ ... }: { + imports = [ ./zsh-stubs.nix ]; + config = { programs.zsh = { enable = true; @@ -13,8 +13,6 @@ with lib; }; }; - test.stubs.zsh = { }; - # Written with regex to ensure we don't end up missing newlines in the future nmt.script = '' assertFileRegex home-files/.zshrc "^bindkey \"\^\[\[B\" history-substring-search-down$" diff --git a/tests/modules/programs/zsh/prezto.nix b/tests/modules/programs/zsh/prezto.nix index 922112ef..7ce60906 100644 --- a/tests/modules/programs/zsh/prezto.nix +++ b/tests/modules/programs/zsh/prezto.nix @@ -1,20 +1,9 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ ... }: { - programs.zsh.prezto.enable = true; + imports = [ ./zsh-stubs.nix ]; - test.stubs.zsh-prezto = { - outPath = null; - buildScript = '' - mkdir -p $out/share/zsh-prezto/runcoms - echo '# zprofile' > $out/share/zsh-prezto/runcoms/zprofile - echo '# zlogin' > $out/share/zsh-prezto/runcoms/zlogin - echo '# zlogout' > $out/share/zsh-prezto/runcoms/zlogout - echo '# zshenv' > $out/share/zsh-prezto/runcoms/zshenv - ''; - }; + programs.zsh.prezto.enable = true; nmt.script = '' assertFileExists home-files/.zpreztorc diff --git a/tests/modules/programs/zsh/session-variables.nix b/tests/modules/programs/zsh/session-variables.nix index f6f795f7..45c63d23 100644 --- a/tests/modules/programs/zsh/session-variables.nix +++ b/tests/modules/programs/zsh/session-variables.nix @@ -1,8 +1,8 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ config, ... }: { + imports = [ ./zsh-stubs.nix ]; + config = { programs.zsh = { enable = true; @@ -13,8 +13,6 @@ with lib; }; }; - test.stubs.zsh = { }; - nmt.script = '' assertFileExists home-files/.zshenv assertFileRegex home-files/.zshenv 'export V1="v1"' diff --git a/tests/modules/programs/zsh/syntax-highlighting.nix b/tests/modules/programs/zsh/syntax-highlighting.nix index 052b228b..2bd58147 100644 --- a/tests/modules/programs/zsh/syntax-highlighting.nix +++ b/tests/modules/programs/zsh/syntax-highlighting.nix @@ -1,8 +1,8 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ pkgs, ... }: { + imports = [ ./zsh-stubs.nix ]; + config = { programs.zsh = { enable = true; @@ -15,8 +15,6 @@ with lib; }; }; - test.stubs.zsh = { }; - nmt.script = '' assertFileContains home-files/.zshrc "source ${pkgs.hello}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" assertFileContains home-files/.zshrc "ZSH_HIGHLIGHT_HIGHLIGHTERS+=(brackets pattern cursor)" diff --git a/tests/modules/programs/zsh/zsh-abbr.nix b/tests/modules/programs/zsh/zsh-abbr.nix index 7e8370d0..f08345e0 100644 --- a/tests/modules/programs/zsh/zsh-abbr.nix +++ b/tests/modules/programs/zsh/zsh-abbr.nix @@ -1,13 +1,13 @@ { ... }: { + imports = [ ./zsh-stubs.nix ]; + programs.zsh.zsh-abbr = { enable = true; abbreviations = { ga = "git add"; }; }; - test.stubs.zsh-abbr = { }; - nmt.script = '' abbreviations=home-files/.config/zsh-abbr/user-abbreviations diff --git a/tests/modules/programs/zsh/zsh-stubs.nix b/tests/modules/programs/zsh/zsh-stubs.nix new file mode 100644 index 00000000..d9e275aa --- /dev/null +++ b/tests/modules/programs/zsh/zsh-stubs.nix @@ -0,0 +1,22 @@ +{ ... }: + +{ + test.stubs = { + hello = { }; + nix-zsh-completions = { }; + zsh = { }; + zsh-abbr = { }; + zsh-history-substring-search = { }; + zsh-prezto = { + outPath = null; + buildScript = '' + mkdir -p $out/share/zsh-prezto/runcoms + echo '# zprofile' > $out/share/zsh-prezto/runcoms/zprofile + echo '# zlogin' > $out/share/zsh-prezto/runcoms/zlogin + echo '# zlogout' > $out/share/zsh-prezto/runcoms/zlogout + echo '# zshenv' > $out/share/zsh-prezto/runcoms/zshenv + ''; + }; + zsh-syntax-highlighting = { }; + }; +} From 54b330ac067e74314f8ca6b38af6fcfbd17f3e9e Mon Sep 17 00:00:00 2001 From: Hoang Nguyen Date: Sat, 26 Oct 2024 00:00:00 +0700 Subject: [PATCH 09/16] go: add telemetry options --- modules/programs/go.nix | 39 ++++++++++++++++++++++ tests/default.nix | 1 + tests/modules/programs/go/default.nix | 1 + tests/modules/programs/go/go-telemetry.nix | 25 ++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 tests/modules/programs/go/default.nix create mode 100644 tests/modules/programs/go/go-telemetry.nix diff --git a/modules/programs/go.nix b/modules/programs/go.nix index 5d150036..19b63eae 100644 --- a/modules/programs/go.nix +++ b/modules/programs/go.nix @@ -6,6 +6,8 @@ let cfg = config.programs.go; + modeFileContent = "${cfg.telemetry.mode} ${cfg.telemetry.date}"; + in { meta.maintainers = [ maintainers.rvolosatovs ]; @@ -71,6 +73,31 @@ in { or checksum database. ''; }; + + telemetry = mkOption { + type = types.submodule { + options = { + mode = mkOption { + type = with types; nullOr (enum [ "off" "local" "on" ]); + default = null; + description = "Go telemetry mode to be set."; + }; + + date = mkOption { + type = types.str; + default = "1970-01-01"; + description = '' + The date indicating the date at which the modefile + was updated, in YYYY-MM-DD format. It's used to + reset the timeout before the next telemetry report + is uploaded when telemetry mode is set to "on". + ''; + }; + }; + }; + default = { }; + description = "Options to configure Go telemetry mode."; + }; }; }; @@ -98,5 +125,17 @@ in { (mkIf (cfg.goPrivate != [ ]) { home.sessionVariables.GOPRIVATE = concatStringsSep "," cfg.goPrivate; }) + + (mkIf (cfg.telemetry.mode != null) { + home.file."Library/Application Support/go/telemetry/mode" = { + enable = pkgs.stdenv.hostPlatform.isDarwin; + text = modeFileContent; + }; + + xdg.configFile."go/telemetry/mode" = { + enable = !pkgs.stdenv.hostPlatform.isDarwin; + text = modeFileContent; + }; + }) ]); } diff --git a/tests/default.nix b/tests/default.nix index b95cd16a..63884575 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -83,6 +83,7 @@ in import nmtSrc { ./modules/programs/git ./modules/programs/git-cliff ./modules/programs/git-credential-oauth + ./modules/programs/go ./modules/programs/gpg ./modules/programs/gradle ./modules/programs/granted diff --git a/tests/modules/programs/go/default.nix b/tests/modules/programs/go/default.nix new file mode 100644 index 00000000..cbf58092 --- /dev/null +++ b/tests/modules/programs/go/default.nix @@ -0,0 +1 @@ +{ go-telemetry = ./go-telemetry.nix; } diff --git a/tests/modules/programs/go/go-telemetry.nix b/tests/modules/programs/go/go-telemetry.nix new file mode 100644 index 00000000..c0afd674 --- /dev/null +++ b/tests/modules/programs/go/go-telemetry.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: + +{ + programs.go = { + enable = true; + telemetry = { + mode = "on"; + date = "2006-01-02"; + }; + }; + + test.stubs.go = { }; + + nm.script = let + modeFileDir = if !pkgs.stdenv.isDarwin then + ".config/go/telemetry" + else + "Library/Application Support/go/telemetry"; + in '' + assertFileExists "home-files/${modeFileDir}/mode" + assertFileContent \ + "home-files/${modeFileDir}/mode" \ + "on 2006-01-02" + ''; +} From 7e00856596891850ba5ad4c5ecd2ed74468c08c5 Mon Sep 17 00:00:00 2001 From: home-manager-bot <106474382+home-manager-bot@users.noreply.github.com> Date: Wed, 8 Jan 2025 21:01:05 +0100 Subject: [PATCH 10/16] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/6df24922a1400241dae323af55f30e4318a6ca65?narHash=sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk%3D' (2025-01-02) → 'github:NixOS/nixpkgs/8f3e1f807051e32d8c95cd12b9b421623850a34d?narHash=sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs%2BrI%3D' (2025-01-04) Co-authored-by: github-actions[bot] --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 7672c219..8fb5d40f 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1735834308, - "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", + "lastModified": 1736012469, + "narHash": "sha256-/qlNWm/IEVVH7GfgAIyP6EsVZI6zjAx1cV5zNyrs+rI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6df24922a1400241dae323af55f30e4318a6ca65", + "rev": "8f3e1f807051e32d8c95cd12b9b421623850a34d", "type": "github" }, "original": { From 01f40d52d65318463d71aa485fe9ad6f26357b45 Mon Sep 17 00:00:00 2001 From: "Shay Eclipse K. Stage" Date: Thu, 9 Jan 2025 12:04:34 +0100 Subject: [PATCH 11/16] zsh/prezto: add `package` option (#5938) Allow setting a custom package for `programs.zsh.prezto`. --- modules/programs/zsh.nix | 2 +- modules/programs/zsh/prezto.nix | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 50f8055c..3e13404c 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -671,7 +671,7 @@ in '' ${optionalString cfg.prezto.enable - (builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zshrc")} + (builtins.readFile "${cfg.prezto.package}/share/zsh-prezto/runcoms/zshrc")} ${concatStrings (map (plugin: '' if [[ -f "$HOME/${pluginsDir}/${plugin.name}/${plugin.file}" ]]; then diff --git a/modules/programs/zsh/prezto.nix b/modules/programs/zsh/prezto.nix index 9a94f238..5fdc8da2 100644 --- a/modules/programs/zsh/prezto.nix +++ b/modules/programs/zsh/prezto.nix @@ -14,6 +14,8 @@ let options = { enable = mkEnableOption "prezto"; + package = mkPackageOption pkgs "prezto" { default = "zsh-prezto"; }; + caseSensitive = mkOption { type = types.nullOr types.bool; # See . @@ -379,15 +381,15 @@ in { }; config = mkIf cfg.enable (mkMerge [{ home.file."${relToDotDir ".zprofile"}".text = - builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zprofile"; + builtins.readFile "${cfg.package}/share/zsh-prezto/runcoms/zprofile"; home.file."${relToDotDir ".zlogin"}".text = - builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zlogin"; + builtins.readFile "${cfg.package}/share/zsh-prezto/runcoms/zlogin"; home.file."${relToDotDir ".zlogout"}".text = - builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zlogout"; - home.packages = with pkgs; [ zsh-prezto ]; + builtins.readFile "${cfg.package}/share/zsh-prezto/runcoms/zlogout"; + home.packages = [ cfg.package ]; home.file."${relToDotDir ".zshenv"}".text = - builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zshenv"; + builtins.readFile "${cfg.package}/share/zsh-prezto/runcoms/zshenv"; home.file."${relToDotDir ".zpreztorc"}".text = '' # Generated by Nix ${optionalString (cfg.caseSensitive != null) '' From d4aebb947a301b8da8654a804979a738c5c5da50 Mon Sep 17 00:00:00 2001 From: Kilian Mio <86004375+Mikilio@users.noreply.github.com> Date: Thu, 9 Jan 2025 12:25:50 +0100 Subject: [PATCH 12/16] todoman: add todoman module (#5252) * todoman: add todoman module Adds Mikilio as maintainer for new module for todoman a standards-based task manager based on iCalendar Apply suggestions from code review Co-authored-by: Robert Helgesson Update modules/programs/todoman.nix Co-authored-by: Robert Helgesson * fix: correct config name * chore: add test --------- Co-authored-by: Robert Helgesson --- modules/lib/maintainers.nix | 6 ++ modules/modules.nix | 1 + modules/programs/todoman.nix | 62 +++++++++++++++++++ tests/modules/programs/todoman/config.nix | 21 +++++++ tests/modules/programs/todoman/default.nix | 1 + .../programs/todoman/todoman-config-expected | 3 + 6 files changed, 94 insertions(+) create mode 100644 modules/programs/todoman.nix create mode 100644 tests/modules/programs/todoman/config.nix create mode 100644 tests/modules/programs/todoman/default.nix create mode 100644 tests/modules/programs/todoman/todoman-config-expected diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 7ee9e1df..932d1196 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -478,6 +478,12 @@ github = "mainrs"; githubId = 5113257; }; + mikilio = { + name = "mikilio"; + email = "official.mikilio+dev@gmail.com"; + github = "mikilio"; + githubId = 86004375; + }; kmaasrud = { name = "Knut Magnus Aasrud"; email = "km@aasrud.com"; diff --git a/modules/modules.nix b/modules/modules.nix index 2aae09eb..342ed06e 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -246,6 +246,7 @@ let ./programs/tmate.nix ./programs/tmux.nix ./programs/tofi.nix + ./programs/todoman.nix ./programs/topgrade.nix ./programs/translate-shell.nix ./programs/urxvt.nix diff --git a/modules/programs/todoman.nix b/modules/programs/todoman.nix new file mode 100644 index 00000000..2e7ebf6a --- /dev/null +++ b/modules/programs/todoman.nix @@ -0,0 +1,62 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.todoman; + + format = pkgs.formats.keyValue { }; + +in { + + meta.maintainers = [ hm.maintainers.mikilio ]; + + options.programs.todoman = { + enable = lib.mkEnableOption "todoman"; + + glob = mkOption { + type = types.str; + default = "*"; + description = '' + The glob expansion which matches all directories relevant. + ''; + example = "*/*"; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Text for configuration of todoman. + The syntax is Python. + + See [docs](`https://todoman.readthedocs.io/en/stable/man.html#id5`). + for the full list of options. + ''; + example = '' + date_format = "%Y-%m-%d"; + time_format = "%H:%M"; + default_list = "Personal"; + default_due = 48; + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [{ + assertion = config.accounts.calendar ? basePath; + message = '' + A base directory for calendars must be specified via + `accounts.calendar.basePath` to generate config for todoman + ''; + }]; + + home.packages = [ pkgs.todoman ]; + + xdg.configFile."todoman/config.py".text = lib.concatLines [ + ''path = "${config.accounts.calendar.basePath}/${cfg.glob}"'' + cfg.extraConfig + ]; + }; +} diff --git a/tests/modules/programs/todoman/config.nix b/tests/modules/programs/todoman/config.nix new file mode 100644 index 00000000..7323b7a4 --- /dev/null +++ b/tests/modules/programs/todoman/config.nix @@ -0,0 +1,21 @@ +{ + programs.todoman = { + enable = true; + glob = "*/*"; + extraConfig = '' + date_format = "%d.%m.%Y" + default_list = "test" + ''; + }; + + accounts.calendar.basePath = "base/path/calendar"; + + test.stubs = { todoman = { }; }; + + nmt.script = '' + configFile=home-files/.config/todoman/config.py + assertFileExists $configFile + assertFileContent $configFile ${./todoman-config-expected} + ''; +} + diff --git a/tests/modules/programs/todoman/default.nix b/tests/modules/programs/todoman/default.nix new file mode 100644 index 00000000..d429f923 --- /dev/null +++ b/tests/modules/programs/todoman/default.nix @@ -0,0 +1 @@ +{ todoman-config = ./config.nix; } diff --git a/tests/modules/programs/todoman/todoman-config-expected b/tests/modules/programs/todoman/todoman-config-expected new file mode 100644 index 00000000..00da13e1 --- /dev/null +++ b/tests/modules/programs/todoman/todoman-config-expected @@ -0,0 +1,3 @@ +path = "/home/hm-user/base/path/calendar/*/*" +date_format = "%d.%m.%Y" +default_list = "test" From 2532b500c3ed2b8940e831039dcec5a5ea093afc Mon Sep 17 00:00:00 2001 From: Terje Larsen Date: Fri, 10 Jan 2025 12:31:03 +0100 Subject: [PATCH 13/16] ollama: add module (#5735) --- modules/modules.nix | 1 + modules/services/ollama.nix | 97 +++++++++++++++++++ tests/default.nix | 1 + tests/modules/services/ollama/basic.nix | 13 +++ tests/modules/services/ollama/default.nix | 4 + .../ollama/set-environment-variables.nix | 22 +++++ 6 files changed, 138 insertions(+) create mode 100644 modules/services/ollama.nix create mode 100644 tests/modules/services/ollama/basic.nix create mode 100644 tests/modules/services/ollama/default.nix create mode 100644 tests/modules/services/ollama/set-environment-variables.nix diff --git a/modules/modules.nix b/modules/modules.nix index 342ed06e..d20300d1 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -346,6 +346,7 @@ let ./services/nextcloud-client.nix ./services/nix-gc.nix ./services/notify-osd.nix + ./services/ollama.nix ./services/opensnitch-ui.nix ./services/osmscout-server.nix ./services/owncloud-client.nix diff --git a/modules/services/ollama.nix b/modules/services/ollama.nix new file mode 100644 index 00000000..66e1e837 --- /dev/null +++ b/modules/services/ollama.nix @@ -0,0 +1,97 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.ollama; + + ollamaPackage = if cfg.acceleration == null then + cfg.package + else + cfg.package.override { inherit (cfg) acceleration; }; + +in { + meta.maintainers = [ maintainers.terlar ]; + + options = { + services.ollama = { + enable = mkEnableOption "ollama server for local large language models"; + + package = mkPackageOption pkgs "ollama" { }; + + host = mkOption { + type = types.str; + default = "127.0.0.1"; + example = "[::]"; + description = '' + The host address which the ollama server HTTP interface listens to. + ''; + }; + + port = mkOption { + type = types.port; + default = 11434; + example = 11111; + description = '' + Which port the ollama server listens to. + ''; + }; + + acceleration = mkOption { + type = types.nullOr (types.enum [ false "rocm" "cuda" ]); + default = null; + example = "rocm"; + description = '' + What interface to use for hardware acceleration. + + - `null`: default behavior + - if `nixpkgs.config.rocmSupport` is enabled, uses `"rocm"` + - if `nixpkgs.config.cudaSupport` is enabled, uses `"cuda"` + - otherwise defaults to `false` + - `false`: disable GPU, only use CPU + - `"rocm"`: supported by most modern AMD GPUs + - may require overriding gpu type with `services.ollama.rocmOverrideGfx` + if rocm doesn't detect your AMD gpu + - `"cuda"`: supported by most modern NVIDIA GPUs + ''; + }; + + environmentVariables = mkOption { + type = types.attrsOf types.str; + default = { }; + example = { + OLLAMA_LLM_LIBRARY = "cpu"; + HIP_VISIBLE_DEVICES = "0,1"; + }; + description = '' + Set arbitrary environment variables for the ollama service. + + Be aware that these are only seen by the ollama server (systemd service), + not normal invocations like `ollama run`. + Since `ollama run` is mostly a shell around the ollama server, this is usually sufficient. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + systemd.user.services.ollama = { + Unit = { + Description = "Server for local large language models"; + After = [ "network.target" ]; + }; + + Service = { + ExecStart = "${getExe ollamaPackage} serve"; + Environment = + (mapAttrsToList (n: v: "${n}=${v}") cfg.environmentVariables) + ++ [ "OLLAMA_HOST=${cfg.host}:${toString cfg.port}" ]; + }; + + Install = { WantedBy = [ "default.target" ]; }; + }; + + home.packages = [ ollamaPackage ]; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 63884575..1f34bbcc 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -270,6 +270,7 @@ in import nmtSrc { ./modules/services/mpd-mpris ./modules/services/mpdris2 ./modules/services/nix-gc + ./modules/services/ollama ./modules/services/osmscout-server ./modules/services/pantalaimon ./modules/services/parcellite diff --git a/tests/modules/services/ollama/basic.nix b/tests/modules/services/ollama/basic.nix new file mode 100644 index 00000000..fecee950 --- /dev/null +++ b/tests/modules/services/ollama/basic.nix @@ -0,0 +1,13 @@ +{ + config = { + services.ollama.enable = true; + + test.stubs.ollama = { }; + + nmt.script = '' + serviceFile="home-files/.config/systemd/user/ollama.service" + assertFileRegex "$serviceFile" 'After=network\.target' + assertFileRegex "$serviceFile" 'Environment=OLLAMA_HOST=127.0.0.1:11434' + ''; + }; +} diff --git a/tests/modules/services/ollama/default.nix b/tests/modules/services/ollama/default.nix new file mode 100644 index 00000000..84ad2c99 --- /dev/null +++ b/tests/modules/services/ollama/default.nix @@ -0,0 +1,4 @@ +{ + ollama-basic = ./basic.nix; + ollama-set-environment-variables = ./set-environment-variables.nix; +} diff --git a/tests/modules/services/ollama/set-environment-variables.nix b/tests/modules/services/ollama/set-environment-variables.nix new file mode 100644 index 00000000..b9ad280c --- /dev/null +++ b/tests/modules/services/ollama/set-environment-variables.nix @@ -0,0 +1,22 @@ +{ + config = { + services.ollama = { + enable = true; + host = "localhost"; + port = 11111; + environmentVariables = { + OLLAMA_LLM_LIBRARY = "cpu"; + HIP_VISIBLE_DEVICES = "0,1"; + }; + }; + + test.stubs.ollama = { }; + + nmt.script = '' + serviceFile="home-files/.config/systemd/user/ollama.service" + assertFileRegex "$serviceFile" 'Environment=OLLAMA_HOST=localhost:11111' + assertFileRegex "$serviceFile" 'Environment=OLLAMA_LLM_LIBRARY=cpu' + assertFileRegex "$serviceFile" 'Environment=HIP_VISIBLE_DEVICES=0,1' + ''; + }; +} From 9616d81f98032d1ee9bec68ab4b6a8c833add88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Zavala=20Villag=C3=B3mez?= Date: Mon, 13 Jan 2025 10:20:04 -0500 Subject: [PATCH 14/16] mangohud: make `false` values actually disable (#6299) Currently the following, will produce `some_opt=false` in the rendered config: ```nix programs.mangohud.settings = { some_opt = false; }; ``` With the intention being to disable the option, this would be incorrect, as per the following stated at: > Use some_parameter=0 to disable a parameter (only works with on/off > parameters) As such, I changed the rendering to follow this. This will be output instead: `some_opt=0` --- modules/programs/mangohud.nix | 2 +- tests/modules/programs/mangohud/basic-configuration.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/mangohud.nix b/modules/programs/mangohud.nix index a62587a2..035a4744 100644 --- a/modules/programs/mangohud.nix +++ b/modules/programs/mangohud.nix @@ -13,7 +13,7 @@ let int = toString option; float = int; path = int; - bool = "false"; + bool = "0"; # "on/off" opts are disabled with `=0` string = option; list = concatStringsSep "," (lists.forEach option (x: toString x)); }.${builtins.typeOf option}; diff --git a/tests/modules/programs/mangohud/basic-configuration.conf b/tests/modules/programs/mangohud/basic-configuration.conf index 8ded2dbc..87ecec5d 100644 --- a/tests/modules/programs/mangohud/basic-configuration.conf +++ b/tests/modules/programs/mangohud/basic-configuration.conf @@ -6,7 +6,7 @@ cpu_stats cpu_temp cpu_text=CPU fps_limit=30,60 -legacy_layout=false +legacy_layout=0 media_player_name=spotify media_player_order=title,artist,album output_folder=/home/user/Documents/mangohud From 0da8b6bae9b3179af68c72827541ef88cad413fc Mon Sep 17 00:00:00 2001 From: greenpsi <123899120+greenpsi@users.noreply.github.com> Date: Mon, 13 Jan 2025 17:26:51 +0100 Subject: [PATCH 15/16] sway: allow sway specific hideEdgeBorders options (#6304) * add `smart_no_gaps` option * allow using `--i3` for hideEdgeBorders: See e.g. https://man.archlinux.org/man/sway.5#Config_or_runtime_commands: The --i3 option enables i3-compatible behavior to hide the title bar on tabbed and stacked containers with one child. Co-authored-by: greenpsi --- modules/services/window-managers/i3-sway/lib/options.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/services/window-managers/i3-sway/lib/options.nix b/modules/services/window-managers/i3-sway/lib/options.nix index 2869c2bf..6a3fcf1c 100644 --- a/modules/services/window-managers/i3-sway/lib/options.nix +++ b/modules/services/window-managers/i3-sway/lib/options.nix @@ -421,7 +421,13 @@ in { }; hideEdgeBorders = mkOption { - type = types.enum [ "none" "vertical" "horizontal" "both" "smart" ]; + type = let + i3Options = [ "none" "vertical" "horizontal" "both" "smart" ]; + swayOptions = i3Options ++ [ "smart_no_gaps" ]; + in if isI3 then + types.enum i3Options + else + types.enum (swayOptions ++ (map (e: "--i3 ${e}") swayOptions)); default = "none"; description = "Hide window borders adjacent to the screen edges."; }; From fc52a210b60f2f52c74eac41a8647c1573d2071d Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Mon, 13 Jan 2025 17:27:56 +0100 Subject: [PATCH 16/16] network-manager-applet: changed nm-applet description (#6311) This makes it a bit easier to find. --- modules/services/network-manager-applet.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/network-manager-applet.nix b/modules/services/network-manager-applet.nix index 343f5728..8d15aa29 100644 --- a/modules/services/network-manager-applet.nix +++ b/modules/services/network-manager-applet.nix @@ -11,7 +11,7 @@ in { options = { services.network-manager-applet = { - enable = mkEnableOption "the Network Manager applet"; + enable = mkEnableOption "the Network Manager applet (nm-applet)"; }; };