From ebd78308144165d65b28f80969a970b8213805b2 Mon Sep 17 00:00:00 2001 From: janabhumi Date: Wed, 14 Sep 2022 00:26:28 +0300 Subject: [PATCH 001/233] exa: add package option --- modules/programs/exa.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/programs/exa.nix b/modules/programs/exa.nix index a7dfeb2b..a1b4a271 100644 --- a/modules/programs/exa.nix +++ b/modules/programs/exa.nix @@ -20,11 +20,14 @@ in { options.programs.exa = { enable = mkEnableOption "exa, a modern replacement for ls"; + enableAliases = mkEnableOption "recommended exa aliases"; + + package = mkPackageOption pkgs "exa" { }; }; config = mkIf cfg.enable { - home.packages = [ pkgs.exa ]; + home.packages = [ cfg.package ]; programs.bash.shellAliases = mkIf cfg.enableAliases aliases; From 6745da6dce1ae023e934e1ea17f7209641fcb9ee Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Tue, 9 Aug 2022 01:22:46 -0300 Subject: [PATCH 002/233] rtorrent: change settings to extraConfig Per NixOS RFC #42, settings should be reserved to structured settings, whereas extraConfig is used for stringly configuration. --- modules/programs/rtorrent.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/programs/rtorrent.nix b/modules/programs/rtorrent.nix index 95015e2c..5cfbe2f1 100644 --- a/modules/programs/rtorrent.nix +++ b/modules/programs/rtorrent.nix @@ -9,10 +9,16 @@ let in { meta.maintainers = [ maintainers.marsam ]; + imports = [ + (mkRenamedOptionModule # \ + [ "programs" "rtorrent" "settings" ] # \ + [ "programs" "rtorrent" "extraConfig" ]) + ]; + options.programs.rtorrent = { enable = mkEnableOption "rTorrent"; - settings = mkOption { + extraConfig = mkOption { type = types.lines; default = ""; description = '' @@ -29,6 +35,6 @@ in { home.packages = [ pkgs.rtorrent ]; xdg.configFile."rtorrent/rtorrent.rc" = - mkIf (cfg.settings != "") { text = cfg.settings; }; + mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; }; } From 5408e27961599b1350b651f88715daf6e67244a7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 14 Sep 2022 05:14:22 +0000 Subject: [PATCH 003/233] 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/90cd5459a1fd707819b9a3fb9c852beaaac3b79a' (2022-06-11) → 'github:nixos/nixpkgs/5f326e2a403e1cebaec378e72ceaf5725983376d' (2022-09-12) • Updated input 'utils': 'github:numtide/flake-utils/1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1' (2022-05-30) → 'github:numtide/flake-utils/c0e246b9b83f637f4681389ecabcb2681b4f3af0' (2022-08-07) --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index e027b4cb..9b829a54 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1654953433, - "narHash": "sha256-TwEeh4r50NdWHFAHQSyjCk2cZxgwUfcCCAJOhPdXB28=", + "lastModified": 1662996720, + "narHash": "sha256-XvLQ3SuXnDMJMpM1sv1ifPjBuRytiDYhB12H/BNTjgY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "90cd5459a1fd707819b9a3fb9c852beaaac3b79a", + "rev": "5f326e2a403e1cebaec378e72ceaf5725983376d", "type": "github" }, "original": { @@ -24,11 +24,11 @@ }, "utils": { "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "type": "github" }, "original": { From b0247ceedc72322f77c16fb490c0fdf6373a3f6b Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 15 Sep 2022 22:17:19 +0200 Subject: [PATCH 004/233] xdg.userDirs: avoid using $HOME Instead of referencing the `HOME` environment variable, use the `home.homeDirectory` option. This allows other modules to reference an XDG user directory without having to support shell syntax. --- modules/misc/xdg-user-dirs.nix | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/modules/misc/xdg-user-dirs.nix b/modules/misc/xdg-user-dirs.nix index 9d29729a..36f200eb 100644 --- a/modules/misc/xdg-user-dirs.nix +++ b/modules/misc/xdg-user-dirs.nix @@ -34,49 +34,65 @@ in { desktop = mkOption { type = with types; coercedTo path toString str; - default = "$HOME/Desktop"; + default = "${config.home.homeDirectory}/Desktop"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Desktop"''; description = "The Desktop directory."; }; documents = mkOption { type = with types; coercedTo path toString str; - default = "$HOME/Documents"; + default = "${config.home.homeDirectory}/Documents"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Documents"''; description = "The Documents directory."; }; download = mkOption { type = with types; coercedTo path toString str; - default = "$HOME/Downloads"; + default = "${config.home.homeDirectory}/Downloads"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Downloads"''; description = "The Downloads directory."; }; music = mkOption { type = with types; coercedTo path toString str; - default = "$HOME/Music"; + default = "${config.home.homeDirectory}/Music"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Music"''; description = "The Music directory."; }; pictures = mkOption { type = with types; coercedTo path toString str; - default = "$HOME/Pictures"; + default = "${config.home.homeDirectory}/Pictures"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Pictures"''; description = "The Pictures directory."; }; publicShare = mkOption { type = with types; coercedTo path toString str; - default = "$HOME/Public"; + default = "${config.home.homeDirectory}/Public"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Public"''; description = "The Public share directory."; }; templates = mkOption { type = with types; coercedTo path toString str; - default = "$HOME/Templates"; + default = "${config.home.homeDirectory}/Templates"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Templates"''; description = "The Templates directory."; }; videos = mkOption { type = with types; coercedTo path toString str; - default = "$HOME/Videos"; + default = "${config.home.homeDirectory}/Videos"; + defaultText = + literalExpression ''"''${config.home.homeDirectory}/Videos"''; description = "The Videos directory."; }; @@ -86,7 +102,7 @@ in { defaultText = literalExpression "{ }"; example = literalExpression '' { - XDG_MISC_DIR = "$HOME/Misc"; + XDG_MISC_DIR = "''${config.home.homeDirectory}/Misc"; } ''; description = "Other user directories."; From 5427f3d1f0ea4357cd4af0bffee7248d640c6ffc Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 15 Sep 2022 22:19:00 +0200 Subject: [PATCH 005/233] mpd: use XDG music dir if XDG user dirs are enabled If the user has enabled the XDG user directories module then we can use the XDG music directory in the MPD module. Otherwise we'll leave the option undefined so that the user is forced to define the directory to use. This applies to state version 22.11 and above. Fixes #3225 --- docs/release-notes/rl-2211.adoc | 5 +++- modules/services/mpd.nix | 23 ++++++++++++++++-- .../services/mpd/basic-configuration.conf | 2 +- .../services/mpd/basic-configuration.nix | 7 +++++- .../mpd/before-state-version-22_11.nix | 24 +++++++++++++++++++ tests/modules/services/mpd/default.nix | 6 ++++- tests/modules/services/mpd/xdg-music-dir.conf | 11 +++++++++ tests/modules/services/mpd/xdg-music-dir.nix | 22 +++++++++++++++++ .../services/mpdris2/basic-configuration.nix | 2 ++ .../services/mpdris2/with-password.nix | 2 ++ 10 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 tests/modules/services/mpd/before-state-version-22_11.nix create mode 100644 tests/modules/services/mpd/xdg-music-dir.conf create mode 100644 tests/modules/services/mpd/xdg-music-dir.nix diff --git a/docs/release-notes/rl-2211.adoc b/docs/release-notes/rl-2211.adoc index ed2fa55c..dccace68 100644 --- a/docs/release-notes/rl-2211.adoc +++ b/docs/release-notes/rl-2211.adoc @@ -93,4 +93,7 @@ release 20.03. Use `services.picom` instead. The state version in this release includes the changes below. These changes are only active if the `home.stateVersion` option is set to "22.11" or later. -* No changes. +* The <> option now defaults to the +value of <> if <> is +enabled. Otherwise it is undefined and must be specified in the user +configuration. diff --git a/modules/services/mpd.nix b/modules/services/mpd.nix index f71d96a4..ea0d1a97 100644 --- a/modules/services/mpd.nix +++ b/modules/services/mpd.nix @@ -52,11 +52,18 @@ in { musicDirectory = mkOption { type = with types; either path str; - default = "${config.home.homeDirectory}/music"; - defaultText = "$HOME/music"; + defaultText = literalExpression '' + ''${home.homeDirectory}/music if state version < 22.11 + ''${xdg.userDirs.music} if xdg.userDirs.enable == true + undefined otherwise + ''; apply = toString; # Prevent copies to Nix store. description = '' The directory where mpd reads music from. + + If is + true then the defined XDG music directory is used. + Otherwise, you must explicitly specify a value. ''; }; @@ -146,6 +153,17 @@ in { (lib.hm.assertions.assertPlatform "services.mpd" pkgs lib.platforms.linux) ]; + services.mpd = mkMerge [ + (mkIf (versionAtLeast config.home.stateVersion "22.11" + && config.xdg.userDirs.enable) { + musicDirectory = mkOptionDefault config.xdg.userDirs.music; + }) + + (mkIf (versionOlder config.home.stateVersion "22.11") { + musicDirectory = mkOptionDefault "${config.home.homeDirectory}/music"; + }) + ]; + systemd.user.services.mpd = { Unit = { After = [ "network.target" "sound.target" ]; @@ -164,6 +182,7 @@ in { ${pkgs.bash}/bin/bash -c "${pkgs.coreutils}/bin/mkdir -p '${cfg.dataDir}' '${cfg.playlistDirectory}'"''; }; }; + systemd.user.sockets.mpd = mkIf cfg.network.startWhenNeeded { Socket = { ListenStream = let diff --git a/tests/modules/services/mpd/basic-configuration.conf b/tests/modules/services/mpd/basic-configuration.conf index 54d6059f..59b3568b 100644 --- a/tests/modules/services/mpd/basic-configuration.conf +++ b/tests/modules/services/mpd/basic-configuration.conf @@ -1,4 +1,4 @@ -music_directory "/home/hm-user/music" +music_directory "/my/music/dir" playlist_directory "/home/hm-user/.local/share/mpd/playlists" db_file "/home/hm-user/.local/share/mpd/tag_cache" diff --git a/tests/modules/services/mpd/basic-configuration.nix b/tests/modules/services/mpd/basic-configuration.nix index c1f28898..6d6250d9 100644 --- a/tests/modules/services/mpd/basic-configuration.nix +++ b/tests/modules/services/mpd/basic-configuration.nix @@ -3,7 +3,12 @@ with lib; { - services.mpd.enable = true; + services.mpd = { + enable = true; + musicDirectory = "/my/music/dir"; + }; + + home.stateVersion = "22.11"; test.stubs.mpd = { }; diff --git a/tests/modules/services/mpd/before-state-version-22_11.nix b/tests/modules/services/mpd/before-state-version-22_11.nix new file mode 100644 index 00000000..6e044b36 --- /dev/null +++ b/tests/modules/services/mpd/before-state-version-22_11.nix @@ -0,0 +1,24 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + services.mpd.enable = true; + + home.stateVersion = "18.09"; + + test.stubs.mpd = { }; + + nmt.script = '' + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/mpd.service) + assertFileContent "$serviceFile" ${./basic-configuration.service} + + confFile=$(grep -o \ + '/nix/store/.*-mpd.conf' \ + $TESTED/home-files/.config/systemd/user/mpd.service) + + assertFileContains \ + "$confFile" \ + 'music_directory "/home/hm-user/music"' + ''; +} diff --git a/tests/modules/services/mpd/default.nix b/tests/modules/services/mpd/default.nix index 22d1638e..d2fd2a29 100644 --- a/tests/modules/services/mpd/default.nix +++ b/tests/modules/services/mpd/default.nix @@ -1 +1,5 @@ -{ mpd-basic-configuration = ./basic-configuration.nix; } +{ + mpd-basic-configuration = ./basic-configuration.nix; + mpd-before-state-version-22_11 = ./before-state-version-22_11.nix; + mpd-xdg-music-dir = ./xdg-music-dir.nix; +} diff --git a/tests/modules/services/mpd/xdg-music-dir.conf b/tests/modules/services/mpd/xdg-music-dir.conf new file mode 100644 index 00000000..56fe71b4 --- /dev/null +++ b/tests/modules/services/mpd/xdg-music-dir.conf @@ -0,0 +1,11 @@ +music_directory "/home/hm-user/Music" +playlist_directory "/home/hm-user/.local/share/mpd/playlists" +db_file "/home/hm-user/.local/share/mpd/tag_cache" + +state_file "/home/hm-user/.local/share/mpd/state" +sticker_file "/home/hm-user/.local/share/mpd/sticker.sql" + +bind_to_address "127.0.0.1" + + + diff --git a/tests/modules/services/mpd/xdg-music-dir.nix b/tests/modules/services/mpd/xdg-music-dir.nix new file mode 100644 index 00000000..775043c1 --- /dev/null +++ b/tests/modules/services/mpd/xdg-music-dir.nix @@ -0,0 +1,22 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + services.mpd.enable = true; + xdg.userDirs.enable = true; + + home.stateVersion = "22.11"; + + test.stubs.mpd = { }; + + nmt.script = '' + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/mpd.service) + assertFileContent "$serviceFile" ${./basic-configuration.service} + + confFile=$(grep -o \ + '/nix/store/.*-mpd.conf' \ + $TESTED/home-files/.config/systemd/user/mpd.service) + assertFileContent "$confFile" ${./xdg-music-dir.conf} + ''; +} diff --git a/tests/modules/services/mpdris2/basic-configuration.nix b/tests/modules/services/mpdris2/basic-configuration.nix index 5e809df3..b8c595be 100644 --- a/tests/modules/services/mpdris2/basic-configuration.nix +++ b/tests/modules/services/mpdris2/basic-configuration.nix @@ -7,6 +7,8 @@ multimediaKeys = true; }; + services.mpd.musicDirectory = "/home/hm-user/music"; + test.stubs.mpdris2 = { }; nmt.script = '' diff --git a/tests/modules/services/mpdris2/with-password.nix b/tests/modules/services/mpdris2/with-password.nix index fcfe1531..af4ef33c 100644 --- a/tests/modules/services/mpdris2/with-password.nix +++ b/tests/modules/services/mpdris2/with-password.nix @@ -10,6 +10,8 @@ }; }; + services.mpd.musicDirectory = "/home/hm-user/music"; + test.stubs.mpdris2 = { }; nmt.script = '' From 610b1d988ca9f7bc0831a599b7de0b2e26df0669 Mon Sep 17 00:00:00 2001 From: toonn Date: Sun, 19 Jun 2022 19:00:24 +0200 Subject: [PATCH 006/233] nix-darwin: improve invocation of activation script In #807 I changed the flag passed to `sudo` from `-i` to `-s` so `sudo` wouldn't use a non-existent shell defined in the `passwd` file. kalbasit also reported in that PR that `-i` didn't work for them anymore on an M1 Mac, presumably because Apple changed something in newer versions of macOS. Some users reported that this broke the behavior for them because `SHELL` was set to a path that didn't even exist on their system. It's unclear how this came to be but it shows that my assumption that `SHELL` would be set to a reasonable shell by Home Manager at this point in the activation is false. As a way around this problem we can explicitly set `SHELL` when running the activation script to a value that we know will be good, like `${pkgs.bash}`. One change in behavior this causes is that the activation script will always be run by bash, not the user's shell. If the script is generated by Home Manager this is fine since it can be generated taking into account the supported set of functions and behaviors. If the intent is for the activation script to possibly be run by non-bash and even non-POSIX shells, like tcsh, ksh or Xonsh, then this fix will not suffice. Turns out this is indeed an assumption made by Home Manager, so this is the proper behavior. Fixes #2900 --- nix-darwin/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index c1c07dc1..2d0f7722 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -15,7 +15,7 @@ in { system.activationScripts.postActivation.text = concatStringsSep "\n" (mapAttrsToList (username: usercfg: '' echo Activating home-manager configuration for ${username} - sudo -u ${username} -s --set-home ${ + SHELL=${pkgs.bash} sudo -u ${username} -s --set-home ${ pkgs.writeShellScript "activation-${username}" '' ${lib.optionalString (cfg.backupFileExtension != null) "export HOME_MANAGER_BACKUP_EXT=${ From 95559181518533741c516826ae377a51814569c3 Mon Sep 17 00:00:00 2001 From: toonn Date: Mon, 20 Jun 2022 10:59:26 +0200 Subject: [PATCH 007/233] nix-darwin: simplify activation script invocation In #587, kalbasit introduce the `-i` flag so the sudo invocation would run in an environment with `HOME` set to the correct value for the target user. This was necessary to be able to set up multiple users without interfering with the invoking user's `HOME`. In #807, I switched to `-s` instead because I managed to get an invalid shell set for my user by switching `useUserPackages` from `true` to `false` which changes the location where packages are installed and `~/.nix-profile/bin/` was no longer valid. This was based on the assumption that `SHELL` would be set to some sensible value by Home Manager at this point. This turned out to be false as reported in #2900. In 0ced6d6d (this commit's parent at this time), I explicitly set `SHELL` to `${pkgs.bash}` so it is definitely set to a good shell when invoking the activation script. However, #807 broke activation for multiple users, the original motivation for `-i`, as reported in #2856. I fixed this in #2857 by additionally passing `--set-home`. Further discussion with rycee in #3040 made me realize that the activation script already has a good Nix store bash shebang. So all the problems have been caused, not by the shell used for the activation script but by sudo trying to use a different shell at all. `-i` uses the shell set in the `passwd` file for the target user, but this can become invalid as happened to me. `-s` uses either `SHELL` if it's defined or the invoking user's shell as set in the `passwd` file. By explicitly setting this to a shell provided by Nix we make sure we're not trying to launch a non-existent shell. However, we're clearly already running in an existing shell and because of `--set-home` we can activate other users properly so there's not actually any need to try to have sudo start a different shell first, it just adds an extra process that then goes on to run the activation script with a good bash because of the shebang. Dropping `-s` altogether and keeping `--set-home` should avoid all of these issues. --- nix-darwin/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-darwin/default.nix b/nix-darwin/default.nix index 2d0f7722..018e9bab 100644 --- a/nix-darwin/default.nix +++ b/nix-darwin/default.nix @@ -15,7 +15,7 @@ in { system.activationScripts.postActivation.text = concatStringsSep "\n" (mapAttrsToList (username: usercfg: '' echo Activating home-manager configuration for ${username} - SHELL=${pkgs.bash} sudo -u ${username} -s --set-home ${ + sudo -u ${username} --set-home ${ pkgs.writeShellScript "activation-${username}" '' ${lib.optionalString (cfg.backupFileExtension != null) "export HOME_MANAGER_BACKUP_EXT=${ From b4bfe3b2d955f31d6983b4f11ac4095997a11710 Mon Sep 17 00:00:00 2001 From: cafkafk Date: Mon, 19 Sep 2022 20:22:39 +0200 Subject: [PATCH 008/233] Translate using Weblate (Danish) Currently translated at 100.0% (32 of 32 strings) Add translation using Weblate (Danish) Co-authored-by: cafkafk Translate-URL: https://hosted.weblate.org/projects/home-manager/cli/da/ Translation: Home Manager/Home Manager CLI --- home-manager/po/da.po | 187 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 home-manager/po/da.po diff --git a/home-manager/po/da.po b/home-manager/po/da.po new file mode 100644 index 00000000..aeda9100 --- /dev/null +++ b/home-manager/po/da.po @@ -0,0 +1,187 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: 2022-09-19 18:22+0000\n" +"Last-Translator: cafkafk \n" +"Language-Team: Danish \n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "Ingen konfigurationsfiler fundet ved %s" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "Ingen konfigurationsfiler fundet. Venligst lav en ved %s" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "Kan ikke inspicere indstillinger af en flake konfiguration" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "Kan ikke instantiere en flake konfiguration" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +"Der er %d ulæst og relavante nyheder.\n" +"Læs den ved at køre \"%s news\"." +msgstr[1] "" +"Der er %d ulæste og relavante nyheder.\n" +"Læs dem ved at køre \"%s news\"." + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "Ubekændt \"news.display\" indstilling \"%s\"." + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "Venligst sæt $EDITOR miljøvariablen" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "Kan ikke bygge i en læs-kun folder" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "Ingen generation med ID %s" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "Kan ikke fjerne den nuværende generation %s" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "Fjern generation %s" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "Ingen generationer som skal udløbes" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "" +"Det virker ikke som om der er nogle home-manager pakker der er installeret." + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "Ubekendt argument %s" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "Dette vil fjerne Home Manager fra dit system." + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "Dette er en tør kørsel, intet vil rent faktisk blive uinstalleret." + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "Virkelig uinstaller Home Manager?" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "Skifter til tom Home Manager konfiguration..." + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "Juhuu!" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "Fjern alle Home Manager generationer?" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "Alle generationer kan nu blive tjekket for overflødige filer." + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" +"Forlad generationer, men de kan stadig bliver fjernet som overflødige filer." + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" +"Home Manager bliver uinstalleret, men din home.nix bliver forladt uberørt." + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "%s: ukendt indstilling '%s'" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "Kør '%s --help' for brugsvejledning" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "expire-generations forventer et argument, fik %d." + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "Ubekendt kommando: %s" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "Laver initial Home Manager konfiguration..." + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "Laver initial Home Manager generation..." + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" +"Alt er færdigt! Home-manager værktøjet burde nu være installeret, og du kan " +"ændre\n" +"\n" +" %s\n" +" \n" +"For at konfigurere Home Manager. Kør 'man home-configuration.nix' for at \n" +"se alle de mulige indstillinger." + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" +"Åh nej, installationen fejlede! Venligst opret en fejlrapport ved\n" +"\n" +" %s\n" +" \n" +"hvis fejlen fremstår som forskyldt af Home Manager." + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "Denne derivation er ikke bygbar, venligst kør den gennem nix-shell." From 22ef57a54c6ec3a0465c84cc3fbba8eabd446bab Mon Sep 17 00:00:00 2001 From: Weblate Date: Mon, 19 Sep 2022 20:22:40 +0200 Subject: [PATCH 009/233] Add translation using Weblate (Danish) Co-authored-by: Weblate --- modules/po/da.po | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 modules/po/da.po diff --git a/modules/po/da.po b/modules/po/da.po new file mode 100644 index 00000000..24cbd9ed --- /dev/null +++ b/modules/po/da.po @@ -0,0 +1,97 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: da\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "" From df79df8be10bc54d79118ac6167a92b779344228 Mon Sep 17 00:00:00 2001 From: cafkafk Date: Mon, 19 Sep 2022 20:22:40 +0200 Subject: [PATCH 010/233] Translate using Weblate (Danish) Currently translated at 100.0% (14 of 14 strings) Co-authored-by: cafkafk Translate-URL: https://hosted.weblate.org/projects/home-manager/modules/da/ Translation: Home Manager/Home Manager Modules --- modules/po/da.po | 57 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/modules/po/da.po b/modules/po/da.po index 24cbd9ed..d2f5467e 100644 --- a/modules/po/da.po +++ b/modules/po/da.po @@ -8,29 +8,32 @@ msgstr "" "Project-Id-Version: Home Manager Modules\n" "Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" "POT-Creation-Date: 2022-03-26 15:08+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" +"PO-Revision-Date: 2022-09-19 18:22+0000\n" +"Last-Translator: cafkafk \n" +"Language-Team: Danish \n" "Language: da\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.14.1\n" #: modules/files.nix:233 msgid "Creating home file links in %s" -msgstr "" +msgstr "Skaber hjemme fil links i %s" #: modules/files.nix:246 msgid "Cleaning up orphan links from %s" -msgstr "" +msgstr "Opryder forældreløse links fra %s" #: modules/files.nix:262 msgid "Creating profile generation %s" -msgstr "" +msgstr "Kreere profil generation %s" #: modules/files.nix:276 msgid "No change so reusing latest profile generation %s" -msgstr "" +msgstr "Ingen ændring så genbrug den seneste profil generation %s" #: modules/home-environment.nix:607 msgid "" @@ -47,14 +50,26 @@ msgid "" "\n" "Then try activating your Home Manager configuration again." msgstr "" +"Åh nej, Nix fejlede i at installere din nye Home Manager profil! \n" +" \n" +"Måske er der en konflikt med en pakke der blev installeret gennem\n" +"\"%s\"? Prøv at køre \n" +"\n" +" %s\n" +" \n" +"og hvis der er en pakke konflikt, kan du fjerne pakken med \n" +" \n" +" %s\n" +" \n" +"og så prøve at genaktivere din Home Manager konfiguration igen." #: modules/home-environment.nix:639 msgid "Activating %s" -msgstr "" +msgstr "Aktivere %s" #: modules/lib-bash/activation-init.sh:31 msgid "Sanity checking oldGenNum and oldGenPath" -msgstr "" +msgstr "Tjekker fornuften af oldGenNum and oldGenPath" #: modules/lib-bash/activation-init.sh:34 msgid "" @@ -71,27 +86,39 @@ msgid "" "\n" "and trying home-manager switch again. Good luck!" msgstr "" +"Den forrige generations nummer og sti er i konflikt! Disse\n" +"skal enten begge være tomme, eller begge være sat, men er nu sat til \n" +" \n" +" '%s' and '%s'\n" +" \n" +"Hvis du ikke har noget mod at miste tidligere profil generationer så\n" +"er den nemmeste løsning nok at køre \n" +" \n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +" \n" +"og så prøve at køre home-manager switch igen. Held og lykke!" #: modules/lib-bash/activation-init.sh:51 msgid "Starting Home Manager activation" -msgstr "" +msgstr "Starter Home Manager aktivation" #: modules/lib-bash/activation-init.sh:55 msgid "Sanity checking Nix" -msgstr "" +msgstr "Udføre fornuft check af Nix" #: modules/lib-bash/activation-init.sh:61 msgid "This is a dry run" -msgstr "" +msgstr "Dette er en tør kørsel" #: modules/lib-bash/activation-init.sh:64 msgid "This is a live run" -msgstr "" +msgstr "Dette er en direkte kørsel" #: modules/lib-bash/activation-init.sh:69 msgid "Using Nix version: %s" -msgstr "" +msgstr "Bruger Nix version: %s" #: modules/lib-bash/activation-init.sh:72 msgid "Activation variables:" -msgstr "" +msgstr "Aktivere variable:" From 41790ba656bafc023f48ccdbbe7816d30fd52d76 Mon Sep 17 00:00:00 2001 From: David Baynard Date: Mon, 19 Sep 2022 22:19:21 +0100 Subject: [PATCH 011/233] mbsync: extend config type with list of strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some configuration options can take space separated strings; for example `SSLVersions` can be configured with multiple allowed versions. SSLVersions TLSv1.3 TLSv1.2 This can now be represented in Home Manager. SSLVersions = [ “TLSv1.3” “TLSv1.2” ]; In implementing this change, it uses oneOf for config type, as it is a cleaner way to represent the union than the nested eithers formulation. Also add SSLVersions to test lists of strings in `account.extraConfig`. --- modules/programs/mbsync-accounts.nix | 3 ++- tests/modules/programs/mbsync/mbsync-expected.conf | 1 + tests/modules/programs/mbsync/mbsync.nix | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/programs/mbsync-accounts.nix b/modules/programs/mbsync-accounts.nix index fa3f00ab..af368b9d 100644 --- a/modules/programs/mbsync-accounts.nix +++ b/modules/programs/mbsync-accounts.nix @@ -4,7 +4,8 @@ with lib; let - extraConfigType = with lib.types; attrsOf (either (either str int) bool); + extraConfigType = with lib.types; + attrsOf (oneOf [ str int bool (listOf str) ]); perAccountGroups = { name, config, ... }: { options = { diff --git a/tests/modules/programs/mbsync/mbsync-expected.conf b/tests/modules/programs/mbsync/mbsync-expected.conf index c1ca921a..17110978 100644 --- a/tests/modules/programs/mbsync/mbsync-expected.conf +++ b/tests/modules/programs/mbsync/mbsync-expected.conf @@ -57,6 +57,7 @@ CertificateFile /etc/ssl/certs/ca-certificates.crt Host imap.example.com PassCmd password-command SSLType IMAPS +SSLVersions TLSv1.3 TLSv1.2 User home.manager IMAPStore hm@example.com-remote diff --git a/tests/modules/programs/mbsync/mbsync.nix b/tests/modules/programs/mbsync/mbsync.nix index 7042760a..862e1c0e 100644 --- a/tests/modules/programs/mbsync/mbsync.nix +++ b/tests/modules/programs/mbsync/mbsync.nix @@ -21,6 +21,7 @@ with lib; accounts.email.accounts = { "hm@example.com".mbsync = { enable = true; + extraConfig.account.SSLVersions = [ "TLSv1.3" "TLSv1.2" ]; groups.inboxes = { channels = { inbox1 = { From f5e4614c1163ffe4a30cfb3cf1b76a72f69c3fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Reynier?= Date: Fri, 9 Sep 2022 09:56:07 +0200 Subject: [PATCH 012/233] yt-dlp: add `settings` option --- .github/CODEOWNERS | 1 + modules/programs/yt-dlp.nix | 49 ++++++++++++++----- tests/default.nix | 1 + tests/modules/programs/yt-dlp/default.nix | 1 + .../yt-dlp/yt-dlp-simple-config-expected | 8 +++ .../programs/yt-dlp/yt-dlp-simple-config.nix | 27 ++++++++++ 6 files changed, 75 insertions(+), 12 deletions(-) create mode 100644 tests/modules/programs/yt-dlp/default.nix create mode 100644 tests/modules/programs/yt-dlp/yt-dlp-simple-config-expected create mode 100644 tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index beb9e5eb..8eb769e9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -314,6 +314,7 @@ Makefile @thiagokokada /tests/modules/programs/xmobar @t4ccer /modules/programs/yt-dlp.nix @marsam +/tests/modules/programs/yt-dlp @marsam /modules/programs/z-lua.nix @marsam diff --git a/modules/programs/yt-dlp.nix b/modules/programs/yt-dlp.nix index 19e9c7e0..0ee80ae8 100644 --- a/modules/programs/yt-dlp.nix +++ b/modules/programs/yt-dlp.nix @@ -6,6 +6,12 @@ let cfg = config.programs.yt-dlp; + renderSettings = mapAttrsToList (name: value: + if isBool value then + if value then "--${name}" else "--no-${name}" + else + "--${name} ${toString value}"); + in { meta.maintainers = [ maintainers.marsam ]; @@ -19,29 +25,48 @@ in { description = "Package providing the yt-dlp tool."; }; - extraConfig = mkOption { - type = types.lines; - default = ""; + settings = mkOption { + type = with types; attrsOf (oneOf [ bool int str ]); + default = { }; example = literalExpression '' - --embed-thumbnail - --embed-subs - --sub-langs all - --downloader aria2c - --downloader-args aria2c:'-c -x8 -s8 -k1M' + embed-thumbnail = true; + embed-subs = true; + sub-langs = "all"; + downloader = "aria2c"; + downloader-args = "aria2c:'-c -x8 -s8 -k1M'"; ''; description = '' Configuration written to - $XDG_CONFIG_HOME/yt-dlp/config. See - + $XDG_CONFIG_HOME/yt-dlp/config. + + Options must be specified in their long form, for + example, update = true; instead of U = true;. + Short options can be specified in the extraConfig option. + See for explanation about possible values. ''; }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + example = '' + --update + -F + ''; + description = '' + Extra configuration to add to + $XDG_CONFIG_HOME/yt-dlp/config. + ''; + }; }; config = mkIf cfg.enable { home.packages = [ cfg.package ]; - xdg.configFile."yt-dlp/config" = - mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; + xdg.configFile."yt-dlp/config" = mkIf (cfg.settings != { }) { + text = concatStringsSep "\n" + (remove "" (renderSettings cfg.settings ++ [ cfg.extraConfig ])) + "\n"; + }; }; } diff --git a/tests/default.nix b/tests/default.nix index 5b173a7f..0a09e61c 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -155,6 +155,7 @@ import nmt { ./modules/programs/terminator ./modules/programs/waybar ./modules/programs/xmobar + ./modules/programs/yt-dlp ./modules/services/barrier ./modules/services/devilspie2 ./modules/services/dropbox diff --git a/tests/modules/programs/yt-dlp/default.nix b/tests/modules/programs/yt-dlp/default.nix new file mode 100644 index 00000000..4b09a9c5 --- /dev/null +++ b/tests/modules/programs/yt-dlp/default.nix @@ -0,0 +1 @@ +{ yt-dlp-simple-config = ./yt-dlp-simple-config.nix; } diff --git a/tests/modules/programs/yt-dlp/yt-dlp-simple-config-expected b/tests/modules/programs/yt-dlp/yt-dlp-simple-config-expected new file mode 100644 index 00000000..f5062dde --- /dev/null +++ b/tests/modules/programs/yt-dlp/yt-dlp-simple-config-expected @@ -0,0 +1,8 @@ +--downloader aria2c +--downloader-args aria2c:'-c -x8 -s8 -k1M' +--no-embed-subs +--embed-thumbnail +--sub-langs all +--trim-filenames 30 +--config-locations /home/user/.yt-dlp.conf + diff --git a/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix b/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix new file mode 100644 index 00000000..229f0438 --- /dev/null +++ b/tests/modules/programs/yt-dlp/yt-dlp-simple-config.nix @@ -0,0 +1,27 @@ +{ ... }: + +{ + programs.yt-dlp = { + enable = true; + settings = { + embed-thumbnail = true; + embed-subs = false; + sub-langs = "all"; + downloader = "aria2c"; + downloader-args = "aria2c:'-c -x8 -s8 -k1M'"; + trim-filenames = 30; + }; + extraConfig = '' + --config-locations /home/user/.yt-dlp.conf + ''; + }; + + test.stubs.yt-dlp = { }; + + nmt.script = '' + assertFileExists home-files/.config/yt-dlp/config + assertFileContent home-files/.config/yt-dlp/config ${ + ./yt-dlp-simple-config-expected + } + ''; +} From f17819f4f198a3973be76797aa8a9370e35c7ca6 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sun, 28 Aug 2022 21:43:14 -0300 Subject: [PATCH 013/233] fluxbox: add module --- .github/CODEOWNERS | 2 + modules/misc/news.nix | 8 ++ modules/modules.nix | 1 + modules/services/window-managers/fluxbox.nix | 127 +++++++++++++++++++ 4 files changed, 138 insertions(+) create mode 100644 modules/services/window-managers/fluxbox.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8eb769e9..57b50236 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -484,6 +484,8 @@ Makefile @thiagokokada /modules/services/window-managers/bspwm @ncfavier /tests/modules/services/window-managers/bspwm @ncfavier +/modules/services/window-managers/fluxbox.nix @AndersonTorres + /modules/services/window-managers/herbstluftwm @olmokramer /tests/modules/services/window-managers/herbstluftwm @olmokramer diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 7253b1ad..b22d7659 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -696,6 +696,14 @@ in A new module is available: 'programs.gallery-dl'. ''; } + + { + time = "2022-09-21T22:42:42+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'xsession.windowManager.fluxbox'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 2c1e6601..5b01c9ea 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -276,6 +276,7 @@ let ./services/volnoti.nix ./services/window-managers/awesome.nix ./services/window-managers/bspwm/default.nix + ./services/window-managers/fluxbox.nix ./services/window-managers/herbstluftwm.nix ./services/window-managers/i3-sway/i3.nix ./services/window-managers/i3-sway/sway.nix diff --git a/modules/services/window-managers/fluxbox.nix b/modules/services/window-managers/fluxbox.nix new file mode 100644 index 00000000..ec58faf5 --- /dev/null +++ b/modules/services/window-managers/fluxbox.nix @@ -0,0 +1,127 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.xsession.windowManager.fluxbox; + +in { + meta.maintainers = [ maintainers.AndersonTorres ]; + + options = { + xsession.windowManager.fluxbox = { + enable = mkEnableOption "Fluxbox window manager"; + + package = mkOption { + type = types.package; + default = pkgs.fluxbox; + defaultText = literalExpression "pkgs.fluxbox"; + description = "Package to use for running Fluxbox WM."; + }; + + init = mkOption { + type = types.lines; + default = ""; + description = '' + Init configuration for Fluxbox, written to + ~/.fluxbox/init. Look at the + + fluxbox + 1 manpage for details. + ''; + }; + + apps = mkOption { + type = types.lines; + default = ""; + description = '' + Apps configuration for Fluxbox, written to + ~/.fluxbox/apps. Look at the + fluxbox + 1 manpage for details. + ''; + }; + + keys = mkOption { + type = types.lines; + default = ""; + description = '' + Keyboard shortcuts configuration for Fluxbox, written to + ~/.fluxbox/keys. Look at the + fluxbox-keys + 1 manpage for details. + ''; + }; + + menu = mkOption { + type = types.lines; + default = ""; + description = '' + Menu configuration for Fluxbox, written to + ~/.fluxbox/menu. Look at the + fluxbox-menu + 1 manpage for details. + ''; + }; + + slitlist = mkOption { + type = types.lines; + default = ""; + description = '' + Slitlist configuration for Fluxbox, written to + ~/.fluxbox/slitlist. Look at the + fluxbox + 1 manpage for details. + ''; + }; + + windowmenu = mkOption { + type = types.lines; + default = ""; + description = '' + Window menu configuration for Fluxbox, written to + ~/.fluxbox/windowmenu. Look at the + fluxbox-menu + 1 + manpage for details. + ''; + }; + + extraCommandLineArgs = mkOption { + type = with types; listOf str; + default = [ ]; + example = [ "-log" "/tmp/fluxbox.log" ]; + description = '' + Extra command line arguments to pass to fluxbox. + Look at the + fluxbox + 1 manpage for details. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "xsession.windowManager.fluxbox" pkgs + platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + home.file = { + ".fluxbox/init" = mkIf (cfg.init != "") { text = cfg.init; }; + ".fluxbox/apps" = mkIf (cfg.apps != "") { text = cfg.apps; }; + ".fluxbox/keys" = mkIf (cfg.keys != "") { text = cfg.keys; }; + ".fluxbox/menu" = mkIf (cfg.menu != "") { text = cfg.menu; }; + ".fluxbox/slitlist" = mkIf (cfg.slitlist != "") { text = cfg.slitlist; }; + ".fluxbox/windowmenu" = + mkIf (cfg.windowMenu != "") { text = cfg.windowmenu; }; + }; + + xsession.windowManager.command = concatStringsSep " " + ([ "${cfg.package}/bin/fluxbox" ] + ++ escapeShellArgs (remove "" cfg.extraCommandLineArgs)); + }; +} From bd83eab6220226085c82e637931a7ae3863d9893 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Thu, 22 Sep 2022 10:39:55 +0200 Subject: [PATCH 014/233] programs.neovim: default to init.lua (#3233) We change the current logic: instead of writing an init.vim which loads lua/init-home-manager.lua, we write an init.lua that sources init.vim This commit also avoids writing any of these files if the plugins have no config. --- modules/programs/neovim.nix | 47 +++++++++++-------- tests/modules/programs/neovim/no-init.nix | 8 +++- .../modules/programs/neovim/plugin-config.vim | 1 - 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index 7123f07a..a5bcc463 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -35,10 +35,10 @@ let pluginWithConfigType = types.submodule { options = { config = mkOption { - type = types.lines; + type = types.nullOr types.lines; description = "Script to configure this plugin. The scripting language should match type."; - default = ""; + default = null; }; type = mkOption { @@ -326,7 +326,7 @@ in { defaultPlugin = { type = "viml"; plugin = null; - config = ""; + config = null; optional = false; runtime = { }; }; @@ -337,7 +337,7 @@ in { allPlugins; suppressNotVimlConfig = p: - if p.type != "viml" then p // { config = ""; } else p; + if p.type != "viml" then p // { config = null; } else p; neovimConfig = pkgs.neovimUtils.makeNeovimConfig { inherit (cfg) extraPython3Packages withPython3 withRuby viAlias vimAlias; @@ -353,26 +353,33 @@ in { programs.neovim.generatedConfigs = let grouped = lib.lists.groupBy (x: x.type) pluginsNormalized; concatConfigs = lib.concatMapStrings (p: p.config); - in mapAttrs (name: vals: concatConfigs vals) grouped; + configsOnly = lib.foldl + (acc: p: if p.config != null then acc ++ [ (p.config) ] else acc) [ ]; + in mapAttrs (name: vals: lib.concatStringsSep "\n" (configsOnly vals)) + grouped; home.packages = [ cfg.finalPackage ]; - xdg.configFile = mkMerge ( - # writes runtime - (map (x: x.runtime) pluginsNormalized) ++ [{ - "nvim/init.vim" = mkIf (neovimConfig.neovimRcContent != "") { - text = neovimConfig.neovimRcContent + lib.optionalString - (hasAttr "lua" config.programs.neovim.generatedConfigs) - "lua require('init-home-manager')"; - }; - "nvim/lua/init-home-manager.lua" = - mkIf (hasAttr "lua" config.programs.neovim.generatedConfigs) { - text = config.programs.neovim.generatedConfigs.lua; + xdg.configFile = + let hasLuaConfig = hasAttr "lua" config.programs.neovim.generatedConfigs; + in mkMerge ( + # writes runtime + (map (x: x.runtime) pluginsNormalized) ++ [{ + "nvim/init.vim" = mkIf (neovimConfig.neovimRcContent != "") { + text = neovimConfig.neovimRcContent; }; - "nvim/coc-settings.json" = mkIf cfg.coc.enable { - source = jsonFormat.generate "coc-settings.json" cfg.coc.settings; - }; - }]); + "nvim/init.lua" = let + luaRcContent = + lib.optionalString (neovimConfig.neovimRcContent != "") + "vim.cmd.source ${config.xdg.configHome}/nvim/init.vim" + + lib.optionalString hasLuaConfig + config.programs.neovim.generatedConfigs.lua; + in mkIf (luaRcContent != "") { text = luaRcContent; }; + + "nvim/coc-settings.json" = mkIf cfg.coc.enable { + source = jsonFormat.generate "coc-settings.json" cfg.coc.settings; + }; + }]); programs.neovim.finalPackage = pkgs.wrapNeovimUnstable cfg.package (neovimConfig // { diff --git a/tests/modules/programs/neovim/no-init.nix b/tests/modules/programs/neovim/no-init.nix index 3ec9b067..02dd34a0 100644 --- a/tests/modules/programs/neovim/no-init.nix +++ b/tests/modules/programs/neovim/no-init.nix @@ -12,10 +12,14 @@ with lib; withRuby = false; extraPython3Packages = (ps: with ps; [ jedi pynvim ]); + + # plugins without associated config should not trigger the creation of init.vim + plugins = with pkgs.vimPlugins; [ fugitive ({ plugin = vim-sensible; }) ]; }; nmt.script = '' - vimrc="home-files/.config/nvim/init.vim" - assertPathNotExists "$vimrc" + nvimFolder="home-files/.config/nvim" + assertPathNotExists "$nvimFolder/init.vim" + assertPathNotExists "$nvimFolder/init.lua" ''; }; } diff --git a/tests/modules/programs/neovim/plugin-config.vim b/tests/modules/programs/neovim/plugin-config.vim index 8b5f3546..8f2e1062 100644 --- a/tests/modules/programs/neovim/plugin-config.vim +++ b/tests/modules/programs/neovim/plugin-config.vim @@ -1,4 +1,3 @@ - " plugin-specific config autocmd FileType c setlocal commentstring=//\ %s autocmd FileType c setlocal comments=:// From de3758e31a3a1bc79d569f5deb5dac39791bf9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joosep=20J=C3=A4=C3=A4ger?= Date: Fri, 23 Sep 2022 11:33:17 +0000 Subject: [PATCH 015/233] neovim: fix a typo in the generated init.lua (#3252) neovim complains when having both an init.lua and an init.vim --- modules/programs/neovim.nix | 9 +++++---- tests/modules/programs/neovim/plugin-config.nix | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index a5bcc463..88683e40 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -365,13 +365,14 @@ in { in mkMerge ( # writes runtime (map (x: x.runtime) pluginsNormalized) ++ [{ - "nvim/init.vim" = mkIf (neovimConfig.neovimRcContent != "") { - text = neovimConfig.neovimRcContent; - }; + "nvim/init-home-manager.vim" = + mkIf (neovimConfig.neovimRcContent != "") { + text = neovimConfig.neovimRcContent; + }; "nvim/init.lua" = let luaRcContent = lib.optionalString (neovimConfig.neovimRcContent != "") - "vim.cmd.source ${config.xdg.configHome}/nvim/init.vim" + "vim.cmd [[source ${config.xdg.configHome}/nvim/init-home-manager.vim]]" + lib.optionalString hasLuaConfig config.programs.neovim.generatedConfigs.lua; in mkIf (luaRcContent != "") { text = luaRcContent; }; diff --git a/tests/modules/programs/neovim/plugin-config.nix b/tests/modules/programs/neovim/plugin-config.nix index 9647fb5a..843330b9 100644 --- a/tests/modules/programs/neovim/plugin-config.nix +++ b/tests/modules/programs/neovim/plugin-config.nix @@ -24,7 +24,7 @@ with lib; }; nmt.script = '' - vimrc="$TESTED/home-files/.config/nvim/init.vim" + vimrc="$TESTED/home-files/.config/nvim/init-home-manager.vim" vimrcNormalized="$(normalizeStorePaths "$vimrc")" assertFileExists "$vimrc" From 3eaadd82b8fb646a6779839c4f276b810e0354a5 Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Sat, 3 Sep 2022 14:51:29 -0400 Subject: [PATCH 016/233] maintainers: add Rosuavio --- modules/lib/maintainers.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index ab224efc..0784c8a6 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -289,6 +289,12 @@ github = "sebtm"; githubId = 17243347; }; + rosuavio = { + name = "Rosario Pulella"; + email = "RosarioPulella@gmail.com"; + github = "Rosuavio"; + githubId = 7164552; + }; rszamszur = { name = "Radosław Szamszur"; email = "radoslawszamszur@gmail.com"; From 9b91709899ddf20cbead93e4af622bd0a501dd0b Mon Sep 17 00:00:00 2001 From: Rosario Pulella Date: Sun, 25 Sep 2022 15:47:53 -0400 Subject: [PATCH 017/233] safeeyes: add module This adds a basic module for Safe Eyes based off of the one in Nixpkgs. --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 8 +++++++ modules/modules.nix | 1 + modules/services/safeeyes.nix | 44 +++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 modules/services/safeeyes.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 57b50236..15fbe8e4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -448,6 +448,8 @@ Makefile @thiagokokada /modules/services/redshift-gammastep @rycee @petabyteboy @thiagokokada /tests/modules/redshift-gammastep @thiagokokada +/modules/services/safeeyes @Rosuavio + /modules/services/screen-locker.nix @jrobsonchase @rszamszur /tests/modules/services/screen-locker @jrobsonchase @rszamszur diff --git a/modules/misc/news.nix b/modules/misc/news.nix index b22d7659..34729e85 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -704,6 +704,14 @@ in A new module is available: 'xsession.windowManager.fluxbox'. ''; } + + { + time = "2022-09-25T21:00:05+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.safeeyes'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 5b01c9ea..08c0e5d8 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -256,6 +256,7 @@ let ./services/redshift-gammastep/gammastep.nix ./services/redshift-gammastep/redshift.nix ./services/rsibreak.nix + ./services/safeeyes.nix ./services/screen-locker.nix ./services/sctd.nix ./services/spotifyd.nix diff --git a/modules/services/safeeyes.nix b/modules/services/safeeyes.nix new file mode 100644 index 00000000..15662469 --- /dev/null +++ b/modules/services/safeeyes.nix @@ -0,0 +1,44 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.safeeyes; + +in { + meta.maintainers = [ hm.maintainers.rosuavio ]; + + options = { + services.safeeyes = { + enable = mkEnableOption "The Safe Eyes OSGI service"; + + package = mkPackageOption pkgs "safeeyes" { }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "services.safeeyes" pkgs platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + systemd.user.services.safeeyes = { + Install.WantedBy = [ "graphical-session.target" ]; + + Unit = { + Description = "Safe Eyes"; + PartOf = [ "graphical-session.target" ]; + StartLimitIntervalSec = 350; + StartLimitBurst = 30; + }; + + Service = { + ExecStart = getExe pkgs.safeeyes; + Restart = "on-failure"; + RestartSec = 3; + }; + }; + }; +} From 707cb75ed33c59b58e6e03af881a833f3538d3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Lafuente?= Date: Wed, 21 Sep 2022 22:59:50 +0200 Subject: [PATCH 018/233] tmate: add module --- .github/CODEOWNERS | 3 + modules/misc/news.nix | 7 +++ modules/modules.nix | 1 + modules/programs/tmate.nix | 80 ++++++++++++++++++++++++ tests/default.nix | 1 + tests/modules/programs/tmate/default.nix | 1 + tests/modules/programs/tmate/tmate.nix | 25 ++++++++ 7 files changed, 118 insertions(+) create mode 100644 modules/programs/tmate.nix create mode 100644 tests/modules/programs/tmate/default.nix create mode 100644 tests/modules/programs/tmate/tmate.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 15fbe8e4..945e1d42 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -298,6 +298,9 @@ Makefile @thiagokokada /modules/programs/tiny.nix @kmaasrud +/modules/programs/tmate.nix @jlesquembre +/tests/modules/programs/tmate @jlesquembre + /modules/programs/topgrade.nix @msfjarvis /tests/modules/programs/topgrade @msfjarvis diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 34729e85..72448faa 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -712,6 +712,13 @@ in A new module is available: 'services.safeeyes'. ''; } + + { + time = "2022-09-25T22:22:17+00:00"; + message = '' + A new module is available: 'programs.tmate'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 08c0e5d8..e4a863a5 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -170,6 +170,7 @@ let ./programs/timidity.nix ./programs/tint2.nix ./programs/tiny.nix + ./programs/tmate.nix ./programs/tmux.nix ./programs/topgrade.nix ./programs/urxvt.nix diff --git a/modules/programs/tmate.nix b/modules/programs/tmate.nix new file mode 100644 index 00000000..6681baf6 --- /dev/null +++ b/modules/programs/tmate.nix @@ -0,0 +1,80 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.tmate; + +in { + meta.maintainers = [ maintainers.jlesquembre ]; + + options = { + programs.tmate = { + enable = mkEnableOption "tmate"; + + package = mkOption { + type = types.package; + default = pkgs.tmate; + defaultText = literalExpression "pkgs.tmate"; + example = literalExpression "pkgs.tmate"; + description = "The tmate package to install."; + }; + + host = mkOption { + type = with types; nullOr str; + default = null; + example = literalExpression "tmate.io"; + description = "Tmate server address."; + }; + + port = mkOption { + type = with types; nullOr port; + default = null; + example = 2222; + description = "Tmate server port."; + }; + + dsaFingerprint = mkOption { + type = with types; nullOr string; + default = null; + example = literalExpression + "SHA256:1111111111111111111111111111111111111111111"; + description = "Tmate server EdDSA key fingerprint."; + }; + + rsaFingerprint = mkOption { + type = with types; nullOr string; + default = null; + example = literalExpression + "SHA256:1111111111111111111111111111111111111111111"; + description = "Tmate server RSA key fingerprint."; + }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Additional content written at the end of + ~/.tmate.conf. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + home.file.".tmate.conf".text = let + conf = + optional (cfg.host != null) ''set -g tmate-server-host "${cfg.host}"'' + ++ optional (cfg.port != null) + "set -g tmate-server-port ${builtins.toString cfg.port}" + ++ optional (cfg.dsaFingerprint != null) + ''set -g tmate-server-ed25519-fingerprint "${cfg.dsaFingerprint}"'' + ++ optional (cfg.rsaFingerprint != null) + ''set -g tmate-server-rsa-fingerprint "${cfg.rsaFingerprint}"'' + ++ optional (cfg.extraConfig != "") cfg.extraConfig; + in concatStringsSep "\n" conf + "\n"; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 0a09e61c..40b82f68 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -114,6 +114,7 @@ import nmt { ./modules/programs/starship ./modules/programs/taskwarrior ./modules/programs/texlive + ./modules/programs/tmate ./modules/programs/tmux ./modules/programs/topgrade ./modules/programs/vscode diff --git a/tests/modules/programs/tmate/default.nix b/tests/modules/programs/tmate/default.nix new file mode 100644 index 00000000..c5e05d56 --- /dev/null +++ b/tests/modules/programs/tmate/default.nix @@ -0,0 +1 @@ +{ tmate = ./tmate.nix; } diff --git a/tests/modules/programs/tmate/tmate.nix b/tests/modules/programs/tmate/tmate.nix new file mode 100644 index 00000000..4beb84c1 --- /dev/null +++ b/tests/modules/programs/tmate/tmate.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: + +{ + programs.tmate = { + enable = true; + port = 222; + dsaFingerprint = "SHA256:1111111111111111111111111111111111111111111"; + extraConfig = ''set tmate-session-name "session-name"''; + }; + + test.stubs.tmate = { }; + + nmt.script = let + expectedConfig = '' + set -g tmate-server-port 222 + set -g tmate-server-ed25519-fingerprint "SHA256:1111111111111111111111111111111111111111111" + set tmate-session-name "session-name" + ''; + in '' + assertFileExists home-files/.tmate.conf + assertFileContent home-files/.tmate.conf ${ + builtins.toFile "config" expectedConfig + } + ''; +} From 9e7394523eb4f298528d457e316fc752bdf07151 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 25 Sep 2022 23:02:18 +0000 Subject: [PATCH 019/233] ci: bump DeterminateSystems/update-flake-lock from 13 to 14 Bumps [DeterminateSystems/update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) from 13 to 14. - [Release notes](https://github.com/DeterminateSystems/update-flake-lock/releases) - [Commits](https://github.com/DeterminateSystems/update-flake-lock/compare/v13...v14) --- updated-dependencies: - dependency-name: DeterminateSystems/update-flake-lock dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/update-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml index e472513a..084c1c0d 100644 --- a/.github/workflows/update-flake.yml +++ b/.github/workflows/update-flake.yml @@ -14,7 +14,7 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v17 - name: Update flake.lock - uses: DeterminateSystems/update-flake-lock@v13 + uses: DeterminateSystems/update-flake-lock@v14 with: token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} pr-labels: dependencies From 65b65ce5ef08d54bc09336fe3f35e33be487e2fe Mon Sep 17 00:00:00 2001 From: Robin Stumm Date: Mon, 26 Sep 2022 20:36:06 +0200 Subject: [PATCH 020/233] broot: use upstream defaults, allow all config options (#2644) * broot: use freeformType for config * broot: use defaults from upstream closes #2395 * broot: generate shell function * broot: add @dermetfan to CODEOWNERS * broot: rename `config` option to `settings` * broot: make example more idiomatic Co-authored-by: Nicolas Berbiche Co-authored-by: Nicolas Berbiche --- .github/CODEOWNERS | 2 +- docs/release-notes/rl-2105.adoc | 2 +- modules/programs/broot.nix | 372 +++++++++++-------------- tests/modules/programs/broot/broot.nix | 33 ++- 4 files changed, 186 insertions(+), 223 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 945e1d42..6cd830fe 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -84,7 +84,7 @@ Makefile @thiagokokada /modules/programs/bottom.nix @polykernel /tests/modules/programs/bottom @polykernel -/modules/programs/broot.nix @aheaume +/modules/programs/broot.nix @aheaume @dermetfan /modules/programs/btop.nix @GaetanLepage /tests/modules/programs/btop.nix @GaetanLepage diff --git a/docs/release-notes/rl-2105.adoc b/docs/release-notes/rl-2105.adoc index 7fcfb268..ed94f888 100644 --- a/docs/release-notes/rl-2105.adoc +++ b/docs/release-notes/rl-2105.adoc @@ -8,7 +8,7 @@ The 21.05 release branch became the stable branch in May, 2021. This release has the following notable changes: -* The <> option is now a list rather than an +* The `opt-programs.broot.verbs` option is now a list rather than an attribute set. To migrate, move the keys of the attrset into the list items' `invocation` keys. For example, + diff --git a/modules/programs/broot.nix b/modules/programs/broot.nix index f37470d7..5197c848 100644 --- a/modules/programs/broot.nix +++ b/modules/programs/broot.nix @@ -8,15 +8,160 @@ let tomlFormat = pkgs.formats.toml { }; - brootConf = { - verbs = cfg.verbs; - skin = cfg.skin; - modal = cfg.modal; + settingsModule = { + freeformType = tomlFormat.type; + + options = { + modal = mkEnableOption "modal (vim) mode"; + + verbs = mkOption { + type = with types; listOf (attrsOf (either bool str)); + default = [ ]; + example = literalExpression '' + [ + { invocation = "p"; execution = ":parent"; } + { invocation = "edit"; shortcut = "e"; execution = "$EDITOR {file}" ; } + { invocation = "create {subpath}"; execution = "$EDITOR {directory}/{subpath}"; } + { invocation = "view"; execution = "less {file}"; } + { + invocation = "blop {name}\\.{type}"; + execution = "mkdir {parent}/{type} && ''${pkgs.neovim}/bin/nvim {parent}/{type}/{name}.{type}"; + from_shell = true; + } + ] + ''; + description = '' + Define new verbs. For more information, see + . + + The possible attributes are: + + + + + + invocation (optional) + how the verb is called by the user, with placeholders for arguments + + + execution (mandatory) + how the verb is executed + + + key (optional) + a keyboard key triggering execution + + + shortcut (optional) + an alternate way to call the verb (without + the arguments part) + + + leave_broot (optional) + whether to quit broot on execution + (default: true) + + + from_shell (optional) + whether the verb must be executed from the + parent shell (default: + false) + + + ''; + }; + + skin = mkOption { + type = types.attrsOf types.str; + default = { }; + example = literalExpression '' + { + status_normal_fg = "grayscale(18)"; + status_normal_bg = "grayscale(3)"; + status_error_fg = "red"; + status_error_bg = "yellow"; + tree_fg = "red"; + selected_line_bg = "grayscale(7)"; + permissions_fg = "grayscale(12)"; + size_bar_full_bg = "red"; + size_bar_void_bg = "black"; + directory_fg = "lightyellow"; + input_fg = "cyan"; + flag_value_fg = "lightyellow"; + table_border_fg = "red"; + code_fg = "lightyellow"; + } + ''; + description = '' + Color configuration. + + Complete list of keys (expected to change before the v1 of broot): + + + char_match + code + directory + exe + file + file_error + flag_label + flag_value + input + link + permissions + selected_line + size_bar_full + size_bar_void + size_text + spinner + status_error + status_normal + table_border + tree + unlisted + + + + Add _fg for a foreground color and + _bg for a background colors. + ''; + }; + }; }; + shellInit = shell: + # Using mkAfter to make it more likely to appear after other + # manipulations of the prompt. + mkAfter '' + source ${ + pkgs.runCommand "br.${shell}" { nativeBuildInputs = [ cfg.package ]; } + "broot --print-shell-function ${shell} > $out" + } + ''; in { meta.maintainers = [ hm.maintainers.aheaume ]; + imports = [ + (mkRenamedOptionModule [ "programs" "broot" "modal" ] [ + "programs" + "broot" + "settings" + "modal" + ]) + (mkRenamedOptionModule [ "programs" "broot" "verbs" ] [ + "programs" + "broot" + "settings" + "verbs" + ]) + (mkRenamedOptionModule [ "programs" "broot" "skin" ] [ + "programs" + "broot" + "settings" + "skin" + ]) + ]; + options.programs.broot = { enable = mkEnableOption "Broot, a better way to navigate directories"; @@ -44,83 +189,6 @@ in { ''; }; - modal = mkEnableOption "modal (vim) mode"; - - verbs = mkOption { - type = with types; listOf (attrsOf (either bool str)); - default = [ - { - invocation = "p"; - execution = ":parent"; - } - { - invocation = "edit"; - shortcut = "e"; - execution = "$EDITOR {file}"; - } - { - invocation = "create {subpath}"; - execution = "$EDITOR {directory}/{subpath}"; - } - { - invocation = "view"; - execution = "less {file}"; - } - ]; - example = literalExpression '' - [ - { invocation = "p"; execution = ":parent"; } - { invocation = "edit"; shortcut = "e"; execution = "$EDITOR {file}" ; } - { invocation = "create {subpath}"; execution = "$EDITOR {directory}/{subpath}"; } - { invocation = "view"; execution = "less {file}"; } - { - invocation = "blop {name}\\.{type}"; - execution = "/bin/mkdir {parent}/{type} && /usr/bin/nvim {parent}/{type}/{name}.{type}"; - from_shell = true; - } - ] - ''; - description = '' - Define new verbs. For more information, see - . - - The possible attributes are: - - - - - - invocation (optional) - how the verb is called by the user, with placeholders for arguments - - - execution (mandatory) - how the verb is executed - - - key (optional) - a keyboard key triggering execution - - - shortcut (optional) - an alternate way to call the verb (without - the arguments part) - - - leave_broot (optional) - whether to quit broot on execution - (default: true) - - - from_shell (optional) - whether the verb must be executed from the - parent shell (default: - false) - - - ''; - }; - package = mkOption { type = types.package; default = pkgs.broot; @@ -128,60 +196,10 @@ in { description = "Package providing broot"; }; - skin = mkOption { - type = types.attrsOf types.str; + settings = mkOption { + type = types.submodule settingsModule; default = { }; - example = literalExpression '' - { - status_normal_fg = "grayscale(18)"; - status_normal_bg = "grayscale(3)"; - status_error_fg = "red"; - status_error_bg = "yellow"; - tree_fg = "red"; - selected_line_bg = "grayscale(7)"; - permissions_fg = "grayscale(12)"; - size_bar_full_bg = "red"; - size_bar_void_bg = "black"; - directory_fg = "lightyellow"; - input_fg = "cyan"; - flag_value_fg = "lightyellow"; - table_border_fg = "red"; - code_fg = "lightyellow"; - } - ''; - description = '' - Color configuration. - - Complete list of keys (expected to change before the v1 of broot): - - - char_match - code - directory - exe - file - file_error - flag_label - flag_value - input - link - permissions - selected_line - size_bar_full - size_bar_void - size_text - spinner - status_error - status_normal - table_border - tree - unlisted - - - - Add _fg for a foreground color and - _bg for a background colors. - ''; + description = "Verbatim config entries"; }; }; @@ -189,88 +207,20 @@ in { home.packages = [ cfg.package ]; xdg.configFile."broot/conf.toml".source = - tomlFormat.generate "broot-config" brootConf; + tomlFormat.generate "broot-config" cfg.settings; # Dummy file to prevent broot from trying to reinstall itself xdg.configFile."broot/launcher/installed-v1".text = ""; - programs.bash.initExtra = mkIf cfg.enableBashIntegration ( - # Using mkAfter to make it more likely to appear after other - # manipulations of the prompt. - mkAfter '' - # This script was automatically generated by the broot function - # More information can be found in https://github.com/Canop/broot - # This function starts broot and executes the command - # it produces, if any. - # It's needed because some shell commands, like `cd`, - # have no useful effect if executed in a subshell. - function br { - f=$(mktemp) - ( - set +e - broot --outcmd "$f" "$@" - code=$? - if [ "$code" != 0 ]; then - rm -f "$f" - exit "$code" - fi - ) - code=$? - if [ "$code" != 0 ]; then - return "$code" - fi - d=$(cat "$f") - rm -f "$f" - eval "$d" - } - ''); + programs.broot.settings = builtins.fromJSON (builtins.readFile + (pkgs.runCommand "default-conf.json" { + nativeBuildInputs = [ pkgs.hjson ]; + } "hjson -c ${cfg.package.src}/resources/default-conf.hjson > $out")); - programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' - # This script was automatically generated by the broot function - # More information can be found in https://github.com/Canop/broot - # This function starts broot and executes the command - # it produces, if any. - # It's needed because some shell commands, like `cd`, - # have no useful effect if executed in a subshell. - function br { - f=$(mktemp) - ( - set +e - broot --outcmd "$f" "$@" - code=$? - if [ "$code" != 0 ]; then - rm -f "$f" - exit "$code" - fi - ) - code=$? - if [ "$code" != 0 ]; then - return "$code" - fi - d=$(cat "$f") - rm -f "$f" - eval "$d" - } - ''; + programs.bash.initExtra = mkIf cfg.enableBashIntegration (shellInit "bash"); - programs.fish.shellInit = mkIf cfg.enableFishIntegration '' - # This script was automatically generated by the broot function - # More information can be found in https://github.com/Canop/broot - # This function starts broot and executes the command - # it produces, if any. - # It's needed because some shell commands, like `cd`, - # have no useful effect if executed in a subshell. - function br - set f (mktemp) - broot --outcmd $f $argv - if test $status -ne 0 - rm -f "$f" - return "$code" - end - set d (cat "$f") - rm -f "$f" - eval "$d" - end - ''; + programs.zsh.initExtra = mkIf cfg.enableZshIntegration (shellInit "zsh"); + + programs.fish.shellInit = mkIf cfg.enableFishIntegration (shellInit "fish"); }; } diff --git a/tests/modules/programs/broot/broot.nix b/tests/modules/programs/broot/broot.nix index a2dddca3..58a28108 100644 --- a/tests/modules/programs/broot/broot.nix +++ b/tests/modules/programs/broot/broot.nix @@ -6,33 +6,46 @@ with lib; config = { programs.broot = { enable = true; - modal = true; + settings.modal = true; }; - test.stubs.broot = { }; - nmt.script = '' assertFileExists home-files/.config/broot/conf.toml assertFileContent home-files/.config/broot/conf.toml ${ pkgs.writeText "broot.expected" '' modal = true + show_selection_mark = true [[verbs]] - execution = ":parent" - invocation = "p" - - [[verbs]] - execution = "$EDITOR {file}" + execution = "$EDITOR +{line} {file}" invocation = "edit" + leave_broot = false shortcut = "e" [[verbs]] execution = "$EDITOR {directory}/{subpath}" invocation = "create {subpath}" + leave_broot = false [[verbs]] - execution = "less {file}" - invocation = "view" + execution = "git difftool -y {file}" + invocation = "git_diff" + leave_broot = false + shortcut = "gd" + + [[verbs]] + auto_exec = false + execution = "cp -r {file} {parent}/{file-stem}-{version}{file-dot-extension}" + invocation = "backup {version}" + key = "ctrl-b" + leave_broot = false + + [[verbs]] + execution = "$SHELL" + invocation = "terminal" + key = "ctrl-t" + leave_broot = false + set_working_dir = true [skin] '' From 1f5ef2bb419a327fae28a83b50fab50959132c24 Mon Sep 17 00:00:00 2001 From: Chan Siu Man <25467044+Chan-Siu-Man@users.noreply.github.com> Date: Tue, 27 Sep 2022 03:19:02 -0700 Subject: [PATCH 021/233] broot: fix config file location (#3273) At commit [5666e6b9](https://github.com/Canop/broot/commit/5666e6b9fb827c07c6c21fbe0fc60f538e1aaf60), broot refactored the content of the file `/resources/default-conf.hjson` into multiple files under the directory `/resources/default-conf`, using [`imports`](https://github.com/Canop/broot/blob/5666e6b9fb827c07c6c21fbe0fc60f538e1aaf60/resources/default-conf/conf.hjson#L152-L165) to refer to other configurations. This refactoring is effective since version 1.14.0 of broot. After this refactoring, in `xdg.configFile.broot` (which defaults to `~/.config/broot`): - we need to copy all potentially referenced files (all files under `resources/default-conf`), - except we need to leave out `conf.hjson` which conflicts with the `conf.toml` generated by home-manager (because broot [accepts both conf.toml and conf.hjson](https://dystroy.org/broot/conf_file/)) To implement this, we use `symlinkJoin` to create the content of `xdg.configFile.broot` by merging multiple sources. --- modules/programs/broot.nix | 27 +++++++++++++++++---- tests/modules/programs/broot/broot.nix | 33 ++------------------------ 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/modules/programs/broot.nix b/modules/programs/broot.nix index 5197c848..d78074ef 100644 --- a/modules/programs/broot.nix +++ b/modules/programs/broot.nix @@ -206,16 +206,33 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - xdg.configFile."broot/conf.toml".source = - tomlFormat.generate "broot-config" cfg.settings; + xdg.configFile."broot" = { + recursive = true; + source = pkgs.symlinkJoin { + name = "xdg.configFile.broot"; + paths = [ + (pkgs.writeTextDir "conf.toml" (builtins.readFile + (tomlFormat.generate "broot-config" cfg.settings))) - # Dummy file to prevent broot from trying to reinstall itself - xdg.configFile."broot/launcher/installed-v1".text = ""; + # Copy all files under /resources/default-conf + "${cfg.package.src}/resources/default-conf" + + # Dummy file to prevent broot from trying to reinstall itself + (pkgs.writeTextDir "launcher/installed-v1" "") + ]; + + # Remove conf.hjson, whose content has been merged into programs.broot.settings + postBuild = '' + rm $out/conf.hjson + ''; + }; + }; programs.broot.settings = builtins.fromJSON (builtins.readFile (pkgs.runCommand "default-conf.json" { nativeBuildInputs = [ pkgs.hjson ]; - } "hjson -c ${cfg.package.src}/resources/default-conf.hjson > $out")); + } + "hjson -c ${cfg.package.src}/resources/default-conf/conf.hjson > $out")); programs.bash.initExtra = mkIf cfg.enableBashIntegration (shellInit "bash"); diff --git a/tests/modules/programs/broot/broot.nix b/tests/modules/programs/broot/broot.nix index 58a28108..440691cf 100644 --- a/tests/modules/programs/broot/broot.nix +++ b/tests/modules/programs/broot/broot.nix @@ -13,39 +13,10 @@ with lib; assertFileExists home-files/.config/broot/conf.toml assertFileContent home-files/.config/broot/conf.toml ${ pkgs.writeText "broot.expected" '' + imports = ["verbs.hjson", {file = "dark-blue-skin.hjson", luma = ["dark", "unknown"]}, {file = "white-skin.hjson", luma = "light"}] modal = true show_selection_mark = true - - [[verbs]] - execution = "$EDITOR +{line} {file}" - invocation = "edit" - leave_broot = false - shortcut = "e" - - [[verbs]] - execution = "$EDITOR {directory}/{subpath}" - invocation = "create {subpath}" - leave_broot = false - - [[verbs]] - execution = "git difftool -y {file}" - invocation = "git_diff" - leave_broot = false - shortcut = "gd" - - [[verbs]] - auto_exec = false - execution = "cp -r {file} {parent}/{file-stem}-{version}{file-dot-extension}" - invocation = "backup {version}" - key = "ctrl-b" - leave_broot = false - - [[verbs]] - execution = "$SHELL" - invocation = "terminal" - key = "ctrl-t" - leave_broot = false - set_working_dir = true + verbs = [] [skin] '' From 6dc8a43f397c92afbc3f771385ac803d96d5eeb5 Mon Sep 17 00:00:00 2001 From: aameen-tulip <98349328+aameen-tulip@users.noreply.github.com> Date: Tue, 27 Sep 2022 00:07:03 -0500 Subject: [PATCH 022/233] flake: list deprecated args in throw The use of `throwIf` was retained on the off chance that someone intentionally overrides it. --- flake.nix | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index a4e570e9..2a1af863 100644 --- a/flake.nix +++ b/flake.nix @@ -45,27 +45,37 @@ , configuration ? null, extraModules ? null, stateVersion ? null , username ? null, homeDirectory ? null, system ? null }@args: let - throwForRemovedArg = v: - lib.throwIf (v != null) '' - The 'homeManagerConfiguration' arguments + msgForRemovedArg = '' + The 'homeManagerConfiguration' arguments - - 'configuration', - - 'username', - - 'homeDirectory' - - 'stateVersion', - - 'extraModules', and - - 'system' + - 'configuration', + - 'username', + - 'homeDirectory' + - 'stateVersion', + - 'extraModules', and + - 'system' - have been removed. Instead use the arguments 'pkgs' and - 'modules'. See the 22.11 release notes for more. - ''; + have been removed. Instead use the arguments 'pkgs' and + 'modules'. See the 22.11 release notes for more. + ''; + + throwForRemovedArgs = v: + let + used = builtins.filter (n: (args.${n} or null) != null) [ + "configuration" + "username" + "homeDirectory" + "stateVersion" + "extraModules" + "system" + ]; + msg = msgForRemovedArg + '' + + + Deprecated args passed: '' + + builtins.concatStringsSep " " used; + in lib.throwIf (used != [ ]) msg v; - throwForRemovedArgs = throwForRemovedArg configuration # \ - throwForRemovedArg username # \ - throwForRemovedArg homeDirectory # \ - throwForRemovedArg stateVersion # \ - throwForRemovedArg extraModules # \ - throwForRemovedArg system; in throwForRemovedArgs (import ./modules { inherit pkgs lib check extraSpecialArgs; configuration = { ... }: { From 28334988dbd613012b1b085c37d144889f8e2abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Thu, 29 Sep 2022 11:34:00 +0200 Subject: [PATCH 023/233] picom: use `types.numbers.between` Mirrors https://github.com/NixOS/nixpkgs/commit/77307fcff86d3e56285b006b3e9204c6b45d90f0 --- modules/services/picom.nix | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/modules/services/picom.nix b/modules/services/picom.nix index a279c155..75ed6a72 100644 --- a/modules/services/picom.nix +++ b/modules/services/picom.nix @@ -16,16 +16,6 @@ let description = "pair of ${x.description}"; }; - floatBetween = a: b: - with types; - let - # toString prints floats with hardcoded high precision - floatToString = f: toJSON f; - in addCheck float (x: x <= b && x >= a) // { - description = "a floating point number in " - + "range [${floatToString a}, ${floatToString b}]"; - }; - mkDefaultAttrs = mapAttrs (n: v: mkDefault v); # Basically a tinkered lib.generators.mkKeyValueDefault @@ -96,7 +86,7 @@ in { }; fadeSteps = mkOption { - type = pairOf (floatBetween 1.0e-2 1); + type = pairOf (types.numbers.between 1.0e-2 1); default = [ 2.8e-2 3.0e-2 ]; example = [ 4.0e-2 4.0e-2 ]; description = '' @@ -132,7 +122,7 @@ in { }; shadowOpacity = mkOption { - type = floatBetween 0 1; + type = types.numbers.between 0 1; default = 0.75; example = 0.8; description = '' @@ -151,7 +141,7 @@ in { }; activeOpacity = mkOption { - type = floatBetween 0 1; + type = types.numbers.between 0 1; default = 1.0; example = 0.8; description = '' @@ -160,7 +150,7 @@ in { }; inactiveOpacity = mkOption { - type = floatBetween 0.1 1; + type = types.numbers.between 0.1 1; default = 1.0; example = 0.8; description = '' @@ -169,7 +159,7 @@ in { }; menuOpacity = mkOption { - type = floatBetween 0 1; + type = types.numbers.between 0 1; default = 1.0; example = 0.8; description = '' From 68ea28d330f2e1ef3fb2c653da42b558f14a1efd Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Wed, 28 Sep 2022 13:07:39 -0600 Subject: [PATCH 024/233] kdeconnect: change package Specifically, use pkgs.kdeconnect instead of pkgs.plasma5Packages.kdeconnect-kde. Closes #3274 Signed-off-by: Sumner Evans --- modules/services/kdeconnect.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/kdeconnect.nix b/modules/services/kdeconnect.nix index 82de1f0e..87c57c4e 100644 --- a/modules/services/kdeconnect.nix +++ b/modules/services/kdeconnect.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.services.kdeconnect; - package = pkgs.kdeconnect; + package = pkgs.plasma5Packages.kdeconnect-kde; in { meta.maintainers = [ maintainers.adisbladis ]; From 9da6c0232e22b7fff358db633f6bbc8f97a891e1 Mon Sep 17 00:00:00 2001 From: mtths Date: Wed, 28 Sep 2022 12:00:46 +0200 Subject: [PATCH 025/233] docs: explain how to enable flakes on NixOS Since `nix.conf` is generated when using NixOS, it cannot be edited. Instead we add the instructions described by Xe in https://xeiaso.net/blog/nix-flakes-1-2022-02-21 --- docs/nix-flakes.adoc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/nix-flakes.adoc b/docs/nix-flakes.adoc index 34b8b0f0..2a0e1da3 100644 --- a/docs/nix-flakes.adoc +++ b/docs/nix-flakes.adoc @@ -13,12 +13,24 @@ The support is still experimental and may change in backwards incompatible ways. * Enable experimental features `nix-command` and `flakes`. + -Either set in `nix.conf` +** When using NixOS, add the following to your `configuration.nix` and rebuild your system. ++ +[source,nix] +nix = { + package = pkgs.nixFlakes; + extraOptions = '' + experimental-features = nix-command flakes + ''; +}; ++ +** If you are not using NixOS, add the following to `nix.conf` (located at `~/.config/nix/` or `/etc/nix/nix.conf`). + [source,bash] experimental-features = nix-command flakes + -or pass them to `nix` and `home-manager` by +You may need to restart the Nix daemon with, for example, `sudo systemctl restart nix-daemon.service`. ++ +** Alternatively, you can enable flakes on a per-command basis with the following additional flags to `nix` and `home-manager`: + [source,console] ---- From 864ff685fe6443101a0a8f3950d21bcb4330e56a Mon Sep 17 00:00:00 2001 From: Liam Petrie Date: Sat, 10 Sep 2022 19:28:38 -0700 Subject: [PATCH 026/233] lib: add two new gvariant types Add GVariant variant and dictionary entry types --- docs/writing-modules.adoc | 8 ++++++++ modules/lib/gvariant.nix | 21 +++++++++++++++++++-- modules/lib/types.nix | 4 ++++ tests/lib/types/gvariant-merge.nix | 8 ++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/docs/writing-modules.adoc b/docs/writing-modules.adoc index 0f3336ff..d8d69e82 100644 --- a/docs/writing-modules.adoc +++ b/docs/writing-modules.adoc @@ -167,9 +167,11 @@ Builds a GVariant array containing the given list of elements, where each elemen - `hm.gvariant.type.int64` - `hm.gvariant.type.uint64` - `hm.gvariant.type.double` +- `hm.gvariant.type.variant` - `hm.gvariant.type.arrayOf type` - `hm.gvariant.type.maybeOf type` - `hm.gvariant.type.tupleOf types` +- `hm.gvariant.type.dictionaryEntryOf types` -- + where `type` and `types` are themselves a type and list of types, respectively. @@ -185,3 +187,9 @@ Builds a GVariant maybe value containing the given GVariant element. + `hm.gvariant.mkTuple elements`::: Builds a GVariant tuple containing the given list of elements, where each element is a GVariant value. ++ +`hm.gvariant.mkVariant element`::: +Builds a GVariant variant which contains the value of a GVariant element. ++ +`hm.gvariant.mkDictionaryEntry elements`::: +Builds a GVariant dictionary entry containing the given list of elements, where each element is a GVariant value. diff --git a/modules/lib/gvariant.nix b/modules/lib/gvariant.nix index 7c4ca5b0..bbb97c64 100644 --- a/modules/lib/gvariant.nix +++ b/modules/lib/gvariant.nix @@ -20,6 +20,7 @@ let arrayOf = t: "a${t}"; maybeOf = t: "m${t}"; tupleOf = ts: "(${concatStrings ts})"; + dictionaryEntryOf = ts: "{${concatStrings ts}}"; string = "s"; boolean = "b"; uchar = "y"; @@ -30,6 +31,7 @@ let int64 = "x"; uint64 = "t"; double = "d"; + variant = "v"; }; # Returns the GVariant type of a given Nix value. If no type can be @@ -74,13 +76,13 @@ in rec { isGVariant = v: v._type or "" == "gvariant"; isArray = hasPrefix "a"; + isDictionaryEntry = hasPrefix "{"; isMaybe = hasPrefix "m"; isTuple = hasPrefix "("; # Returns the GVariant value that most closely matches the given Nix # value. If no GVariant value can be found then `null` is returned. - # - # No support for dictionaries, maybe types, or variants. + mkValue = v: if builtins.isBool v then mkBoolean v @@ -105,6 +107,21 @@ in rec { mkEmptyArray = elemType: mkArray elemType [ ]; + mkVariant = elem: + let gvarElem = mkValue elem; + in mkPrimitive type.variant gvarElem // { + __toString = self: "@${self.type} <${toString self.value}>"; + }; + + mkDictionaryEntry = elems: + let + gvarElems = map mkValue elems; + dictionaryType = type.dictionaryEntryOf (map (e: e.type) gvarElems); + in mkPrimitive dictionaryType gvarElems // { + __toString = self: + "@${self.type} {${concatMapStringsSep "," toString self.value}}"; + }; + mkNothing = elemType: mkMaybe elemType null; mkJust = elem: let gvarElem = mkValue elem; in mkMaybe gvarElem.type gvarElem; diff --git a/modules/lib/types.nix b/modules/lib/types.nix index d2ed24a3..de741b1e 100644 --- a/modules/lib/types.nix +++ b/modules/lib/types.nix @@ -95,6 +95,10 @@ in rec { mergeOneOption loc defs else if gvar.isMaybe sharedDefType && allChecked then mergeOneOption loc defs + else if gvar.isDictionaryEntry sharedDefType && allChecked then + mergeOneOption loc defs + else if gvar.type.variant == sharedDefType && allChecked then + mergeOneOption loc defs else if gvar.type.string == sharedDefType && allChecked then types.str.merge loc defs else if gvar.type.double == sharedDefType && allChecked then diff --git a/tests/lib/types/gvariant-merge.nix b/tests/lib/types/gvariant-merge.nix index c4de6827..5a04848a 100644 --- a/tests/lib/types/gvariant-merge.nix +++ b/tests/lib/types/gvariant-merge.nix @@ -50,6 +50,11 @@ in { { maybe1 = mkNothing type.string; } { maybe2 = mkJust (mkUint32 4); } + + { variant1 = mkVariant "foo"; } + { variant2 = mkVariant 42; } + + { dictionaryEntry = mkDictionaryEntry [ 1 [ "foo" ] ]; } ]; home.file."result.txt".text = let @@ -65,6 +70,7 @@ in { array1 = @as ['one','two'] array2 = @au [1,2] bool = true + dictionaryEntry = @{ias} {1,@as ['foo']} emptyArray1 = @as [] emptyArray2 = @au [] escapedString = '\'\\\n' @@ -79,6 +85,8 @@ in { uint16 = @q 42 uint32 = @u 42 uint64 = @t 42 + variant1 = @v <'foo'> + variant2 = @v <42> '' } ''; From e7be7c468842944a9877ad6ff948afd0d1cb2dbe Mon Sep 17 00:00:00 2001 From: arjan-s Date: Fri, 30 Sep 2022 18:53:39 +0200 Subject: [PATCH 027/233] pls: add module (#3285) --- .github/CODEOWNERS | 3 +++ modules/misc/news.nix | 7 +++++ modules/modules.nix | 1 + modules/programs/pls.nix | 36 ++++++++++++++++++++++++++ tests/default.nix | 1 + tests/modules/programs/pls/bash.nix | 29 +++++++++++++++++++++ tests/modules/programs/pls/default.nix | 5 ++++ tests/modules/programs/pls/fish.nix | 36 ++++++++++++++++++++++++++ tests/modules/programs/pls/zsh.nix | 32 +++++++++++++++++++++++ 9 files changed, 150 insertions(+) create mode 100644 modules/programs/pls.nix create mode 100644 tests/modules/programs/pls/bash.nix create mode 100644 tests/modules/programs/pls/default.nix create mode 100644 tests/modules/programs/pls/fish.nix create mode 100644 tests/modules/programs/pls/zsh.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6cd830fe..281fc006 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -243,6 +243,9 @@ Makefile @thiagokokada /modules/programs/piston-cli.nix @ethancedwards8 +/modules/programs/pls.nix @arjan-s +/tests/modules/programs/pls @arjan-s + /modules/programs/powerline-go.nix @DamienCassou /modules/programs/pubs.nix @loicreynier diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 72448faa..e0a313e7 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -719,6 +719,13 @@ in A new module is available: 'programs.tmate'. ''; } + + { + time = "2022-09-29T13:43:02+00:00"; + message = '' + A new module is available: 'programs.pls'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index e4a863a5..4f3b3fde 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -142,6 +142,7 @@ let ./programs/pidgin.nix ./programs/pistol.nix ./programs/piston-cli.nix + ./programs/pls.nix ./programs/powerline-go.nix ./programs/pubs.nix ./programs/pylint.nix diff --git a/modules/programs/pls.nix b/modules/programs/pls.nix new file mode 100644 index 00000000..1c5af378 --- /dev/null +++ b/modules/programs/pls.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.pls; + + aliases = { + ls = "${cfg.package}/bin/pls"; + ll = + "${cfg.package}/bin/pls -d perms -d user -d group -d size -d mtime -d git"; + }; + +in { + meta.maintainers = [ hm.maintainers.kalhauge ]; + + options.programs.pls = { + enable = + mkEnableOption "pls, a modern replacement for ls"; + + package = mkPackageOption pkgs "pls" { }; + + enableAliases = mkEnableOption "recommended pls aliases"; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + programs.bash.shellAliases = mkIf cfg.enableAliases aliases; + + programs.fish.shellAliases = mkIf cfg.enableAliases aliases; + + programs.zsh.shellAliases = mkIf cfg.enableAliases aliases; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 40b82f68..da7f539e 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -102,6 +102,7 @@ import nmt { ./modules/programs/pandoc ./modules/programs/pet ./modules/programs/pistol + ./modules/programs/pls ./modules/programs/powerline-go ./modules/programs/pubs ./modules/programs/qutebrowser diff --git a/tests/modules/programs/pls/bash.nix b/tests/modules/programs/pls/bash.nix new file mode 100644 index 00000000..d6fff5f4 --- /dev/null +++ b/tests/modules/programs/pls/bash.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs = { + bash.enable = true; + + pls = { + enable = true; + enableAliases = true; + package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; + }; + }; + + test.stubs.pls = { }; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileContains \ + home-files/.bashrc \ + "alias ls='@pls@/bin/pls'" + assertFileContains \ + home-files/.bashrc \ + "alias ll='@pls@/bin/pls -d perms -d user -d group -d size -d mtime -d git'" + ''; + }; +} diff --git a/tests/modules/programs/pls/default.nix b/tests/modules/programs/pls/default.nix new file mode 100644 index 00000000..fe80aad5 --- /dev/null +++ b/tests/modules/programs/pls/default.nix @@ -0,0 +1,5 @@ +{ + pls-bash = ./bash.nix; + pls-fish = ./fish.nix; + pls-zsh = ./zsh.nix; +} diff --git a/tests/modules/programs/pls/fish.nix b/tests/modules/programs/pls/fish.nix new file mode 100644 index 00000000..f4b94b73 --- /dev/null +++ b/tests/modules/programs/pls/fish.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs = { + fish.enable = true; + + pls = { + enable = true; + enableAliases = true; + package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; + }; + }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + mkForce (builtins.toFile "empty" ""); + + test.stubs = { + pls = { }; + fish = { }; + }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileContains \ + home-files/.config/fish/config.fish \ + "alias ls '@pls@/bin/pls'" + assertFileContains \ + home-files/.config/fish/config.fish \ + "alias ll '@pls@/bin/pls -d perms -d user -d group -d size -d mtime -d git'" + ''; + }; +} diff --git a/tests/modules/programs/pls/zsh.nix b/tests/modules/programs/pls/zsh.nix new file mode 100644 index 00000000..f3bcbf2a --- /dev/null +++ b/tests/modules/programs/pls/zsh.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs = { + zsh.enable = true; + + pls = { + enable = true; + enableAliases = true; + package = config.lib.test.mkStubPackage { outPath = "@pls@"; }; + }; + }; + + test.stubs = { + pls = { }; + zsh = { }; + }; + + nmt.script = '' + assertFileExists home-files/.zshrc + assertFileContains \ + home-files/.zshrc \ + "alias ls='@pls@/bin/pls'" + assertFileContains \ + home-files/.zshrc \ + "alias ll='@pls@/bin/pls -d perms -d user -d group -d size -d mtime -d git'" + ''; + }; +} From a053da0f22a05ceda845c824cf964077515c7669 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Fri, 30 Sep 2022 13:54:55 -0300 Subject: [PATCH 028/233] fluxbox: use mkPackageOption instead of mkOption (#3286) --- modules/services/window-managers/fluxbox.nix | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/services/window-managers/fluxbox.nix b/modules/services/window-managers/fluxbox.nix index ec58faf5..a41b97fc 100644 --- a/modules/services/window-managers/fluxbox.nix +++ b/modules/services/window-managers/fluxbox.nix @@ -13,12 +13,7 @@ in { xsession.windowManager.fluxbox = { enable = mkEnableOption "Fluxbox window manager"; - package = mkOption { - type = types.package; - default = pkgs.fluxbox; - defaultText = literalExpression "pkgs.fluxbox"; - description = "Package to use for running Fluxbox WM."; - }; + package = mkPackageOption pkgs "fluxbox" { }; init = mkOption { type = types.lines; From 5c5a5b9b45ee92995909b7944eefc4284af93849 Mon Sep 17 00:00:00 2001 From: superherointj <5861043+superherointj@users.noreply.github.com> Date: Mon, 26 Sep 2022 19:38:57 -0300 Subject: [PATCH 029/233] urxvt: fix package name --- modules/programs/urxvt.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/urxvt.nix b/modules/programs/urxvt.nix index 905e14c1..545a1e7f 100644 --- a/modules/programs/urxvt.nix +++ b/modules/programs/urxvt.nix @@ -12,8 +12,8 @@ in { package = mkOption { type = types.package; - default = pkgs.rxvt_unicode; - defaultText = literalExpression "pkgs.rxvt_unicode"; + default = pkgs.rxvt-unicode; + defaultText = literalExpression "pkgs.rxvt-unicode"; description = "rxvt-unicode package to install."; }; From 9727190b804f690c8590bbf191598439a35b0877 Mon Sep 17 00:00:00 2001 From: Vanilla Date: Wed, 28 Sep 2022 08:59:34 +0800 Subject: [PATCH 030/233] mangohud: fix moved link of config file PR #3278 --- modules/programs/mangohud.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/mangohud.nix b/modules/programs/mangohud.nix index c41d5003..f095e073 100644 --- a/modules/programs/mangohud.nix +++ b/modules/programs/mangohud.nix @@ -56,7 +56,7 @@ in { description = '' Configuration written to $XDG_CONFIG_HOME/MangoHud/MangoHud.conf. See - + for the default configuration. ''; }; @@ -75,7 +75,7 @@ in { Sets MangoHud settings per application. Configuration written to $XDG_CONFIG_HOME/MangoHud/{application_name}.conf. See - + for the default configuration. ''; }; From 7a3384c7969f50e6e3799f8d1c7817b698dd77d3 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 30 Sep 2022 22:27:35 +0200 Subject: [PATCH 031/233] syncthing: add platform assertion --- modules/services/syncthing.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index 97ad5862..2f9cecdb 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -57,6 +57,11 @@ in { config = mkMerge [ (mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.syncthing" pkgs + lib.platforms.linux) + ]; + home.packages = [ (getOutput "man" pkgs.syncthing) ]; systemd.user.services = { From a7f0cc2d7b271b4a5df9b9e351d556c172f7e903 Mon Sep 17 00:00:00 2001 From: Judson Lester Date: Fri, 18 Feb 2022 12:24:11 -0800 Subject: [PATCH 032/233] lorri: add nixPackage and enableNotifications options --- modules/services/lorri.nix | 43 +++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/modules/services/lorri.nix b/modules/services/lorri.nix index 0a49cb54..85b75682 100644 --- a/modules/services/lorri.nix +++ b/modules/services/lorri.nix @@ -12,12 +12,22 @@ in { options.services.lorri = { enable = mkEnableOption "lorri build daemon"; + enableNotifications = mkEnableOption "lorri build notifications"; + package = mkOption { type = types.package; default = pkgs.lorri; defaultText = literalExpression "pkgs.lorri"; description = "Which lorri package to install."; }; + + nixPackage = mkOption { + type = types.package; + default = pkgs.nix; + defaultText = literalExpression "pkgs.nix"; + example = literalExpression "pkgs.nixVersions.unstable"; + description = "Which nix package to use."; + }; }; config = mkIf cfg.enable { @@ -45,7 +55,7 @@ in { Restart = "on-failure"; Environment = let path = with pkgs; - makeSearchPath "bin" [ nix gitMinimal gnutar gzip ]; + makeSearchPath "bin" [ cfg.nixPackage gitMinimal gnutar gzip ]; in [ "PATH=${path}" ]; }; }; @@ -60,6 +70,37 @@ in { Install = { WantedBy = [ "sockets.target" ]; }; }; + + services.lorri-notify = mkIf cfg.enableNotifications { + Unit = { + Description = "lorri build notifications"; + After = "lorri.service"; + Requires = "lorri.service"; + }; + + Service = { + ExecStart = let + jqFile = '' + ( + (.Started? | values | "Build starting in \(.nix_file)"), + (.Completed? | values | "Build complete in \(.nix_file)"), + (.Failure? | values | "Build failed in \(.nix_file)") + ) + ''; + + notifyScript = pkgs.writeShellScript "lorri-notify" '' + lorri internal stream-events --kind live \ + | jq --unbuffered '${jqFile}' \ + | xargs -n 1 notify-send "Lorri Build" + ''; + in toString notifyScript; + Restart = "on-failure"; + Environment = let + path = makeSearchPath "bin" + (with pkgs; [ bash jq findutils libnotify cfg.package ]); + in "PATH=${path}"; + }; + }; }; }; } From e4e639dd4dc3e431aa5b5f95325f9a66ac7e0dd9 Mon Sep 17 00:00:00 2001 From: Tad Fisher <129148+tadfisher@users.noreply.github.com> Date: Mon, 3 Oct 2022 00:50:40 -0700 Subject: [PATCH 033/233] programs/lieer: use lieer package (#3262) The gmailieer attribute was aliased to lieer in nixpkgs. --- modules/programs/lieer.nix | 4 ++-- tests/modules/services/lieer/lieer-service-expected.service | 2 +- tests/modules/services/lieer/lieer-service.nix | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/programs/lieer.nix b/modules/programs/lieer.nix index e0369ffc..15fda1ae 100644 --- a/modules/programs/lieer.nix +++ b/modules/programs/lieer.nix @@ -238,8 +238,8 @@ in { package = mkOption { type = types.package; - default = pkgs.gmailieer; - defaultText = "pkgs.gmailieer"; + default = pkgs.lieer; + defaultText = "pkgs.lieer"; description = '' lieer package to use. ''; diff --git a/tests/modules/services/lieer/lieer-service-expected.service b/tests/modules/services/lieer/lieer-service-expected.service index 89859f82..f532bff2 100644 --- a/tests/modules/services/lieer/lieer-service-expected.service +++ b/tests/modules/services/lieer/lieer-service-expected.service @@ -1,6 +1,6 @@ [Service] Environment=NOTMUCH_CONFIG=/home/hm-user/.config/notmuch/default/config -ExecStart=@gmailieer@/bin/gmi sync +ExecStart=@lieer@/bin/gmi sync Type=oneshot WorkingDirectory=/home/hm-user/Mail/hm@example.com diff --git a/tests/modules/services/lieer/lieer-service.nix b/tests/modules/services/lieer/lieer-service.nix index f624ae82..f11f1f6e 100644 --- a/tests/modules/services/lieer/lieer-service.nix +++ b/tests/modules/services/lieer/lieer-service.nix @@ -19,7 +19,7 @@ with lib; }; }; - test.stubs.gmailieer = { }; + test.stubs.lieer = { }; nmt.script = '' assertFileExists home-files/.config/systemd/user/lieer-hm-example-com.service From 1a8e35d2e53ed2ccd9818fad9c9478d56c655661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Wed, 5 Oct 2022 17:22:12 +0200 Subject: [PATCH 034/233] mpd: add package to home path (#3303) It's always useful to have the man pages available. --- modules/services/mpd.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/services/mpd.nix b/modules/services/mpd.nix index ea0d1a97..6ba93a19 100644 --- a/modules/services/mpd.nix +++ b/modules/services/mpd.nix @@ -198,6 +198,8 @@ in { Install = { WantedBy = [ "sockets.target" ]; }; }; + + home.packages = [ cfg.package ]; }; } From 6427ae95789c04534363d2b68289996f08077c0c Mon Sep 17 00:00:00 2001 From: wuyoli Date: Tue, 4 Oct 2022 18:50:55 +0200 Subject: [PATCH 035/233] swayidle: fix examples The example did not work before, since the systemd service does not have swaylock in its PATH. PR #3298 --- modules/services/swayidle.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/services/swayidle.nix b/modules/services/swayidle.nix index 66b4340c..c99296b5 100644 --- a/modules/services/swayidle.nix +++ b/modules/services/swayidle.nix @@ -73,7 +73,7 @@ in { default = [ ]; example = literalExpression '' [ - { timeout = 60; command = "swaylock -fF"; } + { timeout = 60; command = "${pkgs.swaylock}/bin/swaylock -fF"; } ] ''; description = "List of commands to run after idle timeout."; @@ -84,7 +84,7 @@ in { default = [ ]; example = literalExpression '' [ - { event = "before-sleep"; command = "swaylock"; } + { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock"; } { event = "lock"; command = "lock"; } ] ''; From 599e22b1c76dc56172c7bb97bc3cd04266869bd6 Mon Sep 17 00:00:00 2001 From: Philippe Laflamme Date: Sun, 2 Oct 2022 22:52:33 -0400 Subject: [PATCH 036/233] sbt: allow managing the `~/.sbt/repositories` file sbt allows overriding the default repositories to use to resolve dependencies. This is often used with proxies and/or private repositories to host internal packages. This change adds a `repositories` attribute to `sbt` to allow specifying the values that will go in `~/.sbt/repositories` file. To support the above change we also deprecate the `baseConfigPath` option in favour of `baseUserConfigPath` which points one level higher by default. This allows not using relative paths to refer to the top-level configuration directory. Also adds tests for the new option and the deprecation of the previous one. --- modules/programs/sbt.nix | 73 +++++++++++++++++-- tests/modules/programs/sbt/default.nix | 5 +- .../programs/sbt/deprecated-options.nix | 18 +++++ tests/modules/programs/sbt/repositories.nix | 38 ++++++++++ .../modules/programs/sbt/user-config-path.nix | 39 ++++++++++ 5 files changed, 167 insertions(+), 6 deletions(-) create mode 100644 tests/modules/programs/sbt/deprecated-options.nix create mode 100644 tests/modules/programs/sbt/repositories.nix create mode 100644 tests/modules/programs/sbt/user-config-path.nix diff --git a/modules/programs/sbt.nix b/modules/programs/sbt.nix index bf355a80..22a32fe2 100644 --- a/modules/programs/sbt.nix +++ b/modules/programs/sbt.nix @@ -16,6 +16,17 @@ let import scala.sys.process._ ${concatStrings (map renderCredential creds)}''; + renderRepository = value: + if isString value then '' + ${value} + '' else '' + ${concatStrings (mapAttrsToList (name: value: "${name}: ${value}") value)} + ''; + + renderRepositories = repos: '' + [repositories] + ${concatStrings (map renderRepository cfg.repositories)}''; + sbtTypes = { plugin = types.submodule { options = { @@ -68,6 +79,11 @@ let cfg = config.programs.sbt; in { + imports = [ + (mkRemovedOptionModule [ "programs" "sbt" "baseConfigPath" ] + "Use programs.sbt.baseUserConfigPath instead, but note that the semantics are slightly different.") + ]; + meta.maintainers = [ maintainers.kubukoz ]; options.programs.sbt = { @@ -80,10 +96,13 @@ in { description = "The package with sbt to be installed."; }; - baseConfigPath = mkOption { + baseUserConfigPath = mkOption { type = types.str; - default = ".sbt/1.0"; - description = "Where the plugins and credentials should be located."; + default = ".sbt"; + description = '' + Where the sbt configuration files should be located, relative + HOME. + ''; }; plugins = mkOption { @@ -123,19 +142,63 @@ in { A list of credentials to define in the sbt configuration directory. ''; }; + + repositories = mkOption { + type = with types; + listOf + (either (enum [ "local" "maven-central" "maven-local" ]) (attrsOf str)); + default = [ ]; + example = literalExpression '' + [ + "local" + { my-ivy-proxy-releases = "http://repo.company.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]" } + { my-maven-proxy-releases = "http://repo.company.com/maven-releases/" } + "maven-central" + ] + ''; + description = '' + A list of repositories to use when resolving dependencies. Defined as a + list of pre-defined repository or custom repository as a set of name to + URL. The list will be used populate the ~/.sbt/repositories + file in the order specified. + + + + Pre-defined repositories must be one of local, + maven-local, maven-central. + + + + Custom repositories are defined as + { name-of-repo = "https://url.to.repo.com"}. + + + + See + + about this configuration section and + + to read about proxy repositories. + ''; + }; }; config = mkIf cfg.enable (mkMerge [ { home.packages = [ cfg.package ]; } (mkIf (cfg.plugins != [ ]) { - home.file."${cfg.baseConfigPath}/plugins/plugins.sbt".text = + home.file."${cfg.baseUserConfigPath}/1.0/plugins/plugins.sbt".text = concatStrings (map renderPlugin cfg.plugins); }) (mkIf (cfg.credentials != [ ]) { - home.file."${cfg.baseConfigPath}/credentials.sbt".text = + home.file."${cfg.baseUserConfigPath}/1.0/credentials.sbt".text = renderCredentials cfg.credentials; }) + + (mkIf (cfg.repositories != [ ]) { + home.file."${cfg.baseUserConfigPath}/repositories".text = + renderRepositories cfg.repositories; + }) ]); } diff --git a/tests/modules/programs/sbt/default.nix b/tests/modules/programs/sbt/default.nix index 59ad89da..2d506b68 100644 --- a/tests/modules/programs/sbt/default.nix +++ b/tests/modules/programs/sbt/default.nix @@ -1,4 +1,7 @@ { - sbt-plugins = ./plugins.nix; sbt-credentials = ./credentials.nix; + sbt-deprecated-options = ./deprecated-options.nix; + sbt-plugins = ./plugins.nix; + sbt-repositories = ./repositories.nix; + sbt-user-config-path = ./user-config-path.nix; } diff --git a/tests/modules/programs/sbt/deprecated-options.nix b/tests/modules/programs/sbt/deprecated-options.nix new file mode 100644 index 00000000..c760354a --- /dev/null +++ b/tests/modules/programs/sbt/deprecated-options.nix @@ -0,0 +1,18 @@ +{ ... }: + +{ + programs.sbt = { + enable = true; + baseConfigPath = "gone"; + }; + + test.stubs.sbt = { }; + + test.asserts.assertions.expected = [ + (let offendingFile = toString ./deprecated-options.nix; + in '' + The option definition `programs.sbt.baseConfigPath' in `${offendingFile}' no longer has any effect; please remove it. + Use programs.sbt.baseUserConfigPath instead, but note that the semantics are slightly different. + '') + ]; +} diff --git a/tests/modules/programs/sbt/repositories.nix b/tests/modules/programs/sbt/repositories.nix new file mode 100644 index 00000000..0def44f7 --- /dev/null +++ b/tests/modules/programs/sbt/repositories.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: + +let + repositories = [ + "local" + { my-maven-proxy = "http://repo.mavenproxy.io/a/b/c/d"; } + "maven-local" + { + my-ivy-proxy = + "http://repo.company.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]"; + } + "maven-central" + ]; + + expectedRepositories = builtins.toFile "repositories" '' + [repositories] + local + my-maven-proxy: http://repo.mavenproxy.io/a/b/c/d + maven-local + my-ivy-proxy: http://repo.company.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] + maven-central + ''; + + repositoriesSbtPath = ".sbt/repositories"; +in { + config = { + programs.sbt = { + enable = true; + repositories = repositories; + package = pkgs.writeScriptBin "sbt" ""; + }; + + nmt.script = '' + assertFileExists "home-files/${repositoriesSbtPath}" + assertFileContent "home-files/${repositoriesSbtPath}" "${expectedRepositories}" + ''; + }; +} diff --git a/tests/modules/programs/sbt/user-config-path.nix b/tests/modules/programs/sbt/user-config-path.nix new file mode 100644 index 00000000..ef7c2ca8 --- /dev/null +++ b/tests/modules/programs/sbt/user-config-path.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + plugins = [{ + org = "a"; + artifact = "b"; + version = "c"; + }]; + + credentials = [{ + realm = "a"; + host = "b"; + user = "c"; + passwordCommand = "d"; + }]; + + repositories = [ "local" ]; + + baseSbtPath = ".config/sbt"; +in { + config = { + programs.sbt = { + enable = true; + plugins = plugins; + credentials = credentials; + repositories = repositories; + baseUserConfigPath = ".config/sbt"; + package = pkgs.writeScriptBin "sbt" ""; + }; + + nmt.script = '' + assertFileExists "home-files/${baseSbtPath}/1.0/plugins/plugins.sbt" + assertFileExists "home-files/${baseSbtPath}/1.0/credentials.sbt" + assertFileExists "home-files/${baseSbtPath}/repositories" + ''; + }; +} From 7fee13eb4c64740261c774a90e43830f7213c57c Mon Sep 17 00:00:00 2001 From: Philippe Laflamme Date: Sun, 2 Oct 2022 21:26:14 -0400 Subject: [PATCH 037/233] sbt: cache `passwordCommand` output This will cache the output of `passwordCommand` per authentication realm. Context: the `credentials` key in `sbt` is a `TaskKey[Seq[Credentials]]`. In `sbt`, tasks are evaluated on-demand and their output is not cached. This particular key is referenced by all submodules in a project. When the command is relatively expensive (e.g.: `pass show foo`), this results in several seconds of delay when doing basic things like `compile` or `test` which makes this unusable without some kind of caching. --- modules/programs/sbt.nix | 11 +++++++---- tests/modules/programs/sbt/credentials.nix | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/programs/sbt.nix b/modules/programs/sbt.nix index 22a32fe2..3e8dbc10 100644 --- a/modules/programs/sbt.nix +++ b/modules/programs/sbt.nix @@ -8,13 +8,16 @@ let addSbtPlugin("${plugin.org}" % "${plugin.artifact}" % "${plugin.version}") ''; - renderCredential = cred: '' - credentials += Credentials("${cred.realm}", "${cred.host}", "${cred.user}", "${cred.passwordCommand}".!!.trim) - ''; + renderCredential = idx: cred: + let symbol = "credential_${toString idx}"; + in '' + lazy val ${symbol} = "${cred.passwordCommand}".!!.trim + credentials += Credentials("${cred.realm}", "${cred.host}", "${cred.user}", ${symbol}) + ''; renderCredentials = creds: '' import scala.sys.process._ - ${concatStrings (map renderCredential creds)}''; + ${concatStrings (imap0 renderCredential creds)}''; renderRepository = value: if isString value then '' diff --git a/tests/modules/programs/sbt/credentials.nix b/tests/modules/programs/sbt/credentials.nix index 55c3936a..1a79582a 100644 --- a/tests/modules/programs/sbt/credentials.nix +++ b/tests/modules/programs/sbt/credentials.nix @@ -19,8 +19,10 @@ let ]; expectedCredentialsSbt = pkgs.writeText "credentials.sbt" '' import scala.sys.process._ - credentials += Credentials("Sonatype Nexus Repository Manager", "example.com", "user", "echo password".!!.trim) - credentials += Credentials("Sonatype Nexus Repository Manager X", "v2.example.com", "user1", "echo password1".!!.trim) + lazy val credential_0 = "echo password".!!.trim + credentials += Credentials("Sonatype Nexus Repository Manager", "example.com", "user", credential_0) + lazy val credential_1 = "echo password1".!!.trim + credentials += Credentials("Sonatype Nexus Repository Manager X", "v2.example.com", "user1", credential_1) ''; credentialsSbtPath = ".sbt/1.0/credentials.sbt"; in { From 8c297e1816c9744da5a90d8b7aef8ff5c3a41bad Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sat, 1 Oct 2022 04:20:00 +0000 Subject: [PATCH 038/233] ledger: add module Add module for https://www.ledger-cli.org/ --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 7 +++++++ modules/modules.nix | 1 + modules/programs/ledger.nix | 39 +++++++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 modules/programs/ledger.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 281fc006..21af0a18 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -158,6 +158,8 @@ Makefile @thiagokokada /modules/programs/lazygit.nix @kalhauge +/modules/programs/ledger.nix @marsam + /modules/programs/less.nix @pamplemousse /tests/modules/programs/less @pamplemousse diff --git a/modules/misc/news.nix b/modules/misc/news.nix index e0a313e7..695e1026 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -726,6 +726,13 @@ in A new module is available: 'programs.pls'. ''; } + + { + time = "2022-10-06T23:06:08+00:00"; + message = '' + A new module is available: 'programs.ledger'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 4f3b3fde..92030b99 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -101,6 +101,7 @@ let ./programs/kitty.nix ./programs/kodi.nix ./programs/lazygit.nix + ./programs/ledger.nix ./programs/less.nix ./programs/lesspipe.nix ./programs/lf.nix diff --git a/modules/programs/ledger.nix b/modules/programs/ledger.nix new file mode 100644 index 00000000..c51ed7d1 --- /dev/null +++ b/modules/programs/ledger.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.ledger; + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.ledger = { + enable = mkEnableOption "ledger, a double-entry accounting system"; + + package = mkPackageOption pkgs "ledger" { }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + example = literalExpression '' + --sort date + --effective + --date-format %Y-%m-%d + ''; + description = '' + Configuration written to $XDG_CONFIG_HOME/ledger/ledgerrc. + See + for explanation about possible values. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."ledger/ledgerrc" = + mkIf (cfg.extraConfig != "") { text = cfg.extraConfig; }; + }; +} From be2cade373d96b469e5f4bb22c40cac87cf5a6f0 Mon Sep 17 00:00:00 2001 From: AndersonTorres Date: Sun, 25 Sep 2022 03:21:27 -0300 Subject: [PATCH 039/233] havoc: add module --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 8 +++++ modules/modules.nix | 1 + modules/programs/havoc.nix | 64 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 modules/programs/havoc.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 21af0a18..3f50db65 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -124,6 +124,8 @@ Makefile @thiagokokada /modules/programs/go.nix @rvolosatovs +/modules/programs/havoc.nix @AndersonTorres + /modules/programs/helix.nix @Philipp-M /tests/modules/programs/helix @Philipp-M diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 695e1026..830864d9 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -733,6 +733,14 @@ in A new module is available: 'programs.ledger'. ''; } + + { + time = "2022-10-06T23:19:10+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.havoc'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 92030b99..f3e74009 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -82,6 +82,7 @@ let ./programs/gnome-terminal.nix ./programs/go.nix ./programs/gpg.nix + ./programs/havoc.nix ./programs/helix.nix ./programs/hexchat.nix ./programs/himalaya.nix diff --git a/modules/programs/havoc.nix b/modules/programs/havoc.nix new file mode 100644 index 00000000..6ae89c1d --- /dev/null +++ b/modules/programs/havoc.nix @@ -0,0 +1,64 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.havoc; + iniFormat = pkgs.formats.ini { }; + +in { + meta.maintainers = with lib.maintainers; [ AndersonTorres ]; + + options.programs.havoc = { + enable = mkEnableOption "Havoc terminal"; + + package = mkPackageOption pkgs "havoc" { }; + + settings = mkOption { + type = iniFormat.type; + default = { }; + description = '' + Configuration written to + $XDG_CONFIG_HOME/havoc.cfg. See + for a list of available options. + ''; + example = literalExpression '' + { + child.program = "bash"; + window.opacity = 240; + window.margin = no; + terminal = { + rows = 80; + columns = 24; + scrollback = 2000; + }; + bind = { + "C-S-c" = "copy"; + "C-S-v" = "paste"; + "C-S-r" = "reset"; + "C-S-Delete" = "hard reset"; + "C-S-j" = "scroll down"; + "C-S-k" = "scroll up"; + "C-S-Page_Down" = "scroll down page"; + "C-S-Page_Up" = "scroll up page"; + "C-S-End" = "scroll to bottom"; + "C-S-Home" = "scroll to top"; + }; + } + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = + [ (hm.assertions.assertPlatform "programs.havoc" pkgs platforms.linux) ]; + + home.packages = [ cfg.package ]; + + xdg.configFile."havoc.cfg" = mkIf (cfg.settings != { }) { + source = iniFormat.generate "havoc.cfg" cfg.settings; + }; + }; +} From 9fcae11ff29ca5f959b05c206f3724486c28ff07 Mon Sep 17 00:00:00 2001 From: ralismark <13449732+ralismark@users.noreply.github.com> Date: Fri, 7 Oct 2022 15:49:39 +1100 Subject: [PATCH 040/233] systemd: name slice unit correctly --- modules/systemd.nix | 8 ++++---- tests/modules/systemd/default.nix | 1 + tests/modules/systemd/slices.nix | 31 +++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 tests/modules/systemd/slices.nix diff --git a/modules/systemd.nix b/modules/systemd.nix index ff70edf8..7a27e95b 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -125,9 +125,9 @@ in { slices = mkOption { default = { }; - type = unitType "slices"; - description = unitDescription "slices"; - example = unitExample "Slices"; + type = unitType "slice"; + description = unitDescription "slice"; + example = unitExample "Slice"; }; sockets = mkOption { @@ -263,7 +263,7 @@ in { (mkIf (pkgs.stdenv.isLinux && config.home.username != "root") { xdg.configFile = mkMerge [ (lib.listToAttrs ((buildServices "service" cfg.services) - ++ (buildServices "slices" cfg.slices) + ++ (buildServices "slice" cfg.slices) ++ (buildServices "socket" cfg.sockets) ++ (buildServices "target" cfg.targets) ++ (buildServices "timer" cfg.timers) diff --git a/tests/modules/systemd/default.nix b/tests/modules/systemd/default.nix index c949edd9..a0271b47 100644 --- a/tests/modules/systemd/default.nix +++ b/tests/modules/systemd/default.nix @@ -2,5 +2,6 @@ systemd-services = ./services.nix; systemd-services-disabled-for-root = ./services-disabled-for-root.nix; systemd-session-variables = ./session-variables.nix; + systemd-slices = ./slices.nix; systemd-timers = ./timers.nix; } diff --git a/tests/modules/systemd/slices.nix b/tests/modules/systemd/slices.nix new file mode 100644 index 00000000..0bb90504 --- /dev/null +++ b/tests/modules/systemd/slices.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + systemd.user.slices.app-test = { + Unit = { Description = "Slice for a test app"; }; + + Slice = { + MemoryHigh = "30%"; + MemoryMax = "40%"; + }; + }; + + nmt.script = '' + sliceFile=home-files/.config/systemd/user/app-test.slice + assertFileExists $sliceFile + assertFileContent $sliceFile ${ + builtins.toFile "app-test-expected.conf" '' + [Slice] + MemoryHigh=30% + MemoryMax=40% + + [Unit] + Description=Slice for a test app + '' + } + ''; + }; +} From 3b5a8d3dc79e05213d3c428a0b8777e21cb0c6b8 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Sun, 2 Oct 2022 23:12:49 +0200 Subject: [PATCH 041/233] ci: introduce labeler workflow Automatically tag PRs depending on touched files. --- .github/labeler.yml | 4 ++++ .github/workflows/labeler.yml | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 00000000..70ee4707 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,4 @@ +"neovim": + - modules/programs/neovim.nix + - tests/modules/programs/neovim/**/* + diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000..daea610a --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,24 @@ +name: "Label PR" + +on: + - pull_request_target + +# WARNING: +# When extending this action, be aware that $GITHUB_TOKEN allows some write +# access to the GitHub API. This means that it should not evaluate user input in +# a way that allows code injection. + +permissions: + contents: read + pull-requests: write + +jobs: + labels: + runs-on: ubuntu-latest + if: github.repository_owner == 'nix-community' + steps: + - uses: actions/labeler@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + sync-labels: true + From bd87a34bb487a655e1282528a70d0d6b10585a37 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sat, 1 Oct 2022 22:42:51 +0800 Subject: [PATCH 042/233] sioyek: enable multiple bindings for the same command --- modules/programs/sioyek.nix | 22 ++++++++---- tests/default.nix | 1 + tests/modules/programs/sioyek/default.nix | 1 + .../sioyek/sioyek-basic-configuration.nix | 36 +++++++++++++++++++ .../programs/sioyek/test_keys_user.config | 8 +++++ .../programs/sioyek/test_prefs_user.config | 2 ++ 6 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 tests/modules/programs/sioyek/default.nix create mode 100644 tests/modules/programs/sioyek/sioyek-basic-configuration.nix create mode 100644 tests/modules/programs/sioyek/test_keys_user.config create mode 100644 tests/modules/programs/sioyek/test_prefs_user.config diff --git a/modules/programs/sioyek.nix b/modules/programs/sioyek.nix index 9ef32746..63bf5b6f 100644 --- a/modules/programs/sioyek.nix +++ b/modules/programs/sioyek.nix @@ -1,11 +1,16 @@ { config, lib, pkgs, ... }: + with lib; + let + cfg = config.programs.sioyek; - renderAttrs = attrs: - concatStringsSep "\n" - (mapAttrsToList (name: value: "${name} ${value}") attrs); + renderConfig = generators.toKeyValue { + mkKeyValue = key: value: "${key} ${value}"; + listsAsDuplicateKeys = true; + }; + in { options = { programs.sioyek = { @@ -24,8 +29,11 @@ in { Input configuration written to $XDG_CONFIG_HOME/sioyek/keys_user.config. See . + + Each attribute could also accept a list of strings to set multiple + bindings of the same command. ''; - type = types.attrsOf types.str; + type = with types; attrsOf (either str (listOf str)); default = { }; example = literalExpression '' { @@ -33,6 +41,8 @@ in { "move_down" = "j"; "move_left" = "h"; "move_right" = "l"; + "screen_down" = [ "d" "" ]; + "screen_up" = [ "u" "" ]; } ''; }; @@ -59,10 +69,10 @@ in { config = mkIf cfg.enable (mkMerge [ { home.packages = [ cfg.package ]; } (mkIf (cfg.config != { }) { - xdg.configFile."sioyek/prefs_user.config".text = renderAttrs cfg.config; + xdg.configFile."sioyek/prefs_user.config".text = renderConfig cfg.config; }) (mkIf (cfg.bindings != { }) { - xdg.configFile."sioyek/keys_user.config".text = renderAttrs cfg.bindings; + xdg.configFile."sioyek/keys_user.config".text = renderConfig cfg.bindings; }) ]); diff --git a/tests/default.nix b/tests/default.nix index da7f539e..61959860 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -110,6 +110,7 @@ import nmt { ./modules/programs/sagemath ./modules/programs/sbt ./modules/programs/scmpuff + ./modules/programs/sioyek ./modules/programs/sm64ex ./modules/programs/ssh ./modules/programs/starship diff --git a/tests/modules/programs/sioyek/default.nix b/tests/modules/programs/sioyek/default.nix new file mode 100644 index 00000000..c35f1c9f --- /dev/null +++ b/tests/modules/programs/sioyek/default.nix @@ -0,0 +1 @@ +{ sioyek = ./sioyek-basic-configuration.nix; } diff --git a/tests/modules/programs/sioyek/sioyek-basic-configuration.nix b/tests/modules/programs/sioyek/sioyek-basic-configuration.nix new file mode 100644 index 00000000..42eb1302 --- /dev/null +++ b/tests/modules/programs/sioyek/sioyek-basic-configuration.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }: + +{ + programs.sioyek = { + enable = true; + bindings = { + "move_down" = "j"; + "move_left" = "h"; + "move_right" = "l"; + "move_up" = "k"; + "screen_down" = [ "d" "" ]; + "screen_up" = [ "u" "" ]; + }; + config = { + "dark_mode_background_color" = "0.0 0.0 0.0"; + "dark_mode_contrast" = "0.8"; + }; + }; + + test.stubs.sioyek = { }; + + nmt = { + description = "Sioyek basic setup with sample configuration"; + script = '' + assertFileExists home-files/.config/sioyek/prefs_user.config + assertFileContent home-files/.config/sioyek/prefs_user.config ${ + ./test_prefs_user.config + } + + assertFileExists home-files/.config/sioyek/keys_user.config + assertFileContent home-files/.config/sioyek/keys_user.config ${ + ./test_keys_user.config + } + ''; + }; +} diff --git a/tests/modules/programs/sioyek/test_keys_user.config b/tests/modules/programs/sioyek/test_keys_user.config new file mode 100644 index 00000000..f1be89c3 --- /dev/null +++ b/tests/modules/programs/sioyek/test_keys_user.config @@ -0,0 +1,8 @@ +move_down j +move_left h +move_right l +move_up k +screen_down d +screen_down +screen_up u +screen_up diff --git a/tests/modules/programs/sioyek/test_prefs_user.config b/tests/modules/programs/sioyek/test_prefs_user.config new file mode 100644 index 00000000..730dd51b --- /dev/null +++ b/tests/modules/programs/sioyek/test_prefs_user.config @@ -0,0 +1,2 @@ +dark_mode_background_color 0.0 0.0 0.0 +dark_mode_contrast 0.8 From e1f1160284198a68ea8c7fffbbb1436f99e46ef9 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Fri, 9 Sep 2022 12:25:49 -0700 Subject: [PATCH 043/233] redshift/gammastep: add `enableVerboseLogging` option This option controls whether the `-v` command line argument is given. Co-authored-by: Sumner Evans --- modules/services/redshift-gammastep/lib/options.nix | 7 ++++++- .../gammastep-basic-configuration-expected.service | 2 +- .../redshift-basic-configuration-expected.service | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/services/redshift-gammastep/lib/options.nix b/modules/services/redshift-gammastep/lib/options.nix index a5aeac55..4c9d68ab 100644 --- a/modules/services/redshift-gammastep/lib/options.nix +++ b/modules/services/redshift-gammastep/lib/options.nix @@ -110,6 +110,8 @@ in { ''; }; + enableVerboseLogging = mkEnableOption "verbose service logging"; + tray = mkOption { type = types.bool; default = false; @@ -199,7 +201,10 @@ in { ExecStart = let command = if cfg.tray then appletExecutable else mainExecutable; configFullPath = config.xdg.configHome + "/${xdgConfigFilePath}"; - in "${cfg.package}/bin/${command} -v -c ${configFullPath}"; + in "${cfg.package}/bin/${command} " + cli.toGNUCommandLineShell { } { + v = cfg.enableVerboseLogging; + c = configFullPath; + }; RestartSec = 3; Restart = "on-failure"; }; diff --git a/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service index 8d0e7a5f..d172e3a8 100644 --- a/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service +++ b/tests/modules/services/redshift-gammastep/gammastep-basic-configuration-expected.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=@gammastep@/bin/gammastep -v -c /home/hm-user/.config/gammastep/config.ini +ExecStart=@gammastep@/bin/gammastep '-c' '/home/hm-user/.config/gammastep/config.ini' Restart=on-failure RestartSec=3 diff --git a/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service b/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service index 07ffbf06..6ee4cdda 100644 --- a/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service +++ b/tests/modules/services/redshift-gammastep/redshift-basic-configuration-expected.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=@redshift@/bin/redshift -v -c /home/hm-user/.config/redshift/redshift.conf +ExecStart=@redshift@/bin/redshift '-c' '/home/hm-user/.config/redshift/redshift.conf' Restart=on-failure RestartSec=3 From ebe6d2c747cc6e2223dd5962bdca258088518b3f Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 11 Oct 2022 09:31:29 +0200 Subject: [PATCH 044/233] home-manager: set state version when uninstalling Otherwise the switch exits with an error. Fixes #3320 --- home-manager/home-manager | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/home-manager/home-manager b/home-manager/home-manager index 6483c59f..cbf3e883 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -480,7 +480,10 @@ function doUninstall() { y|Y) _i "Switching to empty Home Manager configuration..." HOME_MANAGER_CONFIG="$(mktemp --tmpdir home-manager.XXXXXXXXXX)" - echo "{ lib, ... }: { home.file = lib.mkForce {}; }" > "$HOME_MANAGER_CONFIG" + echo "{ lib, ... }: {" > "$HOME_MANAGER_CONFIG" + echo " home.file = lib.mkForce {};" >> "$HOME_MANAGER_CONFIG" + echo " home.stateVersion = \"18.09\";" >> "$HOME_MANAGER_CONFIG" + echo "}" >> "$HOME_MANAGER_CONFIG" doSwitch $DRY_RUN_CMD $REMOVE_CMD home-manager-path || true rm "$HOME_MANAGER_CONFIG" From b37a909508edb8d7fdcd04ac90761b2cfa2a5f28 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Sun, 9 Oct 2022 23:17:56 +0200 Subject: [PATCH 045/233] ci: specify files that should be tagged "mail" --- .github/labeler.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index 70ee4707..cbdd2c0b 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,3 +1,15 @@ +"mail": + - modules/programs/alot*.nix + - tests/modules/programs/alot/* + - modules/programs/mujmap.nix + - tests/modules/programs/mujmap/* + - modules/programs/notmuch.nix + - modules/programs/neomutt* + - tests/modules/programs/neomutt/* + - modules/programs/getmail* + - modules/*/mbsync* + - tests/modules/programs/mbsync/* + "neovim": - modules/programs/neovim.nix - tests/modules/programs/neovim/**/* From 5597b3a7425a9e3f41128308cb1105d3e780f633 Mon Sep 17 00:00:00 2001 From: ilkecan Date: Fri, 1 Jul 2022 21:33:43 +0000 Subject: [PATCH 046/233] dconf: reset keys that become unmanaged on switch --- modules/misc/dconf.nix | 70 +++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/modules/misc/dconf.nix b/modules/misc/dconf.nix index d731679c..d95f8b5e 100644 --- a/modules/misc/dconf.nix +++ b/modules/misc/dconf.nix @@ -10,6 +10,14 @@ let mkIniKeyValue = key: value: "${key}=${toString (hm.gvariant.mkValue value)}"; + # The dconf keys managed by this configuration. We store this as part of the + # generation state to be able to reset keys that become unmanaged during + # switch. + stateDconfKeys = pkgs.writeText "dconf-keys.json" (builtins.toJSON + (concatLists (mapAttrsToList + (dir: entries: mapAttrsToList (key: _: "/${dir}/${key}") entries) + cfg.settings))); + in { meta.maintainers = [ maintainers.rycee ]; @@ -54,22 +62,56 @@ in { # Make sure the dconf directory exists. xdg.configFile."dconf/.keep".source = builtins.toFile "keep" ""; - home.activation.dconfSettings = hm.dag.entryAfter [ "installPackages" ] - (let iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings); - in '' - if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then - DCONF_DBUS_RUN_SESSION="" - else - DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session" + home.extraBuilderCommands = '' + mkdir -p $out/state/ + ln -s ${stateDconfKeys} $out/state/${stateDconfKeys.name} + ''; + + home.activation.dconfSettings = hm.dag.entryAfter [ "installPackages" ] (let + iniFile = pkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings); + + statePath = "state/${stateDconfKeys.name}"; + + cleanup = pkgs.writeShellScript "dconf-cleanup" '' + set -euo pipefail + + ${config.lib.bash.initHomeManagerLib} + + PATH=${makeBinPath [ pkgs.dconf pkgs.jq ]}''${PATH:+:}$PATH + + oldState="$1" + newState="$2" + + # Can't do cleanup if we don't know the old state. + if [[ ! -f $oldState ]]; then + exit 0 fi - if [[ -v DRY_RUN ]]; then - echo $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / "<" ${iniFile} - else - $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile} - fi + # Reset all keys that are present in the old generation but not the new + # one. + jq -r -n \ + --slurpfile old "$oldState" \ + --slurpfile new "$newState" \ + '($old[] - $new[])[]' \ + | while read -r key; do + $VERBOSE_ECHO "Resetting dconf key \"$key\"" + $DRY_RUN_CMD $DCONF_DBUS_RUN_SESSION dconf reset "$key" + done + ''; + in '' + if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then + export DCONF_DBUS_RUN_SESSION="" + else + export DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session" + fi - unset DCONF_DBUS_RUN_SESSION - ''); + ${cleanup} \ + "$oldGenPath/${statePath}" \ + "$newGenPath/${statePath}" + + $DRY_RUN_CMD $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile} + + unset DCONF_DBUS_RUN_SESSION + ''); }; } From 2d8e5a99343fc7df3ba7a512ea59a98b75166974 Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Tue, 4 Oct 2022 00:53:12 +0300 Subject: [PATCH 047/233] discocss: add module Co-authored-by: Mihai Fufezan --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 7 +++++ modules/modules.nix | 1 + modules/programs/discocss.nix | 49 +++++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 modules/programs/discocss.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3f50db65..33a52f5c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -93,6 +93,8 @@ Makefile @thiagokokada /modules/programs/direnv.nix @rycee +/modules/programs/discocss.nix @Kranzes + /modules/programs/eclipse.nix @rycee /modules/programs/emacs.nix @rycee diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 830864d9..044ce393 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -741,6 +741,13 @@ in A new module is available: 'programs.havoc'. ''; } + + { + time = "2022-10-12T23:10:48+00:00"; + message = '' + A new module is available: 'programs.discocss'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index f3e74009..b1bc0204 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -65,6 +65,7 @@ let ./programs/command-not-found/command-not-found.nix ./programs/dircolors.nix ./programs/direnv.nix + ./programs/discocss.nix ./programs/eclipse.nix ./programs/emacs.nix ./programs/eww.nix diff --git a/modules/programs/discocss.nix b/modules/programs/discocss.nix new file mode 100644 index 00000000..e782b560 --- /dev/null +++ b/modules/programs/discocss.nix @@ -0,0 +1,49 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.programs.discocss; +in { + meta.maintainers = with maintainers; [ kranzes ]; + + options = { + programs.discocss = { + enable = mkEnableOption + "discocss, a tiny Discord CSS injector for Linux and MacOS"; + + package = mkPackageOption pkgs "discocss" { }; + + discordPackage = mkPackageOption pkgs "discord" { }; + + discordAlias = mkOption { + type = types.bool; + default = true; + description = "Whether to alias discocss to discord."; + }; + + css = mkOption { + type = types.str; + default = ""; + description = "The custom CSS for discocss to use."; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [{ + assertion = cfg.discordAlias + -> !(any (p: p.name == cfg.discord.name) config.home.packages); + message = + "To use discocss with discordAlias you have to remove discord from home.packages, or set discordAlias to false."; + }]; + + home.packages = [ + (cfg.package.override { + discordAlias = cfg.discordAlias; + discord = cfg.discordPackage; + }) + ]; + + xdg.configFile."discocss/custom.css".text = cfg.css; + }; +} From 618ab0f882167361108475a9f1404fb4c638b73d Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 13 Oct 2022 11:52:24 +0200 Subject: [PATCH 048/233] discocss: fix attribute name --- modules/programs/discocss.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/discocss.nix b/modules/programs/discocss.nix index e782b560..5a35f187 100644 --- a/modules/programs/discocss.nix +++ b/modules/programs/discocss.nix @@ -32,7 +32,7 @@ in { config = mkIf cfg.enable { assertions = [{ assertion = cfg.discordAlias - -> !(any (p: p.name == cfg.discord.name) config.home.packages); + -> !(any (p: p.name == cfg.discordPackage.name) config.home.packages); message = "To use discocss with discordAlias you have to remove discord from home.packages, or set discordAlias to false."; }]; From 8eaa3ba56edaf89138549d0854e3a94c0dbad060 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 13 Oct 2022 11:09:53 +0200 Subject: [PATCH 049/233] lib/bash: remove unused Bash library files The color echo functions are provided by `lib/bash/home-manager.sh`. --- lib/bash/color-echo | 41 ---------------------------------- modules/lib-bash/color-echo.sh | 39 -------------------------------- 2 files changed, 80 deletions(-) delete mode 100644 lib/bash/color-echo delete mode 100644 modules/lib-bash/color-echo.sh diff --git a/lib/bash/color-echo b/lib/bash/color-echo deleted file mode 100644 index c1638180..00000000 --- a/lib/bash/color-echo +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -# 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="" - errorColor="" - warnColor="" - noteColor="" - - # 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) - - if [[ -n "$ncolors" && "$ncolors" -ge 8 ]]; then - normalColor="$(tput sgr0)" - errorColor="$(tput bold)$(tput setaf 1)" - warnColor="$(tput setaf 3)" - noteColor="$(tput bold)$(tput setaf 6)" - fi - fi -} - -setupColors - -function errorEcho() { - echo "${errorColor}$*${normalColor}" -} - -function warnEcho() { - echo "${warnColor}$*${normalColor}" -} - -function noteEcho() { - echo "${noteColor}$*${normalColor}" -} diff --git a/modules/lib-bash/color-echo.sh b/modules/lib-bash/color-echo.sh deleted file mode 100644 index ac36cedc..00000000 --- a/modules/lib-bash/color-echo.sh +++ /dev/null @@ -1,39 +0,0 @@ -# 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="" - errorColor="" - warnColor="" - noteColor="" - - # 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) - - if [[ -n "$ncolors" && "$ncolors" -ge 8 ]]; then - normalColor="$(tput sgr0)" - errorColor="$(tput bold)$(tput setaf 1)" - warnColor="$(tput setaf 3)" - noteColor="$(tput bold)$(tput setaf 6)" - fi - fi -} - -setupColors - -function errorEcho() { - echo "${errorColor}$*${normalColor}" -} - -function warnEcho() { - echo "${warnColor}$*${normalColor}" -} - -function noteEcho() { - echo "${noteColor}$*${normalColor}" -} From 8cbc6500dfca22d907054f68c564019b3b6cf295 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 13 Oct 2022 11:11:42 +0200 Subject: [PATCH 050/233] lib/bash: make call to tput more robust Specifically, if `tput colors` fails with an error we treat that as if the terminal does not support colors. Fixes #423 Suggested-by: PhotonQuantum --- lib/bash/home-manager.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bash/home-manager.sh b/lib/bash/home-manager.sh index c7ff5c34..b7f3f42b 100644 --- a/lib/bash/home-manager.sh +++ b/lib/bash/home-manager.sh @@ -23,7 +23,7 @@ function setupColors() { if [[ ! -v NO_COLOR && -t 1 ]]; then # See if it supports colors. local ncolors - ncolors=$(tput colors) + ncolors=$(tput colors 2> /dev/null || echo 0) if [[ -n "$ncolors" && "$ncolors" -ge 8 ]]; then normalColor="$(tput sgr0)" From 2ecb3ea990cf737cfb42d8cd805fa86347c1afaf Mon Sep 17 00:00:00 2001 From: Rohan Ferris Date: Sun, 16 Oct 2022 05:49:11 +1000 Subject: [PATCH 051/233] firefox: rename chrome-gnome-shell suggestion to gnome.gnome-browser-connector (#3329) gnome3.chrome-gnome-shell is now gnome.gnome-browser-connector --- modules/programs/firefox.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index 63adf02b..bf0eac15 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -363,7 +363,7 @@ in { description = '' Whether to enable the GNOME Shell native host connector. Note, you also need to set the NixOS option - services.gnome3.chrome-gnome-shell.enable to + services.gnome.gnome-browser-connector.enable to true. ''; }; From 86bc0e349fcc7ab7a9ac7e6892c6bd6ac12fd1ee Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sun, 16 Oct 2022 17:59:57 +0200 Subject: [PATCH 052/233] dconf: handle missing oldGenPath --- modules/misc/dconf.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/misc/dconf.nix b/modules/misc/dconf.nix index d95f8b5e..ed502ea5 100644 --- a/modules/misc/dconf.nix +++ b/modules/misc/dconf.nix @@ -105,9 +105,11 @@ in { export DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session" fi - ${cleanup} \ - "$oldGenPath/${statePath}" \ - "$newGenPath/${statePath}" + if [[ -v oldGenPath ]]; then + ${cleanup} \ + "$oldGenPath/${statePath}" \ + "$newGenPath/${statePath}" + fi $DRY_RUN_CMD $DCONF_DBUS_RUN_SESSION ${pkgs.dconf}/bin/dconf load / < ${iniFile} From da3b8049fd3a98fbe5d2e82d217f415e6f01d45e Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Sun, 16 Oct 2022 10:37:25 -0700 Subject: [PATCH 053/233] im/fcitx5: add GLFW_IM_MODULE session variable This lets fcitx5 be used within the kitty terminal emulator. See https://wiki.archlinux.org/title/Kitty#Enable_IME_support for more. --- modules/i18n/input-method/fcitx5.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/i18n/input-method/fcitx5.nix b/modules/i18n/input-method/fcitx5.nix index 9211d0b7..78eb9708 100644 --- a/modules/i18n/input-method/fcitx5.nix +++ b/modules/i18n/input-method/fcitx5.nix @@ -24,6 +24,7 @@ in { i18n.inputMethod.package = fcitx5Package; home.sessionVariables = { + GLFW_IM_MODULE = "ibus"; # IME support in kitty GTK_IM_MODULE = "fcitx"; QT_IM_MODULE = "fcitx"; XMODIFIERS = "@im=fcitx"; From 04f53999788cd47c6ce932d6cbd7cbfd3998712f Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Sun, 25 Sep 2022 19:27:04 +0200 Subject: [PATCH 054/233] borgmatic: add module --- .github/CODEOWNERS | 5 + modules/misc/news.nix | 14 ++ modules/modules.nix | 2 + modules/programs/borgmatic.nix | 196 ++++++++++++++++++ modules/services/borgmatic.nix | 87 ++++++++ tests/default.nix | 2 + .../borgmatic/basic-configuration.nix | 110 ++++++++++ tests/modules/programs/borgmatic/default.nix | 1 + .../borgmatic/basic-configuration.nix | 22 ++ .../borgmatic/basic-configuration.service | 23 ++ .../borgmatic/basic-configuration.timer | 10 + tests/modules/services/borgmatic/default.nix | 1 + 12 files changed, 473 insertions(+) create mode 100644 modules/programs/borgmatic.nix create mode 100644 modules/services/borgmatic.nix create mode 100644 tests/modules/programs/borgmatic/basic-configuration.nix create mode 100644 tests/modules/programs/borgmatic/default.nix create mode 100644 tests/modules/services/borgmatic/basic-configuration.nix create mode 100644 tests/modules/services/borgmatic/basic-configuration.service create mode 100644 tests/modules/services/borgmatic/basic-configuration.timer create mode 100644 tests/modules/services/borgmatic/default.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 33a52f5c..9fa277b0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -343,6 +343,11 @@ Makefile @thiagokokada /modules/services/betterlockscreen.nix @SebTM +/modules/programs/borgmatic.nix @DamienCassou +/modules/services/borgmatic.nix @DamienCassou +/tests/modules/programs/borgmatic @DamienCassou +/tests/modules/services/borgmatic @DamienCassou + /modules/services/caffeine.nix @uvNikita /modules/services/cbatticon.nix @pmiddend diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 044ce393..0cc0fe54 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -748,6 +748,20 @@ in A new module is available: 'programs.discocss'. ''; } + + { + time = "2022-10-16T19:49:46+00:00"; + condition = hostPlatform.isLinux; + message = '' + Two new modules are available: + + - 'programs.borgmatic' and + - 'services.borgmatic'. + + use the first to configure the borgmatic tool and the second if you + want to automatically run scheduled backups. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index b1bc0204..1bb875a4 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -57,6 +57,7 @@ let ./programs/bashmount.nix ./programs/bat.nix ./programs/beets.nix + ./programs/borgmatic.nix ./programs/bottom.nix ./programs/broot.nix ./programs/browserpass.nix @@ -197,6 +198,7 @@ let ./services/barrier.nix ./services/betterlockscreen.nix ./services/blueman-applet.nix + ./services/borgmatic.nix ./services/caffeine.nix ./services/cbatticon.nix ./services/clipmenu.nix diff --git a/modules/programs/borgmatic.nix b/modules/programs/borgmatic.nix new file mode 100644 index 00000000..054ee232 --- /dev/null +++ b/modules/programs/borgmatic.nix @@ -0,0 +1,196 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.borgmatic; + + mkNullableOption = args: + lib.mkOption (args // { + type = lib.types.nullOr args.type; + default = null; + }); + + mkRetentionOption = frequency: + mkNullableOption { + type = types.int; + description = + "Number of ${frequency} archives to keep. Use -1 for no limit."; + example = 3; + }; + + extraConfigOption = mkOption { + type = with types; attrsOf (oneOf [ str bool path int ]); + default = { }; + description = "Extra settings."; + }; + + consistencyCheckModule = types.submodule { + options = { + name = mkOption { + type = types.enum [ "repository" "archives" "data" "extract" ]; + description = "Name of consistency check to run."; + example = "repository"; + }; + + frequency = mkNullableOption { + type = types.strMatching "([[:digit:]]+ .*)|always"; + description = "Frequency of this type of check"; + example = "2 weeks"; + }; + }; + }; + + configModule = types.submodule { + options = { + location = { + sourceDirectories = mkOption { + type = types.listOf types.str; + description = "Directories to backup."; + example = literalExpression "[config.home.homeDirectory]"; + }; + + repositories = mkOption { + type = types.listOf types.str; + description = "Paths to repositories."; + example = + literalExpression ''["ssh://myuser@myrepo.myserver.com/./repo"]''; + }; + + extraConfig = extraConfigOption; + }; + + storage = { + encryptionPasscommand = mkNullableOption { + type = types.str; + description = "Command writing the passphrase to standard output."; + example = + literalExpression ''"''${pkgs.password-store}/bin/pass borg-repo"''; + }; + extraConfig = extraConfigOption; + }; + + retention = { + keepWithin = mkNullableOption { + type = types.strMatching "[[:digit:]]+[Hdwmy]"; + description = "Keep all archives within this time interval."; + example = "2d"; + }; + + keepSecondly = mkRetentionOption "secondly"; + keepMinutely = mkRetentionOption "minutely"; + keepHourly = mkRetentionOption "hourly"; + keepDaily = mkRetentionOption "daily"; + keepWeekly = mkRetentionOption "weekly"; + keepMonthly = mkRetentionOption "monthly"; + keepYearly = mkRetentionOption "yearly"; + + extraConfig = extraConfigOption; + }; + + consistency = { + checks = mkOption { + type = types.listOf consistencyCheckModule; + default = [ ]; + description = "Consistency checks to run"; + example = literalExpression '' + [ + { + name = "repository"; + frequency = "2 weeks"; + } + { + name = "archives"; + frequency = "4 weeks"; + } + { + name = "data"; + frequency = "6 weeks"; + } + { + name = "extract"; + frequency = "6 weeks"; + } + ]; + ''; + }; + + extraConfig = extraConfigOption; + }; + }; + }; + + removeNullValues = attrSet: filterAttrs (key: value: value != null) attrSet; + + writeConfig = config: + generators.toYAML { } { + location = removeNullValues { + source_directories = config.location.sourceDirectories; + repositories = config.location.repositories; + } // config.location.extraConfig; + storage = removeNullValues { + encryption_passcommand = config.storage.encryptionPasscommand; + } // config.storage.extraConfig; + retention = removeNullValues { + keep_within = config.retention.keepWithin; + keep_secondly = config.retention.keepSecondly; + keep_minutely = config.retention.keepMinutely; + keep_hourly = config.retention.keepHourly; + keep_daily = config.retention.keepDaily; + keep_weekly = config.retention.keepWeekly; + keep_monthly = config.retention.keepMonthly; + keep_yearly = config.retention.keepYearly; + } // config.retention.extraConfig; + consistency = removeNullValues { checks = config.consistency.checks; } + // config.consistency.extraConfig; + }; +in { + meta.maintainers = [ maintainers.DamienCassou ]; + + options = { + programs.borgmatic = { + enable = mkEnableOption "Borgmatic"; + + package = mkPackageOption pkgs "borgmatic" { }; + + backups = mkOption { + type = types.attrsOf configModule; + description = '' + Borgmatic allows for several named backup configurations, + each with its own source directories and repositories. + ''; + example = literalExpression '' + { + personal = { + location = { + sourceDirectories = [ "/home/me/personal" ]; + repositories = [ "ssh://myuser@myserver.com/./personal-repo" ]; + }; + }; + work = { + location = { + sourceDirectories = [ "/home/me/work" ]; + repositories = [ "ssh://myuser@myserver.com/./work-repo" ]; + }; + }; + }; + ''; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "programs.borgmatic" pkgs + lib.platforms.linux) + ]; + + xdg.configFile = with lib.attrsets; + mapAttrs' (configName: config: + nameValuePair ("borgmatic.d/" + configName + ".yaml") { + text = writeConfig config; + }) cfg.backups; + + home.packages = [ cfg.package ]; + }; +} diff --git a/modules/services/borgmatic.nix b/modules/services/borgmatic.nix new file mode 100644 index 00000000..f91e84cd --- /dev/null +++ b/modules/services/borgmatic.nix @@ -0,0 +1,87 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + serviceConfig = config.services.borgmatic; + programConfig = config.programs.borgmatic; +in { + meta.maintainers = [ maintainers.DamienCassou ]; + + options = { + services.borgmatic = { + enable = mkEnableOption "Borgmatic service"; + + frequency = mkOption { + type = types.str; + default = "hourly"; + description = '' + How often to run borgmatic when + services.borgmatic.enable = true. + This value is passed to the systemd timer configuration as + the onCalendar option. See + + systemd.time + 7 + + for more information about the format. + ''; + }; + }; + }; + + config = mkIf serviceConfig.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.borgmatic" pkgs + lib.platforms.linux) + ]; + + systemd.user = { + services.borgmatic = { + Unit = { + Description = "borgmatic backup"; + # Prevent borgmatic from running unless the machine is + # plugged into power: + ConditionACPower = true; + }; + Service = { + Type = "oneshot"; + + # Lower CPU and I/O priority: + Nice = 19; + CPUSchedulingPolicy = "batch"; + IOSchedulingClass = "best-effort"; + IOSchedulingPriority = 7; + IOWeight = 100; + + Restart = "no"; + LogRateLimitIntervalSec = 0; + + # Delay start to prevent backups running during boot: + ExecStartPre = "sleep 3m"; + + ExecStart = '' + ${pkgs.systemd}/bin/systemd-inhibit \ + --who="borgmatic" \ + --why="Prevent interrupting scheduled backup" \ + ${programConfig.package}/bin/borgmatic \ + --stats \ + --verbosity -1 \ + --list \ + --syslog-verbosity 1 + ''; + }; + }; + + timers.borgmatic = { + Unit.Description = "Run borgmatic backup"; + Timer = { + OnCalendar = serviceConfig.frequency; + Persistent = true; + RandomizedDelaySec = "10m"; + }; + Install.WantedBy = [ "timers.target" ]; + }; + }; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 61959860..5621adb0 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -141,6 +141,7 @@ import nmt { ./modules/misc/xsession ./modules/programs/abook ./modules/programs/autorandr + ./modules/programs/borgmatic ./modules/programs/firefox ./modules/programs/foot ./modules/programs/getmail @@ -160,6 +161,7 @@ import nmt { ./modules/programs/xmobar ./modules/programs/yt-dlp ./modules/services/barrier + ./modules/services/borgmatic ./modules/services/devilspie2 ./modules/services/dropbox ./modules/services/emacs diff --git a/tests/modules/programs/borgmatic/basic-configuration.nix b/tests/modules/programs/borgmatic/basic-configuration.nix new file mode 100644 index 00000000..7a7b63d2 --- /dev/null +++ b/tests/modules/programs/borgmatic/basic-configuration.nix @@ -0,0 +1,110 @@ +{ config, pkgs, ... }: + +let + boolToString = bool: if bool then "true" else "false"; + backups = config.programs.borgmatic.backups; +in { + config = { + programs.borgmatic = { + enable = true; + backups = { + main = { + location = { + sourceDirectories = [ "/my-stuff-to-backup" ]; + repositories = [ "/mnt/disk1" "/mnt/disk2" ]; + extraConfig = { one_file_system = true; }; + }; + + storage = { + encryptionPasscommand = "fetch-the-password.sh"; + extraConfig = { checkpoint_interval = 200; }; + }; + + retention = { + keepWithin = "14d"; + keepSecondly = 12; + extraConfig = { prefix = "hostname"; }; + }; + + consistency = { + checks = [ + { + name = "repository"; + frequency = "2 weeks"; + } + { + name = "archives"; + frequency = "4 weeks"; + } + ]; + + extraConfig = { prefix = "hostname"; }; + }; + }; + }; + }; + + test.stubs.borgmatic = { }; + + nmt.script = '' + config_file=$TESTED/home-files/.config/borgmatic.d/main.yaml + assertFileExists $config_file + + declare -A expectations + + expectations[location.source_directories[0]]="${ + builtins.elemAt backups.main.location.sourceDirectories 0 + }" + expectations[location.repositories[0]]="${ + builtins.elemAt backups.main.location.repositories 0 + }" + expectations[location.repositories[1]]="${ + builtins.elemAt backups.main.location.repositories 1 + }" + expectations[location.one_file_system]="${ + boolToString backups.main.location.extraConfig.one_file_system + }" + + expectations[storage.encryption_passcommand]="${backups.main.storage.encryptionPasscommand}" + expectations[storage.checkpoint_interval]="${ + toString backups.main.storage.extraConfig.checkpoint_interval + }" + + expectations[retention.keep_within]="${backups.main.retention.keepWithin}" + expectations[retention.keep_secondly]="${ + toString backups.main.retention.keepSecondly + }" + expectations[retention.prefix]="${backups.main.retention.extraConfig.prefix}" + + expectations[consistency.checks[0].name]="${ + (builtins.elemAt backups.main.consistency.checks 0).name + }" + expectations[consistency.checks[0].frequency]="${ + (builtins.elemAt backups.main.consistency.checks 0).frequency + }" + expectations[consistency.checks[1].name]="${ + (builtins.elemAt backups.main.consistency.checks 1).name + }" + expectations[consistency.checks[1].frequency]="${ + (builtins.elemAt backups.main.consistency.checks 1).frequency + }" + expectations[consistency.prefix]="${backups.main.consistency.extraConfig.prefix}" + + yq=${pkgs.yq-go}/bin/yq + + for filter in "''${!expectations[@]}"; do + expected_value="''${expectations[$filter]}" + actual_value="$($yq ".$filter" $config_file)" + + if [[ "$actual_value" != "$expected_value" ]]; then + fail "Expected '$filter' to be '$expected_value' but was '$actual_value'" + fi + done + + one_file_system=$($yq ".location.one_file_system" $config_file) + if [[ $one_file_system != "true" ]]; then + fail "Expected one_file_system to be true but it was $one_file_system" + fi + ''; + }; +} diff --git a/tests/modules/programs/borgmatic/default.nix b/tests/modules/programs/borgmatic/default.nix new file mode 100644 index 00000000..721c4823 --- /dev/null +++ b/tests/modules/programs/borgmatic/default.nix @@ -0,0 +1 @@ +{ borgmatic-program-basic-configuration = ./basic-configuration.nix; } diff --git a/tests/modules/services/borgmatic/basic-configuration.nix b/tests/modules/services/borgmatic/basic-configuration.nix new file mode 100644 index 00000000..3763b98f --- /dev/null +++ b/tests/modules/services/borgmatic/basic-configuration.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: + +{ + config = { + services.borgmatic = { + enable = true; + frequency = "weekly"; + }; + + test.stubs.borgmatic = { }; + + nmt.script = '' + assertFileContent \ + $(normalizeStorePaths home-files/.config/systemd/user/borgmatic.service) \ + ${./basic-configuration.service} + + assertFileContent \ + home-files/.config/systemd/user/borgmatic.timer \ + ${./basic-configuration.timer} + ''; + }; +} diff --git a/tests/modules/services/borgmatic/basic-configuration.service b/tests/modules/services/borgmatic/basic-configuration.service new file mode 100644 index 00000000..6101b2b6 --- /dev/null +++ b/tests/modules/services/borgmatic/basic-configuration.service @@ -0,0 +1,23 @@ +[Service] +CPUSchedulingPolicy=batch +ExecStart=/nix/store/00000000000000000000000000000000-systemd/bin/systemd-inhibit \ + --who="borgmatic" \ + --why="Prevent interrupting scheduled backup" \ + @borgmatic@/bin/borgmatic \ + --stats \ + --verbosity -1 \ + --list \ + --syslog-verbosity 1 + +ExecStartPre=sleep 3m +IOSchedulingClass=best-effort +IOSchedulingPriority=7 +IOWeight=100 +LogRateLimitIntervalSec=0 +Nice=19 +Restart=no +Type=oneshot + +[Unit] +ConditionACPower=true +Description=borgmatic backup diff --git a/tests/modules/services/borgmatic/basic-configuration.timer b/tests/modules/services/borgmatic/basic-configuration.timer new file mode 100644 index 00000000..1427925f --- /dev/null +++ b/tests/modules/services/borgmatic/basic-configuration.timer @@ -0,0 +1,10 @@ +[Install] +WantedBy=timers.target + +[Timer] +OnCalendar=weekly +Persistent=true +RandomizedDelaySec=10m + +[Unit] +Description=Run borgmatic backup diff --git a/tests/modules/services/borgmatic/default.nix b/tests/modules/services/borgmatic/default.nix new file mode 100644 index 00000000..802e7d0c --- /dev/null +++ b/tests/modules/services/borgmatic/default.nix @@ -0,0 +1 @@ +{ borgmatic-service-basic-configuration = ./basic-configuration.nix; } From bc7432fbcc5bdd15f90109ac32fc4c7b75b968af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 01:28:56 +0000 Subject: [PATCH 055/233] ci: bump cachix/install-nix-action from 17 to 18 Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 17 to 18. - [Release notes](https://github.com/cachix/install-nix-action/releases) - [Commits](https://github.com/cachix/install-nix-action/compare/v17...v18) --- updated-dependencies: - dependency-name: cachix/install-nix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/github_pages.yml | 2 +- .github/workflows/test.yml | 2 +- .github/workflows/update-flake.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/github_pages.yml b/.github/workflows/github_pages.yml index 1e0a0f9a..b4e5c4d1 100644 --- a/.github/workflows/github_pages.yml +++ b/.github/workflows/github_pages.yml @@ -11,7 +11,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v17 + - uses: cachix/install-nix-action@v18 with: nix_path: nixpkgs=channel:nixos-unstable - uses: cachix/cachix-action@v10 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 22e76b59..368f5a44 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v17 + - uses: cachix/install-nix-action@v18 with: nix_path: nixpkgs=channel:nixos-unstable - uses: cachix/cachix-action@v10 diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml index 084c1c0d..5c3dda66 100644 --- a/.github/workflows/update-flake.yml +++ b/.github/workflows/update-flake.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - name: Install Nix - uses: cachix/install-nix-action@v17 + uses: cachix/install-nix-action@v18 - name: Update flake.lock uses: DeterminateSystems/update-flake-lock@v14 with: From a50c0c6fe0e87d999022e5ce840aa3700ca58ce7 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 17 Oct 2022 09:17:50 +0200 Subject: [PATCH 056/233] dependabot: switch target from 21.11 to 22.05 --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index c1d917c2..7a1b642d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,7 +10,7 @@ updates: - package-ecosystem: "github-actions" directory: "/" - target-branch: "release-21.11" + target-branch: "release-22.05" schedule: interval: "weekly" commit-message: From e901c8d86082be74a8be70773bbb6d401ff21e49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 07:28:06 +0000 Subject: [PATCH 057/233] ci: bump cachix/cachix-action from 10 to 11 Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 10 to 11. - [Release notes](https://github.com/cachix/cachix-action/releases) - [Commits](https://github.com/cachix/cachix-action/compare/v10...v11) --- updated-dependencies: - dependency-name: cachix/cachix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/github_pages.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github_pages.yml b/.github/workflows/github_pages.yml index b4e5c4d1..045dae37 100644 --- a/.github/workflows/github_pages.yml +++ b/.github/workflows/github_pages.yml @@ -14,7 +14,7 @@ jobs: - uses: cachix/install-nix-action@v18 with: nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v10 + - uses: cachix/cachix-action@v11 with: name: nix-community signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 368f5a44..0d09765b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: - uses: cachix/install-nix-action@v18 with: nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v10 + - uses: cachix/cachix-action@v11 with: name: nix-community signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' From 42f81ac107c5a9a177888080107094dba57f134e Mon Sep 17 00:00:00 2001 From: j-brn Date: Sun, 9 Oct 2022 20:11:59 +0200 Subject: [PATCH 058/233] looking-glass-client: add module --- .github/CODEOWNERS | 3 + modules/misc/news.nix | 8 +++ modules/modules.nix | 1 + modules/programs/looking-glass-client.nix | 60 +++++++++++++++++++ tests/default.nix | 1 + .../programs/looking-glass-client/default.nix | 4 ++ .../looking-glass-client/empty-settings.nix | 16 +++++ .../looking-glass-client/example-config.ini | 16 +++++ .../looking-glass-client/example-settings.nix | 41 +++++++++++++ 9 files changed, 150 insertions(+) create mode 100644 modules/programs/looking-glass-client.nix create mode 100644 tests/modules/programs/looking-glass-client/default.nix create mode 100644 tests/modules/programs/looking-glass-client/empty-settings.nix create mode 100644 tests/modules/programs/looking-glass-client/example-config.ini create mode 100644 tests/modules/programs/looking-glass-client/example-settings.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9fa277b0..b38049ed 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -176,6 +176,9 @@ Makefile @thiagokokada /modules/programs/lieer.nix @tadfisher +/modules/programs/looking-glass-client.nix @j-brn +/tests/modules/programs/looking-glass-client @j-brn + /modules/programs/lsd.nix @marsam /modules/programs/matplotlib.nix @rprospero diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 0cc0fe54..b88ba7e4 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -762,6 +762,14 @@ in want to automatically run scheduled backups. ''; } + + { + time = "2022-10-18T08:07:43+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.looking-glass-client'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 1bb875a4..f2c6b1e9 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -110,6 +110,7 @@ let ./programs/lf.nix ./programs/librewolf.nix ./programs/lieer.nix + ./programs/looking-glass-client.nix ./programs/lsd.nix ./programs/man.nix ./programs/mangohud.nix diff --git a/modules/programs/looking-glass-client.nix b/modules/programs/looking-glass-client.nix new file mode 100644 index 00000000..1c14282b --- /dev/null +++ b/modules/programs/looking-glass-client.nix @@ -0,0 +1,60 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.looking-glass-client; + settingsFormat = pkgs.formats.ini { }; +in { + meta.maintainers = with maintainers; [ j-brn ]; + + options.programs.looking-glass-client = { + enable = mkEnableOption "looking-glass-client"; + + package = mkPackageOption pkgs "looking-glass-client" { }; + + settings = mkOption { + type = settingsFormat.type; + default = { }; + description = "looking-glass-client settings."; + example = literalExpression '' + { + app = { + allowDMA = true; + shmFile = "/dev/kvmfr0"; + }; + + win = { + fullScreen = true; + showFPS = false; + jitRender = true; + }; + + spice = { + enable = true; + audio = true; + }; + + input = { + rawMouse = true; + escapeKey = 62; + }; + } + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "programs.looking-glass-client" pkgs + platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + xdg.configFile."looking-glass/client.ini" = mkIf (cfg.settings != { }) { + source = + settingsFormat.generate ("looking-glass-client.ini") cfg.settings; + }; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 5621adb0..efe2356f 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -149,6 +149,7 @@ import nmt { ./modules/programs/hexchat ./modules/programs/i3status-rust ./modules/programs/kodi + ./modules/programs/looking-glass-client ./modules/programs/mangohud ./modules/programs/ncmpcpp-linux ./modules/programs/neovim # Broken package dependency on Darwin. diff --git a/tests/modules/programs/looking-glass-client/default.nix b/tests/modules/programs/looking-glass-client/default.nix new file mode 100644 index 00000000..fdbbb25a --- /dev/null +++ b/tests/modules/programs/looking-glass-client/default.nix @@ -0,0 +1,4 @@ +{ + looking-glass-client-example-settings = ./example-settings.nix; + looking-glass-client-empty-settings = ./empty-settings.nix; +} diff --git a/tests/modules/programs/looking-glass-client/empty-settings.nix b/tests/modules/programs/looking-glass-client/empty-settings.nix new file mode 100644 index 00000000..10c177a9 --- /dev/null +++ b/tests/modules/programs/looking-glass-client/empty-settings.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.looking-glass-client = { + enable = true; + package = config.lib.test.mkStubPackage { }; + }; + + nmt.script = '' + assertPathNotExists home-files/.config/looking-glass/client.ini + ''; + }; +} diff --git a/tests/modules/programs/looking-glass-client/example-config.ini b/tests/modules/programs/looking-glass-client/example-config.ini new file mode 100644 index 00000000..db006d3f --- /dev/null +++ b/tests/modules/programs/looking-glass-client/example-config.ini @@ -0,0 +1,16 @@ +[app] +allowDMA=true +shmFile=/dev/kvmfr0 + +[input] +escapeKey=62 +rawMouse=true + +[spice] +audio=true +enable=true + +[win] +fullScreen=true +jitRender=true +showFPS=false diff --git a/tests/modules/programs/looking-glass-client/example-settings.nix b/tests/modules/programs/looking-glass-client/example-settings.nix new file mode 100644 index 00000000..6ac8f018 --- /dev/null +++ b/tests/modules/programs/looking-glass-client/example-settings.nix @@ -0,0 +1,41 @@ +{ config, lib, ... }: + +with lib; + +{ + config = { + programs.looking-glass-client = { + enable = true; + package = config.lib.test.mkStubPackage { }; + + settings = { + app = { + allowDMA = true; + shmFile = "/dev/kvmfr0"; + }; + + win = { + fullScreen = true; + showFPS = false; + jitRender = true; + }; + + spice = { + enable = true; + audio = true; + }; + + input = { + rawMouse = true; + escapeKey = 62; + }; + }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/looking-glass/client.ini \ + ${./example-config.ini} + ''; + }; +} From d1191c6d05120449f3e54e1211518df7c69ee282 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 20 Oct 2022 08:47:36 +0200 Subject: [PATCH 059/233] docs: bump nmd Fixes #3342 --- docs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 4aad2bfc..dc304ae2 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,8 +7,8 @@ let nmdSrc = fetchTarball { url = - "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=91dee681dd1c478d6040a00835d73c0f4a4c5c29"; - sha256 = "07szg39wmna287hv5w9hl45wvm04zbh0k54br59nv3yzvg9ymlj4"; + "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169"; + sha256 = "0c2nq28rw4v559s3f1nf6y2p6fladgmbqgbsyf3vzs2przn5qn37"; }; nmd = import nmdSrc { inherit lib pkgs; }; From c485669ca529e01c1505429fa9017c9a93f15559 Mon Sep 17 00:00:00 2001 From: David Warde-Farley Date: Wed, 19 Oct 2022 00:50:06 +0100 Subject: [PATCH 060/233] i3status: add `package` attribute --- modules/programs/i3status.nix | 4 +++- tests/modules/programs/i3status/with-custom.nix | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/programs/i3status.nix b/modules/programs/i3status.nix index ca1f133e..5fd4f741 100644 --- a/modules/programs/i3status.nix +++ b/modules/programs/i3status.nix @@ -138,6 +138,8 @@ in { } ''; }; + + package = mkPackageOption pkgs "i3status" { }; }; config = mkIf cfg.enable { @@ -197,7 +199,7 @@ in { }; }; - home.packages = [ pkgs.i3status ]; + home.packages = [ cfg.package ]; xdg.configFile."i3status/config".text = concatStringsSep "\n" ([ ] ++ optional (cfg.general != { }) (formatModule "general" cfg.general) diff --git a/tests/modules/programs/i3status/with-custom.nix b/tests/modules/programs/i3status/with-custom.nix index 830bc6c9..8b673b8a 100644 --- a/tests/modules/programs/i3status/with-custom.nix +++ b/tests/modules/programs/i3status/with-custom.nix @@ -16,6 +16,8 @@ with lib; interval = 1; }; + package = config.lib.test.mkStubPackage { }; + modules = { "volume master" = { position = 1; From 69d19b9839638fc487b370e0600a03577a559081 Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Fri, 27 May 2022 20:01:44 -0400 Subject: [PATCH 061/233] firefox: support setting search engines With this change, it's now possible to configure the default search engine in Firefox with programs.firefox.profiles..search.default and add custom engines with programs.firefox.profiles..search.engines. It's also recommended to enable programs.firefox.profiles..search.force = true since Firefox will replace the symlink for the search configuration on every launch, but note that you'll loose any existing configuration by enabling this. --- modules/misc/news.nix | 23 ++ modules/programs/firefox.nix | 198 +++++++++++++++++- .../profile-settings-expected-search.json | 75 +++++++ .../programs/firefox/profile-settings.nix | 53 +++++ 4 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 tests/modules/programs/firefox/profile-settings-expected-search.json diff --git a/modules/misc/news.nix b/modules/misc/news.nix index b88ba7e4..88a1dce9 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -770,6 +770,29 @@ in A new module is available: 'programs.looking-glass-client'. ''; } + + { + time = "2022-10-22T17:52:30+00:00"; + condition = config.programs.firefox.enable; + message = '' + It is now possible to configure the default search engine in Firefox + with + + programs.firefox.profiles..search.default + + and add custom engines with + + programs.firefox.profiles..search.engines. + + It is also recommended to set + + programs.firefox.profiles..search.force = true + + since Firefox will replace the symlink for the search configuration on + every launch, but note that you'll lose any existing configuration by + enabling this. + ''; + } ]; }; } diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index bf0eac15..06c9aac7 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -8,6 +8,8 @@ let cfg = config.programs.firefox; + jsonFormat = pkgs.formats.json { }; + mozillaConfigPath = if isDarwin then "Library/Application Support/Mozilla" else ".mozilla"; @@ -106,7 +108,7 @@ let ''; in { - meta.maintainers = [ maintainers.rycee ]; + meta.maintainers = [ maintainers.rycee maintainers.kira-bruneau ]; imports = [ (mkRemovedOptionModule [ "programs" "firefox" "enableAdobeFlash" ] @@ -351,6 +353,87 @@ in { defaultText = "true if profile ID is 0"; description = "Whether this is a default profile."; }; + + search = { + force = mkOption { + type = with types; bool; + default = false; + description = '' + Whether to force replace the existing search + configuration. This is recommended since Firefox will + replace the symlink for the search configuration on every + launch, but note that you'll lose any existing + configuration by enabling this. + ''; + }; + + default = mkOption { + type = with types; nullOr str; + default = null; + example = "DuckDuckGo"; + description = '' + The default search engine used in the address bar and search bar. + ''; + }; + + order = mkOption { + type = with types; uniq (listOf str); + default = [ ]; + example = [ "DuckDuckGo" "Google" ]; + description = '' + The order the search engines are listed in. Any engines + that aren't included in this list will be listed after + these in an unspecified order. + ''; + }; + + engines = mkOption { + type = with types; attrsOf (attrsOf jsonFormat.type); + default = { }; + example = literalExpression '' + { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { name = "type"; value = "packages"; } + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + + icon = "''${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; + + "NixOS Wiki" = { + urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = [ "@nw" ]; + }; + + "Bing".metaData.hidden = true; + "Google".metaData.alias = "@g"; # builtin engines only support specifying one additional alias + } + ''; + description = '' + Attribute set of search engine configurations. Engines + that only have metaData specified will + be treated as builtin to Firefox. + + See SearchEngine.jsm + in Firefox's source for available options. We maintain a + mapping to let you specify all options in the referenced + link without underscores, but it may fall out of date with + future options. + + Note, icon is also a special option + added by Home Manager to make it convenient to specify + absolute icon paths. + ''; + }; + }; }; })); default = { }; @@ -444,6 +527,119 @@ in { mkUserJs profile.settings profile.extraConfig profile.bookmarks; }; + "${profilesPath}/${profile.path}/search.json.mozlz4" = mkIf + (profile.search.default != null || profile.search.order != [ ] + || profile.search.engines != { }) { + force = profile.search.force; + source = let + settings = { + version = 6; + + engines = let + allEngines = (profile.search.engines // + # If search.default isn't in search.engines, assume it's app + # provided and include it in the set of all engines + optionalAttrs (profile.search.default != null + && !(hasAttr profile.search.default + profile.search.engines)) { + ${profile.search.default} = { }; + }); + + # Map allEngines to a list and order by search.order + orderedEngineList = (imap (order: name: + let engine = allEngines.${name} or { }; + in engine // { + inherit name; + metaData = (engine.metaData or { }) // { inherit order; }; + }) profile.search.order) ++ (mapAttrsToList + (name: config: config // { inherit name; }) + (removeAttrs allEngines profile.search.order)); + + engines = map (config: + let + name = config.name; + isAppProvided = removeAttrs config [ "name" "metaData" ] + == { }; + metaData = config.metaData or { }; + in mapAttrs' (name: value: { + # Map nice field names to internal field names. This is + # intended to be exhaustive, but any future fields will + # either have to be specified with an underscore, or added + # to this map. + name = ((genAttrs [ + "name" + "isAppProvided" + "loadPath" + "hasPreferredIcon" + "updateInterval" + "updateURL" + "iconUpdateURL" + "iconURL" + "iconMapObj" + "metaData" + "orderHint" + "definedAliases" + "urls" + ] (name: "_${name}")) // { + "searchForm" = "__searchForm"; + }).${name} or name; + + inherit value; + }) ((removeAttrs config [ "icon" ]) + // (optionalAttrs (!isAppProvided) + (optionalAttrs (config ? iconUpdateURL) { + # Convenience to default iconURL to iconUpdateURL so + # the icon is immediately downloaded from the URL + iconURL = config.iconURL or config.iconUpdateURL; + } // optionalAttrs (config ? icon) { + # Convenience to specify absolute path to icon + iconURL = "file://${config.icon}"; + } // { + # Required for custom engine configurations, loadPaths + # are unique identifiers that are generally formatted + # like: [source]/path/to/engine.xml + loadPath = '' + [home-manager]/programs.firefox.profiles.${profile.name}.search.engines."${ + replaceChars [ "\\" ] [ "\\\\" ] name + }"''; + })) // { + # Required fields for all engine configurations + inherit name isAppProvided metaData; + })) orderedEngineList; + in engines; + + metaData = optionalAttrs (profile.search.default != null) { + current = profile.search.default; + hash = "@hash@"; + } // { + useSavedOrder = profile.search.order != [ ]; + }; + }; + + # Home Manager doesn't circumvent user consent and isn't acting + # maliciously. We're modifying the search outside of Firefox, but + # a claim by Mozilla to remove this would be very anti-user, and + # is unlikely to be an issue for our use case. + disclaimer = appName: + "By modifying this file, I agree that I am doing so " + + "only within ${appName} itself, using official, user-driven search " + + "engine selection processes, and in a way which does not circumvent " + + "user consent. I acknowledge that any attempt to change this file " + + "from outside of ${appName} is a malicious act, and will be responded " + + "to accordingly."; + + salt = profile.path + profile.search.default + + disclaimer "Firefox"; + in pkgs.runCommand "search.json.mozlz4" { + nativeBuildInputs = with pkgs; [ mozlz4a openssl ]; + json = builtins.toJSON settings; + inherit salt; + } '' + export hash=$(echo -n "$salt" | openssl dgst -sha256 -binary | base64) + mozlz4a <(substituteStream json search.json.in --subst-var hash) "$out" + ''; + }; + "${profilesPath}/${profile.path}/extensions" = mkIf (cfg.extensions != [ ]) { source = "${extensionsEnvPkg}/share/mozilla/${extensionPath}"; diff --git a/tests/modules/programs/firefox/profile-settings-expected-search.json b/tests/modules/programs/firefox/profile-settings-expected-search.json new file mode 100644 index 00000000..ceee27ee --- /dev/null +++ b/tests/modules/programs/firefox/profile-settings-expected-search.json @@ -0,0 +1,75 @@ +{ + "engines": [ + { + "_definedAliases": [ + "@np" + ], + "_iconURL": "file:///run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg", + "_isAppProvided": false, + "_loadPath": "[home-manager]/programs.firefox.profiles.search.search.engines.\"Nix Packages\"", + "_metaData": { + "order": 1 + }, + "_name": "Nix Packages", + "_urls": [ + { + "params": [ + { + "name": "type", + "value": "packages" + }, + { + "name": "query", + "value": "{searchTerms}" + } + ], + "template": "https://search.nixos.org/packages" + } + ] + }, + { + "_definedAliases": [ + "@nw" + ], + "_iconURL": "https://nixos.wiki/favicon.png", + "_iconUpdateURL": "https://nixos.wiki/favicon.png", + "_isAppProvided": false, + "_loadPath": "[home-manager]/programs.firefox.profiles.search.search.engines.\"NixOS Wiki\"", + "_metaData": { + "order": 2 + }, + "_name": "NixOS Wiki", + "_updateInterval": 86400000, + "_urls": [ + { + "template": "https://nixos.wiki/index.php?search={searchTerms}" + } + ] + }, + { + "_isAppProvided": true, + "_metaData": { + "hidden": true + }, + "_name": "Bing" + }, + { + "_isAppProvided": true, + "_metaData": {}, + "_name": "DuckDuckGo" + }, + { + "_isAppProvided": true, + "_metaData": { + "alias": "@g" + }, + "_name": "Google" + } + ], + "metaData": { + "current": "DuckDuckGo", + "hash": "BWvqUiaCuMJ20lbymFf2dqzWyl1cgm1LZhhdWNEp0Cc=", + "useSavedOrder": true + }, + "version": 6 +} diff --git a/tests/modules/programs/firefox/profile-settings.nix b/tests/modules/programs/firefox/profile-settings.nix index 23bf1285..b28e6459 100644 --- a/tests/modules/programs/firefox/profile-settings.nix +++ b/tests/modules/programs/firefox/profile-settings.nix @@ -60,6 +60,49 @@ lib.mkIf config.test.enableBig { } ]; }; + + profiles.search = { + id = 3; + search = { + force = true; + default = "DuckDuckGo"; + order = [ "Nix Packages" "NixOS Wiki" ]; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + }]; + + icon = + "/run/current-system/sw/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + + definedAliases = [ "@np" ]; + }; + + "NixOS Wiki" = { + urls = [{ + template = "https://nixos.wiki/index.php?search={searchTerms}"; + }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; + definedAliases = [ "@nw" ]; + }; + + "Bing".metaData.hidden = true; + "Google".metaData.alias = "@g"; + }; + }; + }; }; nixpkgs.overlays = [ @@ -101,5 +144,15 @@ lib.mkIf config.test.enableBig { assertFileContent \ $bookmarksFile \ ${./profile-settings-expected-bookmarks.html} + + compressedSearch=$(normalizeStorePaths \ + home-files/.mozilla/firefox/search/search.json.mozlz4) + + decompressedSearch=$(dirname $compressedSearch)/search.json + ${pkgs.mozlz4a}/bin/mozlz4a -d "$compressedSearch" >(${pkgs.jq}/bin/jq . > "$decompressedSearch") + + assertFileContent \ + $decompressedSearch \ + ${./profile-settings-expected-search.json} ''; } From 186d9399f9eb64fb06ea4385732c1cf1624ae2b6 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Sun, 23 Oct 2022 22:52:22 +0200 Subject: [PATCH 062/233] borgmatic: specify where to find sleep (#3349) Closes #3348. --- modules/services/borgmatic.nix | 2 +- tests/modules/services/borgmatic/basic-configuration.service | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/services/borgmatic.nix b/modules/services/borgmatic.nix index f91e84cd..f5368cdf 100644 --- a/modules/services/borgmatic.nix +++ b/modules/services/borgmatic.nix @@ -58,7 +58,7 @@ in { LogRateLimitIntervalSec = 0; # Delay start to prevent backups running during boot: - ExecStartPre = "sleep 3m"; + ExecStartPre = "${pkgs.coreutils}/bin/sleep 3m"; ExecStart = '' ${pkgs.systemd}/bin/systemd-inhibit \ diff --git a/tests/modules/services/borgmatic/basic-configuration.service b/tests/modules/services/borgmatic/basic-configuration.service index 6101b2b6..4840f11b 100644 --- a/tests/modules/services/borgmatic/basic-configuration.service +++ b/tests/modules/services/borgmatic/basic-configuration.service @@ -9,7 +9,7 @@ ExecStart=/nix/store/00000000000000000000000000000000-systemd/bin/systemd-inhibi --list \ --syslog-verbosity 1 -ExecStartPre=sleep 3m +ExecStartPre=/nix/store/00000000000000000000000000000000-coreutils/bin/sleep 3m IOSchedulingClass=best-effort IOSchedulingPriority=7 IOWeight=100 From 7dc4e4ebd71280842b4d30975439980baaac9db8 Mon Sep 17 00:00:00 2001 From: Paul Meyer <49727155+katexochen@users.noreply.github.com> Date: Sun, 23 Oct 2022 21:22:14 +0200 Subject: [PATCH 063/233] k9s: add module --- .github/CODEOWNERS | 3 + modules/lib/maintainers.nix | 6 ++ modules/misc/news.nix | 7 ++ modules/modules.nix | 1 + modules/programs/k9s.nix | 65 +++++++++++++++++++ tests/default.nix | 1 + tests/modules/programs/k9s/default.nix | 4 ++ tests/modules/programs/k9s/empty-settings.nix | 11 ++++ .../programs/k9s/example-config-expected.yml | 5 ++ .../modules/programs/k9s/example-settings.nix | 42 ++++++++++++ .../programs/k9s/example-skin-expected.yml | 8 +++ 11 files changed, 153 insertions(+) create mode 100644 modules/programs/k9s.nix create mode 100644 tests/modules/programs/k9s/default.nix create mode 100644 tests/modules/programs/k9s/empty-settings.nix create mode 100644 tests/modules/programs/k9s/example-config-expected.yml create mode 100644 tests/modules/programs/k9s/example-settings.nix create mode 100644 tests/modules/programs/k9s/example-skin-expected.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b38049ed..a500b20d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -155,6 +155,9 @@ Makefile @thiagokokada /modules/programs/just.nix @maximsmol +/modules/programs/k9s.nix @katexochen +/tests/modules/programs/k9s @katexochen + /modules/programs/keychain.nix @marsam /modules/programs/kodi.nix @dwagenk diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 0784c8a6..cbe77968 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -101,6 +101,12 @@ fingerprint = "2BE3 BAFD 793E A349 ED1F F00F 04D0 CEAF 916A 9A40"; }]; }; + katexochen = { + name = "Paul Meyer"; + email = "49727155+katexochen@users.noreply.github.com"; + github = "katexochen"; + githubId = 49727155; + }; kubukoz = { name = "Jakub Kozłowski"; email = "kubukoz@users.noreply.github.com"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 88a1dce9..b61a3af4 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -793,6 +793,13 @@ in enabling this. ''; } + + { + time = "2022-10-24T22:05:27+00:00"; + message = '' + A new module is available: 'programs.k9s'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index f2c6b1e9..5b228c5f 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -99,6 +99,7 @@ let ./programs/java.nix ./programs/jq.nix ./programs/just.nix + ./programs/k9s.nix ./programs/kakoune.nix ./programs/keychain.nix ./programs/kitty.nix diff --git a/modules/programs/k9s.nix b/modules/programs/k9s.nix new file mode 100644 index 00000000..11ac2bfd --- /dev/null +++ b/modules/programs/k9s.nix @@ -0,0 +1,65 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.k9s; + yamlFormat = pkgs.formats.yaml { }; + +in { + meta.maintainers = [ hm.maintainers.katexochen ]; + + options.programs.k9s = { + enable = + mkEnableOption "k9s - Kubernetes CLI To Manage Your Clusters In Style"; + + package = mkPackageOption pkgs "k9s" { }; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + description = '' + Configuration written to + $XDG_CONFIG_HOME/k9s/config.yml. See + + for supported values. + ''; + example = literalExpression '' + k9s = { + refreshRate = 2; + }; + ''; + }; + + skin = mkOption { + type = yamlFormat.type; + default = { }; + description = '' + Skin written to + $XDG_CONFIG_HOME/k9s/skin.yml. See + + for supported values. + ''; + example = literalExpression '' + k9s = { + body = { + fgColor = "dodgerblue"; + }; + }; + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."k9s/config.yml" = mkIf (cfg.settings != { }) { + source = yamlFormat.generate "k9s-config" cfg.settings; + }; + + xdg.configFile."k9s/skin.yml" = mkIf (cfg.skin != { }) { + source = yamlFormat.generate "k9s-skin" cfg.skin; + }; + }; +} diff --git a/tests/default.nix b/tests/default.nix index efe2356f..e84dbf05 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -80,6 +80,7 @@ import nmt { ./modules/programs/hyfetch ./modules/programs/i3status ./modules/programs/irssi + ./modules/programs/k9s ./modules/programs/kakoune ./modules/programs/kitty ./modules/programs/less diff --git a/tests/modules/programs/k9s/default.nix b/tests/modules/programs/k9s/default.nix new file mode 100644 index 00000000..58d9f32f --- /dev/null +++ b/tests/modules/programs/k9s/default.nix @@ -0,0 +1,4 @@ +{ + k9s-example-settings = ./example-settings.nix; + k9s-empty-settings = ./empty-settings.nix; +} diff --git a/tests/modules/programs/k9s/empty-settings.nix b/tests/modules/programs/k9s/empty-settings.nix new file mode 100644 index 00000000..5084be4f --- /dev/null +++ b/tests/modules/programs/k9s/empty-settings.nix @@ -0,0 +1,11 @@ +{ ... }: + +{ + programs.k9s.enable = true; + + test.stubs.k9s = { }; + + nmt.script = '' + assertPathNotExists home-files/.config/k9s + ''; +} diff --git a/tests/modules/programs/k9s/example-config-expected.yml b/tests/modules/programs/k9s/example-config-expected.yml new file mode 100644 index 00000000..019ee7a7 --- /dev/null +++ b/tests/modules/programs/k9s/example-config-expected.yml @@ -0,0 +1,5 @@ +k9s: + enableMouse: true + headless: false + maxConnRetry: 5 + refreshRate: 2 diff --git a/tests/modules/programs/k9s/example-settings.nix b/tests/modules/programs/k9s/example-settings.nix new file mode 100644 index 00000000..ffe52144 --- /dev/null +++ b/tests/modules/programs/k9s/example-settings.nix @@ -0,0 +1,42 @@ +{ config, ... }: + +{ + programs.k9s = { + enable = true; + package = config.lib.test.mkStubPackage { }; + + settings = { + k9s = { + refreshRate = 2; + maxConnRetry = 5; + enableMouse = true; + headless = false; + }; + }; + + skin = { + k9s = { + body = { + fgColor = "dodgerblue"; + bgColor = "#ffffff"; + logoColor = "#0000ff"; + }; + info = { + fgColor = "lightskyblue"; + sectionColor = "steelblue"; + }; + }; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/k9s/config.yml + assertFileContent \ + home-files/.config/k9s/config.yml \ + ${./example-config-expected.yml} + assertFileExists home-files/.config/k9s/skin.yml + assertFileContent \ + home-files/.config/k9s/skin.yml \ + ${./example-skin-expected.yml} + ''; +} diff --git a/tests/modules/programs/k9s/example-skin-expected.yml b/tests/modules/programs/k9s/example-skin-expected.yml new file mode 100644 index 00000000..94f7e6eb --- /dev/null +++ b/tests/modules/programs/k9s/example-skin-expected.yml @@ -0,0 +1,8 @@ +k9s: + body: + bgColor: '#ffffff' + fgColor: dodgerblue + logoColor: '#0000ff' + info: + fgColor: lightskyblue + sectionColor: steelblue From 32fe7d2ebb7e338ad95a3ea9393fc6ad681368ce Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 27 Oct 2022 14:47:50 +0200 Subject: [PATCH 064/233] home-environment: add hm-version file This commits adds a file `hm-version` to the generated generation directory. This file will contain the release version, and if available, the Git commit hash. --- modules/home-environment.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 38576260..e186dd6c 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -676,6 +676,33 @@ in ${activationCmds} ''; + + getVersion = pkgs.writeShellScript "get-hm-version" '' + set -euo pipefail + + cd "${../.}" || exit 1 + + # Get the base release and initialize an empty version suffix. + release=$(< .release) + suffix="" + + # If we are in a Git repo then update the suffix to be + # + # .git.HASH + # + # where HASH are the first 8 characters of the commit hash. + if [[ -f .git/HEAD ]]; then + ref=$(sed '/ref:/ { s/.* //; }' .git/HEAD) + if [[ -f ".git/$ref" ]]; then + hash=$(< ".git/$ref") + if [[ -n "$hash" ]]; then + suffix=".git.''${hash:0:8}" + fi + fi + fi + + echo "$release$suffix" + ''; in pkgs.runCommand "home-manager-generation" @@ -685,6 +712,8 @@ in '' mkdir -p $out + ${getVersion} > $out/hm-version + cp ${activationScript} $out/activate mkdir $out/bin From d3f21617acace32097a53b0b74fb5000d333d094 Mon Sep 17 00:00:00 2001 From: "Markus S. Wamser" Date: Tue, 17 May 2022 22:39:11 +0200 Subject: [PATCH 065/233] vscode: add options to disable update checks Update notification popups are annoying when vscode/vscodium is managed by Home Manager. However, as these settings also require the configuration to be managed via `userSettings`, they are disabled by default. --- modules/programs/vscode.nix | 27 +++++++++++++++-- tests/modules/programs/vscode/default.nix | 5 +++- tests/modules/programs/vscode/keybindings.nix | 16 +++++++--- .../modules/programs/vscode/update-checks.nix | 29 +++++++++++++++++++ 4 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 tests/modules/programs/vscode/update-checks.nix diff --git a/modules/programs/vscode.nix b/modules/programs/vscode.nix index dcfed07b..443e623b 100644 --- a/modules/programs/vscode.nix +++ b/modules/programs/vscode.nix @@ -34,6 +34,11 @@ let # TODO: On Darwin where are the extensions? extensionPath = ".${extensionDir}/extensions"; + mergedUserSettings = cfg.userSettings + // optionalAttrs (!cfg.enableUpdateCheck) { "update.mode" = "none"; } + // optionalAttrs (!cfg.enableExtensionUpdateCheck) { + "extensions.autoCheckUpdates" = false; + }; in { imports = [ (mkChangedOptionModule [ "programs" "vscode" "immutableExtensionsDir" ] [ @@ -56,12 +61,28 @@ in { ''; }; + enableUpdateCheck = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable update checks/notifications. + ''; + }; + + enableExtensionUpdateCheck = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable update notifications for extensions. + ''; + }; + userSettings = mkOption { type = jsonFormat.type; default = { }; example = literalExpression '' { - "update.channel" = "none"; + "files.autoSave" = "off" "[nix]"."editor.tabSize" = 2; } ''; @@ -164,9 +185,9 @@ in { home.packages = [ cfg.package ]; home.file = mkMerge [ - (mkIf (cfg.userSettings != { }) { + (mkIf (mergedUserSettings != { }) { "${configFilePath}".source = - jsonFormat.generate "vscode-user-settings" cfg.userSettings; + jsonFormat.generate "vscode-user-settings" mergedUserSettings; }) (mkIf (cfg.userTasks != { }) { "${tasksFilePath}".source = diff --git a/tests/modules/programs/vscode/default.nix b/tests/modules/programs/vscode/default.nix index 70f6d2e7..60775826 100644 --- a/tests/modules/programs/vscode/default.nix +++ b/tests/modules/programs/vscode/default.nix @@ -1 +1,4 @@ -{ vscode-keybindings = ./keybindings.nix; } +{ + vscode-keybindings = ./keybindings.nix; + vscode-update-checks = ./update-checks.nix; +} diff --git a/tests/modules/programs/vscode/keybindings.nix b/tests/modules/programs/vscode/keybindings.nix index 57931c43..ed457a9b 100644 --- a/tests/modules/programs/vscode/keybindings.nix +++ b/tests/modules/programs/vscode/keybindings.nix @@ -27,12 +27,17 @@ let } ]; - targetPath = if pkgs.stdenv.hostPlatform.isDarwin then + keybindingsPath = if pkgs.stdenv.hostPlatform.isDarwin then "Library/Application Support/Code/User/keybindings.json" else ".config/Code/User/keybindings.json"; - expectedJson = pkgs.writeText "expected.json" '' + settingsPath = if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/Code/User/settings.json" + else + ".config/Code/User/settings.json"; + + expectedKeybindings = pkgs.writeText "expected.json" '' [ { "command": "editor.action.clipboardCopyAction", @@ -58,6 +63,7 @@ let } ] ''; + in { config = { programs.vscode = { @@ -67,8 +73,10 @@ in { }; nmt.script = '' - assertFileExists "home-files/${targetPath}" - assertFileContent "home-files/${targetPath}" "${expectedJson}" + assertFileExists "home-files/${keybindingsPath}" + assertFileContent "home-files/${keybindingsPath}" "${expectedKeybindings}" + + assertPathNotExists "home-files/${settingsPath}" ''; }; } diff --git a/tests/modules/programs/vscode/update-checks.nix b/tests/modules/programs/vscode/update-checks.nix new file mode 100644 index 00000000..1547bd36 --- /dev/null +++ b/tests/modules/programs/vscode/update-checks.nix @@ -0,0 +1,29 @@ +{ pkgs, ... }: + +let + + settingsPath = if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/Code/User/settings.json" + else + ".config/Code/User/settings.json"; + + expectedSettings = pkgs.writeText "settings-expected.json" '' + { + "extensions.autoCheckUpdates": false, + "update.mode": "none" + } + ''; + +in { + programs.vscode = { + enable = true; + package = pkgs.writeScriptBin "vscode" "" // { pname = "vscode"; }; + enableUpdateCheck = false; + enableExtensionUpdateCheck = false; + }; + + nmt.script = '' + assertFileExists "home-files/${settingsPath}" + assertFileContent "home-files/${settingsPath}" "${expectedSettings}" + ''; +} From f67649307d4f81d8fbac68c19d1d1c564ab26dca Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 27 Oct 2022 22:20:37 +0200 Subject: [PATCH 066/233] home-environment: make getVersion more robust --- modules/home-environment.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index e186dd6c..b8908b9a 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -680,7 +680,15 @@ in getVersion = pkgs.writeShellScript "get-hm-version" '' set -euo pipefail - cd "${../.}" || exit 1 + dir="${../.}" + + # Apparently, dir is not always set to the Home Manager directory. + if [[ ! -d $dir ]]; then + echo "" + exit 0 + fi + + cd "$dir" || exit 1 # Get the base release and initialize an empty version suffix. release=$(< .release) From 213a06295dff96668a1d673b9fd1c03ce1de6745 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 27 Oct 2022 22:47:27 +0200 Subject: [PATCH 067/233] ci: don't run tests in GitLab CI It eats too many CI minutes. --- .gitlab-ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 37b08ef6..a7d63798 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,17 +4,8 @@ variables: NIX_PATH: "nixpkgs=channel:nixos-unstable" stages: - - test - deploy -Run tests: - stage: test - script: - - nix-shell --pure tests -A run.files-text - rules: - - if: $CI_COMMIT_BRANCH == "master" - when: always - pages: stage: deploy script: From 423211401c245934db5052e3867cac704f658544 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 28 Oct 2022 22:51:35 +0200 Subject: [PATCH 068/233] home-environment: update hm-version generation Instead of home-made script use the Nixpkgs library functions. This will hopefully be more robust and give more accurate results. --- modules/home-environment.nix | 37 +----------------------------------- modules/misc/version.nix | 34 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 36 deletions(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index b8908b9a..7c0c30ae 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -676,41 +676,6 @@ in ${activationCmds} ''; - - getVersion = pkgs.writeShellScript "get-hm-version" '' - set -euo pipefail - - dir="${../.}" - - # Apparently, dir is not always set to the Home Manager directory. - if [[ ! -d $dir ]]; then - echo "" - exit 0 - fi - - cd "$dir" || exit 1 - - # Get the base release and initialize an empty version suffix. - release=$(< .release) - suffix="" - - # If we are in a Git repo then update the suffix to be - # - # .git.HASH - # - # where HASH are the first 8 characters of the commit hash. - if [[ -f .git/HEAD ]]; then - ref=$(sed '/ref:/ { s/.* //; }' .git/HEAD) - if [[ -f ".git/$ref" ]]; then - hash=$(< ".git/$ref") - if [[ -n "$hash" ]]; then - suffix=".git.''${hash:0:8}" - fi - fi - fi - - echo "$release$suffix" - ''; in pkgs.runCommand "home-manager-generation" @@ -720,7 +685,7 @@ in '' mkdir -p $out - ${getVersion} > $out/hm-version + echo "${config.home.version.full}" > $out/hm-version cp ${activationScript} $out/activate diff --git a/modules/misc/version.nix b/modules/misc/version.nix index 25bc0afd..d5dcc304 100644 --- a/modules/misc/version.nix +++ b/modules/misc/version.nix @@ -30,5 +30,39 @@ with lib; conversion or moving files. ''; }; + + home.version = { + full = mkOption { + internal = true; + readOnly = true; + type = types.str; + default = let + inherit (config.home.version) release revision; + suffix = + optionalString (revision != null) "+${substring 0 8 revision}"; + in "${release}${suffix}"; + example = "22.05+213a0629"; + description = "The full Home Manager version."; + }; + + release = mkOption { + internal = true; + readOnly = true; + type = types.str; + default = fileContents ../../.release; + example = "22.05"; + description = "The Home Manager release."; + }; + + revision = mkOption { + internal = true; + type = types.nullOr types.str; + default = let gitRepo = "${toString ./../..}/.git"; + in if pathIsGitRepo gitRepo then commitIdFromGitRepo gitRepo else null; + description = '' + The Git revision from which this Home Manager configuration was built. + ''; + }; + }; }; } From 160025ca46e48a6a0b2bdb971801a0470f744500 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Sat, 29 Oct 2022 15:58:14 +0100 Subject: [PATCH 069/233] irssi: add option for SASL external authentication --- modules/programs/irssi.nix | 16 +++++++++++++++- .../irssi/example-settings-expected.config | 2 ++ .../modules/programs/irssi/example-settings.nix | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/modules/programs/irssi.nix b/modules/programs/irssi.nix index 3d830a4f..355be085 100644 --- a/modules/programs/irssi.nix +++ b/modules/programs/irssi.nix @@ -23,6 +23,11 @@ let type = "${v.type}"; nick = "${quoteStr v.nick}"; autosendcmd = "${concatMapStringsSep ";" quoteStr v.autoCommands}"; + ${ + lib.optionalString (v.saslExternal) '' + sasl_username = "${quoteStr v.nick}"; + sasl_mechanism = "EXTERNAL";'' + } }; '')); @@ -36,7 +41,7 @@ let ssl_verify = "${lib.hm.booleans.yesNo v.server.ssl.verify}"; autoconnect = "${lib.hm.booleans.yesNo v.server.autoConnect}"; ${ - lib.optionalString (v.server.ssl.certificateFile != null) '' + optionalString (v.server.ssl.certificateFile != null) '' ssl_cert = "${v.server.ssl.certificateFile}"; '' } @@ -142,6 +147,15 @@ let type = types.attrsOf channelType; default = { }; }; + + saslExternal = mkOption { + type = types.bool; + default = false; + description = '' + Enable SASL external authentication. This requires setting a path in + . + ''; + }; }; }); diff --git a/tests/modules/programs/irssi/example-settings-expected.config b/tests/modules/programs/irssi/example-settings-expected.config index 8c54243b..6857eccf 100644 --- a/tests/modules/programs/irssi/example-settings-expected.config +++ b/tests/modules/programs/irssi/example-settings-expected.config @@ -13,6 +13,8 @@ oftc = { type = "IRC"; nick = "nick"; autosendcmd = ""; + sasl_username = "nick"; + sasl_mechanism = "EXTERNAL"; }; }; diff --git a/tests/modules/programs/irssi/example-settings.nix b/tests/modules/programs/irssi/example-settings.nix index 93cf9f2d..f279b03c 100644 --- a/tests/modules/programs/irssi/example-settings.nix +++ b/tests/modules/programs/irssi/example-settings.nix @@ -8,6 +8,7 @@ with lib; enable = true; networks.oftc = { nick = "nick"; + saslExternal = true; server = { address = "irc.oftc.net"; port = 6697; From fad4e7c79cb6668e9c2f90f008ee3522d9cd298f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 30 Oct 2022 04:35:00 +0000 Subject: [PATCH 070/233] 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/5f326e2a403e1cebaec378e72ceaf5725983376d' (2022-09-12) → 'github:nixos/nixpkgs/fdebb81f45a1ba2c4afca5fd9f526e1653ad0949' (2022-10-29) • Updated input 'utils': 'github:numtide/flake-utils/c0e246b9b83f637f4681389ecabcb2681b4f3af0' (2022-08-07) → 'github:numtide/flake-utils/6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817' (2022-10-29) --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 9b829a54..22603156 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1662996720, - "narHash": "sha256-XvLQ3SuXnDMJMpM1sv1ifPjBuRytiDYhB12H/BNTjgY=", + "lastModified": 1667050928, + "narHash": "sha256-xOn0ZgjImIyeecEsrjxuvlW7IW5genTwvvnDQRFncB8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5f326e2a403e1cebaec378e72ceaf5725983376d", + "rev": "fdebb81f45a1ba2c4afca5fd9f526e1653ad0949", "type": "github" }, "original": { @@ -24,11 +24,11 @@ }, "utils": { "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1667077288, + "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817", "type": "github" }, "original": { From 2464c21ab2b3607bed3c206a436855c487f35f55 Mon Sep 17 00:00:00 2001 From: polykernel <81340136+polykernel@users.noreply.github.com> Date: Mon, 31 Oct 2022 08:09:06 -0400 Subject: [PATCH 071/233] sway: import XDG_SESSION_TYPE in systemd user environment (#3328) - The `XDG_SESSION_TYPE` environment variable is used by some applications and frameworks to detect wayland sessions (i.e qt5/6, electron/chromium). It is set by wlroots since version 0.13.0 [1]. - Propagating `XDG_SESSION_TYPE` to the systemd user environment is necessary when processes launched by services (e.g emacs) need to inherit the environment variable. [1] - https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/90c8452959470461497c4a83aac0bd93efb0a524 --- modules/services/window-managers/i3-sway/sway.nix | 2 +- .../services/window-managers/sway/sway-bar-focused-colors.conf | 2 +- .../sway/sway-bindkeys-to-code-and-extra-config.conf | 2 +- tests/modules/services/window-managers/sway/sway-default.conf | 2 +- .../window-managers/sway/sway-followmouse-expected.conf | 2 +- .../window-managers/sway/sway-followmouse-legacy-expected.conf | 2 +- tests/modules/services/window-managers/sway/sway-modules.conf | 2 +- .../services/window-managers/sway/sway-null-package.conf | 2 +- .../window-managers/sway/sway-workspace-default-expected.conf | 2 +- .../window-managers/sway/sway-workspace-output-expected.conf | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 725fac7d..fdcbaabc 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -317,7 +317,7 @@ let ) else [ ]) ++ (optional cfg.systemdIntegration '' - exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target"'') + exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target"'') ++ (optional (!cfg.xwayland) "xwayland disable") ++ [ cfg.extraConfig ])); defaultSwayPackage = pkgs.sway.override { diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf index 7f44a2b5..22d00e6a 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf @@ -106,4 +106,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf index 9029febf..9ed389bc 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf @@ -105,5 +105,5 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" exec_always pkill flashfocus; flasfocus & diff --git a/tests/modules/services/window-managers/sway/sway-default.conf b/tests/modules/services/window-managers/sway/sway-default.conf index 0ca82f99..dc1ff8b8 100644 --- a/tests/modules/services/window-managers/sway/sway-default.conf +++ b/tests/modules/services/window-managers/sway/sway-default.conf @@ -103,4 +103,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf index e8afc19d..c1a62721 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf @@ -81,4 +81,4 @@ mode "resize" { bindsym l resize grow width 10 px } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf index bba46942..65e96575 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf @@ -81,4 +81,4 @@ mode "resize" { bindsym l resize grow width 10 px } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-modules.conf b/tests/modules/services/window-managers/sway/sway-modules.conf index 8753b24a..551fafd7 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.conf +++ b/tests/modules/services/window-managers/sway/sway-modules.conf @@ -115,4 +115,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-null-package.conf b/tests/modules/services/window-managers/sway/sway-null-package.conf index 0ca82f99..dc1ff8b8 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.conf +++ b/tests/modules/services/window-managers/sway/sway-null-package.conf @@ -103,4 +103,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf index 2f2dd125..c5daf6ec 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf @@ -102,4 +102,4 @@ bar { } } -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf index 4ec1e7ce..4c91dc7e 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf @@ -107,4 +107,4 @@ workspace "1" output eDP workspace "ABC" output DP workspace "3: Test" output HDMI workspace "!"§$%&/(){}[]=?\*#<>-_.:,;²³" output DVI -exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP; systemctl --user start sway-session.target" +exec "/nix/store/00000000000000000000000000000000-dbus/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE; systemctl --user start sway-session.target" From 25344cb808759197c0eb5a425e23732041c95062 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 15:12:57 +0000 Subject: [PATCH 072/233] ci: bump cachix/cachix-action from 11 to 12 (#3368) Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 11 to 12. - [Release notes](https://github.com/cachix/cachix-action/releases) - [Commits](https://github.com/cachix/cachix-action/compare/v11...v12) --- updated-dependencies: - dependency-name: cachix/cachix-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/github_pages.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github_pages.yml b/.github/workflows/github_pages.yml index 045dae37..708ace78 100644 --- a/.github/workflows/github_pages.yml +++ b/.github/workflows/github_pages.yml @@ -14,7 +14,7 @@ jobs: - uses: cachix/install-nix-action@v18 with: nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v11 + - uses: cachix/cachix-action@v12 with: name: nix-community signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0d09765b..6389a6e4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: - uses: cachix/install-nix-action@v18 with: nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v11 + - uses: cachix/cachix-action@v12 with: name: nix-community signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' From 722e8d65d3aba6f527100cc2d1539e4ca04d066f Mon Sep 17 00:00:00 2001 From: zimbatm Date: Mon, 31 Oct 2022 15:38:57 +0100 Subject: [PATCH 073/233] ci: use the cachix auth token --- .github/workflows/github_pages.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github_pages.yml b/.github/workflows/github_pages.yml index 708ace78..b60812ae 100644 --- a/.github/workflows/github_pages.yml +++ b/.github/workflows/github_pages.yml @@ -17,7 +17,7 @@ jobs: - uses: cachix/cachix-action@v12 with: name: nix-community - signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: | nix-build -A docs.html cp -r result/share/doc/home-manager public diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6389a6e4..73ac7a00 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - uses: cachix/cachix-action@v12 with: name: nix-community - signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - run: | if grep -R --exclude stdlib-extended.nix literalExample modules ; then echo "Error: literalExample should be replaced by literalExpression" > /dev/stderr From 8957d531997a2b1f4562a7e6313a78a450d5074b Mon Sep 17 00:00:00 2001 From: Anton Bulakh Date: Tue, 1 Nov 2022 20:43:20 +0200 Subject: [PATCH 074/233] awesome: fix luaModules using pkgs.lua instead of awesome.lua (#3258) Mirroring my change to awesome module in nixos: https://github.com/NixOS/nixpkgs/commit/b79f9e9b8a822ac64710d67d26b558f9aba6d47b --- modules/services/window-managers/awesome.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/window-managers/awesome.nix b/modules/services/window-managers/awesome.nix index a012a03c..d79e72fe 100644 --- a/modules/services/window-managers/awesome.nix +++ b/modules/services/window-managers/awesome.nix @@ -6,7 +6,7 @@ let cfg = config.xsession.windowManager.awesome; awesome = cfg.package; - getLuaPath = lib: dir: "${lib}/${dir}/lua/${pkgs.luaPackages.lua.luaversion}"; + getLuaPath = lib: dir: "${lib}/${dir}/lua/${awesome.lua.luaversion}"; makeSearchPath = lib.concatMapStrings (path: " --search ${getLuaPath path "share"}" + " --search ${getLuaPath path "lib"}"); From 824202b4c4feb02e11fa1a44b140d5b0f218702c Mon Sep 17 00:00:00 2001 From: pogobanane <38314551+pogobanane@users.noreply.github.com> Date: Mon, 31 Oct 2022 13:21:09 +0100 Subject: [PATCH 075/233] readme: add inofficial option search --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 095effcd..25a2cfc4 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,9 @@ Before attempting to use Home Manager please read the warning below. For a systematic overview of Home Manager and its available options, please see -- the [Home Manager manual][manual] and -- the [Home Manager configuration options][configuration options]. +- the [Home Manager manual][manual], +- the [Home Manager configuration options][configuration options], and +- the 3rd party [Home Manager option search](https://mipmip.github.io/home-manager-option-search/). If you would like to contribute to Home Manager then please have a look at the [contributing][] chapter of the manual. From 183a62f356f16d12ac60f0e4e5d54f0bd78f6ba6 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Sun, 30 Oct 2022 21:19:58 -0500 Subject: [PATCH 076/233] targets/generic-linux: use the correct nix package --- modules/targets/generic-linux.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/targets/generic-linux.nix b/modules/targets/generic-linux.nix index aad74afb..b5a07d5f 100644 --- a/modules/targets/generic-linux.nix +++ b/modules/targets/generic-linux.nix @@ -8,6 +8,8 @@ let profileDirectory = config.home.profileDirectory; + nixPkg = if config.nix.package == null then pkgs.nix else config.nix.package; + in { imports = [ (mkRenamedOptionModule [ "targets" "genericLinux" "extraXdgDataDirs" ] [ @@ -55,7 +57,7 @@ in { }; home.sessionVariablesExtra = '' - . "${pkgs.nix}/etc/profile.d/nix.sh" + . "${nixPkg}/etc/profile.d/nix.sh" # reset TERM with new TERMINFO available (if any) export TERM="$TERM" @@ -64,7 +66,7 @@ in { # We need to source both nix.sh and hm-session-vars.sh as noted in # https://github.com/nix-community/home-manager/pull/797#issuecomment-544783247 programs.bash.initExtra = '' - . "${pkgs.nix}/etc/profile.d/nix.sh" + . "${nixPkg}/etc/profile.d/nix.sh" . "${profileDirectory}/etc/profile.d/hm-session-vars.sh" ''; From 04e844090ed17298bfbe0f8249109b15770571bc Mon Sep 17 00:00:00 2001 From: Arjan Schrijver Date: Thu, 29 Sep 2022 13:08:53 +0200 Subject: [PATCH 077/233] oh-my-posh: add module --- .github/CODEOWNERS | 3 + modules/misc/news.nix | 7 ++ modules/modules.nix | 1 + modules/programs/oh-my-posh.nix | 94 +++++++++++++++++++ tests/default.nix | 1 + tests/modules/programs/oh-my-posh/bash.nix | 21 +++++ tests/modules/programs/oh-my-posh/default.nix | 5 + tests/modules/programs/oh-my-posh/fish.nix | 28 ++++++ tests/modules/programs/oh-my-posh/zsh.nix | 24 +++++ 9 files changed, 184 insertions(+) create mode 100644 modules/programs/oh-my-posh.nix create mode 100644 tests/modules/programs/oh-my-posh/bash.nix create mode 100644 tests/modules/programs/oh-my-posh/default.nix create mode 100644 tests/modules/programs/oh-my-posh/fish.nix create mode 100644 tests/modules/programs/oh-my-posh/zsh.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a500b20d..e3255a6a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -237,6 +237,9 @@ Makefile @thiagokokada /modules/programs/octant.nix @06kellyjac +/modules/programs/oh-my-posh.nix @arjan-s +/tests/modules/programs/oh-my-posh @arjan-s + /modules/programs/opam.nix @marsam /modules/programs/openssh.nix @rycee diff --git a/modules/misc/news.nix b/modules/misc/news.nix index b61a3af4..21303e63 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -800,6 +800,13 @@ in A new module is available: 'programs.k9s'. ''; } + + { + time = "2022-11-01T23:57:50+00:00"; + message = '' + A new module is available: 'programs.oh-my-posh'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 5b228c5f..bfeae7e7 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -140,6 +140,7 @@ let ./programs/obs-studio.nix ./programs/octant.nix ./programs/offlineimap.nix + ./programs/oh-my-posh.nix ./programs/opam.nix ./programs/pandoc.nix ./programs/password-store.nix diff --git a/modules/programs/oh-my-posh.nix b/modules/programs/oh-my-posh.nix new file mode 100644 index 00000000..d1dfda97 --- /dev/null +++ b/modules/programs/oh-my-posh.nix @@ -0,0 +1,94 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + + cfg = config.programs.oh-my-posh; + + jsonFormat = pkgs.formats.json { }; + + configArgument = if cfg.settings != { } then + "--config ${config.xdg.configHome}/oh-my-posh/config.json" + else if cfg.useTheme != null then + "--config ${cfg.package}/share/oh-my-posh/themes/${cfg.useTheme}.omp.json" + else + ""; + +in { + meta.maintainers = [ maintainers.arjan-s ]; + + options.programs.oh-my-posh = { + enable = mkEnableOption "oh-my-posh, a prompt theme engine for any shell"; + + package = mkPackageOption pkgs "oh-my-posh" { }; + + settings = mkOption { + type = jsonFormat.type; + default = { }; + example = literalExpression '' + builtins.fromJSON (builtins.unsafeDiscardStringContext (builtins.readFile "''${pkgs.oh-my-posh}/share/oh-my-posh/themes/space.omp.json"))''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/oh-my-posh/config.json. See + + for details. The useTheme option is ignored when this + option is used. + ''; + }; + + useTheme = mkOption { + type = types.nullOr types.str; + default = null; + description = '' + Use one of the official themes. This should be a name from this list: + . Because a theme + is essentially a configuration file, this option is not used when a + configFile is set. + ''; + }; + + enableBashIntegration = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable Bash integration. + ''; + }; + + enableZshIntegration = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable Zsh integration. + ''; + }; + + enableFishIntegration = mkOption { + type = types.bool; + default = true; + description = '' + Whether to enable Fish integration. + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile."oh-my-posh/config.json" = mkIf (cfg.settings != { }) { + source = jsonFormat.generate "oh-my-posh-settings" cfg.settings; + }; + + programs.bash.initExtra = mkIf cfg.enableBashIntegration '' + eval "$(${cfg.package}/bin/oh-my-posh init bash ${configArgument})" + ''; + + programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' + eval "$(${cfg.package}/bin/oh-my-posh init zsh ${configArgument})" + ''; + + programs.fish.shellInit = mkIf cfg.enableFishIntegration '' + ${cfg.package}/bin/oh-my-posh init fish ${configArgument} | source + ''; + }; +} diff --git a/tests/default.nix b/tests/default.nix index e84dbf05..e78e2436 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -100,6 +100,7 @@ import nmt { ./modules/programs/nix-index ./modules/programs/nnn ./modules/programs/nushell + ./modules/programs/oh-my-posh ./modules/programs/pandoc ./modules/programs/pet ./modules/programs/pistol diff --git a/tests/modules/programs/oh-my-posh/bash.nix b/tests/modules/programs/oh-my-posh/bash.nix new file mode 100644 index 00000000..2e3d93ac --- /dev/null +++ b/tests/modules/programs/oh-my-posh/bash.nix @@ -0,0 +1,21 @@ +{ ... }: + +{ + programs = { + bash.enable = true; + + oh-my-posh = { + enable = true; + useTheme = "jandedobbeleer"; + }; + }; + + test.stubs.oh-my-posh = { }; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileContains \ + home-files/.bashrc \ + '/bin/oh-my-posh init bash --config' + ''; +} diff --git a/tests/modules/programs/oh-my-posh/default.nix b/tests/modules/programs/oh-my-posh/default.nix new file mode 100644 index 00000000..65526256 --- /dev/null +++ b/tests/modules/programs/oh-my-posh/default.nix @@ -0,0 +1,5 @@ +{ + oh-my-posh-bash = ./bash.nix; + oh-my-posh-zsh = ./zsh.nix; + oh-my-posh-fish = ./fish.nix; +} diff --git a/tests/modules/programs/oh-my-posh/fish.nix b/tests/modules/programs/oh-my-posh/fish.nix new file mode 100644 index 00000000..69dd9ac1 --- /dev/null +++ b/tests/modules/programs/oh-my-posh/fish.nix @@ -0,0 +1,28 @@ +{ lib, ... }: + +{ + programs = { + fish.enable = true; + + oh-my-posh = { + enable = true; + useTheme = "jandedobbeleer"; + }; + }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + test.stubs = { + oh-my-posh = { }; + fish = { }; + }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileContains \ + home-files/.config/fish/config.fish \ + '/bin/oh-my-posh init fish --config' + ''; +} diff --git a/tests/modules/programs/oh-my-posh/zsh.nix b/tests/modules/programs/oh-my-posh/zsh.nix new file mode 100644 index 00000000..6d2a5bed --- /dev/null +++ b/tests/modules/programs/oh-my-posh/zsh.nix @@ -0,0 +1,24 @@ +{ ... }: + +{ + programs = { + zsh.enable = true; + + oh-my-posh = { + enable = true; + useTheme = "jandedobbeleer"; + }; + }; + + test.stubs = { + oh-my-posh = { }; + zsh = { }; + }; + + nmt.script = '' + assertFileExists home-files/.zshrc + assertFileContains \ + home-files/.zshrc \ + '/bin/oh-my-posh init zsh --config' + ''; +} From 916811c8f9ef37beb7705150d76cc88ce79466fd Mon Sep 17 00:00:00 2001 From: Chuang Zhu Date: Wed, 2 Nov 2022 17:06:05 +0800 Subject: [PATCH 078/233] xfconf: add module --- .github/CODEOWNERS | 2 + modules/misc/news.nix | 8 ++++ modules/misc/xfconf.nix | 102 ++++++++++++++++++++++++++++++++++++++++ modules/modules.nix | 1 + 4 files changed, 113 insertions(+) create mode 100644 modules/misc/xfconf.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e3255a6a..b39486cf 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -59,6 +59,8 @@ Makefile @thiagokokada /tests/modules/misc/xdg/desktop-full-expected.desktop @cwyc /tests/modules/misc/xdg/desktop-min-expected.desktop @cwyc +/modules/misc/xfconf.nix @chuangzhu + /modules/programs/aerc.nix @lukasngl /modules/programs/aerc-accounts.nix @lukasngl /tests/modules/programs/aerc @lukasngl diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 21303e63..bb1e7e2b 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -807,6 +807,14 @@ in A new module is available: 'programs.oh-my-posh'. ''; } + + { + time = "2022-11-02T10:56:14+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'xfconf'. + ''; + } ]; }; } diff --git a/modules/misc/xfconf.nix b/modules/misc/xfconf.nix new file mode 100644 index 00000000..b4141bf5 --- /dev/null +++ b/modules/misc/xfconf.nix @@ -0,0 +1,102 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.xfconf; + + withType = v: + if builtins.isBool v then [ + "-t" + "bool" + "-s" + (if v then "true" else "false") + ] else if builtins.isInt v then [ + "-t" + "int" + "-s" + (toString v) + ] else if builtins.isFloat v then [ + "-t" + "double" + "-s" + (toString v) + ] else if builtins.isString v then [ + "-t" + "string" + "-s" + v + ] else if builtins.isList v then + [ "-a" ] ++ concatMap withType v + else + throw "unexpected xfconf type: ${builtins.typeOf v}"; + +in { + meta.maintainers = [ maintainers.chuangzhu ]; + + options.xfconf = { + enable = mkOption { + type = types.bool; + default = true; + visible = false; + description = '' + Whether to enable Xfconf settings. + + Note, if you use NixOS then you must add + programs.xfconf.enable = true + to your system configuration. Otherwise you will see a systemd error + message when your configuration is activated. + ''; + }; + + settings = mkOption { + type = with types; + attrsOf (attrsOf (oneOf [ + bool + int + float + str + (listOf (oneOf [ bool int float str ])) + ])) // { + description = "xfconf settings"; + }; + default = { }; + example = literalExpression '' + { + xfce4-session = { + "startup/ssh-agent/enabled" = false; + "general/LockCommand" = "''${pkgs.lightdm}/bin/dm-tool lock"; + }; + xfce4-desktop = { + "backdrop/screen0/monitorLVDS-1/workspace0/last-image" = + "''${pkgs.nixos-artwork.wallpapers.stripes-logo.gnomeFilePath}"; + }; + } + ''; + description = '' + Settings to write to the Xfconf configuration system. + ''; + }; + }; + + config = mkIf (cfg.enable && cfg.settings != { }) { + assertions = + [ (hm.assertions.assertPlatform "xfconf" pkgs platforms.linux) ]; + + home.activation.xfconfSettings = hm.dag.entryAfter [ "installPackages" ] + (let + mkCommand = channel: property: value: '' + $DRY_RUN_CMD ${pkgs.xfce.xfconf}/bin/xfconf-query \ + ${ + escapeShellArgs + ([ "-n" "-c" channel "-p" "/${property}" ] ++ withType value) + } + ''; + + commands = mapAttrsToList + (channel: properties: mapAttrsToList (mkCommand channel) properties) + cfg.settings; + in concatMapStrings concatStrings commands); + }; +} diff --git a/modules/modules.nix b/modules/modules.nix index bfeae7e7..d465e8ca 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -43,6 +43,7 @@ let ./misc/xdg-system-dirs.nix ./misc/xdg-user-dirs.nix ./misc/xdg.nix + ./misc/xfconf.nix ./programs/abook.nix ./programs/aerc.nix ./programs/afew.nix From f520832a47dbc24d1e2c4e4b9a3dbe910777d1a2 Mon Sep 17 00:00:00 2001 From: Marin Date: Wed, 2 Nov 2022 13:41:53 -0400 Subject: [PATCH 079/233] darwin: re-enable ~/Applications symlinks (#3139) Tested-by: supermarin@users.noreply.github.com --- modules/targets/darwin/linkapps.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/targets/darwin/linkapps.nix b/modules/targets/darwin/linkapps.nix index 118321e8..0d434234 100644 --- a/modules/targets/darwin/linkapps.nix +++ b/modules/targets/darwin/linkapps.nix @@ -1,9 +1,7 @@ { config, lib, pkgs, ... }: { - # Disabled for now due to conflicting behavior with nix-darwin. See - # https://github.com/nix-community/home-manager/issues/1341#issuecomment-687286866 - config = lib.mkIf (false && pkgs.stdenv.hostPlatform.isDarwin) { + config = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin { # Install MacOS applications to the user environment. home.file."Applications/Home Manager Apps".source = let apps = pkgs.buildEnv { From 39c1e6704a58cb160d4f6b03215dffc819774f1c Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 29 Oct 2022 10:01:25 +0900 Subject: [PATCH 080/233] vscode: fix invalid examples --- modules/programs/vscode.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/programs/vscode.nix b/modules/programs/vscode.nix index 443e623b..27faf39b 100644 --- a/modules/programs/vscode.nix +++ b/modules/programs/vscode.nix @@ -82,7 +82,7 @@ in { default = { }; example = literalExpression '' { - "files.autoSave" = "off" + "files.autoSave" = "off"; "[nix]"."editor.tabSize" = 2; } ''; @@ -97,14 +97,14 @@ in { default = { }; example = literalExpression '' { - "version": "2.0.0", - "tasks": [ + version = "2.0.0"; + tasks = [ { - "type": "shell", - "label": "Hello task", - "command": "hello", + type = "shell"; + label = "Hello task"; + command = "hello"; } - ] + ]; } ''; description = '' From 93335810751f0404fe424e61ad58bc8e94bf8e9d Mon Sep 17 00:00:00 2001 From: natsukium Date: Sat, 29 Oct 2022 10:47:06 +0900 Subject: [PATCH 081/233] vscode: add userTasks test --- tests/modules/programs/vscode/default.nix | 1 + tests/modules/programs/vscode/tasks.nix | 43 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/modules/programs/vscode/tasks.nix diff --git a/tests/modules/programs/vscode/default.nix b/tests/modules/programs/vscode/default.nix index 60775826..4015121d 100644 --- a/tests/modules/programs/vscode/default.nix +++ b/tests/modules/programs/vscode/default.nix @@ -1,4 +1,5 @@ { vscode-keybindings = ./keybindings.nix; + vscode-tasks = ./tasks.nix; vscode-update-checks = ./update-checks.nix; } diff --git a/tests/modules/programs/vscode/tasks.nix b/tests/modules/programs/vscode/tasks.nix new file mode 100644 index 00000000..f0d28380 --- /dev/null +++ b/tests/modules/programs/vscode/tasks.nix @@ -0,0 +1,43 @@ +{ pkgs, config, ... }: + +let + + tasksFilePath = if pkgs.stdenv.hostPlatform.isDarwin then + "Library/Application Support/Code/User/tasks.json" + else + ".config/Code/User/tasks.json"; + + tasks = { + version = "2.0.0"; + tasks = [{ + type = "shell"; + label = "Hello task"; + command = "hello"; + }]; + }; + + expectedTasks = pkgs.writeText "tasks-expected.json" '' + { + "tasks": [ + { + "command": "hello", + "label": "Hello task", + "type": "shell" + } + ], + "version": "2.0.0" + } + ''; + +in { + programs.vscode = { + enable = true; + package = pkgs.writeScriptBin "vscode" "" // { pname = "vscode"; }; + userTasks = tasks; + }; + + nmt.script = '' + assertFileExists "home-files/${tasksFilePath}" + assertFileContent "home-files/${tasksFilePath}" "${expectedTasks}" + ''; +} From b764068a506c6f70dba998efa0e7fcb99cb4deb2 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 21 Sep 2022 18:03:17 +0200 Subject: [PATCH 082/233] thunderbird: add module Add a new Thunderbird module that uses the configuration in `accounts.email.accounts` to setup SMTP and IMAP accounts. Multiple profiles are not supported at this point. --- .github/CODEOWNERS | 3 + modules/lib/maintainers.nix | 16 + modules/misc/news.nix | 8 + modules/modules.nix | 1 + modules/programs/thunderbird.nix | 275 ++++++++++++++++++ tests/default.nix | 1 + .../modules/programs/thunderbird/default.nix | 1 + .../thunderbird/thunderbird-expected-first.js | 61 ++++ .../thunderbird-expected-profiles.ini | 15 + .../thunderbird-expected-second.js | 31 ++ .../programs/thunderbird/thunderbird.nix | 64 ++++ 11 files changed, 476 insertions(+) create mode 100644 modules/programs/thunderbird.nix create mode 100644 tests/modules/programs/thunderbird/default.nix create mode 100644 tests/modules/programs/thunderbird/thunderbird-expected-first.js create mode 100644 tests/modules/programs/thunderbird/thunderbird-expected-profiles.ini create mode 100644 tests/modules/programs/thunderbird/thunderbird-expected-second.js create mode 100644 tests/modules/programs/thunderbird/thunderbird.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b39486cf..68e0760d 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -312,6 +312,9 @@ Makefile @thiagokokada /modules/programs/texlive.nix @rycee +/modules/programs/thunderbird.nix @d-dervishi +/tests/modules/programs/thunderbird @d-dervishi + /modules/programs/timidity.nix @amesgen /modules/programs/tint2.nix @CarlosLoboxyz diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index cbe77968..896e47f6 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -37,12 +37,28 @@ github = "CarlosLoboxyz"; githubId = 86011416; }; + d-dervishi = { + email = "david.dervishi@epfl.ch"; + github = "d-dervishi"; + githubId = 61125355; + name = "David Dervishi"; + keys = [{ + longKeyId = "rsa4096/0xB1C012F0E7697195"; + fingerprint = "4C92 E3B0 21B5 5562 A1E0 CE3D B1C0 12F0 E769 7195"; + }]; + }; dwagenk = { email = "dwagenk@mailbox.org"; github = "dwagenk"; githubId = 32838899; name = "Daniel Wagenknecht"; }; + jkarlson = { + email = "jekarlson@gmail.com"; + github = "jkarlson"; + githubId = 1204734; + name = "Emil Karlson"; + }; justinlovinger = { name = "Justin Lovinger"; email = "git@justinlovinger.com"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index bb1e7e2b..34c2e0e1 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -815,6 +815,14 @@ in A new module is available: 'xfconf'. ''; } + + { + time = "2022-11-04T14:56:46+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'programs.thunderbird'; + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index d465e8ca..a57925ea 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -176,6 +176,7 @@ let ./programs/terminator.nix ./programs/termite.nix ./programs/texlive.nix + ./programs/thunderbird.nix ./programs/timidity.nix ./programs/tint2.nix ./programs/tiny.nix diff --git a/modules/programs/thunderbird.nix b/modules/programs/thunderbird.nix new file mode 100644 index 00000000..118a98a6 --- /dev/null +++ b/modules/programs/thunderbird.nix @@ -0,0 +1,275 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.thunderbird; + + enabledAccounts = attrValues + (filterAttrs (_: a: a.thunderbird.enable) config.accounts.email.accounts); + + enabledAccountsWithId = + map (a: a // { id = builtins.hashString "sha256" a.name; }) enabledAccounts; + + thunderbirdConfigPath = ".thunderbird"; + + profilesWithId = + imap0 (i: v: v // { id = toString i; }) (attrValues cfg.profiles); + + profilesIni = foldl recursiveUpdate { + General = { + StartWithLastProfile = 1; + Version = 2; + }; + } (flip map profilesWithId (profile: { + "Profile${profile.id}" = { + Name = profile.name; + Path = profile.name; + IsRelative = 1; + Default = if profile.isDefault then 1 else 0; + }; + })); + + toThunderbirdAccount = account: profile: + let id = account.id; + in { + "mail.account.account_${id}.identities" = "id_${id}"; + "mail.account.account_${id}.server" = "server_${id}"; + "mail.identity.id_${id}.fullName" = account.realName; + "mail.identity.id_${id}.useremail" = account.address; + "mail.identity.id_${id}.valid" = true; + } // optionalAttrs account.primary { + "mail.accountmanager.defaultaccount" = "account_${id}"; + } // optionalAttrs (account.gpg != null) { + "mail.identity.id_${id}.attachPgpKey" = false; + "mail.identity.id_${id}.autoEncryptDrafts" = true; + "mail.identity.id_${id}.e2etechpref" = 0; + "mail.identity.id_${id}.encryptionpolicy" = + if account.gpg.encryptByDefault then 2 else 0; + "mail.identity.id_${id}.is_gnupg_key_id" = true; + "mail.identity.id_${id}.last_entered_external_gnupg_key_id" = + account.gpg.key; + "mail.identity.id_${id}.openpgp_key_id" = account.gpg.key; + "mail.identity.id_${id}.protectSubject" = true; + "mail.identity.id_${id}.sign_mail" = account.gpg.signByDefault; + } // optionalAttrs (account.imap != null) { + "mail.server.server_${id}.directory" = + "${thunderbirdConfigPath}/${profile.name}/ImapMail/${account.imap.host}"; + "mail.server.server_${id}.directory-rel" = + "[ProfD]ImapMail/${account.imap.host}"; + "mail.server.server_${id}.hostname" = account.imap.host; + "mail.server.server_${id}.login_at_startup" = true; + "mail.server.server_${id}.name" = account.name; + "mail.server.server_${id}.port" = + if (account.imap.port != null) then account.imap.port else 143; + "mail.server.server_${id}.socketType" = if !account.imap.tls.enable then + 0 + else if account.imap.tls.useStartTls then + 2 + else + 3; + "mail.server.server_${id}.type" = "imap"; + "mail.server.server_${id}.userName" = account.userName; + } // optionalAttrs (account.smtp != null) { + "mail.identity.id_${id}.smtpServer" = "smtp_${id}"; + "mail.smtpserver.smtp_${id}.authMethod" = 3; + "mail.smtpserver.smtp_${id}.hostname" = account.smtp.host; + "mail.smtpserver.smtp_${id}.port" = + if (account.smtp.port != null) then account.smtp.port else 587; + "mail.smtpserver.smtp_${id}.try_ssl" = if !account.smtp.tls.enable then + 0 + else if account.smtp.tls.useStartTls then + 2 + else + 3; + "mail.smtpserver.smtp_${id}.username" = account.userName; + } // optionalAttrs (account.smtp != null && account.primary) { + "mail.smtp.defaultserver" = "smtp_${id}"; + } // account.thunderbird.settings id; + + mkUserJs = prefs: '' + // Generated by Home Manager. + + ${concatStrings (mapAttrsToList (name: value: '' + user_pref("${name}", ${builtins.toJSON value}); + '') prefs)} + ''; +in { + meta.maintainers = with hm.maintainers; [ d-dervishi jkarlson ]; + + options = { + programs.thunderbird = { + enable = mkEnableOption "Thunderbird"; + + package = mkOption { + type = types.package; + default = pkgs.thunderbird; + defaultText = literalExpression "pkgs.thunderbird"; + example = literalExpression "pkgs.thunderbird-91"; + description = "The Thunderbird package to use."; + }; + + profiles = mkOption { + type = with types; + attrsOf (submodule ({ config, name, ... }: { + options = { + name = mkOption { + type = types.str; + default = name; + readOnly = true; + description = "This profile's name."; + }; + + isDefault = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + Whether this is a default profile. There must be exactly one + default profile. + ''; + }; + + settings = mkOption { + type = with types; attrsOf (oneOf [ bool int str ]); + default = { }; + example = literalExpression '' + { + "mail.spellcheck.inline" = false; + } + ''; + description = '' + Preferences to add to this profile's + user.js. + ''; + }; + + withExternalGnupg = mkOption { + type = types.bool; + default = false; + example = true; + description = "Allow using external GPG keys with GPGME."; + }; + }; + })); + }; + + settings = mkOption { + type = with types; attrsOf (oneOf [ bool int str ]); + default = { }; + example = literalExpression '' + { + "general.useragent.override" = ""; + "privacy.donottrackheader.enabled" = true; + } + ''; + description = '' + Attribute set of Thunderbird preferences to be added to + all profiles. + ''; + }; + }; + + accounts.email.accounts = mkOption { + type = with types; + attrsOf (submodule { + options.thunderbird = { + enable = + mkEnableOption "the Thunderbird mail client for this account"; + + profiles = mkOption { + type = with types; listOf str; + default = [ ]; + example = literalExpression '' + [ "profile1" "profile2" ] + ''; + description = '' + List of Thunderbird profiles for which this account should be + enabled. If this list is empty (the default), this account will + be enabled for all declared profiles. + ''; + }; + + settings = mkOption { + type = with types; functionTo (attrsOf (oneOf [ bool int str ])); + default = _: { }; + defaultText = literalExpression "_: { }"; + example = literalExpression '' + id: { + "mail.identity.id_''${id}.protectSubject" = false; + "mail.identity.id_''${id}.autoEncryptDrafts" = false; + }; + ''; + description = '' + Extra settings to add to this Thunderbird account configuration. + The id given as argument is an automatically + generated account identifier. + ''; + }; + }; + }); + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (hm.assertions.assertPlatform "programs.thunderbird" pkgs platforms.linux) + + (let defaults = catAttrs "name" (filter (a: a.isDefault) profilesWithId); + in { + assertion = cfg.profiles == { } || length defaults == 1; + message = "Must have exactly one default Thunderbird profile but found " + + toString (length defaults) + optionalString (length defaults > 1) + (", namely " concatStringsSep "," defaults); + }) + + (let + profiles = catAttrs "name" profilesWithId; + selectedProfiles = + concatMap (a: a.thunderbird.profiles) enabledAccounts; + in { + assertion = (intersectLists profiles selectedProfiles) + == selectedProfiles; + message = "Cannot enable an account for a non-declared profile. " + + "The declared profiles are " + (concatStringsSep "," profiles) + + ", but the used profiles are " + + (concatStringsSep "," selectedProfiles); + }) + ]; + + home.packages = [ cfg.package ] + ++ optional (any (p: p.withExternalGnupg) (attrValues cfg.profiles)) + pkgs.gpgme; + + home.file = mkMerge ([{ + "${thunderbirdConfigPath}/profiles.ini" = + mkIf (cfg.profiles != { }) { text = generators.toINI { } profilesIni; }; + }] ++ flip mapAttrsToList cfg.profiles (name: profile: { + "${thunderbirdConfigPath}/${name}/user.js" = let + accounts = filter (a: + a.thunderbird.profiles == [ ] + || any (p: p == name) a.thunderbird.profiles) enabledAccountsWithId; + + smtp = filter (a: a.smtp != null) accounts; + in { + text = mkUserJs (builtins.foldl' (a: b: a // b) { } ([ + cfg.settings + + (optionalAttrs (length accounts != 0) { + "mail.accountmanager.accounts" = + concatStringsSep "," (map (a: "account_${a.id}") accounts); + }) + + (optionalAttrs (length smtp != 0) { + "mail.smtpservers" = + concatStringsSep "," (map (a: "smtp_${a.id}") smtp); + }) + + { "mail.openpgp.allow_external_gnupg" = profile.withExternalGnupg; } + + profile.settings + ] ++ (map (a: toThunderbirdAccount a profile) accounts))); + }; + })); + }; +} diff --git a/tests/default.nix b/tests/default.nix index e78e2436..f4f8d877 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -160,6 +160,7 @@ import nmt { ./modules/programs/rofi-pass ./modules/programs/swaylock ./modules/programs/terminator + ./modules/programs/thunderbird ./modules/programs/waybar ./modules/programs/xmobar ./modules/programs/yt-dlp diff --git a/tests/modules/programs/thunderbird/default.nix b/tests/modules/programs/thunderbird/default.nix new file mode 100644 index 00000000..48729778 --- /dev/null +++ b/tests/modules/programs/thunderbird/default.nix @@ -0,0 +1 @@ +{ thunderbird = ./thunderbird.nix; } diff --git a/tests/modules/programs/thunderbird/thunderbird-expected-first.js b/tests/modules/programs/thunderbird/thunderbird-expected-first.js new file mode 100644 index 00000000..6fc45b0e --- /dev/null +++ b/tests/modules/programs/thunderbird/thunderbird-expected-first.js @@ -0,0 +1,61 @@ +// Generated by Home Manager. + +user_pref("general.useragent.override", ""); +user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.identities", "id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.server", "server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.identities", "id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.account.account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.server", "server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.accountmanager.defaultaccount", "account_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.autoEncryptDrafts", false); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.fullName", "H. M. Test Jr."); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.protectSubject", false); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.smtpServer", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.useremail", "hm@example.org"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.valid", true); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.attachPgpKey", false); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.autoEncryptDrafts", true); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.e2etechpref", 0); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.encryptionpolicy", 0); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.fullName", "H. M. Test"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.is_gnupg_key_id", true); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.last_entered_external_gnupg_key_id", "ABC"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.openpgp_key_id", "ABC"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.protectSubject", true); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.sign_mail", false); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.smtpServer", "smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.useremail", "hm@example.com"); +user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.valid", true); +user_pref("mail.openpgp.allow_external_gnupg", true); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory", ".thunderbird/first/ImapMail/imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory-rel", "[ProfD]ImapMail/imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.login_at_startup", true); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.name", "hm-account"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 143); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.socketType", 3); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.type", "imap"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.userName", "home.manager.jr"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory", ".thunderbird/first/ImapMail/imap.example.com"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory-rel", "[ProfD]ImapMail/imap.example.com"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.hostname", "imap.example.com"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.login_at_startup", true); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.name", "hm@example.com"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.port", 123); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.socketType", 3); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.type", "imap"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.userName", "home.manager"); +user_pref("mail.smtp.defaultserver", "smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.authMethod", 3); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "smtp.example.org"); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 587); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.try_ssl", 2); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.username", "home.manager.jr"); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.authMethod", 3); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.hostname", "smtp.example.com"); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.port", 456); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.try_ssl", 3); +user_pref("mail.smtpserver.smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.username", "home.manager"); +user_pref("mail.smtpservers", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc,smtp_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("privacy.donottrackheader.enabled", true); + diff --git a/tests/modules/programs/thunderbird/thunderbird-expected-profiles.ini b/tests/modules/programs/thunderbird/thunderbird-expected-profiles.ini new file mode 100644 index 00000000..4191f160 --- /dev/null +++ b/tests/modules/programs/thunderbird/thunderbird-expected-profiles.ini @@ -0,0 +1,15 @@ +[General] +StartWithLastProfile=1 +Version=2 + +[Profile0] +Default=1 +IsRelative=1 +Name=first +Path=first + +[Profile1] +Default=0 +IsRelative=1 +Name=second +Path=second diff --git a/tests/modules/programs/thunderbird/thunderbird-expected-second.js b/tests/modules/programs/thunderbird/thunderbird-expected-second.js new file mode 100644 index 00000000..f18427a9 --- /dev/null +++ b/tests/modules/programs/thunderbird/thunderbird-expected-second.js @@ -0,0 +1,31 @@ +// Generated by Home Manager. + +user_pref("general.useragent.override", ""); +user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.identities", "id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.account.account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.server", "server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.accountmanager.accounts", "account_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.autoEncryptDrafts", false); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.fullName", "H. M. Test Jr."); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.protectSubject", false); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.smtpServer", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.useremail", "hm@example.org"); +user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.valid", true); +user_pref("mail.openpgp.allow_external_gnupg", false); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory", ".thunderbird/second/ImapMail/imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory-rel", "[ProfD]ImapMail/imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.login_at_startup", true); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.name", "hm-account"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 143); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.socketType", 3); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.type", "imap"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.userName", "home.manager.jr"); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.authMethod", 3); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "smtp.example.org"); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.port", 587); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.try_ssl", 2); +user_pref("mail.smtpserver.smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.username", "home.manager.jr"); +user_pref("mail.smtpservers", "smtp_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("privacy.donottrackheader.enabled", true); +user_pref("second.setting", "some-test-setting"); + diff --git a/tests/modules/programs/thunderbird/thunderbird.nix b/tests/modules/programs/thunderbird/thunderbird.nix new file mode 100644 index 00000000..ee16efa0 --- /dev/null +++ b/tests/modules/programs/thunderbird/thunderbird.nix @@ -0,0 +1,64 @@ +{ + imports = [ ../../accounts/email-test-accounts.nix ]; + + accounts.email.accounts = { + "hm@example.com" = { + thunderbird = { + enable = true; + profiles = [ "first" ]; + }; + + gpg.key = "ABC"; + + imap = { + port = 123; + tls.enable = true; + }; + smtp.port = 456; + }; + + hm-account = { + thunderbird = { + enable = true; + settings = id: { + "mail.identity.id_${id}.protectSubject" = false; + "mail.identity.id_${id}.autoEncryptDrafts" = false; + }; + }; + }; + }; + + programs.thunderbird = { + enable = true; + + profiles = { + first = { + isDefault = true; + withExternalGnupg = true; + }; + + second.settings = { "second.setting" = "some-test-setting"; }; + }; + + settings = { + "general.useragent.override" = ""; + "privacy.donottrackheader.enabled" = true; + }; + }; + + test.stubs.thunderbird = { }; + + nmt.script = '' + assertFileExists home-files/.thunderbird/profiles.ini + assertFileContent home-files/.thunderbird/profiles.ini \ + ${./thunderbird-expected-profiles.ini} + + assertFileExists home-files/.thunderbird/first/user.js + assertFileContent home-files/.thunderbird/first/user.js \ + ${./thunderbird-expected-first.js} + + assertFileExists home-files/.thunderbird/second/user.js + assertFileContent home-files/.thunderbird/second/user.js \ + ${./thunderbird-expected-second.js} + ''; +} From c728307482dacc9b2720b8036292b166c7865fa9 Mon Sep 17 00:00:00 2001 From: midchildan Date: Sat, 5 Nov 2022 12:10:27 +0900 Subject: [PATCH 083/233] darwin: use full path to commands in activation script --- modules/launchd/default.nix | 8 ++++---- modules/targets/darwin/user-defaults/default.nix | 6 +++--- tests/modules/targets-darwin/user-defaults.nix | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix index 17b36cdb..34fefc17 100644 --- a/modules/launchd/default.nix +++ b/modules/launchd/default.nix @@ -162,12 +162,12 @@ in { fi if [[ -f "$dstPath" ]]; then for (( i = 0; i < bootout_retries; i++ )); do - $DRY_RUN_CMD launchctl bootout "$domain/$agentName" || err=$? + $DRY_RUN_CMD /bin/launchctl bootout "$domain/$agentName" || err=$? if [[ -v DRY_RUN ]]; then break fi if (( err != 9216 )) && - ! launchctl print "$domain/$agentName" &> /dev/null; then + ! /bin/launchctl print "$domain/$agentName" &> /dev/null; then break fi sleep 1 @@ -178,7 +178,7 @@ in { fi fi $DRY_RUN_CMD install -Dm444 -T "$srcPath" "$dstPath" - $DRY_RUN_CMD launchctl bootstrap "$domain" "$dstPath" + $DRY_RUN_CMD /bin/launchctl bootstrap "$domain" "$dstPath" done if [[ ! -e "$oldDir" ]]; then @@ -194,7 +194,7 @@ in { continue fi - $DRY_RUN_CMD launchctl bootout "$domain/$agentName" || : + $DRY_RUN_CMD /bin/launchctl bootout "$domain/$agentName" || : if [[ ! -e "$dstPath" ]]; then continue fi diff --git a/modules/targets/darwin/user-defaults/default.nix b/modules/targets/darwin/user-defaults/default.nix index dfb9b61e..c44d4f9c 100644 --- a/modules/targets/darwin/user-defaults/default.nix +++ b/modules/targets/darwin/user-defaults/default.nix @@ -13,9 +13,9 @@ let cliFlags = lib.optionalString isLocal "-currentHost"; toActivationCmd = domain: attrs: - "$DRY_RUN_CMD defaults ${cliFlags} import ${escapeShellArg domain} ${ - toDefaultsFile domain attrs - }"; + "$DRY_RUN_CMD /usr/bin/defaults ${cliFlags} import ${ + escapeShellArg domain + } ${toDefaultsFile domain attrs}"; nonNullDefaults = mapAttrs (domain: attrs: (filterAttrs (n: v: v != null) attrs)) diff --git a/tests/modules/targets-darwin/user-defaults.nix b/tests/modules/targets-darwin/user-defaults.nix index 26e0656e..bb23f718 100644 --- a/tests/modules/targets-darwin/user-defaults.nix +++ b/tests/modules/targets-darwin/user-defaults.nix @@ -10,9 +10,9 @@ nmt.script = '' assertFileRegex activate \ - "defaults import 'com.apple.desktopservices' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.desktopservices\\.plist" + "/usr/bin/defaults import 'com.apple.desktopservices' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.desktopservices\\.plist" assertFileRegex activate \ - "defaults -currentHost import 'com.apple.controlcenter' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.controlcenter\\.plist" + "/usr/bin/defaults -currentHost import 'com.apple.controlcenter' /nix/store/[a-z0-9]\\{32\\}-com\\.apple\\.controlcenter\\.plist" ''; }; } From ccc9164b76e4167873ed819f0fb014635453ec68 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Thu, 8 Sep 2022 13:08:57 +0200 Subject: [PATCH 084/233] home-environment: fix activation on new style profiles When using the new style profiles we get conflicts when trying to replace the old `home-path` derivation. To avoid this conflict we delete the old `home-path` before the install. Unfortunately, `nix profile` does not yet have a equivalent for `nix-env --set` and we have to do this hackish workaround. See https://github.com/NixOS/nix/issues/6349 for the associated issue in Nix. Fixes #2848 --- modules/home-environment.nix | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 7c0c30ae..a0b9aa24 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -592,22 +592,37 @@ in '' else '' + function nixReplaceProfile() { + local oldNix="$(which nix)" + + nix profile list \ + | { grep 'home-manager-path$' || test $? = 1; } \ + | awk -F ' ' '{ print $4 }' \ + | cut -d ' ' -f 4 \ + | xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG + + $DRY_RUN_CMD $oldNix profile install $1 + } + if [[ -e "$nixProfilePath"/manifest.json ]] ; then INSTALL_CMD="nix profile install" + INSTALL_CMD_ACTUAL="nixReplaceProfile" LIST_CMD="nix profile list" REMOVE_CMD_SYNTAX='nix profile remove {number | store path}' else INSTALL_CMD="nix-env -i" + INSTALL_CMD_ACTUAL="$DRY_RUN_CMD nix-env -i" LIST_CMD="nix-env -q" REMOVE_CMD_SYNTAX='nix-env -e {package name}' fi - if ! $DRY_RUN_CMD $INSTALL_CMD ${cfg.path} ; then + if ! $INSTALL_CMD_ACTUAL ${cfg.path} ; then echo _iError $'Oops, Nix failed to install your new Home Manager profile!\n\nPerhaps there is a conflict with a package that was installed using\n"%s"? Try running\n\n %s\n\nand if there is a conflicting package you can remove it with\n\n %s\n\nThen try activating your Home Manager configuration again.' "$INSTALL_CMD" "$LIST_CMD" "$REMOVE_CMD_SYNTAX" exit 1 fi - unset INSTALL_CMD LIST_CMD REMOVE_CMD_SYNTAX + unset -f nixReplaceProfile + unset INSTALL_CMD INSTALL_CMD_ACTUAL LIST_CMD REMOVE_CMD_SYNTAX '' ); From 989d4fa536e9bcd6bc2d42b3ac8b9dc07b1f9d26 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Tue, 1 Nov 2022 09:51:58 -0500 Subject: [PATCH 085/233] home-environment: remove no-op commands --- modules/home-environment.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index a0b9aa24..f609558e 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -581,7 +581,6 @@ in if [[ -e "$nixProfilePath"/manifest.json ]] ; then nix profile list \ | { grep 'home-manager-path$' || test $? = 1; } \ - | awk -F ' ' '{ print $4 }' \ | cut -d ' ' -f 4 \ | xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG else @@ -593,11 +592,10 @@ in else '' function nixReplaceProfile() { - local oldNix="$(which nix)" + local oldNix="$(command -v nix)" nix profile list \ | { grep 'home-manager-path$' || test $? = 1; } \ - | awk -F ' ' '{ print $4 }' \ | cut -d ' ' -f 4 \ | xargs -t $DRY_RUN_CMD nix profile remove $VERBOSE_ARG From c5adf29545b553089ccf9c28b68973ce6f812c1c Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Sat, 5 Nov 2022 12:00:00 +0000 Subject: [PATCH 086/233] i3: fix reloading when there are several sockets This can happen after logout/login. Fixes #527 --- modules/services/window-managers/i3-sway/i3.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/services/window-managers/i3-sway/i3.nix b/modules/services/window-managers/i3-sway/i3.nix index 16e82d16..21044a54 100644 --- a/modules/services/window-managers/i3-sway/i3.nix +++ b/modules/services/window-managers/i3-sway/i3.nix @@ -249,10 +249,13 @@ in { xdg.configFile."i3/config" = { source = checkI3Config; onChange = '' - i3Socket=''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.* - if [ -S $i3Socket ]; then - ${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null - fi + # There may be several sockets after log out/log in, but the old ones + # will fail with "Connection refused". + for i3Socket in ''${XDG_RUNTIME_DIR:-/run/user/$UID}/i3/ipc-socket.*; do + if [[ -S $i3Socket ]]; then + ${cfg.package}/bin/i3-msg -s $i3Socket reload >/dev/null |& grep -v "Connection refused" || true + fi + done ''; }; } From 1ef0da321217c6c19b7a30509631c080a19321e5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 6 Nov 2022 04:14:41 +0000 Subject: [PATCH 087/233] 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/fdebb81f45a1ba2c4afca5fd9f526e1653ad0949' (2022-10-29) → 'github:nixos/nixpkgs/3bacde6273b09a21a8ccfba15586fb165078fb62' (2022-11-05) • Updated input 'utils': 'github:numtide/flake-utils/6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817' (2022-10-29) → 'github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f' (2022-11-02) --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 22603156..090f8fa7 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1667050928, - "narHash": "sha256-xOn0ZgjImIyeecEsrjxuvlW7IW5genTwvvnDQRFncB8=", + "lastModified": 1667629849, + "narHash": "sha256-P+v+nDOFWicM4wziFK9S/ajF2lc0N2Rg9p6Y35uMoZI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "fdebb81f45a1ba2c4afca5fd9f526e1653ad0949", + "rev": "3bacde6273b09a21a8ccfba15586fb165078fb62", "type": "github" }, "original": { @@ -24,11 +24,11 @@ }, "utils": { "locked": { - "lastModified": 1667077288, - "narHash": "sha256-bdC8sFNDpT0HK74u9fUkpbf1MEzVYJ+ka7NXCdgBoaA=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "6ee9ebb6b1ee695d2cacc4faa053a7b9baa76817", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { From 5dd3ce3f1eb83cb6d45c27ef7d19fc9913681a82 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 3 Nov 2022 23:01:31 +0100 Subject: [PATCH 088/233] mu: use absolute path to mu in activation block --- modules/programs/mu.nix | 2 +- tests/modules/programs/mu/basic-configuration.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/mu.nix b/modules/programs/mu.nix index 58b8b3df..835be361 100644 --- a/modules/programs/mu.nix +++ b/modules/programs/mu.nix @@ -52,7 +52,7 @@ in { # In theory, mu is the only thing that creates that directory, and it is # only created during the initial index. if [[ ! -d "${dbLocation}" ]]; then - $DRY_RUN_CMD mu init ${maildirOption} ${myAddresses} $VERBOSE_ARG; + $DRY_RUN_CMD ${pkgs.mu}/bin/mu init ${maildirOption} ${myAddresses} $VERBOSE_ARG; fi ''; }; diff --git a/tests/modules/programs/mu/basic-configuration.nix b/tests/modules/programs/mu/basic-configuration.nix index 1e1deeea..4b315c2e 100644 --- a/tests/modules/programs/mu/basic-configuration.nix +++ b/tests/modules/programs/mu/basic-configuration.nix @@ -19,6 +19,6 @@ 'if [[ ! -d "/home/hm-user/.cache/mu" ]]; then' assertFileContains activate \ - '$DRY_RUN_CMD mu init --maildir=/home/hm-user/Mail --my-address=hm@example.com --my-address=foo@example.com $VERBOSE_ARG;' + '$DRY_RUN_CMD @mu@/bin/mu init --maildir=/home/hm-user/Mail --my-address=hm@example.com --my-address=foo@example.com $VERBOSE_ARG;' ''; } From d67776563ec1f11df401837aa800c212417a6ca6 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 3 Nov 2022 23:13:29 +0100 Subject: [PATCH 089/233] systemd: fix `systemctlPath` default text --- modules/systemd.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/systemd.nix b/modules/systemd.nix index 7a27e95b..6abc2460 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -107,7 +107,7 @@ in { systemd.user = { systemctlPath = mkOption { default = "${pkgs.systemd}/bin/systemctl"; - defaultText = "\${pkgs.systemd}/bin/systemctl"; + defaultText = literalExpression ''"''${pkgs.systemd}/bin/systemctl"''; type = types.str; description = '' Absolute path to the systemctl tool. This From 886675991b643b701a33f533443db165c70692d1 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 3 Nov 2022 15:00:29 +0100 Subject: [PATCH 090/233] home-environment: reset PATH in activation script Starting with state version 22.11 we completely reset the PATH variable in the activation script. This is to avoid impurities and unexpected results if the activation script accidentally uses a command found in the user's PATH. --- docs/release-notes/rl-2211.adoc | 14 ++++++++++++++ modules/home-environment.nix | 24 ++++++++++++++++++++---- nixos/common.nix | 2 +- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/docs/release-notes/rl-2211.adoc b/docs/release-notes/rl-2211.adoc index dccace68..046995d5 100644 --- a/docs/release-notes/rl-2211.adoc +++ b/docs/release-notes/rl-2211.adoc @@ -97,3 +97,17 @@ These changes are only active if the `home.stateVersion` option is set to "22.11 value of <> if <> is enabled. Otherwise it is undefined and must be specified in the user configuration. + +* The activation script now resets `PATH` before running. Before, the +user's `PATH` environment variable would be used in the script and +this made it possible for commands in the activation script to run +arbitrary commands accessible to the user. We now restrict the +activation script to commands that are explicitly specified. ++ +There is no official way to restore the old behavior. We attempt to +make the activation script as reproducible as possible and honoring +the user's `PATH` reduces reproducibility. ++ +If you need to run a command in an activation script block then refer +to the command by its absolute command path, such as +`${pkgs.hello}/bin/hello`. diff --git a/modules/home-environment.nix b/modules/home-environment.nix index f609558e..9d61cc99 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -346,12 +346,18 @@ in home.emptyActivationPath = mkOption { internal = true; - default = false; type = types.bool; + default = versionAtLeast stateVersion "22.11"; + defaultText = literalExpression '' + false for state version < 22.11, + true for state version ≥ 22.11 + ''; description = '' Whether the activation script should start with an empty - PATH variable. When false - then the user's PATH will be used. + PATH variable. When false then the + user's PATH will be accessible in the script. It is + recommended to keep this at true to avoid + uncontrolled use of tools found in PATH. ''; }; @@ -672,7 +678,17 @@ in gnugrep gnused ncurses # For `tput`. - ] ++ config.home.extraActivationPath + ] + ++ optional (config.nix.enable && config.nix.package != null) config.nix.package + ++ config.home.extraActivationPath + ) + + ( + # Add path of the Nix binaries, if a Nix package is configured, then + # use that one, otherwise grab the path of the nix-env tool. + if config.nix.enable && config.nix.package != null then + ":${config.nix.package}/bin" + else + ":$(dirname $(readlink -m $(type -p nix-env)))" ) + optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH"; diff --git a/nixos/common.nix b/nixos/common.nix index bbc0f976..25872b25 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -35,7 +35,7 @@ let # Make activation script use same version of Nix as system as a whole. # This avoids problems with Nix not being in PATH. - home.extraActivationPath = [ config.nix.package ]; + nix.package = config.nix.package; }; }) ] ++ cfg.sharedModules; From b0cf7245c430df2ae9e511449e5840bfdfd01cc7 Mon Sep 17 00:00:00 2001 From: Eise Zimmerman Date: Mon, 7 Nov 2022 18:06:30 +0100 Subject: [PATCH 091/233] Translate using Weblate (Dutch) Currently translated at 40.6% (13 of 32 strings) Co-authored-by: Eise Zimmerman Translate-URL: https://hosted.weblate.org/projects/home-manager/cli/nl/ Translation: Home Manager/Home Manager CLI --- home-manager/po/nl.po | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/home-manager/po/nl.po b/home-manager/po/nl.po index 358d5dea..4d9804ca 100644 --- a/home-manager/po/nl.po +++ b/home-manager/po/nl.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: 2022-03-26 15:08+0100\n" -"PO-Revision-Date: 2022-07-12 19:40+0000\n" -"Last-Translator: Frederik Engels \n" +"PO-Revision-Date: 2022-11-07 17:06+0000\n" +"Last-Translator: Eise Zimmerman \n" "Language-Team: Dutch \n" "Language: nl\n" @@ -17,23 +17,24 @@ 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 4.14-dev\n" +"X-Generator: Weblate 4.14.2\n" #: home-manager/home-manager:60 msgid "No configuration file found at %s" -msgstr "" +msgstr "Geen configuratiebestand gevonden in %s" #: home-manager/home-manager:79 msgid "No configuration file found. Please create one at %s" -msgstr "" +msgstr "Geen configuratiebestand gevonden. Gelieve een nieuwe te creëren op %s" #: home-manager/home-manager:122 msgid "Can't inspect options of a flake configuration" msgstr "" +"Het is niet gelukt om de options van de vlok-configuratie te inspecteren" #: home-manager/home-manager:162 msgid "Can't instantiate a flake configuration" -msgstr "" +msgstr "Het is niet gelukt om de vlok-configuratie te creëren" #: home-manager/home-manager:237 msgid "" @@ -43,7 +44,11 @@ msgid_plural "" "There are %d unread and relevant news items.\n" "Read them by running the command \"%s news\"." msgstr[0] "" +"Er is %d ongelezen and relevant nieuws artikel.\n" +"Lees het door het commando \"%s news\" uit te voeren." msgstr[1] "" +"Er zijn %d ongelezen and relevante nieuws artikelen.\n" +"Lees ze door het commando \"%s news\" uit te voeren." #: home-manager/home-manager:251 msgid "Unknown \"news.display\" setting \"%s\"." From d20e3d070c78271356a2d5d73c01f1de94586087 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 8 Nov 2022 10:13:26 +0100 Subject: [PATCH 092/233] screen-locker: minor description fix --- modules/services/screen-locker.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/screen-locker.nix b/modules/services/screen-locker.nix index 3ea84ebe..155896cd 100644 --- a/modules/services/screen-locker.nix +++ b/modules/services/screen-locker.nix @@ -99,7 +99,7 @@ in { type = types.int; default = 600; description = '' - X server's screensaver cycle value expresed as seconds. + The X server's screensaver cycle value expressed as seconds. This will be used with xset to configure the cycle along with timeout. ''; From 6ce3493a3c5c6a8f4cfa6f5f88723272e0cfd335 Mon Sep 17 00:00:00 2001 From: Xyz00777 <52142054+Xyz00777@users.noreply.github.com> Date: Tue, 8 Nov 2022 22:42:14 +0100 Subject: [PATCH 093/233] kodi: fix syntax error in example --- modules/programs/kodi.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/programs/kodi.nix b/modules/programs/kodi.nix index 36169948..0441eebc 100644 --- a/modules/programs/kodi.nix +++ b/modules/programs/kodi.nix @@ -131,9 +131,8 @@ in { type = types.package; default = pkgs.kodi; defaultText = literalExpression "pkgs.kodi"; - example = literalExpression '' - { pkgs.kodi.withPackages (exts: [ exts.pvr-iptvsimple ]) } - ''; + example = literalExpression + "pkgs.kodi.withPackages (exts: [ exts.pvr-iptvsimple ])"; description = '' The kodi package to use. Can be used to specify extensions. From 651db464dcbf86700dbb84bf7085702a82533aaa Mon Sep 17 00:00:00 2001 From: David Date: Fri, 11 Nov 2022 17:31:39 +0100 Subject: [PATCH 094/233] thunderbird: allow using the module on Darwin While the Nix packages for Thunderbird are not available for macOS, the module can still be used to manage profiles and configuration. Fixes #3407. --- modules/misc/news.nix | 22 ++++++++++++++- modules/programs/thunderbird.nix | 46 +++++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 34c2e0e1..a2f08db2 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -820,7 +820,27 @@ in time = "2022-11-04T14:56:46+00:00"; condition = hostPlatform.isLinux; message = '' - A new module is available: 'programs.thunderbird'; + A new module is available: 'programs.thunderbird'. + ''; + } + + { + time = "2022-11-13T09:05:51+00:00"; + condition = hostPlatform.isDarwin; + message = '' + A new module is available: 'programs.thunderbird'. + + Please note that the Thunderbird packages provided by Nix are + currently not working on macOS. The module can still be used to manage + configuration files by installing Thunderbird manually and setting the + 'programs.thunderbird.package' option to a dummy package, for example + using 'pkgs.runCommand'. + + This module requires you to set the following environment variables + when using an installation of Thunderbird that is not provided by Nix: + + export MOZ_LEGACY_PROFILES=1 + export MOZ_ALLOW_DOWNGRADE=1 ''; } ]; diff --git a/modules/programs/thunderbird.nix b/modules/programs/thunderbird.nix index 118a98a6..94ccea10 100644 --- a/modules/programs/thunderbird.nix +++ b/modules/programs/thunderbird.nix @@ -3,6 +3,8 @@ with lib; let + inherit (pkgs.stdenv.hostPlatform) isDarwin; + cfg = config.programs.thunderbird; enabledAccounts = attrValues @@ -11,7 +13,13 @@ let enabledAccountsWithId = map (a: a // { id = builtins.hashString "sha256" a.name; }) enabledAccounts; - thunderbirdConfigPath = ".thunderbird"; + thunderbirdConfigPath = + if isDarwin then "Library/Thunderbird" else ".thunderbird"; + + thunderbirdProfilesPath = if isDarwin then + "${thunderbirdConfigPath}/Profiles" + else + thunderbirdConfigPath; profilesWithId = imap0 (i: v: v // { id = toString i; }) (attrValues cfg.profiles); @@ -24,7 +32,7 @@ let } (flip map profilesWithId (profile: { "Profile${profile.id}" = { Name = profile.name; - Path = profile.name; + Path = if isDarwin then "Profiles/${profile.name}" else profile.name; IsRelative = 1; Default = if profile.isDefault then 1 else 0; }; @@ -54,7 +62,7 @@ let "mail.identity.id_${id}.sign_mail" = account.gpg.signByDefault; } // optionalAttrs (account.imap != null) { "mail.server.server_${id}.directory" = - "${thunderbirdConfigPath}/${profile.name}/ImapMail/${account.imap.host}"; + "${thunderbirdProfilesPath}/${profile.name}/ImapMail/${account.imap.host}"; "mail.server.server_${id}.directory-rel" = "[ProfD]ImapMail/${account.imap.host}"; "mail.server.server_${id}.hostname" = account.imap.host; @@ -168,6 +176,18 @@ in { all profiles. ''; }; + + darwinSetupWarning = mkOption { + type = types.bool; + default = true; + example = false; + visible = isDarwin; + readOnly = !isDarwin; + description = '' + Warn to set environment variables before using this module. Only + relevant on Darwin. + ''; + }; }; accounts.email.accounts = mkOption { @@ -213,14 +233,12 @@ in { config = mkIf cfg.enable { assertions = [ - (hm.assertions.assertPlatform "programs.thunderbird" pkgs platforms.linux) - (let defaults = catAttrs "name" (filter (a: a.isDefault) profilesWithId); in { assertion = cfg.profiles == { } || length defaults == 1; message = "Must have exactly one default Thunderbird profile but found " + toString (length defaults) + optionalString (length defaults > 1) - (", namely " concatStringsSep "," defaults); + (", namely " + concatStringsSep "," defaults); }) (let @@ -237,6 +255,20 @@ in { }) ]; + warnings = optional (isDarwin && cfg.darwinSetupWarning) '' + Thunderbird packages are not yet supported on Darwin. You can still use + this module to manage your accounts and profiles by setting + 'programs.thunderbird.package' to a dummy value, for example using + 'pkgs.runCommand'. + + Note that this module requires you to set the following environment + variables when using an installation of Thunderbird that is not provided + by Nix: + + export MOZ_LEGACY_PROFILES=1 + export MOZ_ALLOW_DOWNGRADE=1 + ''; + home.packages = [ cfg.package ] ++ optional (any (p: p.withExternalGnupg) (attrValues cfg.profiles)) pkgs.gpgme; @@ -245,7 +277,7 @@ in { "${thunderbirdConfigPath}/profiles.ini" = mkIf (cfg.profiles != { }) { text = generators.toINI { } profilesIni; }; }] ++ flip mapAttrsToList cfg.profiles (name: profile: { - "${thunderbirdConfigPath}/${name}/user.js" = let + "${thunderbirdProfilesPath}/${name}/user.js" = let accounts = filter (a: a.thunderbird.profiles == [ ] || any (p: p == name) a.thunderbird.profiles) enabledAccountsWithId; From bc90de24d898655542589237cc0a6ada7564cb6c Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 12 Nov 2022 09:35:01 -0500 Subject: [PATCH 095/233] xdg-user-dirs: allow setting to null to skip setting Previously, this module was all-or-nothing with its pre-defined user dirs. This allows e.g. `xdg.userDirs.desktop = null;` to opt-out of some configuration while still benefiting from the rest. --- modules/misc/xdg-user-dirs.nix | 20 ++++++++--------- tests/modules/misc/xdg/default.nix | 1 + tests/modules/misc/xdg/user-dirs-null.nix | 26 +++++++++++++++++++++++ 3 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 tests/modules/misc/xdg/user-dirs-null.nix diff --git a/modules/misc/xdg-user-dirs.nix b/modules/misc/xdg-user-dirs.nix index 36f200eb..2ea07709 100644 --- a/modules/misc/xdg-user-dirs.nix +++ b/modules/misc/xdg-user-dirs.nix @@ -33,7 +33,7 @@ in { # https://gitlab.freedesktop.org/xdg/xdg-user-dirs/blob/master/man/user-dirs.dirs.xml desktop = mkOption { - type = with types; coercedTo path toString str; + type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Desktop"; defaultText = literalExpression ''"''${config.home.homeDirectory}/Desktop"''; @@ -41,7 +41,7 @@ in { }; documents = mkOption { - type = with types; coercedTo path toString str; + type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Documents"; defaultText = literalExpression ''"''${config.home.homeDirectory}/Documents"''; @@ -49,7 +49,7 @@ in { }; download = mkOption { - type = with types; coercedTo path toString str; + type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Downloads"; defaultText = literalExpression ''"''${config.home.homeDirectory}/Downloads"''; @@ -57,7 +57,7 @@ in { }; music = mkOption { - type = with types; coercedTo path toString str; + type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Music"; defaultText = literalExpression ''"''${config.home.homeDirectory}/Music"''; @@ -65,7 +65,7 @@ in { }; pictures = mkOption { - type = with types; coercedTo path toString str; + type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Pictures"; defaultText = literalExpression ''"''${config.home.homeDirectory}/Pictures"''; @@ -73,7 +73,7 @@ in { }; publicShare = mkOption { - type = with types; coercedTo path toString str; + type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Public"; defaultText = literalExpression ''"''${config.home.homeDirectory}/Public"''; @@ -81,7 +81,7 @@ in { }; templates = mkOption { - type = with types; coercedTo path toString str; + type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Templates"; defaultText = literalExpression ''"''${config.home.homeDirectory}/Templates"''; @@ -89,7 +89,7 @@ in { }; videos = mkOption { - type = with types; coercedTo path toString str; + type = with types; nullOr (coercedTo path toString str); default = "${config.home.homeDirectory}/Videos"; defaultText = literalExpression ''"''${config.home.homeDirectory}/Videos"''; @@ -113,7 +113,7 @@ in { }; config = let - directories = { + directories = (filterAttrs (n: v: !isNull v) { XDG_DESKTOP_DIR = cfg.desktop; XDG_DOCUMENTS_DIR = cfg.documents; XDG_DOWNLOAD_DIR = cfg.download; @@ -122,7 +122,7 @@ in { XDG_PUBLICSHARE_DIR = cfg.publicShare; XDG_TEMPLATES_DIR = cfg.templates; XDG_VIDEOS_DIR = cfg.videos; - } // cfg.extraConfig; + }) // cfg.extraConfig; in mkIf cfg.enable { assertions = [ (hm.assertions.assertPlatform "xdg.userDirs" pkgs platforms.linux) ]; diff --git a/tests/modules/misc/xdg/default.nix b/tests/modules/misc/xdg/default.nix index f3fef092..4cce5baf 100644 --- a/tests/modules/misc/xdg/default.nix +++ b/tests/modules/misc/xdg/default.nix @@ -4,4 +4,5 @@ xdg-desktop-entries = ./desktop-entries.nix; xdg-file-gen = ./file-gen.nix; xdg-default-locations = ./default-locations.nix; + xdg-user-dirs-null = ./user-dirs-null.nix; } diff --git a/tests/modules/misc/xdg/user-dirs-null.nix b/tests/modules/misc/xdg/user-dirs-null.nix new file mode 100644 index 00000000..6e8c4f18 --- /dev/null +++ b/tests/modules/misc/xdg/user-dirs-null.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +{ + config = { + xdg.userDirs = { + enable = true; + desktop = null; + }; + + nmt.script = '' + configFile=home-files/.config/user-dirs.dirs + assertFileExists $configFile + assertFileContent $configFile ${ + pkgs.writeText "expected" '' + XDG_DOCUMENTS_DIR="/home/hm-user/Documents" + XDG_DOWNLOAD_DIR="/home/hm-user/Downloads" + XDG_MUSIC_DIR="/home/hm-user/Music" + XDG_PICTURES_DIR="/home/hm-user/Pictures" + XDG_PUBLICSHARE_DIR="/home/hm-user/Public" + XDG_TEMPLATES_DIR="/home/hm-user/Templates" + XDG_VIDEOS_DIR="/home/hm-user/Videos" + '' + } + ''; + }; +} From fe85cc4c37d5f37104e349c5553029417e3833d1 Mon Sep 17 00:00:00 2001 From: Sumner Evans Date: Thu, 17 Nov 2022 15:27:03 -0500 Subject: [PATCH 096/233] udiskie: add note about needing to enable system-wide config (#3424) Closes #3153 Signed-off-by: Sumner Evans --- modules/services/udiskie.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/services/udiskie.nix b/modules/services/udiskie.nix index 0d9ae2eb..d53d7cc8 100644 --- a/modules/services/udiskie.nix +++ b/modules/services/udiskie.nix @@ -25,7 +25,16 @@ in { options = { services.udiskie = { - enable = mkEnableOption "udiskie mount daemon"; + enable = mkEnableOption "udiskie mount daemon" // { + description = '' + Whether to enable the udiskie mount daemon. + + Note, if you use NixOS then you must add + services.udisks2.enable = true + to your system configuration. Otherwise mounting will fail because + the Udisk2 DBus service is not found. + ''; + }; settings = mkOption { type = yaml.type; From c94c9c342f16914565b1abf413b09fbbb05fa4b8 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 18 Nov 2022 15:59:30 +0000 Subject: [PATCH 097/233] picom: remove experimentalBackends, add extraArgs (#3423) `--experimental-backends` flag was removed in the recent released picom v10. Using it now will result in the program exiting. v10 also introduces its counter-part, `--legacy-backends`. However this will be removed soon. Instead of adding this as an separate option, add `extraArgs` option so for those that they want they can pass it manuall. It is also more future proof. --- modules/services/picom.nix | 15 ++++++++++++--- .../picom-basic-configuration-expected.service | 2 +- .../services/picom/picom-basic-configuration.nix | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/modules/services/picom.nix b/modules/services/picom.nix index 75ed6a72..f3c47a6c 100644 --- a/modules/services/picom.nix +++ b/modules/services/picom.nix @@ -54,6 +54,8 @@ in { imports = [ (mkRemovedOptionModule [ "services" "picom" "refreshRate" ] "The option `refresh-rate` has been deprecated by upstream.") + (mkRemovedOptionModule [ "services" "picom" "experimentalBackends" ] + "The option `--experimental-backends` has been removed by upstream.") (mkRemovedOptionModule [ "services" "picom" "extraOptions" ] "This option has been replaced by `services.picom.settings`.") (mkRenamedOptionModule [ "services" "picom" "opacityRule" ] [ @@ -66,8 +68,6 @@ in { options.services.picom = { enable = mkEnableOption "Picom X11 compositor"; - experimentalBackends = mkEnableOption "the new experimental backends"; - fade = mkOption { type = types.bool; default = false; @@ -213,6 +213,15 @@ in { ''; }; + extraArgs = mkOption { + type = with types; listOf str; + default = [ ]; + example = literalExpression ''[ "--legacy-backends" ]''; + description = '' + Extra arguments to be passed to the picom executable. + ''; + }; + package = mkOption { type = types.package; default = pkgs.picom; @@ -306,7 +315,7 @@ in { ExecStart = concatStringsSep " " ([ "${cfg.package}/bin/picom" "--config ${config.xdg.configFile."picom/picom.conf".source}" - ] ++ optional cfg.experimentalBackends "--experimental-backends"); + ] ++ cfg.extraArgs); Restart = "always"; RestartSec = 3; }; diff --git a/tests/modules/services/picom/picom-basic-configuration-expected.service b/tests/modules/services/picom/picom-basic-configuration-expected.service index 62620502..6aeef224 100644 --- a/tests/modules/services/picom/picom-basic-configuration-expected.service +++ b/tests/modules/services/picom/picom-basic-configuration-expected.service @@ -2,7 +2,7 @@ WantedBy=graphical-session.target [Service] -ExecStart=@picom@/bin/picom --config /nix/store/00000000000000000000000000000000-hm_picompicom.conf --experimental-backends +ExecStart=@picom@/bin/picom --config /nix/store/00000000000000000000000000000000-hm_picompicom.conf --legacy-backends Restart=always RestartSec=3 diff --git a/tests/modules/services/picom/picom-basic-configuration.nix b/tests/modules/services/picom/picom-basic-configuration.nix index 67848f52..1c268979 100644 --- a/tests/modules/services/picom/picom-basic-configuration.nix +++ b/tests/modules/services/picom/picom-basic-configuration.nix @@ -19,7 +19,7 @@ "unredir-if-possible" = true; "dbe" = true; }; - experimentalBackends = true; + extraArgs = [ "--legacy-backends" ]; }; test.stubs.picom = { }; From 5589b28e66ccaa13852c8aa58ecb45025e88e67e Mon Sep 17 00:00:00 2001 From: alois31 <36605164+alois31@users.noreply.github.com> Date: Fri, 18 Nov 2022 17:00:57 +0100 Subject: [PATCH 098/233] opam: add fish integration (#3422) --- modules/programs/opam.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/programs/opam.nix b/modules/programs/opam.nix index 9cd76d95..2916fb19 100644 --- a/modules/programs/opam.nix +++ b/modules/programs/opam.nix @@ -34,6 +34,14 @@ in { Whether to enable Zsh integration. ''; }; + + enableFishIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable Fish integration. + ''; + }; }; config = mkIf cfg.enable { @@ -46,5 +54,9 @@ in { programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' eval "$(${cfg.package}/bin/opam env --shell=zsh)" ''; + + programs.fish.shellInit = mkIf cfg.enableFishIntegration '' + eval "$(${cfg.package}/bin/opam env --shell=fish)" + ''; }; } From 948d1f8a5cef55a281d4f5d17f3b79df6c82fce1 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Fri, 18 Nov 2022 17:27:43 +0100 Subject: [PATCH 099/233] programs.zsh: generate a more compact config (#3170) --- modules/programs/zsh.nix | 51 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index e595e5c2..9ffe9dfa 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -18,10 +18,6 @@ let mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}") cfg.shellAliases ); - globalAliasesStr = concatStringsSep "\n" ( - mapAttrsToList (k: v: "alias -g ${k}=${lib.escapeShellArg v}") cfg.shellGlobalAliases - ); - dirHashesStr = concatStringsSep "\n" ( mapAttrsToList (k: v: ''hash -d ${k}="${v}"'') cfg.dirHashes ); @@ -488,35 +484,36 @@ in ++ optional cfg.enableCompletion nix-zsh-completions ++ optional cfg.oh-my-zsh.enable oh-my-zsh; - home.file."${relToDotDir ".zshrc"}".text = '' - ${cfg.initExtraFirst} + home.file."${relToDotDir ".zshrc"}".text = concatStringsSep "\n" ([ + cfg.initExtraFirst + "typeset -U path cdpath fpath manpath" - typeset -U path cdpath fpath manpath - - ${optionalString (cfg.cdpath != []) '' + (optionalString (cfg.cdpath != []) '' cdpath+=(${concatStringsSep " " cfg.cdpath}) - ''} + '') + '' for profile in ''${(z)NIX_PROFILES}; do fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions) done HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help" + '' - ${optionalString (cfg.defaultKeymap != null) '' + (optionalString (cfg.defaultKeymap != null) '' # Use ${cfg.defaultKeymap} keymap as the default. ${getAttr cfg.defaultKeymap bindkeyCommands} - ''} + '') + localVarsStr - ${localVarsStr} + cfg.initExtraBeforeCompInit - ${cfg.initExtraBeforeCompInit} - - ${concatStrings (map (plugin: '' + (concatStrings (map (plugin: '' path+="$HOME/${pluginsDir}/${plugin.name}" fpath+="$HOME/${pluginsDir}/${plugin.name}" - '') cfg.plugins)} + '') cfg.plugins)) + '' # Oh-My-Zsh/Prezto calls compinit during initialization, # calling it twice causes slight start up slowdown # as all $fpath entries will be traversed again. @@ -575,27 +572,29 @@ in # Aliases ${aliasesStr} - - # Global Aliases - ${globalAliasesStr} - + '' + ] + ++ (mapAttrsToList (k: v: "alias -g ${k}=${lib.escapeShellArg v}") cfg.shellGlobalAliases) + ++ [ ('' # Named Directory Hashes ${dirHashesStr} + '') - ${optionalString cfg.enableSyntaxHighlighting + (optionalString cfg.enableSyntaxHighlighting # Load zsh-syntax-highlighting after all custom widgets have been created # https://github.com/zsh-users/zsh-syntax-highlighting#faq "source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" - } - ${optionalString (cfg.historySubstringSearch.enable or false) + ) + + (optionalString (cfg.historySubstringSearch.enable or false) # Load zsh-history-substring-search after zsh-syntax-highlighting # https://github.com/zsh-users/zsh-history-substring-search#usage '' source ${pkgs.zsh-history-substring-search}/share/zsh-history-substring-search/zsh-history-substring-search.zsh bindkey '${cfg.historySubstringSearch.searchUpKey}' history-substring-search-up bindkey '${cfg.historySubstringSearch.searchDownKey}' history-substring-search-down - ''} - ''; + '') + ]); } (mkIf cfg.oh-my-zsh.enable { From c0f9cbcf93ca22e4f0ca66843be61a4bdf6f0a44 Mon Sep 17 00:00:00 2001 From: KFearsoff Date: Fri, 6 May 2022 17:20:16 +0500 Subject: [PATCH 100/233] newsboat: allow imperative "urls" management This commit allows imperative management of "urls" file. It can be useful if "urls" file is treated as a secret. With this change, it's possible to provision "urls" via Syncthing, agenix, sops-nix or other means, while still managing Newsboat declaratively. --- modules/programs/newsboat.nix | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/programs/newsboat.nix b/modules/programs/newsboat.nix index ba074a42..d2782bf2 100644 --- a/modules/programs/newsboat.nix +++ b/modules/programs/newsboat.nix @@ -68,7 +68,10 @@ in { url = "http://example.com"; tags = [ "foo" "bar" ]; }]; - description = "List of news feeds."; + description = '' + List of news feeds. Leave it empty if you want to manage feeds + imperatively, for example, using Syncthing. + ''; }; maxItems = mkOption { @@ -121,16 +124,24 @@ in { }; config = mkIf cfg.enable { + assertions = [{ + assertion = cfg.queries != { } -> cfg.urls != [ ]; + message = '' + Cannot specify queries if urls is empty. Unset queries if you + want to manage urls imperatively. + ''; + }]; + home.packages = [ pkgs.newsboat ]; # Use ~/.newsboat on stateVersion < 21.05 and use ~/.config/newsboat for # stateVersion >= 21.05. home.file = mkIf (versionOlder config.home.stateVersion "21.05") { - ".newsboat/urls".text = urlsFileContents; + ".newsboat/urls" = mkIf (cfg.urls != [ ]) { text = urlsFileContents; }; ".newsboat/config".text = configFileContents; }; xdg.configFile = mkIf (versionAtLeast config.home.stateVersion "21.05") { - "newsboat/urls".text = urlsFileContents; + "newsboat/urls" = mkIf (cfg.urls != [ ]) { text = urlsFileContents; }; "newsboat/config".text = configFileContents; }; }; From 433e8de330fd9c157b636f9ccea45e3eeaf69ad2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Reynier?= <88983487+loicreynier@users.noreply.github.com> Date: Mon, 21 Nov 2022 16:35:18 +0100 Subject: [PATCH 101/233] fzf: add colors option (#3206) --- modules/programs/fzf.nix | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/programs/fzf.nix b/modules/programs/fzf.nix index d8eef49c..fe1e720d 100644 --- a/modules/programs/fzf.nix +++ b/modules/programs/fzf.nix @@ -6,6 +6,10 @@ let cfg = config.programs.fzf; + renderedColors = colors: + concatStringsSep "," + (mapAttrsToList (name: value: "${name}:${value}") colors); + in { imports = [ (mkRemovedOptionModule [ "programs" "fzf" "historyWidgetCommand" ] @@ -88,6 +92,24 @@ in { ''; }; + colors = mkOption { + type = types.attrsOf types.str; + default = { }; + example = literalExpression '' + { + bg = "#1e1e1e"; + "bg+" = "#1e1e1e"; + fg = "#d4d4d4"; + "fg+" = "#d4d4d4"; + } + ''; + description = '' + Color scheme options added to FZF_DEFAULT_OPTS. See + + for documentation. + ''; + }; + tmux = { enableShellIntegration = mkEnableOption '' setting FZF_TMUX=1 which causes shell integration to use fzf-tmux @@ -141,7 +163,9 @@ in { FZF_CTRL_T_COMMAND = cfg.fileWidgetCommand; FZF_CTRL_T_OPTS = cfg.fileWidgetOptions; FZF_DEFAULT_COMMAND = cfg.defaultCommand; - FZF_DEFAULT_OPTS = cfg.defaultOptions; + FZF_DEFAULT_OPTS = cfg.defaultOptions + ++ lib.optionals (cfg.colors != { }) + [ "--color ${renderedColors cfg.colors}" ]; FZF_TMUX = if cfg.tmux.enableShellIntegration then "1" else null; FZF_TMUX_OPTS = cfg.tmux.shellIntegrationOptions; }); From c3690701d1a9ecb01ac322954caec548f96355b1 Mon Sep 17 00:00:00 2001 From: Jakub Janczak Date: Wed, 16 Nov 2022 14:47:15 +0100 Subject: [PATCH 102/233] Translate using Weblate (Polish) Currently translated at 100.0% (14 of 14 strings) Co-authored-by: Jakub Janczak Translate-URL: https://hosted.weblate.org/projects/home-manager/modules/pl/ Translation: Home Manager/Home Manager Modules --- modules/po/pl.po | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/modules/po/pl.po b/modules/po/pl.po index e9262433..307ffc01 100644 --- a/modules/po/pl.po +++ b/modules/po/pl.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: 2022-03-26 15:08+0100\n" -"PO-Revision-Date: 2022-03-01 13:58+0000\n" -"Last-Translator: Anon Ymous \n" +"PO-Revision-Date: 2022-11-16 13:47+0000\n" +"Last-Translator: Jakub Janczak \n" "Language-Team: Polish \n" "Language: pl\n" @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2;\n" -"X-Generator: Weblate 4.11.1-dev\n" +"X-Generator: Weblate 4.15-dev\n" #: modules/files.nix:233 msgid "Creating home file links in %s" @@ -51,6 +51,18 @@ msgid "" "\n" "Then try activating your Home Manager configuration again." msgstr "" +"Oops, Nix nie zdołał zainstalować twojego profilu Home Manager'a!\n" +"\n" +"Być może zaistniał konflikt z pakietem zainstalowanym przez\n" +"\"%s\"? Spróbuj uruchomić\n" +"\n" +" %s\n" +"\n" +"i jeśli istnieje konflikt możesz spróbować go rozwiązać uruchamiając\n" +"\n" +" %s\n" +"\n" +"Następnie spróbuj aktywować konfigurację Home Manager'a ponownie." #: modules/home-environment.nix:639 msgid "Activating %s" @@ -75,6 +87,18 @@ msgid "" "\n" "and trying home-manager switch again. Good luck!" msgstr "" +"Istnieje konflikt pomiędzy poprzednią generacją i ścieżką! Powinny\n" +"być obie puste lub ustawione, a efektywnie są ustawione na:\n" +"\n" +" '%s' i '%s'\n" +"\n" +"Jeśli możesz sobie pozwolić na utratę poprzednich generacji,\n" +"możesz uruchomić\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"i spróbować uruchomić home-manager switch raz jeszcze. Powodzenia!" #: modules/lib-bash/activation-init.sh:51 msgid "Starting Home Manager activation" @@ -85,19 +109,17 @@ msgid "Sanity checking Nix" msgstr "Sprawdzanie poprawności Nix" #: modules/lib-bash/activation-init.sh:61 -#, fuzzy msgid "This is a dry run" -msgstr "To jest próbne wykonanie" +msgstr "To jest wykonanie testowe" #: modules/lib-bash/activation-init.sh:64 msgid "This is a live run" -msgstr "" +msgstr "To jest wykonanie właściwe" #: modules/lib-bash/activation-init.sh:69 msgid "Using Nix version: %s" msgstr "Używając wersji Nix: %s" #: modules/lib-bash/activation-init.sh:72 -#, fuzzy msgid "Activation variables:" msgstr "Zmienne aktywacyjne:" From 3ce1c4787a48f9882267e93f62af0c7f7711076d Mon Sep 17 00:00:00 2001 From: Pablo Bollansee Date: Wed, 16 Nov 2022 14:47:16 +0100 Subject: [PATCH 103/233] Translate using Weblate (Dutch) Currently translated at 100.0% (14 of 14 strings) Translate using Weblate (Dutch) Currently translated at 100.0% (32 of 32 strings) Co-authored-by: Pablo Bollansee Translate-URL: https://hosted.weblate.org/projects/home-manager/cli/nl/ Translate-URL: https://hosted.weblate.org/projects/home-manager/modules/nl/ Translation: Home Manager/Home Manager CLI Translation: Home Manager/Home Manager Modules --- home-manager/po/nl.po | 63 ++++++++++++++++++++++++------------------- modules/po/nl.po | 57 +++++++++++++++++++++++++++++---------- 2 files changed, 79 insertions(+), 41 deletions(-) diff --git a/home-manager/po/nl.po b/home-manager/po/nl.po index 4d9804ca..58c90c26 100644 --- a/home-manager/po/nl.po +++ b/home-manager/po/nl.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: 2022-03-26 15:08+0100\n" -"PO-Revision-Date: 2022-11-07 17:06+0000\n" -"Last-Translator: Eise Zimmerman \n" +"PO-Revision-Date: 2022-11-16 13:47+0000\n" +"Last-Translator: Pablo Bollansee \n" "Language-Team: Dutch \n" "Language: nl\n" @@ -17,20 +17,19 @@ 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 4.14.2\n" +"X-Generator: Weblate 4.15-dev\n" #: home-manager/home-manager:60 msgid "No configuration file found at %s" -msgstr "Geen configuratiebestand gevonden in %s" +msgstr "Geen configuratiebestand gevonden op %s" #: home-manager/home-manager:79 msgid "No configuration file found. Please create one at %s" -msgstr "Geen configuratiebestand gevonden. Gelieve een nieuwe te creëren op %s" +msgstr "Geen configuratiebestand gevonden, maak er alstublieft een aan op %s" #: home-manager/home-manager:122 msgid "Can't inspect options of a flake configuration" -msgstr "" -"Het is niet gelukt om de options van de vlok-configuratie te inspecteren" +msgstr "Kan de opties van een flake configuratie niet inspecteren" #: home-manager/home-manager:162 msgid "Can't instantiate a flake configuration" @@ -52,62 +51,60 @@ msgstr[1] "" #: home-manager/home-manager:251 msgid "Unknown \"news.display\" setting \"%s\"." -msgstr "" +msgstr "Onbekende \"new.display\" instelling \"%s\"." #: home-manager/home-manager:258 #, sh-format msgid "Please set the $EDITOR environment variable" -msgstr "" +msgstr "Gelieve de $EDITOR omgevingsvariabele in te stellen" #: home-manager/home-manager:273 msgid "Cannot run build in read-only directory" -msgstr "" +msgstr "Het is niet mogelijk om te bouwen in een read-only map" #: home-manager/home-manager:355 msgid "No generation with ID %s" -msgstr "" +msgstr "Geen generatie met de ID %s" #: home-manager/home-manager:357 msgid "Cannot remove the current generation %s" -msgstr "" +msgstr "Het is niet mogelijk om de huidige generatie %s te verwijderen" #: home-manager/home-manager:359 msgid "Removing generation %s" -msgstr "" +msgstr "Generatie %s aan het verwijderen" #: home-manager/home-manager:385 msgid "No generations to expire" -msgstr "" +msgstr "Geen generatie om te beëindigen" #: home-manager/home-manager:396 msgid "No home-manager packages seem to be installed." -msgstr "" +msgstr "Er lijkt geen home-manager pakket geïnstalleerd te zijn." #: home-manager/home-manager:453 msgid "Unknown argument %s" msgstr "Onbekend argument %s" #: home-manager/home-manager:469 -#, fuzzy msgid "This will remove Home Manager from your system." msgstr "Dit zal Home Manager van jouw systeem verwijderen." #: home-manager/home-manager:472 -#, fuzzy msgid "This is a dry run, nothing will actually be uninstalled." -msgstr "Dit is een oefening, niks word werkelijk geinstalleerd." +msgstr "Dit is een oefening, niets wordt werkelijk geïnstalleerd." #: home-manager/home-manager:476 msgid "Really uninstall Home Manager?" -msgstr "Werkelijk Home Manager verwijderen?" +msgstr "Wilt u zeker Home Manager verwijderen?" #: home-manager/home-manager:481 msgid "Switching to empty Home Manager configuration..." -msgstr "" +msgstr "Naar een lege Home Manager configuratie aan het veranderen..." #: home-manager/home-manager:493 msgid "Yay!" -msgstr "Jaaa!" +msgstr "Joepie!" #: home-manager/home-manager:500 msgid "Remove all Home Manager generations?" @@ -119,7 +116,7 @@ msgstr "Alle generaties zijn nu in aanmerking voor afvalinzameling." #: home-manager/home-manager:510 msgid "Leaving generations but they may still be garbage collected." -msgstr "" +msgstr "Generaties blijven momenteel bestaan maar worden later opgekuist." #: home-manager/home-manager:514 msgid "Home Manager is uninstalled but your home.nix is left untouched." @@ -131,11 +128,11 @@ msgstr "%s: onbekende keuze '%s'" #: home-manager/home-manager:674 msgid "Run '%s --help' for usage help" -msgstr "" +msgstr "Voer '%s --help' in om gebruiksinfo te zien" #: home-manager/home-manager:708 msgid "expire-generations expects one argument, got %d." -msgstr "" +msgstr "expire-generations verwacht één argument, maar kreeg er %d." #: home-manager/home-manager:730 msgid "Unknown command: %s" @@ -143,11 +140,11 @@ msgstr "Onbekende opdracht: %s" #: home-manager/install.nix:22 msgid "Creating initial Home Manager configuration..." -msgstr "" +msgstr "Initiële Home Manager configuratie aan het maken..." #: home-manager/install.nix:66 msgid "Creating initial Home Manager generation..." -msgstr "" +msgstr "Initiële Home Manager generatie aan het maken..." #. translators: The "%s" specifier will be replaced by a file path. #: home-manager/install.nix:71 @@ -159,6 +156,14 @@ msgid "" "to configure Home Manager. Run 'man home-configuration.nix' to\n" "see all available options." msgstr "" +"Helemaal klaar! De home-manager tool zou nu geïnstalleerd moeten zijn en je " +"kan\n" +"\n" +" %s\n" +"\n" +"aanpassen om Home Manager te configureren. Draai 'man home-" +"configuration.nix' om\n" +"alle opties te zien." #. translators: The "%s" specifier will be replaced by a URL. #: home-manager/install.nix:76 @@ -169,9 +174,13 @@ msgid "" "\n" "if the error seems to be the fault of Home Manager." msgstr "" +"Oh nee, de installatie is mislukt. Gelieve een ticket aan te maken in\n" +"\n" +" %s\n" +"\n" +"als de error de schuld van Home Manager lijkt te zijn." #: home-manager/install.nix:83 -#, fuzzy msgid "This derivation is not buildable, please run it using nix-shell." msgstr "" "Deze afleiding kan niet gebouwd worden, voer het alstublieft uit met nix-" diff --git a/modules/po/nl.po b/modules/po/nl.po index 7c239502..de46344b 100644 --- a/modules/po/nl.po +++ b/modules/po/nl.po @@ -8,29 +8,33 @@ msgstr "" "Project-Id-Version: Home Manager Modules\n" "Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" "POT-Creation-Date: 2022-03-26 15:08+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" +"PO-Revision-Date: 2022-11-16 13:47+0000\n" +"Last-Translator: Pablo Bollansee \n" +"Language-Team: Dutch \n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.15-dev\n" #: modules/files.nix:233 msgid "Creating home file links in %s" -msgstr "" +msgstr "Home-bestandskoppelingen aan het maken in %s" #: modules/files.nix:246 msgid "Cleaning up orphan links from %s" -msgstr "" +msgstr "Wees links van %s aan het opkuisen" #: modules/files.nix:262 msgid "Creating profile generation %s" -msgstr "" +msgstr "Profiel generatie %s aan het maken" #: modules/files.nix:276 msgid "No change so reusing latest profile generation %s" msgstr "" +"Geen veranderingen dus de laatste profiel generatie %s wordt hergebruikt" #: modules/home-environment.nix:607 msgid "" @@ -47,14 +51,27 @@ msgid "" "\n" "Then try activating your Home Manager configuration again." msgstr "" +"Oei, het is Nix niet gelukt om je nieuwe Home Manager profiel te installeren!" +"\n" +"\n" +"Misschien is er een conflict met het pakket dat geïnstalleerd was met\n" +"\"%s\"? Probeer het volgende te draaien\n" +"\n" +" %s\n" +"\n" +"en als er een pakket is dat een conflict geeft kan je dat verwijderen met\n" +"\n" +" %s\n" +"\n" +"Probeer daarna je Home Manager configuratie opnieuw te activeren." #: modules/home-environment.nix:639 msgid "Activating %s" -msgstr "" +msgstr "%s aan het activeren" #: modules/lib-bash/activation-init.sh:31 msgid "Sanity checking oldGenNum and oldGenPath" -msgstr "" +msgstr "oldGenNum en oldGenPath aan het sanity checken" #: modules/lib-bash/activation-init.sh:34 msgid "" @@ -71,27 +88,39 @@ msgid "" "\n" "and trying home-manager switch again. Good luck!" msgstr "" +"Er is een conflict met de generatie nummer en pad! Deze\n" +"moeten beide leeg of beide ingevuld zijn, maar zijn nu\n" +"\n" +" '%s' en '%s'\n" +"\n" +"Als je het niet erg vindt je vorige profiel generaties te verliezen dan\n" +"is waarschijnlijk de eenvoudigste oplossing om het volgende te draaien\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"en dan opnieuw 'home-manager switch' te proberen. Veel succes!" #: modules/lib-bash/activation-init.sh:51 msgid "Starting Home Manager activation" -msgstr "" +msgstr "Home manager activatie aan het starten" #: modules/lib-bash/activation-init.sh:55 msgid "Sanity checking Nix" -msgstr "" +msgstr "Nix aan het sanity checken" #: modules/lib-bash/activation-init.sh:61 msgid "This is a dry run" -msgstr "" +msgstr "Dit is een oefening" #: modules/lib-bash/activation-init.sh:64 msgid "This is a live run" -msgstr "" +msgstr "Dit is voor echt" #: modules/lib-bash/activation-init.sh:69 msgid "Using Nix version: %s" -msgstr "" +msgstr "Nix versie %s wordt gebruikt" #: modules/lib-bash/activation-init.sh:72 msgid "Activation variables:" -msgstr "" +msgstr "Activatie variabelen:" From f7641a3ff398ccce952e19a199d775934e518c1d Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Mon, 22 Aug 2022 05:38:58 -0400 Subject: [PATCH 104/233] scmpuff: add fish integration flag --- modules/programs/scmpuff.nix | 13 +++++++++++++ tests/modules/programs/scmpuff/default.nix | 2 ++ tests/modules/programs/scmpuff/fish.nix | 20 ++++++++++++++++++++ tests/modules/programs/scmpuff/no-fish.nix | 20 ++++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 tests/modules/programs/scmpuff/fish.nix create mode 100644 tests/modules/programs/scmpuff/no-fish.nix diff --git a/modules/programs/scmpuff.nix b/modules/programs/scmpuff.nix index 5f36ca02..0a573af0 100644 --- a/modules/programs/scmpuff.nix +++ b/modules/programs/scmpuff.nix @@ -31,6 +31,14 @@ in { Whether to enable Zsh integration. ''; }; + + enableFishIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable fish integration. + ''; + }; }; config = mkIf cfg.enable { @@ -43,5 +51,10 @@ in { programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' eval "$(${cfg.package}/bin/scmpuff init -s)" ''; + + programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration + (mkAfter '' + ${cfg.package}/bin/scmpuff init -s --shell=fish | source + ''); }; } diff --git a/tests/modules/programs/scmpuff/default.nix b/tests/modules/programs/scmpuff/default.nix index 5852c5b6..bf162a9b 100644 --- a/tests/modules/programs/scmpuff/default.nix +++ b/tests/modules/programs/scmpuff/default.nix @@ -4,4 +4,6 @@ scmpuff-no-shell = ./no-shell.nix; scmpuff-no-zsh = ./no-zsh.nix; scmpuff-zsh = ./zsh.nix; + scmpuff-fish = ./fish.nix; + scmpuff-no-fish = ./no-fish.nix; } diff --git a/tests/modules/programs/scmpuff/fish.nix b/tests/modules/programs/scmpuff/fish.nix new file mode 100644 index 00000000..f6abb1c7 --- /dev/null +++ b/tests/modules/programs/scmpuff/fish.nix @@ -0,0 +1,20 @@ +{ pkgs, lib, ... }: { + programs = { + scmpuff.enable = true; + fish.enable = true; + }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + test.stubs.fish = { }; + test.stubs.scmpuff = { }; + + nmt.script = '' + assertFileExists home-files/.config/fish/config.fish + assertFileContains \ + home-files/.config/fish/config.fish \ + '@scmpuff@/bin/scmpuff init -s --shell=fish | source' + ''; +} diff --git a/tests/modules/programs/scmpuff/no-fish.nix b/tests/modules/programs/scmpuff/no-fish.nix new file mode 100644 index 00000000..d9f7e36f --- /dev/null +++ b/tests/modules/programs/scmpuff/no-fish.nix @@ -0,0 +1,20 @@ +{ pkgs, lib, ... }: { + programs = { + scmpuff = { + enable = true; + enableFishIntegration = false; + }; + fish.enable = true; + }; + + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + test.stubs.fish = { }; + test.stubs.scmpuff = { }; + + nmt.script = '' + assertFileNotRegex home-files/.config/fish/config.fish '@scmpuff@' + ''; +} From 62cb5bcf93896e4dd6b4507dac7ba2e2e3abc9d7 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 24 Nov 2022 23:13:38 +0100 Subject: [PATCH 105/233] Switch master branch version to 23.05 --- .release | 2 +- docs/release-notes/release-notes.adoc | 2 ++ docs/release-notes/rl-2305.adoc | 19 +++++++++++++++++++ modules/misc/version.nix | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 docs/release-notes/rl-2305.adoc diff --git a/.release b/.release index 8b84b727..f8c86096 100644 --- a/.release +++ b/.release @@ -1 +1 @@ -22.11 +23.05 diff --git a/docs/release-notes/release-notes.adoc b/docs/release-notes/release-notes.adoc index b5f607ae..d7058ca0 100644 --- a/docs/release-notes/release-notes.adoc +++ b/docs/release-notes/release-notes.adoc @@ -6,6 +6,8 @@ This section lists the release notes for stable versions of Home Manager and the :leveloffset: 1 +include::rl-2305.adoc[] + include::rl-2211.adoc[] include::rl-2205.adoc[] diff --git a/docs/release-notes/rl-2305.adoc b/docs/release-notes/rl-2305.adoc new file mode 100644 index 00000000..8c737db1 --- /dev/null +++ b/docs/release-notes/rl-2305.adoc @@ -0,0 +1,19 @@ +[[sec-release-23.05]] +== Release 23.05 + +This is the current unstable branch and the information in this section is therefore not final. + +[[sec-release-23.05-highlights]] +=== Highlights + +This release has the following notable changes: + +* No highlights. + +[[sec-release-23.05-state-version-changes]] +=== State Version Changes + +The state version in this release includes the changes below. +These changes are only active if the `home.stateVersion` option is set to "23.05" or later. + +* No changes. diff --git a/modules/misc/version.nix b/modules/misc/version.nix index d5dcc304..b729fbb4 100644 --- a/modules/misc/version.nix +++ b/modules/misc/version.nix @@ -16,6 +16,7 @@ with lib; "21.11" "22.05" "22.11" + "23.05" ]; description = '' It is occasionally necessary for Home Manager to change From bf99255fc9a092ef0272df598ab70eeecc93ca78 Mon Sep 17 00:00:00 2001 From: Nicholas Sielicki Date: Sat, 26 Nov 2022 16:16:33 -0800 Subject: [PATCH 106/233] kitty: silently drop darwin-specific options (#3394) Rather than reject a configuration when this option is set, just silently ignore it when the platform isn't darwin. The name makes it obvious that it won't be applied outside of darwin, and this allows people to use the same configuration between hosts without any special concern. Co-authored-by: Nicholas Sielicki --- modules/programs/kitty.nix | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/modules/programs/kitty.nix b/modules/programs/kitty.nix index 196ecbdb..1a6258a3 100644 --- a/modules/programs/kitty.nix +++ b/modules/programs/kitty.nix @@ -119,14 +119,6 @@ in { }; config = mkIf cfg.enable { - assertions = [{ - assertion = (cfg.darwinLaunchOptions != null) - -> pkgs.stdenv.hostPlatform.isDarwin; - message = '' - The 'programs.kitty.darwinLaunchOptions' option is only available on darwin. - ''; - }]; - home.packages = [ cfg.package ] ++ optionalPackage cfg.font; xdg.configFile."kitty/kitty.conf" = { @@ -158,8 +150,8 @@ in { ''; }; - xdg.configFile."kitty/macos-launch-services-cmdline" = - mkIf (cfg.darwinLaunchOptions != null) { + xdg.configFile."kitty/macos-launch-services-cmdline" = mkIf + (cfg.darwinLaunchOptions != null && pkgs.stdenv.hostPlatform.isDarwin) { text = concatStringsSep " " cfg.darwinLaunchOptions; }; }; From 64f7a775175bff9f7d4ba31d7ef425fed494df71 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 27 Nov 2022 01:17:28 +0100 Subject: [PATCH 107/233] polybar: don't generate config if no options are set (#3383) * polybar: don't generate config if no options are set * polybar: add h7x4 as maintainer --- .github/CODEOWNERS | 3 +++ modules/services/polybar.nix | 13 ++++++++---- .../services/polybar/basic-configuration.nix | 2 +- tests/modules/services/polybar/default.nix | 5 ++++- .../services/polybar/empty-configuration.nix | 21 +++++++++++++++++++ 5 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 tests/modules/services/polybar/empty-configuration.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 68e0760d..8458e42b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -263,6 +263,9 @@ Makefile @thiagokokada /modules/programs/pls.nix @arjan-s /tests/modules/programs/pls @arjan-s +/modules/programs/polybar.nix @h7x4 +/tests/modules/programs/polybar @h7x4 + /modules/programs/powerline-go.nix @DamienCassou /modules/programs/pubs.nix @loicreynier diff --git a/modules/services/polybar.nix b/modules/services/polybar.nix index da0c617e..1ebc0463 100644 --- a/modules/services/polybar.nix +++ b/modules/services/polybar.nix @@ -1,10 +1,11 @@ -{ config, lib, pkgs, ... }: +{ config, options, lib, pkgs, ... }: with lib; let cfg = config.services.polybar; + opt = options.services.polybar; eitherStrBoolIntList = with types; either str (either bool (either int (listOf str))); @@ -198,15 +199,19 @@ in { lib.platforms.linux) ]; + meta.maintainers = with maintainers; [ h7x4 ]; + home.packages = [ cfg.package ]; - xdg.configFile."polybar/config.ini".source = configFile; + xdg.configFile."polybar/config.ini" = let + isDeclarativeConfig = cfg.settings != opt.settings.default || cfg.config + != opt.config.default || cfg.extraConfig != opt.extraConfig.default; + in mkIf isDeclarativeConfig { source = configFile; }; systemd.user.services.polybar = { Unit = { Description = "Polybar status bar"; PartOf = [ "tray.target" ]; - X-Restart-Triggers = - [ "${config.xdg.configFile."polybar/config.ini".source}" ]; + X-Restart-Triggers = [ "${config.xdg.configHome}/polybar/config.ini" ]; }; Service = { diff --git a/tests/modules/services/polybar/basic-configuration.nix b/tests/modules/services/polybar/basic-configuration.nix index e5bb3f38..43d62fe8 100644 --- a/tests/modules/services/polybar/basic-configuration.nix +++ b/tests/modules/services/polybar/basic-configuration.nix @@ -47,7 +47,7 @@ serviceFile=home-files/.config/systemd/user/polybar.service assertFileExists $serviceFile - assertFileRegex $serviceFile 'X-Restart-Triggers=.*polybar\.conf' + assertFileRegex $serviceFile 'X-Restart-Triggers=.*/.config/polybar/config.ini' assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' assertFileExists home-files/.config/polybar/config.ini diff --git a/tests/modules/services/polybar/default.nix b/tests/modules/services/polybar/default.nix index 94d5d3cd..b5594d24 100644 --- a/tests/modules/services/polybar/default.nix +++ b/tests/modules/services/polybar/default.nix @@ -1 +1,4 @@ -{ polybar-basic-configuration = ./basic-configuration.nix; } +{ + polybar-basic-configuration = ./basic-configuration.nix; + polybar-empty-configuration = ./empty-configuration.nix; +} diff --git a/tests/modules/services/polybar/empty-configuration.nix b/tests/modules/services/polybar/empty-configuration.nix new file mode 100644 index 00000000..e4f2fb4a --- /dev/null +++ b/tests/modules/services/polybar/empty-configuration.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: + +{ + config = { + services.polybar = { + enable = true; + package = config.lib.test.mkStubPackage { }; + script = "polybar bar &"; + }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/polybar.service + + assertFileExists $serviceFile + assertFileRegex $serviceFile 'X-Restart-Triggers=.*/.config/polybar/config.ini' + assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' + + assertPathNotExists home-files/.config/polybar/config.ini + ''; + }; +} From 5c98a8d8609c9a5b3d1df0a153e3d57ce32e2cef Mon Sep 17 00:00:00 2001 From: home-manager-bot <106474382+home-manager-bot@users.noreply.github.com> Date: Sun, 27 Nov 2022 01:24:34 +0100 Subject: [PATCH 108/233] flake.lock: Update (#3403) 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/3bacde6273b09a21a8ccfba15586fb165078fb62' (2022-11-05) → 'github:nixos/nixpkgs/20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8' (2022-11-21) 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 090f8fa7..3b66de67 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1667629849, - "narHash": "sha256-P+v+nDOFWicM4wziFK9S/ajF2lc0N2Rg9p6Y35uMoZI=", + "lastModified": 1669052418, + "narHash": "sha256-M1I4BKXBQm2gey1tScemEh5TpHHE3gKptL7BpWUvL8s=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3bacde6273b09a21a8ccfba15586fb165078fb62", + "rev": "20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8", "type": "github" }, "original": { From cc58d3195342fee3574b5544565696a210d5d5ea Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Sat, 26 Nov 2022 19:37:24 -0500 Subject: [PATCH 109/233] flake: Expose tests to allow running purely (#3412) * flake: Expose tests to allow running purely The existing way to run tests with `nix-shell` relies on impure usage of ``. This can lead to failures when the local nixpkgs is incompatible with the locked one. I.e., where CI is passing but a contributor may experience a failure. So, expose tests as `devShells.tests` to use the locked nixpkgs and allow easy invocation via `nix develop`. * tests: Remove impure path With Nix 2.10+ and pure evaluation mode e.g. ``` nix run nixpkgs/nixos-unstable#nixVersions.nix_2_10 -- develop -i .#tests.zplug-modules ``` this test would fail with: > error: the path '~/.customZplugHome' can not be resolved in pure mode Since the test only cares that it is a path, rather than anything about its contents, use a dummy empty directory. --- docs/contributing.adoc | 5 +++++ flake.nix | 2 ++ tests/modules/programs/zplug/modules.nix | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/contributing.adoc b/docs/contributing.adoc index 0b440993..82a07a9a 100644 --- a/docs/contributing.adoc +++ b/docs/contributing.adoc @@ -256,3 +256,8 @@ and run an individual test, for example `alacritty-empty-settings`, through [source,console] $ nix-shell --pure tests -A run.alacritty-empty-settings + +However, those invocations will impurely source the system’s nixpkgs, and may cause failures. To run against the nixpkgs from the flake.lock, use instead e.g. + +[source,console] +$ nix develop --ignore-environment .#tests.all diff --git a/flake.nix b/flake.nix index 2a1af863..51211170 100644 --- a/flake.nix +++ b/flake.nix @@ -88,7 +88,9 @@ let pkgs = nixpkgs.legacyPackages.${system}; docs = import ./docs { inherit pkgs; }; + tests = import ./tests { inherit pkgs; }; in { + devShells.tests = tests.run; packages = rec { home-manager = pkgs.callPackage ./home-manager { }; docs-html = docs.manual.html; diff --git a/tests/modules/programs/zplug/modules.nix b/tests/modules/programs/zplug/modules.nix index 7c4abbc4..9f4d4332 100644 --- a/tests/modules/programs/zplug/modules.nix +++ b/tests/modules/programs/zplug/modules.nix @@ -8,7 +8,7 @@ with lib; enable = true; zplug = { enable = true; - zplugHome = ~/.customZplugHome; + zplugHome = pkgs.emptyDirectory; plugins = [ { name = "plugins/git"; From e999dfe7cba2e1fd59ab135e7496545bd4f82b76 Mon Sep 17 00:00:00 2001 From: Loric Brevet Date: Sun, 27 Nov 2022 01:49:15 +0100 Subject: [PATCH 110/233] kakoune: allow custom package (#3434) --- modules/programs/kakoune.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/programs/kakoune.nix b/modules/programs/kakoune.nix index 495ef8e1..042b6ee3 100644 --- a/modules/programs/kakoune.nix +++ b/modules/programs/kakoune.nix @@ -489,9 +489,8 @@ let }; }; - kakouneWithPlugins = pkgs.wrapKakoune pkgs.kakoune-unwrapped { - configure = { plugins = cfg.plugins; }; - }; + kakouneWithPlugins = + pkgs.wrapKakoune cfg.package { configure = { plugins = cfg.plugins; }; }; configFile = let wrapOptions = with cfg.config.wrapLines; @@ -624,6 +623,8 @@ in { programs.kakoune = { enable = mkEnableOption "the kakoune text editor"; + package = mkPackageOption pkgs "kakoune-unwrapped" { }; + config = mkOption { type = types.nullOr configModule; default = { }; From 4a12f304e0abc3f24c3c7d36423d84d7d8021364 Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Sun, 23 Oct 2022 19:11:21 +0200 Subject: [PATCH 111/233] nushell: add options 'extraConfig' and 'extraEnv' --- modules/programs/nushell.nix | 47 ++++++++++++++----- .../programs/nushell/config-expected.nu | 1 + .../modules/programs/nushell/env-expected.nu | 1 + 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/modules/programs/nushell.nix b/modules/programs/nushell.nix index 58b47798..c31c6c65 100644 --- a/modules/programs/nushell.nix +++ b/modules/programs/nushell.nix @@ -6,14 +6,17 @@ let cfg = config.programs.nushell; - tomlFormat = pkgs.formats.toml { }; - linesOrSource = name: types.submodule ({ config, ... }: { options = { text = mkOption { type = types.lines; - default = ""; + default = if config.source != null then + builtins.readFile config.source + else + ""; + defaultText = literalExpression + "if source is defined, the content of source, otherwise empty"; description = '' Text of the nushell ${name} file. If unset then the source option will be preferred. @@ -22,18 +25,14 @@ let source = mkOption { type = types.nullOr types.path; - default = pkgs.writeTextFile { - inherit (config) text; - name = hm.strings.storeFileName name; - }; - defaultText = literalExpression "file containing text"; + default = null; description = '' Path of the nushell ${name} file to use. + If the text option is set, it will be preferred. ''; }; }; }); - in { meta.maintainers = [ maintainers.Philipp-M ]; @@ -91,14 +90,40 @@ in { See for more information. ''; }; + + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Additional configuration to add to the nushell configuration file. + ''; + }; + + extraEnv = mkOption { + type = types.lines; + default = ""; + description = '' + Additional configuration to add to the nushell environment variables file. + ''; + }; }; config = mkIf cfg.enable { home.packages = [ cfg.package ]; xdg.configFile = mkMerge [ - (mkIf (cfg.configFile != null) { "nushell/config.nu" = cfg.configFile; }) - (mkIf (cfg.envFile != null) { "nushell/env.nu" = cfg.envFile; }) + (mkIf (cfg.configFile != null || cfg.extraConfig != "") { + "nushell/config.nu".text = mkMerge [ + (mkIf (cfg.configFile != null) cfg.configFile.text) + cfg.extraConfig + ]; + }) + (mkIf (cfg.envFile != null || cfg.extraEnv != "") { + "nushell/env.nu".text = mkMerge [ + (mkIf (cfg.envFile != null) cfg.envFile.text) + cfg.extraEnv + ]; + }) ]; }; } diff --git a/tests/modules/programs/nushell/config-expected.nu b/tests/modules/programs/nushell/config-expected.nu index 7fa80723..c70286d7 100644 --- a/tests/modules/programs/nushell/config-expected.nu +++ b/tests/modules/programs/nushell/config-expected.nu @@ -3,3 +3,4 @@ let $config = { table_mode: rounded use_ls_colors: true } + diff --git a/tests/modules/programs/nushell/env-expected.nu b/tests/modules/programs/nushell/env-expected.nu index 5a820ca8..280b59bf 100644 --- a/tests/modules/programs/nushell/env-expected.nu +++ b/tests/modules/programs/nushell/env-expected.nu @@ -1 +1,2 @@ let-env FOO = 'BAR' + From 7ae7250df8f38c4efc8cd6669a36272ab7a575ed Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Sun, 23 Oct 2022 19:12:01 +0200 Subject: [PATCH 112/233] starship: add nushell integration support --- modules/programs/starship.nix | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 58ec518a..0a83a7b8 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -89,6 +89,14 @@ in { Whether to enable Ion integration. ''; }; + + enableNushellIntegration = mkOption { + default = true; + type = types.bool; + description = '' + Whether to enable Nushell integration. + ''; + }; }; config = mkIf cfg.enable { @@ -116,10 +124,21 @@ in { end ''; - programs.ion.initExtra = mkIf cfg.enableIonIntegration '' - if test $TERM != "dumb" && not exists -s INSIDE_EMACS || test $INSIDE_EMACS = "vterm" - eval $(${starshipCmd} init ion) - end - ''; + programs.nushell = mkIf cfg.enableNushellIntegration { + # Unfortunately nushell doesn't allow conditionally sourcing nor + # conditionally setting (global) environment variables, which is why the + # check for terminal compatibility (as seen above for the other shells) is + # not done here. + extraEnv = '' + let starship_cache = "${config.xdg.cacheHome}/starship" + if not ($starship_cache | path exists) { + mkdir $starship_cache + } + ${starshipCmd} init nu | save ${config.xdg.cacheHome}/starship/init.nu + ''; + extraConfig = '' + source ${config.xdg.cacheHome}/starship/init.nu + ''; + }; }; } From 1bdbebc3f83a7b6a69f84797d5cda9ece8ca3c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Fi=C5=A1er?= <10010448+jficz@users.noreply.github.com> Date: Sun, 27 Nov 2022 16:15:32 +0100 Subject: [PATCH 113/233] ssh: add generic Match support for matchBlocks (#2992) * ssh: add generic Match support for matchBlocks Introduce conservative support for actual `Match` blocks in ssh config. "Conservative" means this PR doesn'tt try to process the `match` expression and simply uses it as a string provided by the user. If set, `match` has precedence over `host` meaning if both are set, `match` is used and `host` is ignored. * Add news entry --- modules/misc/news.nix | 9 ++++ modules/programs/ssh.nix | 48 ++++++++++++++++--- tests/modules/programs/ssh/default.nix | 1 + ...match-blocks-match-and-hosts-expected.conf | 19 ++++++++ .../ssh/match-blocks-match-and-hosts.nix | 32 +++++++++++++ 5 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 tests/modules/programs/ssh/match-blocks-match-and-hosts-expected.conf create mode 100644 tests/modules/programs/ssh/match-blocks-match-and-hosts.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index a2f08db2..cc82598f 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -843,6 +843,15 @@ in export MOZ_ALLOW_DOWNGRADE=1 ''; } + + { + time = "2022-11-27T13:14:01+00:00"; + message = '' + 'programs.ssh.matchBlocks.*' now supports literal 'Match' blocks via + 'programs.ssh.matchBlocks.*.match' option as an alternative to plain + 'Host' blocks + ''; + } ]; }; } diff --git a/modules/programs/ssh.nix b/modules/programs/ssh.nix index 05d16a2c..f906d1bc 100644 --- a/modules/programs/ssh.nix +++ b/modules/programs/ssh.nix @@ -60,10 +60,37 @@ let matchBlockModule = types.submodule ({ dagName, ... }: { options = { host = mkOption { - type = types.str; + type = types.nullOr types.str; + default = null; example = "*.example.org"; description = '' - The host pattern used by this conditional block. + Host pattern used by this conditional block. + See + + ssh_config + 5 + + for Host block details. + This option is ignored if + + if defined. + ''; + }; + + match = mkOption { + type = types.nullOr types.str; + default = null; + example = "host canonical\nhost exec \"ping -c1 -q 192.168.17.1\""; + description = '' + Match block conditions used by this block. See + + ssh_config + 5 + + for Match block details. + This option takes precedence over + + if defined. ''; }; @@ -276,11 +303,16 @@ let }; }; - config.host = mkDefault dagName; +# config.host = mkDefault dagName; }); - matchBlockStr = cf: concatStringsSep "\n" ( - ["Host ${cf.host}"] + matchBlockStr = key: cf: concatStringsSep "\n" ( + let + hostOrDagName = if cf.host != null then cf.host else key; + matchHead = if cf.match != null + then "Match ${cf.match}" + else "Host ${hostOrDagName}"; + in [ "${matchHead}" ] ++ optional (cf.port != null) " Port ${toString cf.port}" ++ optional (cf.forwardAgent != null) " ForwardAgent ${lib.hm.booleans.yesNo cf.forwardAgent}" ++ optional cf.forwardX11 " ForwardX11 yes" @@ -492,7 +524,7 @@ in ++ (optional (cfg.includes != [ ]) '' Include ${concatStringsSep " " cfg.includes} '') - ++ (map (block: matchBlockStr block.data) matchBlocks) + ++ (map (block: matchBlockStr block.name block.data) matchBlocks) )} Host * @@ -508,5 +540,9 @@ in ${replaceStrings ["\n"] ["\n "] cfg.extraConfig} ''; + + warnings = mapAttrsToList + (n: v: "The SSH config match block `programs.ssh.matchBlocks.${n}` sets both of the host and match options.\nThe match option takes precedence.") + (filterAttrs (n: v: v.data.host != null && v.data.match != null) cfg.matchBlocks); }; } diff --git a/tests/modules/programs/ssh/default.nix b/tests/modules/programs/ssh/default.nix index b2f832c9..c5e17599 100644 --- a/tests/modules/programs/ssh/default.nix +++ b/tests/modules/programs/ssh/default.nix @@ -2,6 +2,7 @@ ssh-defaults = ./default-config.nix; ssh-includes = ./includes.nix; ssh-match-blocks = ./match-blocks-attrs.nix; + ssh-match-blocks-match-and-hosts = ./match-blocks-match-and-hosts.nix; ssh-forwards-dynamic-valid-bind-no-asserts = ./forwards-dynamic-valid-bind-no-asserts.nix; diff --git a/tests/modules/programs/ssh/match-blocks-match-and-hosts-expected.conf b/tests/modules/programs/ssh/match-blocks-match-and-hosts-expected.conf new file mode 100644 index 00000000..d50343b9 --- /dev/null +++ b/tests/modules/programs/ssh/match-blocks-match-and-hosts-expected.conf @@ -0,0 +1,19 @@ +Host * !github.com + Port 516 +Host abc + Port 2222 +Match host xyz canonical + Port 2223 + +Host * + ForwardAgent no + Compression no + ServerAliveInterval 0 + ServerAliveCountMax 3 + HashKnownHosts no + UserKnownHostsFile ~/.ssh/known_hosts + ControlMaster no + ControlPath ~/.ssh/master-%r@%n:%p + ControlPersist no + + diff --git a/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix b/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix new file mode 100644 index 00000000..aa1e40d0 --- /dev/null +++ b/tests/modules/programs/ssh/match-blocks-match-and-hosts.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.ssh = { + enable = true; + matchBlocks = { + abc = { port = 2222; }; + + xyz = { + match = "host xyz canonical"; + port = 2223; + }; + + "* !github.com" = { port = 516; }; + }; + }; + + home.file.assertions.text = builtins.toJSON + (map (a: a.message) (filter (a: !a.assertion) config.assertions)); + + nmt.script = '' + assertFileExists home-files/.ssh/config + assertFileContent \ + home-files/.ssh/config \ + ${./match-blocks-match-and-hosts-expected.conf} + assertFileContent home-files/assertions ${./no-assertions.json} + ''; + }; +} From f7fed4dd3d9086ff4b7813a8600a262423cb63c1 Mon Sep 17 00:00:00 2001 From: Leix b Date: Sun, 27 Nov 2022 18:48:48 +0100 Subject: [PATCH 114/233] picom: add `egl` backend to options (#3441) Mirrors: https://github.com/NixOS/nixpkgs/commit/2beff9375cda53f2ab42844eb85d9c60175f3434 --- modules/services/picom.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/services/picom.nix b/modules/services/picom.nix index f3c47a6c..f4f8edb4 100644 --- a/modules/services/picom.nix +++ b/modules/services/picom.nix @@ -198,10 +198,10 @@ in { }; backend = mkOption { - type = types.enum [ "glx" "xrender" "xr_glx_hybrid" ]; + type = types.enum [ "egl" "glx" "xrender" "xr_glx_hybrid" ]; default = "xrender"; description = '' - Backend to use: glx, xrender or xr_glx_hybrid. + Backend to use: egl, glx, xrender or xr_glx_hybrid. ''; }; From fa671f1795824ea2e92629555d63e2b8196f6f99 Mon Sep 17 00:00:00 2001 From: Peter Kling Date: Sun, 27 Nov 2022 18:50:46 +0100 Subject: [PATCH 115/233] programs.zsh: set ZPLUG_HOME before loading zplug (#2987) ZPLUG_HOME must be set before loading zplug, since otherwise it is ignored. --- modules/programs/zplug.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/zplug.nix b/modules/programs/zplug.nix index 5f2b4431..7c731444 100644 --- a/modules/programs/zplug.nix +++ b/modules/programs/zplug.nix @@ -45,10 +45,10 @@ in { home.packages = [ pkgs.zplug ]; programs.zsh.initExtraBeforeCompInit = '' - source ${pkgs.zplug}/init.zsh - export ZPLUG_HOME=${cfg.zplugHome} + source ${pkgs.zplug}/init.zsh + ${optionalString (cfg.plugins != [ ]) '' ${concatStrings (map (plugin: '' zplug "${plugin.name}"${ From 50c9bccb6abc52811a59db620606e016fcde32bd Mon Sep 17 00:00:00 2001 From: Nicholas Sielicki Date: Sat, 5 Nov 2022 18:57:15 -0500 Subject: [PATCH 116/233] bat: add extraPackages option The bat program has a few additional packages in Nixpkgs, allow for these to be specified via Home Manager. --- modules/programs/bat.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/programs/bat.nix b/modules/programs/bat.nix index 30b0bbb7..df2e4968 100644 --- a/modules/programs/bat.nix +++ b/modules/programs/bat.nix @@ -30,6 +30,16 @@ in { ''; }; + extraPackages = mkOption { + type = types.listOf types.package; + default = [ ]; + example = literalExpression + "with pkgs.bat-extras; [ batdiff batman batgrep batwatch ];"; + description = '' + Additional bat packages to install. + ''; + }; + themes = mkOption { type = types.attrsOf types.lines; default = { }; @@ -51,7 +61,7 @@ in { }; config = mkIf cfg.enable { - home.packages = [ pkgs.bat ]; + home.packages = [ pkgs.bat ] ++ cfg.extraPackages; xdg.configFile = mkMerge ([{ "bat/config" = From 02c05460339e5239ef6fc83eecea047e7e879704 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Thu, 10 Nov 2022 16:51:27 +0800 Subject: [PATCH 117/233] dbus: fix dbus-run-session command Specifically, inform the command about the absolute path of dbus-daemon. Otherwise it will try running dbus-daemon from PATH, which may not always work. PR #3405 --- modules/misc/dconf.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/misc/dconf.nix b/modules/misc/dconf.nix index ed502ea5..aaefdfa3 100644 --- a/modules/misc/dconf.nix +++ b/modules/misc/dconf.nix @@ -102,7 +102,7 @@ in { if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then export DCONF_DBUS_RUN_SESSION="" else - export DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session" + export DCONF_DBUS_RUN_SESSION="${pkgs.dbus}/bin/dbus-run-session --dbus-daemon=${pkgs.dbus}/bin/dbus-daemon" fi if [[ -v oldGenPath ]]; then From cd2a826f33ee96f705e8c07b01fd1346b2eccbc0 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 29 Nov 2022 13:25:48 +0100 Subject: [PATCH 118/233] ssh: make news item conditional --- modules/misc/news.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/misc/news.nix b/modules/misc/news.nix index cc82598f..f728be44 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -846,6 +846,7 @@ in { time = "2022-11-27T13:14:01+00:00"; + condition = config.programs.ssh.enable; message = '' 'programs.ssh.matchBlocks.*' now supports literal 'Match' blocks via 'programs.ssh.matchBlocks.*.match' option as an alternative to plain From 63cef13e495776a0e4d8da0cb69554ed4fe70c37 Mon Sep 17 00:00:00 2001 From: li <@li:maisiliym.niks> Date: Sat, 17 Sep 2022 04:48:51 +0000 Subject: [PATCH 119/233] pueue: fix for empty settings PR #3230 --- modules/services/pueue.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/services/pueue.nix b/modules/services/pueue.nix index b812e271..3375f49d 100644 --- a/modules/services/pueue.nix +++ b/modules/services/pueue.nix @@ -39,7 +39,8 @@ in { home.packages = [ cfg.package ]; - xdg.configFile."pueue/pueue.yml".source = configFile; + xdg.configFile = + mkIf (cfg.settings != { }) { "pueue/pueue.yml".source = configFile; }; systemd.user = { services.pueued = { From 3b0a446bbf29cfeb78e0d1a8210bdf6fae8efccd Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Mon, 28 Nov 2022 15:32:59 +0100 Subject: [PATCH 120/233] ci: autolabel more programs to 'mail' More specifically Thunderbird and Himalaya. --- .github/labeler.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index cbdd2c0b..ba7ecffe 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -9,8 +9,11 @@ - modules/programs/getmail* - modules/*/mbsync* - tests/modules/programs/mbsync/* + - modules/programs/himalaya.nix + - tests/modules/programs/himalaya/* + - modules/programs/thunderbird.nix + - tests/modules/programs/thunderbird/* "neovim": - modules/programs/neovim.nix - tests/modules/programs/neovim/**/* - From 724395e653ca6a917a58587f4587269d17386a44 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 30 Nov 2022 03:59:14 +0000 Subject: [PATCH 121/233] 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/20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8' (2022-11-21) → 'github:nixos/nixpkgs/a115bb9bd56831941be3776c8a94005867f316a7' (2022-11-27) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 3b66de67..c118f74a 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1669052418, - "narHash": "sha256-M1I4BKXBQm2gey1tScemEh5TpHHE3gKptL7BpWUvL8s=", + "lastModified": 1669542132, + "narHash": "sha256-DRlg++NJAwPh8io3ExBJdNW7Djs3plVI5jgYQ+iXAZQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "20fc948445a6c22d4e8d5178e9a6bc6e1f5417c8", + "rev": "a115bb9bd56831941be3776c8a94005867f316a7", "type": "github" }, "original": { From e38ce0ae16b68515c913ab50177bc7624f65f569 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sun, 27 Nov 2022 04:20:00 +0000 Subject: [PATCH 122/233] direnv: fix direnv configuration path Direnv >=2.21.0 uses [1] $XDG_CONFIG_HOME/direnv/config.toml as configuration path. [1] https://github.com/direnv/direnv/commit/54cb3c5a91edb377b4b7387e2cda43dc39064a4a --- modules/programs/direnv.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index 03210827..ad294b2e 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -29,7 +29,7 @@ in { default = { }; description = '' Configuration written to - $XDG_CONFIG_HOME/direnv/config.toml. + $XDG_CONFIG_HOME/direnv/direnv.toml. See @@ -92,7 +92,7 @@ in { config = mkIf cfg.enable { home.packages = [ pkgs.direnv ]; - xdg.configFile."direnv/config.toml" = mkIf (cfg.config != { }) { + xdg.configFile."direnv/direnv.toml" = mkIf (cfg.config != { }) { source = tomlFormat.generate "direnv-config" cfg.config; }; From 478610aa37c8339eacabfa03f07dacf5574edd47 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Wed, 30 Nov 2022 11:19:31 -0500 Subject: [PATCH 123/233] neovim: Source neovimRcContent directly from store (#3444) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous version linked the file into home, then sourced that. Since nothing else expects that file to be there, this is unnecessary. Additionally, doing so made it impossible to test a built config without switching, e.g. using `XDG_CONFIG_HOME=… nvim` or `nvim -u`. This remedies that, at least for this particular reference. To test this, change from asserting contents of the config file to actually starting nvim, outputting sentinel values, and then asserting their values are present. This way it’s tested that nvim loaded the config, rather than that some config is in a specific place. This is all in one commit as the test, as written now, would not have worked before since the previously hard-coded home path was not an actual file in the test environment. --- modules/programs/neovim.nix | 10 ++++------ tests/modules/programs/neovim/plugin-config.nix | 17 ++++++++--------- tests/modules/programs/neovim/plugin-config.vim | 5 ----- 3 files changed, 12 insertions(+), 20 deletions(-) delete mode 100644 tests/modules/programs/neovim/plugin-config.vim diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index 88683e40..4560c930 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -365,15 +365,13 @@ in { in mkMerge ( # writes runtime (map (x: x.runtime) pluginsNormalized) ++ [{ - "nvim/init-home-manager.vim" = - mkIf (neovimConfig.neovimRcContent != "") { - text = neovimConfig.neovimRcContent; - }; "nvim/init.lua" = let luaRcContent = lib.optionalString (neovimConfig.neovimRcContent != "") - "vim.cmd [[source ${config.xdg.configHome}/nvim/init-home-manager.vim]]" - + lib.optionalString hasLuaConfig + "vim.cmd [[source ${ + pkgs.writeText "nvim-init-home-manager.vim" + neovimConfig.neovimRcContent + }]]" + lib.optionalString hasLuaConfig config.programs.neovim.generatedConfigs.lua; in mkIf (luaRcContent != "") { text = luaRcContent; }; diff --git a/tests/modules/programs/neovim/plugin-config.nix b/tests/modules/programs/neovim/plugin-config.nix index 843330b9..e4921aae 100644 --- a/tests/modules/programs/neovim/plugin-config.nix +++ b/tests/modules/programs/neovim/plugin-config.nix @@ -7,16 +7,14 @@ with lib; programs.neovim = { enable = true; extraConfig = '' - " This 'extraConfig' should be present in vimrc + let g:hmExtraConfig='HM_EXTRA_CONFIG' ''; plugins = with pkgs.vimPlugins; [ vim-nix { plugin = vim-commentary; config = '' - " plugin-specific config - autocmd FileType c setlocal commentstring=//\ %s - autocmd FileType c setlocal comments=:// + let g:hmPlugins='HM_PLUGINS_CONFIG' ''; } ]; @@ -24,11 +22,12 @@ with lib; }; nmt.script = '' - vimrc="$TESTED/home-files/.config/nvim/init-home-manager.vim" - vimrcNormalized="$(normalizeStorePaths "$vimrc")" - - assertFileExists "$vimrc" - assertFileContent "$vimrcNormalized" "${./plugin-config.vim}" + vimout=$(mktemp) + echo "redir >> /dev/stdout | echo g:hmExtraConfig | echo g:hmPlugins | redir END" \ + | ${pkgs.neovim}/bin/nvim -es -u "$TESTED/home-files/.config/nvim/init.lua" \ + > "$vimout" + assertFileContains "$vimout" "HM_EXTRA_CONFIG" + assertFileContains "$vimout" "HM_PLUGINS_CONFIG" ''; }; } diff --git a/tests/modules/programs/neovim/plugin-config.vim b/tests/modules/programs/neovim/plugin-config.vim deleted file mode 100644 index 8f2e1062..00000000 --- a/tests/modules/programs/neovim/plugin-config.vim +++ /dev/null @@ -1,5 +0,0 @@ -" plugin-specific config -autocmd FileType c setlocal commentstring=//\ %s -autocmd FileType c setlocal comments=:// - -" This 'extraConfig' should be present in vimrc From 71fa4cdf9cd89a3e0d452439b6a2f7f01d6292e9 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 2 Dec 2022 11:49:58 +0100 Subject: [PATCH 124/233] home-manager: update stable version to 22.11 --- README.md | 4 ++-- docs/installation.adoc | 12 ++++++------ docs/nix-flakes.adoc | 6 +++--- docs/usage.adoc | 4 ++-- home-manager/home-manager | 2 +- home-manager/install.nix | 2 +- modules/misc/version.nix | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 25a2cfc4..f792af54 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ will write to your dconf store and cannot tell whether a configuration that it is about to be overwritten was from a previous Home Manager generation or from manual configuration. -Home Manager targets [NixOS][] unstable and NixOS version 22.05 (the +Home Manager targets [NixOS][] unstable and NixOS version 22.11 (the current stable version), it may or may not work on other Linux distributions and NixOS versions. @@ -107,7 +107,7 @@ Home Manager is developed against `nixpkgs-unstable` branch, which often causes it to contain tweaks for changes/packages not yet released in stable NixOS. To avoid breaking users' configurations, Home Manager is released in branches corresponding to NixOS releases -(e.g. `release-22.05`). These branches get fixes, but usually not new +(e.g. `release-22.11`). These branches get fixes, but usually not new modules. If you need a module to be backported, then feel free to open an issue. diff --git a/docs/installation.adoc b/docs/installation.adoc index 1862f616..657b11d4 100644 --- a/docs/installation.adoc +++ b/docs/installation.adoc @@ -51,11 +51,11 @@ $ nix-channel --add https://github.com/nix-community/home-manager/archive/master $ nix-channel --update ---- + -and if you follow a Nixpkgs version 22.05 channel you can run +and if you follow a Nixpkgs version 22.11 channel you can run + [source,console] ---- -$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz home-manager +$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager $ nix-channel --update ---- + @@ -133,11 +133,11 @@ $ sudo nix-channel --add https://github.com/nix-community/home-manager/archive/m $ sudo nix-channel --update ---- -and if you follow a Nixpkgs version 22.05 channel, you can run +and if you follow a Nixpkgs version 22.11 channel, you can run [source,console] ---- -$ sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz home-manager +$ sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager $ sudo nix-channel --update ---- @@ -244,11 +244,11 @@ $ nix-channel --add https://github.com/nix-community/home-manager/archive/master $ nix-channel --update ---- -and if you follow a Nixpkgs version 22.05 channel, you can run +and if you follow a Nixpkgs version 22.11 channel, you can run [source,console] ---- -$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.05.tar.gz home-manager +$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager $ nix-channel --update ---- diff --git a/docs/nix-flakes.adoc b/docs/nix-flakes.adoc index 2a0e1da3..412dafa6 100644 --- a/docs/nix-flakes.adoc +++ b/docs/nix-flakes.adoc @@ -90,9 +90,9 @@ writing a Home Manager configuration. ==== * The above example tracks the master branch of Home Manager and nixos-unstable branch of Nixpkgs. -If you would like to use the `release-22.05` branch, -change the `home-manager` input url to `github:nix-community/home-manager/release-22.05` -and `nixpkgs` url to `github:NixOS/nixpkgs/nixos-22.05`. +If you would like to use the `release-22.11` branch, +change the `home-manager` input url to `github:nix-community/home-manager/release-22.11` +and `nixpkgs` url to `github:NixOS/nixpkgs/nixos-22.11`. * The Home Manager library is exported by the flake under `lib.hm`. diff --git a/docs/usage.adoc b/docs/usage.adoc index 26b9eee7..adac7b72 100644 --- a/docs/usage.adoc +++ b/docs/usage.adoc @@ -52,7 +52,7 @@ A fresh install of Home Manager will generate a minimal `~/.config/nixpkgs/home. # You can update Home Manager without changing this value. See # the Home Manager release notes for a list of state version # changes in each release. - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; @@ -92,7 +92,7 @@ To satisfy the above setup we should elaborate the `home.nix` file as follows: # You can update Home Manager without changing this value. See # the Home Manager release notes for a list of state version # changes in each release. - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/home-manager/home-manager b/home-manager/home-manager index cbf3e883..9a5af6d9 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -664,7 +664,7 @@ while [[ $# -gt 0 ]]; do export VERBOSE=1 ;; --version) - echo 22.05 + echo 22.11 exit 0 ;; *) diff --git a/home-manager/install.nix b/home-manager/install.nix index f69508a8..f4bcbb3f 100644 --- a/home-manager/install.nix +++ b/home-manager/install.nix @@ -54,7 +54,7 @@ in runCommand "home-manager-install" { # You can update Home Manager without changing this value. See # the Home Manager release notes for a list of state version # changes in each release. - home.stateVersion = "22.05"; + home.stateVersion = "22.11"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/modules/misc/version.nix b/modules/misc/version.nix index b729fbb4..0c590372 100644 --- a/modules/misc/version.nix +++ b/modules/misc/version.nix @@ -42,7 +42,7 @@ with lib; suffix = optionalString (revision != null) "+${substring 0 8 revision}"; in "${release}${suffix}"; - example = "22.05+213a0629"; + example = "22.11+213a0629"; description = "The full Home Manager version."; }; @@ -51,7 +51,7 @@ with lib; readOnly = true; type = types.str; default = fileContents ../../.release; - example = "22.05"; + example = "22.11"; description = "The Home Manager release."; }; From eb3598cf44aa10f2a16fe38488a102c0f474d766 Mon Sep 17 00:00:00 2001 From: maximsmol Date: Fri, 2 Dec 2022 20:48:58 -0800 Subject: [PATCH 125/233] just: deprecate module The module is no longer necessary since completions work out of the box now. --- modules/programs/just.nix | 50 ++++++++------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/modules/programs/just.nix b/modules/programs/just.nix index 6d5447c3..79006a51 100644 --- a/modules/programs/just.nix +++ b/modules/programs/just.nix @@ -9,44 +9,14 @@ let in { meta.maintainers = [ hm.maintainers.maximsmol ]; - options.programs.just = { - enable = mkEnableOption - "just, a handy way to save and run project-specific commands"; - - package = mkOption { - type = types.package; - default = pkgs.just; - defaultText = literalExpression "pkgs.just"; - description = "Package providing the just tool."; - }; - - enableBashIntegration = mkEnableOption "Bash integration" // { - default = true; - }; - - enableZshIntegration = mkEnableOption "Zsh integration" // { - default = true; - }; - - enableFishIntegration = mkEnableOption "Fish integration" // { - default = true; - }; - }; - - config = mkIf cfg.enable { - home.packages = [ cfg.package ]; - - programs.bash.initExtra = mkIf cfg.enableBashIntegration '' - source ${cfg.package}/share/bash-completion/completions/just.bash - ''; - - programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' - source ${cfg.package}/share/zsh/site-functions/_just - ''; - - programs.fish.shellInit = mkIf cfg.enableFishIntegration '' - source ${cfg.package}/share/fish/vendor_completions.d/just.fish - ''; - - }; + imports = let + msg = '' + 'program.just' is deprecated, simply add 'pkgs.just' to 'home.packages' instead. + See https://github.com/nix-community/home-manager/issues/3449#issuecomment-1329823502''; + in [ + (mkRemovedOptionModule [ "programs" "just" "enable" ] msg) + (mkRemovedOptionModule [ "programs" "just" "enableBashIntegration" ] msg) + (mkRemovedOptionModule [ "programs" "just" "enableZshIntegration" ] msg) + (mkRemovedOptionModule [ "programs" "just" "enableFishIntegration" ] msg) + ]; } From 518dca61c062d66d933379c5d49908c9d3377c15 Mon Sep 17 00:00:00 2001 From: Kylie McClain Date: Thu, 1 Dec 2022 15:49:44 -0500 Subject: [PATCH 126/233] mpd-discord-rpc: fix typo --- modules/services/mpd-discord-rpc.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/mpd-discord-rpc.nix b/modules/services/mpd-discord-rpc.nix index a865d337..5e7a6664 100644 --- a/modules/services/mpd-discord-rpc.nix +++ b/modules/services/mpd-discord-rpc.nix @@ -46,7 +46,7 @@ in { Description = "Discord Rich Presence for MPD"; Documentation = "https://github.com/JakeStanger/mpd-discord-rpc"; After = [ "graphical-session-pre.target" ]; - PartOf = [ "graphical-session.desktop" ]; + PartOf = [ "graphical-session.target" ]; }; Service = { ExecStart = "${cfg.package}/bin/mpd-discord-rpc"; From ca48fced83b37b4927ee264e54b9fdd5706c4139 Mon Sep 17 00:00:00 2001 From: mat ess Date: Mon, 28 Nov 2022 23:29:34 -0500 Subject: [PATCH 127/233] fish: format user and generated .fish files Adds a `fishIndent` wrapper to pass fish scripts to the built in `fish_indent` function. --- modules/programs/fish.nix | 76 ++++++++++++------- tests/modules/programs/fish/default.nix | 1 + .../modules/programs/fish/format-scripts.nix | 50 ++++++++++++ 3 files changed, 99 insertions(+), 28 deletions(-) create mode 100644 tests/modules/programs/fish/format-scripts.nix diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 7eda6eb6..50c7c5bb 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -145,6 +145,16 @@ let aliasesStr = concatStringsSep "\n" (mapAttrsToList (k: v: "alias ${k} ${escapeShellArg v}") cfg.shellAliases); + fishIndent = name: text: + if cfg.formatFishScripts then + pkgs.runCommand name { + nativeBuildInputs = [ cfg.package ]; + inherit text; + passAsFile = [ "text" ]; + } "fish_indent < $textPath > $out" + else + pkgs.writeText name text; + in { imports = [ (mkRemovedOptionModule [ "programs" "fish" "promptInit" ] '' @@ -279,6 +289,15 @@ in { ''; }; + programs.fish.formatFishScripts = mkOption { + type = types.bool; + default = false; + description = '' + Whether to process fish configuration and scripts with + fish_indent. + ''; + }; + }; config = mkIf cfg.enable (mkMerge [ @@ -340,7 +359,7 @@ in { end ''; - xdg.configFile."fish/config.fish".text = '' + xdg.configFile."fish/config.fish".source = fishIndent "config.fish" '' # ~/.config/fish/config.fish: DO NOT EDIT -- this file has been generated # automatically by home-manager. @@ -379,7 +398,7 @@ in { xdg.configFile = mapAttrs' (name: def: { name = "fish/functions/${name}.fish"; value = { - text = let + source = let modifierStr = n: v: optional (v != null) ''--${n}="${toString v}"''; modifierStrs = n: v: optional (v != null) "--${n}=${toString v}"; modifierBool = n: v: optional (v != null && v) "--${n}"; @@ -397,9 +416,9 @@ in { modifiers = if isAttrs def then " ${toString mods}" else ""; body = if isAttrs def then def.body else def; - in '' + in fishIndent "${name}.fish" '' function ${name}${modifiers} - ${body} + ${lib.strings.removeSuffix "\n" body} end ''; }; @@ -410,34 +429,35 @@ in { # in the paths and any initialization scripts. (mkIf (length cfg.plugins > 0) { xdg.configFile = mkMerge ((map (plugin: { - "fish/conf.d/plugin-${plugin.name}.fish".text = '' - # Plugin ${plugin.name} - set -l plugin_dir ${plugin.src} + "fish/conf.d/plugin-${plugin.name}.fish".source = + fishIndent "${plugin.name}.fish" '' + # Plugin ${plugin.name} + set -l plugin_dir ${plugin.src} - # Set paths to import plugin components - if test -d $plugin_dir/functions - set fish_function_path $fish_function_path[1] $plugin_dir/functions $fish_function_path[2..-1] - end - - if test -d $plugin_dir/completions - set fish_complete_path $fish_complete_path[1] $plugin_dir/completions $fish_complete_path[2..-1] - end - - # Source initialization code if it exists. - if test -d $plugin_dir/conf.d - for f in $plugin_dir/conf.d/*.fish - source $f + # Set paths to import plugin components + if test -d $plugin_dir/functions + set fish_function_path $fish_function_path[1] $plugin_dir/functions $fish_function_path[2..-1] end - end - if test -f $plugin_dir/key_bindings.fish - source $plugin_dir/key_bindings.fish - end + if test -d $plugin_dir/completions + set fish_complete_path $fish_complete_path[1] $plugin_dir/completions $fish_complete_path[2..-1] + end - if test -f $plugin_dir/init.fish - source $plugin_dir/init.fish - end - ''; + # Source initialization code if it exists. + if test -d $plugin_dir/conf.d + for f in $plugin_dir/conf.d/*.fish + source $f + end + end + + if test -f $plugin_dir/key_bindings.fish + source $plugin_dir/key_bindings.fish + end + + if test -f $plugin_dir/init.fish + source $plugin_dir/init.fish + end + ''; }) cfg.plugins)); }) ]); diff --git a/tests/modules/programs/fish/default.nix b/tests/modules/programs/fish/default.nix index 99fe8136..3ed5b9cf 100644 --- a/tests/modules/programs/fish/default.nix +++ b/tests/modules/programs/fish/default.nix @@ -1,4 +1,5 @@ { + fish-format-scripts = ./format-scripts.nix; fish-functions = ./functions.nix; fish-no-functions = ./no-functions.nix; fish-plugins = ./plugins.nix; diff --git a/tests/modules/programs/fish/format-scripts.nix b/tests/modules/programs/fish/format-scripts.nix new file mode 100644 index 00000000..2ba58cae --- /dev/null +++ b/tests/modules/programs/fish/format-scripts.nix @@ -0,0 +1,50 @@ +{ config, pkgs, ... }: + +let + + expectedFunc = pkgs.writeText "func.fish" '' + function func + echo foo + end + ''; + + expectedFuncMulti = pkgs.writeText "func-multi.fish" '' + function func-multi + echo bar + if foo + bar + baz + end + end + ''; + +in { + config = { + programs.fish = { + enable = true; + + formatFishScripts = true; + + functions = { + func = ''echo "foo"''; + func-multi = '' + echo bar + if foo + bar + baz + end + ''; + }; + }; + + nmt.script = '' + assertFileExists home-files/.config/fish/functions/func.fish + echo ${expectedFunc} + assertFileContent home-files/.config/fish/functions/func.fish ${expectedFunc} + + assertFileExists home-files/.config/fish/functions/func-multi.fish + echo ${expectedFuncMulti} + assertFileContent home-files/.config/fish/functions/func-multi.fish ${expectedFuncMulti} + ''; + }; +} From 9e266ca2a766acb886e0a9da8f34dd3f74455d92 Mon Sep 17 00:00:00 2001 From: toastal Date: Sun, 16 Oct 2022 15:19:53 +0700 Subject: [PATCH 128/233] maintainers: add toastal I wish there there were a contribution option outside of the proprietary closed-source, Microsoft GitHub platform :( --- .github/CODEOWNERS | 4 ++-- modules/lib/maintainers.nix | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8458e42b..dbeca9f1 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -136,8 +136,8 @@ Makefile @thiagokokada /modules/programs/hexchat.nix @thiagokokada /tests/modules/programs/hexchat @thiagokokada -/modules/programs/himalaya.nix @ambroisie -/tests/modules/programs/himalaya @ambroisie +/modules/programs/himalaya.nix @toastal +/tests/modules/programs/himalaya @toastal /modules/programs/home-manager.nix @rycee diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 896e47f6..5b557644 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -345,4 +345,13 @@ github = "lukasngl"; githubId = 69244516; }; + toastal = { + email = "toastal+nix@posteo.net"; + matrix = "@toastal:matrix.org"; + github = "toastal"; + githubId = 561087; + name = "toastal"; + keys = + [{ fingerprint = "7944 74B7 D236 DAB9 C9EF E7F9 5CCE 6F14 66D4 7C9E"; }]; + }; } From 05d71f517b6406471e2ebca49980db83e5c7d565 Mon Sep 17 00:00:00 2001 From: toastal Date: Sun, 16 Oct 2022 15:21:24 +0700 Subject: [PATCH 129/233] email: add signature delimiter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While this is created to match `himalaya`’s configuration API, this could easly be reused for other programs that consume the email module by concatination the strings. --- modules/accounts/email.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/accounts/email.nix b/modules/accounts/email.nix index a5ded6a0..2d158a21 100644 --- a/modules/accounts/email.nix +++ b/modules/accounts/email.nix @@ -44,6 +44,19 @@ let ''; }; + delimiter = mkOption { + type = types.str; + default = '' + -- + ''; + example = literalExpression '' + ~*~*~*~*~*~*~*~*~*~*~*~ + ''; + description = '' + The delimiter used between the document and the signature. + ''; + }; + command = mkOption { type = with types; nullOr path; default = null; From 9fb1bb9794d85c80126e1840a836280f9c83ee71 Mon Sep 17 00:00:00 2001 From: toastal Date: Sun, 16 Oct 2022 15:25:31 +0700 Subject: [PATCH 130/233] himalaya: 0.6.x config updates Some properties were renamed. Big changes however include `backend` and `sender` enum options. --- modules/programs/himalaya.nix | 53 +++++++++++++++---- .../programs/himalaya/himalaya-expected.toml | 8 +-- tests/modules/programs/himalaya/himalaya.nix | 5 +- 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/modules/programs/himalaya.nix b/modules/programs/himalaya.nix index 1faee820..92328153 100644 --- a/modules/programs/himalaya.nix +++ b/modules/programs/himalaya.nix @@ -11,7 +11,7 @@ let toHimalayaConfig = account: { email = account.address; - name = account.realName; + display-name = account.realName; default = account.primary; mailboxes = { @@ -20,30 +20,46 @@ let draft = account.folders.drafts; # NOTE: himalaya does not support configuring the name of the trash folder }; - + } // (lib.optionalAttrs (account.signature.showSignature == "append") { + # FIXME: signature cannot be attached + signature = account.signature.text; + signature-delim = account.signature.delimiter; + }) // (if account.himalaya.backend == null then { + backend = "none"; + } else if account.himalaya.backend == "imap" then { # FIXME: does not support disabling TLS altogether # NOTE: does not accept sequence of strings for password commands + backend = account.himalaya.backend; imap-login = account.userName; imap-passwd-cmd = lib.escapeShellArgs account.passwordCommand; imap-host = account.imap.host; imap-port = account.imap.port; imap-starttls = account.imap.tls.useStartTls; - + } else if account.himalaya.backend == "maildir" then { + backend = account.himalaya.backend; + maildir-root-dir = account.maildirBasePath; + } else + throw "Unsupported backend: ${account.himalaya.backend}") + // (if account.himalaya.sender == null then { + sender = "none"; + } else if account.himalaya.sender == "smtp" then { + sender = account.himalaya.sender; smtp-login = account.userName; smtp-passwd-cmd = lib.escapeShellArgs account.passwordCommand; smtp-host = account.smtp.host; smtp-port = account.smtp.port; smtp-starttls = account.smtp.tls.useStartTls; - } // (lib.optionalAttrs (account.signature.showSignature == "append") { - # FIXME: signature cannot be attached - signature = account.signature.text; - }) // account.himalaya.settings; + } else if account.himalaya.sender == "sendmail" then { + sender = account.himalaya.sender; + } else + throw "Unsupported sender: ${account.himalaya.sender}") + // account.himalaya.settings; in { # NOTE: will not start without this configured, but each account overrides it - name = ""; + display-name = ""; } // cfg.settings // (lib.mapAttrs (_: toHimalayaConfig) enabledAccounts); in { - meta.maintainers = with lib.hm.maintainers; [ ambroisie ]; + meta.maintainers = with lib.hm.maintainers; [ toastal ]; options = with lib; { programs.himalaya = { @@ -63,7 +79,8 @@ in { default = { }; example = lib.literalExpression '' { - default-page-size = 50; + email-listing-page-size = 50; + watch-cmds = [ "mbsync -a" ] } ''; description = '' @@ -80,6 +97,22 @@ in { the himalaya mail client for this account ''; + backend = mkOption { + # TODO: “notmuch” (requires compile flag for himalaya, libnotmuch) + type = types.nullOr (types.enum [ "imap" "maildir" ]); + description = '' + The method for which himalaya will fetch, store, + etc. mail. + ''; + }; + + sender = mkOption { + type = types.nullOr (types.enum [ "smtp" "sendmail" ]); + description = '' + The method for which himalaya will send mail. + ''; + }; + settings = mkOption { type = tomlFormat.type; default = { }; diff --git a/tests/modules/programs/himalaya/himalaya-expected.toml b/tests/modules/programs/himalaya/himalaya-expected.toml index 6c2dfb84..ca7ada66 100644 --- a/tests/modules/programs/himalaya/himalaya-expected.toml +++ b/tests/modules/programs/himalaya/himalaya-expected.toml @@ -1,16 +1,18 @@ +display-name = "" downloads-dir = "/data/download" -name = "" ["hm@example.com"] +backend = "imap" default = true -default-page-size = 50 +display-name = "H. M. Test" email = "hm@example.com" +email-listing-page-size = 50 imap-host = "imap.example.com" imap-login = "home.manager" imap-passwd-cmd = "'password-command'" imap-port = 995 imap-starttls = false -name = "H. M. Test" +sender = "smtp" smtp-host = "smtp.example.com" smtp-login = "home.manager" smtp-passwd-cmd = "'password-command'" diff --git a/tests/modules/programs/himalaya/himalaya.nix b/tests/modules/programs/himalaya/himalaya.nix index 13872d15..4d556ff8 100644 --- a/tests/modules/programs/himalaya/himalaya.nix +++ b/tests/modules/programs/himalaya/himalaya.nix @@ -10,7 +10,9 @@ with lib; himalaya = { enable = true; - settings = { default-page-size = 50; }; + backend = "imap"; + sender = "smtp"; + settings = { email-listing-page-size = 50; }; }; folders = { @@ -38,4 +40,3 @@ with lib; } ''; } - From 65700a4fd10aa20ff4a65cbf0ab8b3dc0c438dcb Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sun, 4 Dec 2022 12:12:32 +0100 Subject: [PATCH 131/233] polybar: fix restart trigger The old trigger would actually never cause a restart since the path doesn't change. With this change the trigger is now using the actual configuration path in the Nix store, which depends on the content. --- modules/services/polybar.nix | 24 +++++++++++-------- .../services/polybar/basic-configuration.nix | 2 +- .../services/polybar/empty-configuration.nix | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/services/polybar.nix b/modules/services/polybar.nix index 1ebc0463..d3ac68de 100644 --- a/modules/services/polybar.nix +++ b/modules/services/polybar.nix @@ -55,11 +55,17 @@ let in "${key}=${value'}"; }; - configFile = pkgs.writeText "polybar.conf" '' - ${toPolybarIni cfg.config} - ${toPolybarIni (mapAttrs convertPolybarSection cfg.settings)} - ${cfg.extraConfig} - ''; + configFile = let + isDeclarativeConfig = cfg.settings != opt.settings.default || cfg.config + != opt.config.default || cfg.extraConfig != opt.extraConfig.default; + in if isDeclarativeConfig then + pkgs.writeText "polybar.conf" '' + ${toPolybarIni cfg.config} + ${toPolybarIni (mapAttrs convertPolybarSection cfg.settings)} + ${cfg.extraConfig} + '' + else + null; in { options = { @@ -202,16 +208,14 @@ in { meta.maintainers = with maintainers; [ h7x4 ]; home.packages = [ cfg.package ]; - xdg.configFile."polybar/config.ini" = let - isDeclarativeConfig = cfg.settings != opt.settings.default || cfg.config - != opt.config.default || cfg.extraConfig != opt.extraConfig.default; - in mkIf isDeclarativeConfig { source = configFile; }; + xdg.configFile."polybar/config.ini" = + mkIf (configFile != null) { source = configFile; }; systemd.user.services.polybar = { Unit = { Description = "Polybar status bar"; PartOf = [ "tray.target" ]; - X-Restart-Triggers = [ "${config.xdg.configHome}/polybar/config.ini" ]; + X-Restart-Triggers = mkIf (configFile != null) "${configFile}"; }; Service = { diff --git a/tests/modules/services/polybar/basic-configuration.nix b/tests/modules/services/polybar/basic-configuration.nix index 43d62fe8..5d9c8df5 100644 --- a/tests/modules/services/polybar/basic-configuration.nix +++ b/tests/modules/services/polybar/basic-configuration.nix @@ -47,7 +47,7 @@ serviceFile=home-files/.config/systemd/user/polybar.service assertFileExists $serviceFile - assertFileRegex $serviceFile 'X-Restart-Triggers=.*/.config/polybar/config.ini' + assertFileRegex $serviceFile 'X-Restart-Triggers=/nix/store/.*-polybar.conf$' assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' assertFileExists home-files/.config/polybar/config.ini diff --git a/tests/modules/services/polybar/empty-configuration.nix b/tests/modules/services/polybar/empty-configuration.nix index e4f2fb4a..26350967 100644 --- a/tests/modules/services/polybar/empty-configuration.nix +++ b/tests/modules/services/polybar/empty-configuration.nix @@ -12,7 +12,7 @@ serviceFile=home-files/.config/systemd/user/polybar.service assertFileExists $serviceFile - assertFileRegex $serviceFile 'X-Restart-Triggers=.*/.config/polybar/config.ini' + assertFileNotRegex $serviceFile 'X-Restart-Triggers=/nix/store/.*-polybar.conf$' assertFileRegex $serviceFile 'ExecStart=.*/bin/polybar-start' assertPathNotExists home-files/.config/polybar/config.ini From 15d94f3058961528bff708a3a5e5eb3ff468fe01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Reynier?= Date: Thu, 1 Dec 2022 17:11:46 +0100 Subject: [PATCH 132/233] pet: don't create file without snippets --- modules/programs/pet.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/programs/pet.nix b/modules/programs/pet.nix index e75b10df..48e972ae 100644 --- a/modules/programs/pet.nix +++ b/modules/programs/pet.nix @@ -99,8 +99,9 @@ in { else { General = cfg.settings; }); - "pet/snippet.toml".source = - format.generate "snippet.toml" { snippets = cfg.snippets; }; + "pet/snippet.toml" = mkIf (cfg.snippets != [ ]) { + source = format.generate "snippet.toml" { snippets = cfg.snippets; }; + }; }; }; } From 848ae0d6bbf3f0a33126887085274195c1565209 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sun, 4 Dec 2022 13:13:19 +0100 Subject: [PATCH 133/233] neovim: avoid aliased package --- tests/modules/programs/neovim/no-init.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/modules/programs/neovim/no-init.nix b/tests/modules/programs/neovim/no-init.nix index 02dd34a0..693bdede 100644 --- a/tests/modules/programs/neovim/no-init.nix +++ b/tests/modules/programs/neovim/no-init.nix @@ -14,7 +14,10 @@ with lib; extraPython3Packages = (ps: with ps; [ jedi pynvim ]); # plugins without associated config should not trigger the creation of init.vim - plugins = with pkgs.vimPlugins; [ fugitive ({ plugin = vim-sensible; }) ]; + plugins = with pkgs.vimPlugins; [ + vim-fugitive + ({ plugin = vim-sensible; }) + ]; }; nmt.script = '' nvimFolder="home-files/.config/nvim" From 7bfe3cd9b0c2feae04ceed52bbc0b64222ed4b7e Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sun, 4 Dec 2022 13:29:25 +0100 Subject: [PATCH 134/233] firefox: fix expected bookmarks in test --- .../firefox/profile-settings-expected-bookmarks.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html b/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html index 3bdcac0f..d60e88ff 100644 --- a/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html +++ b/tests/modules/programs/firefox/profile-settings-expected-bookmarks.html @@ -17,10 +17,9 @@
homepage
wiki

Nix sites

-

-

homepage -
wiki -

+

+

homepage +
wiki

From 17bbfcb82458ac2270dec71ce1f7044deb4f1ca3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 4 Dec 2022 03:59:19 +0000 Subject: [PATCH 135/233] 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/a115bb9bd56831941be3776c8a94005867f316a7' (2022-11-27) → 'github:nixos/nixpkgs/b72b8b94cf0c012b0252a9100a636cad69696666' (2022-12-02) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index c118f74a..b94fed5d 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1669542132, - "narHash": "sha256-DRlg++NJAwPh8io3ExBJdNW7Djs3plVI5jgYQ+iXAZQ=", + "lastModified": 1669969257, + "narHash": "sha256-mOS13sK3v+kfgP+1Mh56ohiG8uVhLHAo7m/q9kqAehc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "a115bb9bd56831941be3776c8a94005867f316a7", + "rev": "b72b8b94cf0c012b0252a9100a636cad69696666", "type": "github" }, "original": { From 2b02f8c7cb71098e21f8d67674562c9977caf007 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 30 Nov 2022 23:00:27 +0100 Subject: [PATCH 136/233] thunderbird: use account id for IMAP directory name This allows users to have multiple accounts on the same domain within the same profile. Fixes #3448. --- modules/programs/thunderbird.nix | 5 ++--- .../programs/thunderbird/thunderbird-expected-first.js | 8 ++++---- .../programs/thunderbird/thunderbird-expected-second.js | 4 ++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/programs/thunderbird.nix b/modules/programs/thunderbird.nix index 94ccea10..8c5a4b86 100644 --- a/modules/programs/thunderbird.nix +++ b/modules/programs/thunderbird.nix @@ -62,9 +62,8 @@ let "mail.identity.id_${id}.sign_mail" = account.gpg.signByDefault; } // optionalAttrs (account.imap != null) { "mail.server.server_${id}.directory" = - "${thunderbirdProfilesPath}/${profile.name}/ImapMail/${account.imap.host}"; - "mail.server.server_${id}.directory-rel" = - "[ProfD]ImapMail/${account.imap.host}"; + "${thunderbirdProfilesPath}/${profile.name}/ImapMail/${id}"; + "mail.server.server_${id}.directory-rel" = "[ProfD]ImapMail/${id}"; "mail.server.server_${id}.hostname" = account.imap.host; "mail.server.server_${id}.login_at_startup" = true; "mail.server.server_${id}.name" = account.name; diff --git a/tests/modules/programs/thunderbird/thunderbird-expected-first.js b/tests/modules/programs/thunderbird/thunderbird-expected-first.js index 6fc45b0e..de677575 100644 --- a/tests/modules/programs/thunderbird/thunderbird-expected-first.js +++ b/tests/modules/programs/thunderbird/thunderbird-expected-first.js @@ -27,8 +27,8 @@ user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.useremail", "hm@example.com"); user_pref("mail.identity.id_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.valid", true); user_pref("mail.openpgp.allow_external_gnupg", true); -user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory", ".thunderbird/first/ImapMail/imap.example.org"); -user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory-rel", "[ProfD]ImapMail/imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory", ".thunderbird/first/ImapMail/bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory-rel", "[ProfD]ImapMail/bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "imap.example.org"); user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.login_at_startup", true); user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.name", "hm-account"); @@ -36,8 +36,8 @@ user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da50 user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.socketType", 3); user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.type", "imap"); user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.userName", "home.manager.jr"); -user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory", ".thunderbird/first/ImapMail/imap.example.com"); -user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory-rel", "[ProfD]ImapMail/imap.example.com"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory", ".thunderbird/first/ImapMail/cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); +user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.directory-rel", "[ProfD]ImapMail/cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f"); user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.hostname", "imap.example.com"); user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.login_at_startup", true); user_pref("mail.server.server_cda3f13b64c1db7d4b58ce07a31304a362d7dcaf14476bfabcca913ae41ada9f.name", "hm@example.com"); diff --git a/tests/modules/programs/thunderbird/thunderbird-expected-second.js b/tests/modules/programs/thunderbird/thunderbird-expected-second.js index f18427a9..12d7991e 100644 --- a/tests/modules/programs/thunderbird/thunderbird-expected-second.js +++ b/tests/modules/programs/thunderbird/thunderbird-expected-second.js @@ -11,8 +11,8 @@ user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da5039 user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.useremail", "hm@example.org"); user_pref("mail.identity.id_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.valid", true); user_pref("mail.openpgp.allow_external_gnupg", false); -user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory", ".thunderbird/second/ImapMail/imap.example.org"); -user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory-rel", "[ProfD]ImapMail/imap.example.org"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory", ".thunderbird/second/ImapMail/bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); +user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.directory-rel", "[ProfD]ImapMail/bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc"); user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.hostname", "imap.example.org"); user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.login_at_startup", true); user_pref("mail.server.server_bcd3ace52bed41febb6cdc2fb1303aebaa573e0d993872da503950901bb6c6fc.name", "hm-account"); From e56714a057ecfa8b89caeccc23e32c628874ad4a Mon Sep 17 00:00:00 2001 From: anna Date: Wed, 30 Nov 2022 14:46:17 -0600 Subject: [PATCH 137/233] types: allow non-integer font sizes --- modules/lib/types.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lib/types.nix b/modules/lib/types.nix index de741b1e..0195bbfc 100644 --- a/modules/lib/types.nix +++ b/modules/lib/types.nix @@ -55,7 +55,7 @@ in rec { }; size = mkOption { - type = types.nullOr types.int; + type = types.nullOr types.number; default = null; example = "8"; description = '' From 90b0e5f440160f54cb4f1f08372e1be554e10873 Mon Sep 17 00:00:00 2001 From: James Chen-Smith Date: Fri, 2 Sep 2022 10:55:06 -0500 Subject: [PATCH 138/233] flake: correct nix-darwin flake description Corrects copy/paste mistake in the nix-darwin flake description. --- docs/nix-flakes.adoc | 2 +- templates/nix-darwin/flake.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/nix-flakes.adoc b/docs/nix-flakes.adoc index 412dafa6..e08bafa4 100644 --- a/docs/nix-flakes.adoc +++ b/docs/nix-flakes.adoc @@ -200,7 +200,7 @@ is similar to that of NixOS. The `flake.nix` would be: [source,nix] ---- { - description = "NixOS configuration"; + description = "Darwin configuration"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; diff --git a/templates/nix-darwin/flake.nix b/templates/nix-darwin/flake.nix index 85b1db41..ff73efd8 100644 --- a/templates/nix-darwin/flake.nix +++ b/templates/nix-darwin/flake.nix @@ -1,5 +1,5 @@ { - description = "NixOS configuration"; + description = "Darwin configuration"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; From e3e2abaef5c56620680201ebeb84d18fe43c813d Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sat, 3 Dec 2022 04:20:00 +0000 Subject: [PATCH 139/233] yt-dlp: fix settings example The yt-dlp settings should be an attribute set. --- modules/programs/yt-dlp.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/programs/yt-dlp.nix b/modules/programs/yt-dlp.nix index 0ee80ae8..af74db16 100644 --- a/modules/programs/yt-dlp.nix +++ b/modules/programs/yt-dlp.nix @@ -29,11 +29,13 @@ in { type = with types; attrsOf (oneOf [ bool int str ]); default = { }; example = literalExpression '' - embed-thumbnail = true; - embed-subs = true; - sub-langs = "all"; - downloader = "aria2c"; - downloader-args = "aria2c:'-c -x8 -s8 -k1M'"; + { + embed-thumbnail = true; + embed-subs = true; + sub-langs = "all"; + downloader = "aria2c"; + downloader-args = "aria2c:'-c -x8 -s8 -k1M'"; + } ''; description = '' Configuration written to From 6ce326cef9798c6275882954b11cd824b6e31df2 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sat, 3 Dec 2022 04:20:00 +0000 Subject: [PATCH 140/233] treewide: use liberachat and OFTC in examples Freenode was taken over by a wannabe bitcoin millionaire [1], which prompted the migration of communities to Libera Chat and OFTC [2]. [1] https://blog.bofh.it/debian/id_461 [2] https://hackaday.com/2021/05/20/freenode-debacle-prompts-staff-exodus-new-network/ --- modules/programs/hexchat.nix | 8 +++----- modules/programs/irssi.nix | 4 ++-- .../basic-configuration-expected-serverlist-config | 6 ++---- tests/modules/programs/hexchat/basic-configuration.nix | 6 +++--- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/modules/programs/hexchat.nix b/modules/programs/hexchat.nix index a23ea622..4eda0755 100644 --- a/modules/programs/hexchat.nix +++ b/modules/programs/hexchat.nix @@ -170,7 +170,7 @@ let servers = mkOption { type = listOf str; default = [ ]; - example = [ "chat.freenode.net" "irc.freenode.net" ]; + example = [ "irc.oftc.net" ]; description = "IRC Server Address List."; }; }; @@ -239,11 +239,10 @@ in { default = { }; example = literalExpression '' { - freenode = { + oftc = { autojoin = [ "#home-manager" "#linux" - "#nixos" ]; charset = "UTF-8 (Unicode)"; commands = [ @@ -263,8 +262,7 @@ in { password = "my_password"; realName = "my_realname"; servers = [ - "chat.freenode.net" - "irc.freenode.net" + "irc.oftc.net" ]; userName = "my_username"; }; diff --git a/modules/programs/irssi.nix b/modules/programs/irssi.nix index 355be085..d0953ed7 100644 --- a/modules/programs/irssi.nix +++ b/modules/programs/irssi.nix @@ -185,10 +185,10 @@ in { default = { }; example = literalExpression '' { - freenode = { + liberachat = { nick = "hmuser"; server = { - address = "chat.freenode.net"; + address = "irc.libera.chat"; port = 6697; autoConnect = true; }; diff --git a/tests/modules/programs/hexchat/basic-configuration-expected-serverlist-config b/tests/modules/programs/hexchat/basic-configuration-expected-serverlist-config index 29d23284..e550ca48 100644 --- a/tests/modules/programs/hexchat/basic-configuration-expected-serverlist-config +++ b/tests/modules/programs/hexchat/basic-configuration-expected-serverlist-config @@ -8,7 +8,7 @@ S=irc.mzima.net S=irc.prison.net J=#computers -N=freenode +N=oftc L=6 E=UTF-8 (Unicode) F=12 @@ -17,8 +17,6 @@ i=user_ R=real_user U=user P=password -S=chat.freenode.net -S=irc.freenode.net +S=irc.oftc.net J=#home-manager -J=#nixos diff --git a/tests/modules/programs/hexchat/basic-configuration.nix b/tests/modules/programs/hexchat/basic-configuration.nix index 1aa39bd4..6371a0e0 100644 --- a/tests/modules/programs/hexchat/basic-configuration.nix +++ b/tests/modules/programs/hexchat/basic-configuration.nix @@ -6,7 +6,7 @@ enable = true; overwriteConfigFiles = true; channels = { - freenode = { + oftc = { charset = "UTF-8 (Unicode)"; userName = "user"; password = "password"; @@ -18,8 +18,8 @@ autoconnect = true; forceSSL = true; }; - servers = [ "chat.freenode.net" "irc.freenode.net" ]; - autojoin = [ "#home-manager" "#nixos" ]; + servers = [ "irc.oftc.net" ]; + autojoin = [ "#home-manager" ]; }; efnet = { options = { forceSSL = true; }; From c3060ab93790012e3c6ba30e6e5585cd43c6c516 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 5 Dec 2022 11:16:34 +0100 Subject: [PATCH 141/233] emacs: add note about `inhibit-startup-message` --- modules/programs/emacs.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/programs/emacs.nix b/modules/programs/emacs.nix index 4253cb3b..a9a77949 100644 --- a/modules/programs/emacs.nix +++ b/modules/programs/emacs.nix @@ -52,6 +52,10 @@ in { Configuration to include in the Emacs default init file. See for more. + + Note, the inhibit-startup-message Emacs option + cannot be set here since Emacs disallows setting it from the default + initialization file. ''; }; From b5c083300bbc679f1dcd09d007e1c71b6f34d35d Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Sat, 3 Dec 2022 04:20:00 +0000 Subject: [PATCH 142/233] treewide: fix typos --- docs/installation.adoc | 2 +- docs/nix-flakes.adoc | 2 +- modules/launchd/launchd.nix | 41 +++++++++---------- modules/misc/nix.nix | 2 +- modules/programs/autorandr.nix | 2 +- modules/programs/chromium.nix | 2 +- modules/programs/git.nix | 4 +- modules/services/fnott.nix | 2 +- modules/services/kanshi.nix | 2 +- modules/services/mako.nix | 8 ++-- modules/services/poweralertd.nix | 2 +- modules/services/swayidle.nix | 2 +- .../services/window-managers/i3-sway/i3.nix | 2 +- .../window-managers/i3-sway/swaynag.nix | 2 +- .../darwin/user-defaults/opts-allhosts.nix | 2 +- 15 files changed, 38 insertions(+), 39 deletions(-) diff --git a/docs/installation.adoc b/docs/installation.adoc index 657b11d4..6291fba0 100644 --- a/docs/installation.adoc +++ b/docs/installation.adoc @@ -303,7 +303,7 @@ can be sourced directly by POSIX.2-like shells such as {bash}[Bash] or [NOTE] ==== By default user packages will not be ignored in favor of -`environment.systemPackages`, but they will be intalled to +`environment.systemPackages`, but they will be installed to `/etc/profiles/per-user/$USERNAME` if [source,nix] diff --git a/docs/nix-flakes.adoc b/docs/nix-flakes.adoc index e08bafa4..d426e337 100644 --- a/docs/nix-flakes.adoc +++ b/docs/nix-flakes.adoc @@ -7,7 +7,7 @@ Home Manager includes a `flake.nix` file for compatibility with {nixos-wiki-flak The support is still experimental and may change in backwards incompatible ways. [[sec-flakes-prerequisties]] -=== Prerequisties +=== Prerequisites * Install Nix 2.4 or later, or have it in `nix-shell`. diff --git a/modules/launchd/launchd.nix b/modules/launchd/launchd.nix index b54345b7..2e0e6585 100644 --- a/modules/launchd/launchd.nix +++ b/modules/launchd/launchd.nix @@ -39,19 +39,19 @@ with lib; default = null; description = '' This optional key is used as a hint to launchctl(1) that it should not submit this job to launchd when - loading a job or jobs. The value of this key does NOT reflect the current state of the job on the run-ning running - ning system. If you wish to know whether a job is loaded in launchd, reading this key from a configura-tion configuration - tion file yourself is not a sufficient test. You should query launchd for the presence of the job using + loading a job or jobs. The value of this key does NOT reflect the current state of the job on the running + system. If you wish to know whether a job is loaded in launchd, reading this key from a configuration + file yourself is not a sufficient test. You should query launchd for the presence of the job using the launchctl(1) list subcommand or use the ServiceManagement framework's SMJobCopyDictionary() method. Note that as of Mac OS X v10.6, this key's value in a configuration file conveys a default value, which is changed with the [-w] option of the launchctl(1) load and unload subcommands. These subcommands no - longer modify the configuration file, so the value displayed in the configuration file is not necessar-ily necessarily - ily the value that launchctl(1) will apply. See launchctl(1) for more information. + longer modify the configuration file, so the value displayed in the configuration file is not necessarily + the value that launchctl(1) will apply. See launchctl(1) for more information. - Please also be mindful that you should only use this key if the provided on-demand and KeepAlive crite-ria criteria - ria are insufficient to describe the conditions under which your job needs to run. The cost to have a + Please also be mindful that you should only use this key if the provided on-demand and KeepAlive criteria + are insufficient to describe the conditions under which your job needs to run. The cost to have a job loaded in launchd is negligible, so there is no harm in loading a job which only runs once or very rarely. ''; @@ -147,8 +147,7 @@ with lib; type = types.nullOr types.bool; default = null; description = '' - This flag causes launchd to use the glob(3) mechanism to update the program arguments before invoca-tion. invocation. - tion. + This flag causes launchd to use the glob(3) mechanism to update the program arguments before invocation. ''; }; @@ -236,12 +235,12 @@ with lib; description = '' This optional key is used to control whether your job is to be kept continuously running or to let demand and conditions control the invocation. The default is false and therefore only demand will start - the job. The value may be set to true to unconditionally keep the job alive. Alternatively, a dictio-nary dictionary - nary of conditions may be specified to selectively control whether launchd keeps a job alive or not. If + the job. The value may be set to true to unconditionally keep the job alive. Alternatively, a dictionary + of conditions may be specified to selectively control whether launchd keeps a job alive or not. If multiple keys are provided, launchd ORs them, thus providing maximum flexibility to the job to refine the logic and stall if necessary. If launchd finds no reason to restart the job, it falls back on demand based invocation. Jobs that exit quickly and frequently when configured to be kept alive will - be throttled to converve system resources. + be throttled to conserve system resources. ''; }; @@ -677,8 +676,8 @@ with lib; XPC connections. See xpc_transaction_begin(3) for details. Interactive - Interactive jobs run with the same resource limitations as apps, that is to say, none. Interac-tive Interactive - tive jobs are critical to maintaining a responsive user experience, and this key should only be + Interactive jobs run with the same resource limitations as apps, that is to say, none. Interactive + jobs are critical to maintaining a responsive user experience, and this key should only be used if an app's ability to be responsive depends on it, and cannot be made Adaptive. ''; }; @@ -687,8 +686,8 @@ with lib; type = types.nullOr types.bool; default = null; description = '' - When a job dies, launchd kills any remaining processes with the same process group ID as the job. Set-ting Setting - ting this key to true disables that behavior. + When a job dies, launchd kills any remaining processes with the same process group ID as the job. Setting + this key to true disables that behavior. ''; }; @@ -753,9 +752,9 @@ with lib; description = '' This optional key is used to specify launch on demand sockets that can be used to let launchd know when to run the job. The job must check-in to get a copy of the file descriptors using APIs outlined in - launch(3). The keys of the top level Sockets dictionary can be anything. They are meant for the appli-cation application - cation developer to use to differentiate which descriptors correspond to which application level proto-cols protocols - cols (e.g. http vs. ftp vs. DNS...). At check-in time, the value of each Sockets dictionary key will + launch(3). The keys of the top level Sockets dictionary can be anything. They are meant for the application + developer to use to differentiate which descriptors correspond to which application level protocols + (e.g. http vs. ftp vs. DNS...). At check-in time, the value of each Sockets dictionary key will be an array of descriptors. Daemon/Agent writers should consider all descriptors of a given key to be to be effectively equivalent, even though each file descriptor likely represents a different networking protocol which conforms to the criteria specified in the job configuration file. @@ -829,8 +828,8 @@ with lib; default = null; description = '' This optional key is a variant of SockPathName. Instead of binding to a known path, a securely - generated socket is created and the path is assigned to the environment variable that is inher-ited inherited - ited by all jobs spawned by launchd. + generated socket is created and the path is assigned to the environment variable that is inherited + by all jobs spawned by launchd. ''; }; diff --git a/modules/misc/nix.nix b/modules/misc/nix.nix index 7214ac4b..6ae28157 100644 --- a/modules/misc/nix.nix +++ b/modules/misc/nix.nix @@ -202,7 +202,7 @@ in { nix.conf 5 - for avalaible options. + for available options. The value declared here will be translated directly to the key-value pairs Nix expects. diff --git a/modules/programs/autorandr.nix b/modules/programs/autorandr.nix index 3eeedfc2..9e7c6fcc 100644 --- a/modules/programs/autorandr.nix +++ b/modules/programs/autorandr.nix @@ -305,7 +305,7 @@ in { DPI=144 ;; *) - echo "Unknown profle: $AUTORANDR_CURRENT_PROFILE" + echo "Unknown profile: $AUTORANDR_CURRENT_PROFILE" exit 1 esac diff --git a/modules/programs/chromium.nix b/modules/programs/chromium.nix index 429543c5..646d8473 100644 --- a/modules/programs/chromium.nix +++ b/modules/programs/chromium.nix @@ -64,7 +64,7 @@ let id = mkOption { type = strMatching "[a-zA-Z]{32}"; description = '' - The extension's ID from the Chome Web Store url or the unpacked crx. + The extension's ID from the Chrome Web Store url or the unpacked crx. ''; default = ""; }; diff --git a/modules/programs/git.nix b/modules/programs/git.nix index 363ed333..2b0d8a2f 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -267,7 +267,7 @@ in { difftastic = { enable = mkEnableOption "" // { description = '' - Enable the difft syntax highlighter. + Enable the difftastic syntax highlighter. See . ''; }; @@ -278,7 +278,7 @@ in { example = "dark"; description = '' Determines whether difftastic should use the lighter or darker colors - for syntax highlithing. + for syntax highlighting. ''; }; diff --git a/modules/services/fnott.nix b/modules/services/fnott.nix index 762f5303..aa9e9181 100644 --- a/modules/services/fnott.nix +++ b/modules/services/fnott.nix @@ -61,7 +61,7 @@ in { fnott.ini 5 - for a list of avaliable options and for a list of available options and for an example configuration. ''; diff --git a/modules/services/kanshi.nix b/modules/services/kanshi.nix index 3d4451e9..cdef4c72 100644 --- a/modules/services/kanshi.nix +++ b/modules/services/kanshi.nix @@ -109,7 +109,7 @@ let example = "[ \${pkg.sway}/bin/swaymsg workspace 1, move workspace to eDP-1 ]"; description = '' - Commands executed after the profile is succesfully applied. + Commands executed after the profile is successfully applied. Note that if you provide multiple commands, they will be executed asynchronously with no guaranteed ordering. ''; diff --git a/modules/services/mako.nix b/modules/services/mako.nix index 88068e0b..fc9e2161 100644 --- a/modules/services/mako.nix +++ b/modules/services/mako.nix @@ -129,8 +129,8 @@ in { type = types.nullOr types.str; description = '' Set margin of each edge specified in pixels. Specify single value to - apply margin on all sides. Two comma-seperated values will set - vertical and horizontal edges seperately. Four comma-seperated will + apply margin on all sides. Two comma-separated values will set + vertical and horizontal edges separately. Four comma-seperated will give each edge a seperate value. For example: 10,20,5 will set top margin to 10, left and right to 20 and bottom to five. @@ -142,8 +142,8 @@ in { type = types.nullOr types.str; description = '' Set padding of each edge specified in pixels. Specify single value to - apply margin on all sides. Two comma-seperated values will set - vertical and horizontal edges seperately. Four comma-seperated will + apply margin on all sides. Two comma-separated values will set + vertical and horizontal edges separately. Four comma-seperated will give each edge a seperate value. For example: 10,20,5 will set top margin to 10, left and right to 20 and bottom to five. diff --git a/modules/services/poweralertd.nix b/modules/services/poweralertd.nix index cae44c75..bc02dead 100644 --- a/modules/services/poweralertd.nix +++ b/modules/services/poweralertd.nix @@ -8,7 +8,7 @@ in { meta.maintainers = [ maintainers.thibautmarty ]; options.services.poweralertd.enable = - mkEnableOption "the Upower-powered power alerterd"; + mkEnableOption "the Upower-powered power alertd"; config = mkIf cfg.enable { assertions = [ diff --git a/modules/services/swayidle.nix b/modules/services/swayidle.nix index c99296b5..db54f9e2 100644 --- a/modules/services/swayidle.nix +++ b/modules/services/swayidle.nix @@ -88,7 +88,7 @@ in { { event = "lock"; command = "lock"; } ] ''; - description = "Run command on occurence of a event."; + description = "Run command on occurrence of a event."; }; extraArgs = mkOption { diff --git a/modules/services/window-managers/i3-sway/i3.nix b/modules/services/window-managers/i3-sway/i3.nix index 21044a54..277cbe39 100644 --- a/modules/services/window-managers/i3-sway/i3.nix +++ b/modules/services/window-managers/i3-sway/i3.nix @@ -193,7 +193,7 @@ let # We have to make sure the wrapper does not start a dbus session export DBUS_SESSION_BUS_ADDRESS=1 - # A zero exit code means i3 succesfully validated the configuration + # A zero exit code means i3 successfully validated the configuration i3 -c ${configFile} -C -d all || { echo "i3 configuration validation failed" echo "For a verbose log of the failure, run 'i3 -c ${configFile} -C -d all'" diff --git a/modules/services/window-managers/i3-sway/swaynag.nix b/modules/services/window-managers/i3-sway/swaynag.nix index 97d6f473..8b77b55f 100644 --- a/modules/services/window-managers/i3-sway/swaynag.nix +++ b/modules/services/window-managers/i3-sway/swaynag.nix @@ -33,7 +33,7 @@ in { swaynag 5 - for a list of avaliable options and an example configuration. + for a list of available options and an example configuration. Note, configurations declared under <config> will override the default type values of swaynag. ''; diff --git a/modules/targets/darwin/user-defaults/opts-allhosts.nix b/modules/targets/darwin/user-defaults/opts-allhosts.nix index 67399775..832318a9 100644 --- a/modules/targets/darwin/user-defaults/opts-allhosts.nix +++ b/modules/targets/darwin/user-defaults/opts-allhosts.nix @@ -50,7 +50,7 @@ in { AppleMetricUnits = mkNullableEnableOption "the metric system"; NSAutomaticCapitalizationEnabled = - mkNullableEnableOption "automatic captilization"; + mkNullableEnableOption "automatic capitalization"; NSAutomaticDashSubstitutionEnabled = mkNullableEnableOption "smart dashes"; From 8faa86f134e8fda97a75c9d810945e4ae0c1a896 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 5 Dec 2022 13:42:53 +0100 Subject: [PATCH 143/233] ci: bump 22.05 to 22.11 in dependabot setup --- .github/dependabot.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7a1b642d..b65c1278 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -10,7 +10,7 @@ updates: - package-ecosystem: "github-actions" directory: "/" - target-branch: "release-22.05" + target-branch: "release-22.11" schedule: interval: "weekly" commit-message: From 747e36476f341720404bd0d14d687a135a4ce5bf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 13:04:10 +0000 Subject: [PATCH 144/233] ci: bump DeterminateSystems/update-flake-lock from 14 to 15 Bumps [DeterminateSystems/update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) from 14 to 15. - [Release notes](https://github.com/DeterminateSystems/update-flake-lock/releases) - [Commits](https://github.com/DeterminateSystems/update-flake-lock/compare/v14...v15) --- updated-dependencies: - dependency-name: DeterminateSystems/update-flake-lock dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/update-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml index 5c3dda66..b06db161 100644 --- a/.github/workflows/update-flake.yml +++ b/.github/workflows/update-flake.yml @@ -14,7 +14,7 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v18 - name: Update flake.lock - uses: DeterminateSystems/update-flake-lock@v14 + uses: DeterminateSystems/update-flake-lock@v15 with: token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} pr-labels: dependencies From 7e81e7ae2b66d3d059c75914b867575921a0b05a Mon Sep 17 00:00:00 2001 From: mat ess Date: Sun, 4 Dec 2022 20:51:03 -0500 Subject: [PATCH 145/233] fish: always run fish_indent --- modules/programs/fish.nix | 23 ++++--------------- tests/modules/programs/atuin/fish.nix | 1 - tests/modules/programs/atuin/no-shell.nix | 1 - tests/modules/programs/fish/functions.nix | 6 ++--- tests/modules/programs/fish/no-functions.nix | 2 -- tests/modules/programs/fish/plugins.nix | 16 ++++++------- .../nix-index/assert-on-command-not-found.nix | 5 +--- .../programs/nix-index/integrations.nix | 5 +--- tests/modules/programs/oh-my-posh/fish.nix | 5 +--- tests/modules/programs/pls/fish.nix | 5 +--- tests/modules/programs/powerline-go/fish.nix | 5 +--- tests/modules/programs/scmpuff/fish.nix | 1 - tests/modules/programs/scmpuff/no-fish.nix | 1 - 13 files changed, 19 insertions(+), 57 deletions(-) diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 50c7c5bb..55a7c1cc 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -146,14 +146,11 @@ let (mapAttrsToList (k: v: "alias ${k} ${escapeShellArg v}") cfg.shellAliases); fishIndent = name: text: - if cfg.formatFishScripts then - pkgs.runCommand name { - nativeBuildInputs = [ cfg.package ]; - inherit text; - passAsFile = [ "text" ]; - } "fish_indent < $textPath > $out" - else - pkgs.writeText name text; + pkgs.runCommand name { + nativeBuildInputs = [ cfg.package ]; + inherit text; + passAsFile = [ "text" ]; + } "fish_indent < $textPath > $out"; in { imports = [ @@ -288,16 +285,6 @@ in { . ''; }; - - programs.fish.formatFishScripts = mkOption { - type = types.bool; - default = false; - description = '' - Whether to process fish configuration and scripts with - fish_indent. - ''; - }; - }; config = mkIf cfg.enable (mkMerge [ diff --git a/tests/modules/programs/atuin/fish.nix b/tests/modules/programs/atuin/fish.nix index 77232dba..527943d6 100644 --- a/tests/modules/programs/atuin/fish.nix +++ b/tests/modules/programs/atuin/fish.nix @@ -13,7 +13,6 @@ test.stubs = { atuin = { }; bash-preexec = { }; - fish = { }; }; nmt.script = '' diff --git a/tests/modules/programs/atuin/no-shell.nix b/tests/modules/programs/atuin/no-shell.nix index b636f7c0..381bcc0c 100644 --- a/tests/modules/programs/atuin/no-shell.nix +++ b/tests/modules/programs/atuin/no-shell.nix @@ -20,7 +20,6 @@ test.stubs = { atuin = { }; bash-preexec = { }; - fish = { }; }; nmt.script = '' diff --git a/tests/modules/programs/fish/functions.nix b/tests/modules/programs/fish/functions.nix index 67f8ba0d..b8b5793a 100644 --- a/tests/modules/programs/fish/functions.nix +++ b/tests/modules/programs/fish/functions.nix @@ -6,13 +6,13 @@ let func = pkgs.writeText "func.fish" '' function func - echo "Hello" + echo Hello end ''; funcEvent = pkgs.writeText "func-event.fish" '' function func-event --on-event="fish_command_not_found" - echo "Not found!" + echo "Not found!" end ''; @@ -34,8 +34,6 @@ in { xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; - nmt = { description = "if fish.function is set, check file exists and contents match"; diff --git a/tests/modules/programs/fish/no-functions.nix b/tests/modules/programs/fish/no-functions.nix index 0ab38a09..125ed884 100644 --- a/tests/modules/programs/fish/no-functions.nix +++ b/tests/modules/programs/fish/no-functions.nix @@ -14,8 +14,6 @@ with lib; xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; - nmt = { description = "if fish.functions is blank, the functions folder should not exist."; diff --git a/tests/modules/programs/fish/plugins.nix b/tests/modules/programs/fish/plugins.nix index 6b02dd46..88684b3b 100644 --- a/tests/modules/programs/fish/plugins.nix +++ b/tests/modules/programs/fish/plugins.nix @@ -12,26 +12,26 @@ let # Set paths to import plugin components if test -d $plugin_dir/functions - set fish_function_path $fish_function_path[1] $plugin_dir/functions $fish_function_path[2..-1] + set fish_function_path $fish_function_path[1] $plugin_dir/functions $fish_function_path[2..-1] end if test -d $plugin_dir/completions - set fish_complete_path $fish_complete_path[1] $plugin_dir/completions $fish_complete_path[2..-1] + set fish_complete_path $fish_complete_path[1] $plugin_dir/completions $fish_complete_path[2..-1] end # Source initialization code if it exists. if test -d $plugin_dir/conf.d - for f in $plugin_dir/conf.d/*.fish - source $f - end + for f in $plugin_dir/conf.d/*.fish + source $f + end end if test -f $plugin_dir/key_bindings.fish - source $plugin_dir/key_bindings.fish + source $plugin_dir/key_bindings.fish end if test -f $plugin_dir/init.fish - source $plugin_dir/init.fish + source $plugin_dir/init.fish end ''; @@ -50,8 +50,6 @@ in { xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; - nmt = { description = "if fish.plugins set, check conf.d file exists and contents match"; diff --git a/tests/modules/programs/nix-index/assert-on-command-not-found.nix b/tests/modules/programs/nix-index/assert-on-command-not-found.nix index 0fa6ee79..94d7efc3 100644 --- a/tests/modules/programs/nix-index/assert-on-command-not-found.nix +++ b/tests/modules/programs/nix-index/assert-on-command-not-found.nix @@ -12,10 +12,7 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - zsh = { }; - fish = { }; - }; + test.stubs.zsh = { }; programs.nix-index.enable = true; diff --git a/tests/modules/programs/nix-index/integrations.nix b/tests/modules/programs/nix-index/integrations.nix index 1ae46df5..2fd5253a 100644 --- a/tests/modules/programs/nix-index/integrations.nix +++ b/tests/modules/programs/nix-index/integrations.nix @@ -16,10 +16,7 @@ in { xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - zsh = { }; - fish = { }; - }; + test.stubs.zsh = { }; programs.nix-index.enable = true; diff --git a/tests/modules/programs/oh-my-posh/fish.nix b/tests/modules/programs/oh-my-posh/fish.nix index 69dd9ac1..07137b98 100644 --- a/tests/modules/programs/oh-my-posh/fish.nix +++ b/tests/modules/programs/oh-my-posh/fish.nix @@ -14,10 +14,7 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs = { - oh-my-posh = { }; - fish = { }; - }; + test.stubs.oh-my-posh = { }; nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/pls/fish.nix b/tests/modules/programs/pls/fish.nix index f4b94b73..d555a11c 100644 --- a/tests/modules/programs/pls/fish.nix +++ b/tests/modules/programs/pls/fish.nix @@ -18,10 +18,7 @@ with lib; xdg.dataFile."fish/home-manager_generated_completions".source = mkForce (builtins.toFile "empty" ""); - test.stubs = { - pls = { }; - fish = { }; - }; + test.stubs.pls = { }; nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/powerline-go/fish.nix b/tests/modules/programs/powerline-go/fish.nix index b7891bbf..4861d1ba 100644 --- a/tests/modules/programs/powerline-go/fish.nix +++ b/tests/modules/programs/powerline-go/fish.nix @@ -22,10 +22,7 @@ with lib; xdg.dataFile."fish/home-manager_generated_completions".source = mkForce (builtins.toFile "empty" ""); - test.stubs = { - powerline-go = { }; - fish = { }; - }; + test.stubs.powerline-go = { }; nmt.script = '' assertFileExists home-files/.config/fish/config.fish diff --git a/tests/modules/programs/scmpuff/fish.nix b/tests/modules/programs/scmpuff/fish.nix index f6abb1c7..5326995f 100644 --- a/tests/modules/programs/scmpuff/fish.nix +++ b/tests/modules/programs/scmpuff/fish.nix @@ -8,7 +8,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; test.stubs.scmpuff = { }; nmt.script = '' diff --git a/tests/modules/programs/scmpuff/no-fish.nix b/tests/modules/programs/scmpuff/no-fish.nix index d9f7e36f..94666a59 100644 --- a/tests/modules/programs/scmpuff/no-fish.nix +++ b/tests/modules/programs/scmpuff/no-fish.nix @@ -11,7 +11,6 @@ xdg.dataFile."fish/home-manager_generated_completions".source = lib.mkForce (builtins.toFile "empty" ""); - test.stubs.fish = { }; test.stubs.scmpuff = { }; nmt.script = '' From 2af0d07678fc15612345e0dd55337550dcf6465f Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 5 Dec 2022 23:43:57 +0100 Subject: [PATCH 146/233] home-manager: use `hostname` from Nixpkgs Before the home-manager tool got hostname from the system, which was not declarative or reproducible. --- home-manager/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home-manager/default.nix b/home-manager/default.nix index ada4e07a..3589acb8 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -1,5 +1,5 @@ { runCommand, lib, bash, callPackage, coreutils, findutils, gettext, gnused -, less, ncurses +, less, ncurses, unixtools # used for pkgs.path for nixos-option , pkgs @@ -39,6 +39,7 @@ in runCommand "home-manager" { less ncurses nixos-option + unixtools.hostname ] }" \ --subst-var-by HOME_MANAGER_LIB '${../lib/bash/home-manager.sh}' \ From 054d9e3187ca00479e8036dc0e92900a384f30fd Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 8 Dec 2022 14:34:18 +0100 Subject: [PATCH 147/233] gpg: update hash in test --- tests/modules/programs/gpg/immutable-keyfiles.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/modules/programs/gpg/immutable-keyfiles.nix b/tests/modules/programs/gpg/immutable-keyfiles.nix index b66d770f..55a38ecc 100644 --- a/tests/modules/programs/gpg/immutable-keyfiles.nix +++ b/tests/modules/programs/gpg/immutable-keyfiles.nix @@ -12,7 +12,7 @@ source = pkgs.fetchurl { url = "https://keybase.io/rycee/pgp_keys.asc?fingerprint=36cacf52d098cc0e78fb0cb13573356c25c424d4"; - sha256 = "082mjy6llvrdry6i9r5gx97nw9d89blnam7bghza4ynsjk1mmx6c"; + hash = "sha256-5z2kTUXQp0f7kyP0Id6NS3rCdzGGrrkIYzGK42Qy9Sw="; }; trust = 1; # "unknown" } From 263f6e4523168c770e21eee02def21d493c0f4b6 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Tue, 13 Dec 2022 21:46:36 +0100 Subject: [PATCH 148/233] i3status-rust: fix tests Nix 2.12.0 slightly changed the JSON output format. This updates the i3status-rust test cases to match. --- tests/modules/programs/i3status-rust/with-custom.nix | 4 ++-- tests/modules/programs/i3status-rust/with-default.nix | 4 ++-- tests/modules/programs/i3status-rust/with-extra-settings.nix | 4 ++-- tests/modules/programs/i3status-rust/with-multiple-bars.nix | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/modules/programs/i3status-rust/with-custom.nix b/tests/modules/programs/i3status-rust/with-custom.nix index d89e2ddc..c4131e02 100644 --- a/tests/modules/programs/i3status-rust/with-custom.nix +++ b/tests/modules/programs/i3status-rust/with-custom.nix @@ -102,14 +102,14 @@ with lib; icons = "awesome5" theme = "gruvbox-dark" [[block]] - alert = 10 + alert = 10.0 alias = "/" block = "disk_space" info_type = "available" interval = 60 path = "/" unit = "GB" - warning = 20 + warning = 20.0 [[block]] block = "memory" diff --git a/tests/modules/programs/i3status-rust/with-default.nix b/tests/modules/programs/i3status-rust/with-default.nix index 3da74ac0..b5c20cee 100644 --- a/tests/modules/programs/i3status-rust/with-default.nix +++ b/tests/modules/programs/i3status-rust/with-default.nix @@ -16,14 +16,14 @@ with lib; icons = "none" theme = "plain" [[block]] - alert = 10 + alert = 10.0 alias = "/" block = "disk_space" info_type = "available" interval = 60 path = "/" unit = "GB" - warning = 20 + warning = 20.0 [[block]] block = "memory" diff --git a/tests/modules/programs/i3status-rust/with-extra-settings.nix b/tests/modules/programs/i3status-rust/with-extra-settings.nix index 63458662..aad7618e 100644 --- a/tests/modules/programs/i3status-rust/with-extra-settings.nix +++ b/tests/modules/programs/i3status-rust/with-extra-settings.nix @@ -111,14 +111,14 @@ with lib; pkgs.writeText "i3status-rust-expected-config" '' icons = "awesome5" [[block]] - alert = 10 + alert = 10.0 alias = "/" block = "disk_space" info_type = "available" interval = 60 path = "/" unit = "GB" - warning = 20 + warning = 20.0 [[block]] block = "memory" diff --git a/tests/modules/programs/i3status-rust/with-multiple-bars.nix b/tests/modules/programs/i3status-rust/with-multiple-bars.nix index eab7f42d..a8ffd373 100644 --- a/tests/modules/programs/i3status-rust/with-multiple-bars.nix +++ b/tests/modules/programs/i3status-rust/with-multiple-bars.nix @@ -62,14 +62,14 @@ with lib; icons = "none" theme = "plain" [[block]] - alert = 10 + alert = 10.0 alias = "/" block = "disk_space" info_type = "available" interval = 60 path = "/" unit = "GB" - warning = 20 + warning = 20.0 [[block]] block = "memory" From e412025fffdcd6219ddd21c65d9a1b90005ce508 Mon Sep 17 00:00:00 2001 From: Matt Bryant Date: Mon, 12 Dec 2022 21:50:23 -0800 Subject: [PATCH 149/233] borgmatic: allow lists in extraConfig In particular, we should be able to specify `exclude_backups` in our configuration. Fixes #3489 --- modules/programs/borgmatic.nix | 2 +- tests/modules/programs/borgmatic/basic-configuration.nix | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/programs/borgmatic.nix b/modules/programs/borgmatic.nix index 054ee232..d6980388 100644 --- a/modules/programs/borgmatic.nix +++ b/modules/programs/borgmatic.nix @@ -20,7 +20,7 @@ let }; extraConfigOption = mkOption { - type = with types; attrsOf (oneOf [ str bool path int ]); + type = with types; attrsOf (oneOf [ str bool path int (listOf str) ]); default = { }; description = "Extra settings."; }; diff --git a/tests/modules/programs/borgmatic/basic-configuration.nix b/tests/modules/programs/borgmatic/basic-configuration.nix index 7a7b63d2..b9988d47 100644 --- a/tests/modules/programs/borgmatic/basic-configuration.nix +++ b/tests/modules/programs/borgmatic/basic-configuration.nix @@ -12,7 +12,10 @@ in { location = { sourceDirectories = [ "/my-stuff-to-backup" ]; repositories = [ "/mnt/disk1" "/mnt/disk2" ]; - extraConfig = { one_file_system = true; }; + extraConfig = { + one_file_system = true; + exclude_patterns = [ "*.swp" ]; + }; }; storage = { @@ -64,6 +67,9 @@ in { expectations[location.one_file_system]="${ boolToString backups.main.location.extraConfig.one_file_system }" + expectations[location.exclude_patterns[0]]="${ + builtins.elemAt backups.main.location.extraConfig.exclude_patterns 0 + }" expectations[storage.encryption_passcommand]="${backups.main.storage.encryptionPasscommand}" expectations[storage.checkpoint_interval]="${ From 0e9e86b1794c1003db38ee77437b2522d700174e Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 6 Dec 2022 17:21:08 +0100 Subject: [PATCH 150/233] megasync: add module --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 8 +++++++ modules/modules.nix | 1 + modules/services/megasync.nix | 40 +++++++++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+) create mode 100644 modules/services/megasync.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index dbeca9f1..22c23275 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -427,6 +427,8 @@ Makefile @thiagokokada /modules/services/mbsync.nix @pjones +/modules/services/megasync.nix @GaetanLepage + /modules/services/mopidy.nix @foo-dogsquared /tests/modules/services/mopidy @foo-dogsquared diff --git a/modules/misc/news.nix b/modules/misc/news.nix index f728be44..79229dc4 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -853,6 +853,14 @@ in 'Host' blocks ''; } + + { + time = "2022-12-16T15:01:20+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.megasync'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index a57925ea..a96fae90 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -238,6 +238,7 @@ let ./services/lorri.nix ./services/mako.nix ./services/mbsync.nix + ./services/megasync.nix ./services/mopidy.nix ./services/mpd.nix ./services/mpdris2.nix diff --git a/modules/services/megasync.nix b/modules/services/megasync.nix new file mode 100644 index 00000000..c519ba51 --- /dev/null +++ b/modules/services/megasync.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.megasync; + +in { + meta.maintainers = [ maintainers.GaetanLepage ]; + + options = { + services.megasync = { + enable = mkEnableOption "Megasync client"; + + package = mkPackageOption pkgs "megasync" { }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.megasync" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + systemd.user.services.megasync = { + Unit = { + Description = "megasync"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Install = { WantedBy = [ "graphical-session.target" ]; }; + + Service = { ExecStart = "${cfg.package}/bin/megasync"; }; + }; + }; +} From b3565b34477b2e8dbea174cfc9020ac248644731 Mon Sep 17 00:00:00 2001 From: Norbert Melzer Date: Fri, 16 Dec 2022 07:10:26 +0100 Subject: [PATCH 151/233] java: remove IFD The previous variant used IFD to generate the `JAVA_HOME` variable and relied on internal hooks of the `java` package, this failed for a user cross compiling their configuration. This PR changes that and uses the `home` attribute, as documented in the very last sentence of the https://nixos.org/manual/nixpkgs/stable/#sec-language-java chapter. --- modules/programs/java.nix | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/programs/java.nix b/modules/programs/java.nix index 5b2a0129..24467a25 100644 --- a/modules/programs/java.nix +++ b/modules/programs/java.nix @@ -36,11 +36,6 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - home.sessionVariables = { - JAVA_HOME = fileContents (pkgs.runCommandLocal "java-home" { } '' - source "${cfg.package}/nix-support/setup-hook" - echo "$JAVA_HOME" > $out - ''); - }; + home.sessionVariables.JAVA_HOME = cfg.package.home; }; } From 3f0d04aeca4ca51d3b1c2e008067b71b6eb31fee Mon Sep 17 00:00:00 2001 From: 1sixth <1sixth@shinta.ro> Date: Fri, 16 Dec 2022 12:45:46 +0800 Subject: [PATCH 152/233] treewide: replace replaceChars with replaceStrings replaceChars is a deprecated alias, see https://github.com/NixOS/nixpkgs/commit/05a2dfd6744cdc6ab0b57f8ab866cc686b05f519 for details. --- modules/programs/firefox.nix | 2 +- modules/services/imapnotify.nix | 2 +- modules/systemd.nix | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index 06c9aac7..a2eebdb4 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -600,7 +600,7 @@ in { # like: [source]/path/to/engine.xml loadPath = '' [home-manager]/programs.firefox.profiles.${profile.name}.search.engines."${ - replaceChars [ "\\" ] [ "\\\\" ] name + replaceStrings [ "\\" ] [ "\\\\" ] name }"''; })) // { # Required fields for all engine configurations diff --git a/modules/services/imapnotify.nix b/modules/services/imapnotify.nix index 6a464ec8..0197ec54 100644 --- a/modules/services/imapnotify.nix +++ b/modules/services/imapnotify.nix @@ -6,7 +6,7 @@ let cfg = config.services.imapnotify; - safeName = lib.replaceChars [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]; + safeName = lib.replaceStrings [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]; imapnotifyAccounts = filter (a: a.imapnotify.enable) (attrValues config.accounts.email.accounts); diff --git a/modules/systemd.nix b/modules/systemd.nix index 6abc2460..e4c36ae4 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -8,7 +8,7 @@ let # From mkPathSafeName = - lib.replaceChars [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]; + lib.replaceStrings [ "@" ":" "\\" "[" "]" ] [ "-" "-" "-" "" "" ]; enabled = cfg.services != { } # \ || cfg.slices != { } # \ From d744c2bb9b055040a6d7c659bd1578c1308e65c5 Mon Sep 17 00:00:00 2001 From: Walter Franzini Date: Thu, 15 Dec 2022 09:50:39 +0100 Subject: [PATCH 153/233] Translate using Weblate (Italian) Currently translated at 92.8% (13 of 14 strings) Co-authored-by: Walter Franzini Translate-URL: https://hosted.weblate.org/projects/home-manager/modules/it/ Translation: Home Manager/Home Manager Modules --- modules/po/it.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/po/it.po b/modules/po/it.po index cec8b104..b4c475c5 100644 --- a/modules/po/it.po +++ b/modules/po/it.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: 2022-03-26 15:08+0100\n" -"PO-Revision-Date: 2022-04-20 18:18+0000\n" -"Last-Translator: Frankie McEyes \n" +"PO-Revision-Date: 2022-12-15 08:50+0000\n" +"Last-Translator: Walter Franzini \n" "Language-Team: Italian \n" "Language: it\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 4.12-dev\n" +"X-Generator: Weblate 4.15-dev\n" #: modules/files.nix:233 msgid "Creating home file links in %s" @@ -57,7 +57,7 @@ msgstr "Attivando %s" #: modules/lib-bash/activation-init.sh:31 msgid "Sanity checking oldGenNum and oldGenPath" -msgstr "" +msgstr "Controllando oldGenNum e oldGenPath" #: modules/lib-bash/activation-init.sh:34 msgid "" From b7eb400d41244110c539303ef4b2859552405284 Mon Sep 17 00:00:00 2001 From: Matthew Toohey Date: Sat, 10 Dec 2022 15:52:30 -0500 Subject: [PATCH 154/233] pistol: refactor This pull requests refactors the pistol configuration options, since the current options are deficient in a few ways. Closes #3486 --- modules/programs/pistol.nix | 70 ++++++++++++++----- .../modules/programs/pistol/associations.nix | 38 ++++++++++ tests/modules/programs/pistol/config.nix | 26 +++---- tests/modules/programs/pistol/default.nix | 7 +- .../programs/pistol/double-association.nix | 18 +++++ .../programs/pistol/missing-association.nix | 14 ++++ 6 files changed, 137 insertions(+), 36 deletions(-) create mode 100644 tests/modules/programs/pistol/associations.nix create mode 100644 tests/modules/programs/pistol/double-association.nix create mode 100644 tests/modules/programs/pistol/missing-association.nix diff --git a/modules/programs/pistol.nix b/modules/programs/pistol.nix index 8d5d6d71..4d6a1d29 100644 --- a/modules/programs/pistol.nix +++ b/modules/programs/pistol.nix @@ -3,31 +3,55 @@ with lib; let - cfg = config.programs.pistol; - configFile = - concatStringsSep "\n" (mapAttrsToList (k: v: "${k} ${v}") cfg.config); + configFile = concatStringsSep "\n" (map ({ fpath, mime, command }: + if fpath == "" then "${mime} ${command}" else "fpath ${fpath} ${command}") + cfg.associations); + association = types.submodule { + options = { + command = mkOption { + type = types.str; + description = "Preview command for files matched by this association."; + }; + + fpath = mkOption { + type = types.str; + default = ""; + description = "File path regex that this association should match."; + }; + + mime = mkOption { + type = types.str; + default = ""; + description = "Mime type regex that this association should match."; + }; + }; + }; in { + imports = [ + (mkRemovedOptionModule [ "programs" "pistol" "config" ] + "Pistol is now configured with programs.pistol.associations.") + ]; + meta.maintainers = [ hm.maintainers.mtoohey ]; options.programs.pistol = { - enable = mkEnableOption '' - Pistol, a general purpose file previewer designed for terminal file - managers''; + enable = mkEnableOption "file previewer for terminal file managers"; - config = mkOption { - type = with types; attrsOf str; - default = { }; + associations = mkOption { + type = types.listOf association; + default = [ ]; example = literalExpression '' - { - "text/*" = "bat --paging=never --color=always %pistol-filename%"; - "inode/directory" = "ls -l --color %pistol-filename%"; - } + [ + { mime = "application/json"; command = "bat %pistol-filename%"; } + { mime = "application/*"; command = "hexyl %pistol-filename%"; } + { fpath = ".*.md$"; command = "sh: bat --paging=never --color=always %pistol-filename% | head -8"; } + ] ''; description = '' - Pistol configuration written to + Associations written to the Pistol configuration at $XDG_CONFIG_HOME/pistol/pistol.conf. ''; }; @@ -35,14 +59,26 @@ in { }; config = mkIf cfg.enable (mkMerge [ - { home.packages = [ pkgs.pistol ]; } + { + assertions = [{ + assertion = all ({ fpath, mime, ... }: + (fpath != "" && mime == "") || (fpath == "" && mime != "")) + cfg.associations; + message = '' + Each entry in programs.pistol.associations must contain exactly one + of fpath or mime. + ''; + }]; - (mkIf (cfg.config != { } && pkgs.stdenv.hostPlatform.isDarwin) { + home.packages = [ pkgs.pistol ]; + } + + (mkIf (cfg.associations != [ ] && pkgs.stdenv.hostPlatform.isDarwin) { home.file."Library/Application Support/pistol/pistol.conf".text = configFile; }) - (mkIf (cfg.config != { } && !pkgs.stdenv.hostPlatform.isDarwin) { + (mkIf (cfg.associations != [ ] && !pkgs.stdenv.hostPlatform.isDarwin) { xdg.configFile."pistol/pistol.conf".text = configFile; }) ]); diff --git a/tests/modules/programs/pistol/associations.nix b/tests/modules/programs/pistol/associations.nix new file mode 100644 index 00000000..764060ba --- /dev/null +++ b/tests/modules/programs/pistol/associations.nix @@ -0,0 +1,38 @@ +{ pkgs, ... }: + +{ + programs.pistol = { + enable = true; + associations = [ + { + mime = "application/json"; + command = "bat %pistol-filename%"; + } + { + mime = "application/*"; + command = "hexyl %pistol-filename%"; + } + { + fpath = ".*.md$"; + command = + "sh: bat --paging=never --color=always %pistol-filename% | head -8"; + } + ]; + }; + + test.stubs.pistol = { }; + + nmt.script = let + expected = builtins.toFile "config-expected" '' + application/json bat %pistol-filename% + application/* hexyl %pistol-filename% + fpath .*.md$ sh: bat --paging=never --color=always %pistol-filename% | head -8''; + path = if pkgs.stdenv.hostPlatform.isDarwin then + "home-files/Library/Application Support/pistol/pistol.conf" + else + "home-files/.config/pistol/pistol.conf"; + in '' + assertFileExists '${path}' + assertFileContent '${path}' '${expected}' + ''; +} diff --git a/tests/modules/programs/pistol/config.nix b/tests/modules/programs/pistol/config.nix index 324304d3..1999befa 100644 --- a/tests/modules/programs/pistol/config.nix +++ b/tests/modules/programs/pistol/config.nix @@ -1,12 +1,4 @@ -{ pkgs, ... }: - -let - - expected = builtins.toFile "settings-expected" '' - application/json bat --paging=never --color=always --style=auto --wrap=character --terminal-width=%pistol-extra0% --line-range=1:%pistol-extra1% %pistol-filename% - text/* bat --paging=never --color=always --style=auto --wrap=character --terminal-width=%pistol-extra0% --line-range=1:%pistol-extra1% %pistol-filename%''; - -in { +{ programs.pistol = { enable = true; config = { @@ -19,13 +11,11 @@ in { test.stubs.pistol = { }; - nmt.script = let - path = if pkgs.stdenv.hostPlatform.isDarwin then - "home-files/Library/Application Support/pistol/pistol.conf" - else - "home-files/.config/pistol/pistol.conf"; - in '' - assertFileExists '${path}' - assertFileContent '${path}' '${expected}' - ''; + test.asserts.assertions.expected = [ + (let offendingFile = toString ./config.nix; + in '' + The option definition `programs.pistol.config' in `${offendingFile}' no longer has any effect; please remove it. + Pistol is now configured with programs.pistol.associations. + '') + ]; } diff --git a/tests/modules/programs/pistol/default.nix b/tests/modules/programs/pistol/default.nix index ac147c37..1efcbc6a 100644 --- a/tests/modules/programs/pistol/default.nix +++ b/tests/modules/programs/pistol/default.nix @@ -1 +1,6 @@ -{ pistol-config = ./config.nix; } +{ + pistol-associations = ./associations.nix; + pistol-config = ./config.nix; + pistol-double-association = ./double-association.nix; + pistol-missing-association = ./missing-association.nix; +} diff --git a/tests/modules/programs/pistol/double-association.nix b/tests/modules/programs/pistol/double-association.nix new file mode 100644 index 00000000..103f4d05 --- /dev/null +++ b/tests/modules/programs/pistol/double-association.nix @@ -0,0 +1,18 @@ +{ + programs.pistol = { + enable = true; + # contains both fpath and mime + associations = [{ + fpath = ".*.md$"; + mime = "application/json"; + command = "bat %pistol-filename%"; + }]; + }; + + test.stubs.pistol = { }; + + test.asserts.assertions.expected = ['' + Each entry in programs.pistol.associations must contain exactly one + of fpath or mime. + '']; +} diff --git a/tests/modules/programs/pistol/missing-association.nix b/tests/modules/programs/pistol/missing-association.nix new file mode 100644 index 00000000..6ea0a448 --- /dev/null +++ b/tests/modules/programs/pistol/missing-association.nix @@ -0,0 +1,14 @@ +{ + programs.pistol = { + enable = true; + # contains no fpath or mime value + associations = [{ command = "bat %pistol-filename%"; }]; + }; + + test.stubs.pistol = { }; + + test.asserts.assertions.expected = ['' + Each entry in programs.pistol.associations must contain exactly one + of fpath or mime. + '']; +} From 7d55a72d4c1df694e87a41a7e6c9a7b6e9a40ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marijan=20Petri=C4=8Devi=C4=87?= Date: Fri, 16 Dec 2022 11:55:29 -0500 Subject: [PATCH 155/233] lazygit: add package option (#3456) --- modules/programs/lazygit.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/programs/lazygit.nix b/modules/programs/lazygit.nix index 1752b151..84dab379 100644 --- a/modules/programs/lazygit.nix +++ b/modules/programs/lazygit.nix @@ -16,6 +16,8 @@ in { options.programs.lazygit = { enable = mkEnableOption "lazygit, a simple terminal UI for git commands"; + package = mkPackageOption pkgs "lazygit" { }; + settings = mkOption { type = yamlFormat.type; default = { }; @@ -41,7 +43,7 @@ in { }; config = mkIf cfg.enable { - home.packages = [ pkgs.lazygit ]; + home.packages = [ cfg.package ]; home.file."Library/Application Support/lazygit/config.yml" = mkIf (cfg.settings != { } && isDarwin) { From 37713c6b04b963d41664e03576f73a18c9b0d224 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 18 Dec 2022 03:59:28 +0000 Subject: [PATCH 156/233] 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/b72b8b94cf0c012b0252a9100a636cad69696666' (2022-12-02) → 'github:nixos/nixpkgs/757b82211463dd5ba1475b6851d3731dfe14d377' (2022-12-16) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index b94fed5d..483046f5 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1669969257, - "narHash": "sha256-mOS13sK3v+kfgP+1Mh56ohiG8uVhLHAo7m/q9kqAehc=", + "lastModified": 1671200928, + "narHash": "sha256-mZfzDyzojwj6I0wyooIjGIn81WtGVnx6+avU5Wv+VKU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b72b8b94cf0c012b0252a9100a636cad69696666", + "rev": "757b82211463dd5ba1475b6851d3731dfe14d377", "type": "github" }, "original": { From e7eba9cc46547ae86642ad3c6a9a4fb22c07bc26 Mon Sep 17 00:00:00 2001 From: Kamal Al Marhubi Date: Tue, 29 Nov 2022 16:26:00 -0500 Subject: [PATCH 157/233] home-manager: refine flake URI lookup Depending on DHCP settings you might end up with different output from running `hostname`. Eg, your local hostname is `mylaptop`, and your home router is configured with a local domain of `.hoome.arpa`. In this case: $ hostname mylaptop.home.arpa $ hostname -s mylaptop If you then go to cafe which has its router configured with `.lan` as its local domain. Then, if your DHCP settings accept the local domain from the router, $ hostname myalaptop.lan $ hostname -s mylaptop With the pre-existing behaviour, if you had a `"me@mylaptop.home.arpa"` entry in `outputs.homeConfigurations`, running `home-manager switch` would fail: $ home-manager switch error: flake 'git+file:///home/me/.config/nixpkgs' does not provide attribute 'packages.aarch64-darwin.homeConfigurations."me".activationPackage', 'legacyPackages.aarch64-darwin.homeConfigurations."me".activationPackage' or 'homeConfigurations."me".activationPackage' After this commit, you can put configuration in a `"me@mylaptop"` entry in `outputs.homeConfigurations`, and everything will work on either network. --- home-manager/home-manager | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/home-manager/home-manager b/home-manager/home-manager index 9a5af6d9..459908f2 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -106,10 +106,17 @@ function setFlakeAttribute() { local name="${FLAKE_ARG#*#}" ;; *) - local name="$USER@$(hostname)" - if [ "$(nix eval "$flake#homeConfigurations" --apply "x: x ? \"$name\"")" = "false" ]; then - name="$USER" - fi + local name="$USER" + # Check both long and short hostnames; long first to preserve + # pre-existing behaviour in case both happen to be defined. + for n in "$USER@$(hostname)" "$USER@$(hostname -s)"; do + if [[ "$(nix eval "$flake#homeConfigurations" --apply "x: x ? \"$n\"")" == "true" ]]; then + name="$n" + if [[ -v VERBOSE ]]; then + echo "Using flake homeConfiguration for $name" + fi + fi + done ;; esac export FLAKE_CONFIG_URI="$flake#homeConfigurations.\"$name\"" From 1a0a5f50376e2c3b0df9728befc59f07da44be21 Mon Sep 17 00:00:00 2001 From: Olmo Kramer Date: Mon, 19 Dec 2022 22:08:33 +0100 Subject: [PATCH 158/233] herbstluftwm: Fix error when no tags set The default value for `xsession.windowManager.herbstluftwm.tags` is an empty list, but the config file uses `builtins.head` on it, which causes an error upon evaluation. With this change the tags configuration is skipped if the list is empty. --- .../services/window-managers/herbstluftwm.nix | 18 ++++++----- .../window-managers/herbstluftwm/default.nix | 5 ++- .../herbstluftwm-no-tags-autostart | 31 +++++++++++++++++++ .../herbstluftwm/herbstluftwm-no-tags.nix | 16 ++++++++++ ...t => herbstluftwm-simple-config-autostart} | 3 +- .../herbstluftwm-simple-config.nix | 4 ++- 6 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart create mode 100644 tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix rename tests/modules/services/window-managers/herbstluftwm/{autostart => herbstluftwm-simple-config-autostart} (89%) mode change 100755 => 100644 diff --git a/modules/services/window-managers/herbstluftwm.nix b/modules/services/window-managers/herbstluftwm.nix index cbbe3cef..e826100d 100644 --- a/modules/services/window-managers/herbstluftwm.nix +++ b/modules/services/window-managers/herbstluftwm.nix @@ -145,15 +145,17 @@ in { ${renderSettings cfg.settings} - if ${cfg.package}/bin/herbstclient object_tree tags.by-name | ${pkgs.gnugrep}/bin/grep default; then - herbstclient rename default ${ - lib.escapeShellArg (builtins.head cfg.tags) - } - fi + ${lib.optionalString (cfg.tags != [ ]) '' + if ${cfg.package}/bin/herbstclient object_tree tags.default &>/dev/null; then + herbstclient rename default ${ + lib.escapeShellArg (builtins.head cfg.tags) + } + fi - for tag in ${lib.escapeShellArgs cfg.tags}; do - herbstclient add "$tag" - done + for tag in ${lib.escapeShellArgs cfg.tags}; do + herbstclient add "$tag" + done + ''} ${renderKeybinds cfg.keybinds} diff --git a/tests/modules/services/window-managers/herbstluftwm/default.nix b/tests/modules/services/window-managers/herbstluftwm/default.nix index 04b9f89c..31e73365 100644 --- a/tests/modules/services/window-managers/herbstluftwm/default.nix +++ b/tests/modules/services/window-managers/herbstluftwm/default.nix @@ -1 +1,4 @@ -{ herbstluftwm-simple-config = ./herbstluftwm-simple-config.nix; } +{ + herbstluftwm-simple-config = ./herbstluftwm-simple-config.nix; + herbstluftwm-no-tags = ./herbstluftwm-no-tags.nix; +} diff --git a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart new file mode 100644 index 00000000..642d66cd --- /dev/null +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart @@ -0,0 +1,31 @@ +#!/nix/store/00000000000000000000000000000000-bash/bin/bash +shopt -s expand_aliases + +# shellcheck disable=SC2142 +alias herbstclient='set -- "$@" ";"' +set -- + +herbstclient emit_hook reload + +# Reset everything. +herbstclient attr theme.tiling.reset 1 +herbstclient attr theme.floating.reset 1 +herbstclient keyunbind --all +herbstclient unrule --all + + + + + + + + + + + + + +herbstclient unlock + +@herbstluftwm@/bin/herbstclient chain ";" "$@" + diff --git a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix new file mode 100644 index 00000000..bd7fb488 --- /dev/null +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags.nix @@ -0,0 +1,16 @@ +{ lib, pkgs, ... }: + +{ + xsession.windowManager.herbstluftwm = { enable = true; }; + + test.stubs.herbstluftwm = { }; + + nmt.script = '' + autostart=home-files/.config/herbstluftwm/autostart + assertFileExists "$autostart" + assertFileIsExecutable "$autostart" + + normalizedAutostart=$(normalizeStorePaths "$autostart") + assertFileContent "$normalizedAutostart" ${./herbstluftwm-no-tags-autostart} + ''; +} diff --git a/tests/modules/services/window-managers/herbstluftwm/autostart b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart old mode 100755 new mode 100644 similarity index 89% rename from tests/modules/services/window-managers/herbstluftwm/autostart rename to tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart index d59da4ba..31eb1750 --- a/tests/modules/services/window-managers/herbstluftwm/autostart +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart @@ -19,7 +19,7 @@ herbstclient set frame_bg_active_color '#000000' herbstclient set frame_gap '12' herbstclient set frame_padding '-12' -if @herbstluftwm@/bin/herbstclient object_tree tags.by-name | /nix/store/00000000000000000000000000000000-gnugrep/bin/grep default; then +if @herbstluftwm@/bin/herbstclient object_tree tags.default &>/dev/null; then herbstclient rename default '1' fi @@ -27,6 +27,7 @@ for tag in '1' 'with space' 'wə1rd#ch@rs'\'''; do herbstclient add "$tag" done + herbstclient keybind Mod4-1 use 1 herbstclient keybind Mod4-2 use 2 herbstclient keybind Mod4-Alt-Tab cycle -1 diff --git a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix index 27e87150..e351e78f 100644 --- a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config.nix @@ -39,6 +39,8 @@ assertFileIsExecutable "$autostart" normalizedAutostart=$(normalizeStorePaths "$autostart") - assertFileContent "$normalizedAutostart" ${./autostart} + assertFileContent "$normalizedAutostart" ${ + ./herbstluftwm-simple-config-autostart + } ''; } From 47bb9e756937a2609a62b192ba06780f865f7e03 Mon Sep 17 00:00:00 2001 From: Olmo Kramer Date: Mon, 19 Dec 2022 22:12:34 +0100 Subject: [PATCH 159/233] herbstluftwm: Reset mousebinds on (re)load Keybinds and rules were already reset, but now also the mousebinds are. --- modules/services/window-managers/herbstluftwm.nix | 1 + .../window-managers/herbstluftwm/herbstluftwm-no-tags-autostart | 1 + .../herbstluftwm/herbstluftwm-simple-config-autostart | 1 + 3 files changed, 3 insertions(+) diff --git a/modules/services/window-managers/herbstluftwm.nix b/modules/services/window-managers/herbstluftwm.nix index e826100d..67457e95 100644 --- a/modules/services/window-managers/herbstluftwm.nix +++ b/modules/services/window-managers/herbstluftwm.nix @@ -141,6 +141,7 @@ in { herbstclient attr theme.tiling.reset 1 herbstclient attr theme.floating.reset 1 herbstclient keyunbind --all + herbstclient mouseunbind --all herbstclient unrule --all ${renderSettings cfg.settings} diff --git a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart index 642d66cd..9e8cd78a 100644 --- a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-no-tags-autostart @@ -11,6 +11,7 @@ herbstclient emit_hook reload herbstclient attr theme.tiling.reset 1 herbstclient attr theme.floating.reset 1 herbstclient keyunbind --all +herbstclient mouseunbind --all herbstclient unrule --all diff --git a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart index 31eb1750..5f101e0b 100644 --- a/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart +++ b/tests/modules/services/window-managers/herbstluftwm/herbstluftwm-simple-config-autostart @@ -11,6 +11,7 @@ herbstclient emit_hook reload herbstclient attr theme.tiling.reset 1 herbstclient attr theme.floating.reset 1 herbstclient keyunbind --all +herbstclient mouseunbind --all herbstclient unrule --all herbstclient set always_show_frame true From b44f56dfcdc5eabbc5be9094c1db1251fb761483 Mon Sep 17 00:00:00 2001 From: David Armstrong Lewis <6754950+davidarmstronglewis@users.noreply.github.com> Date: Wed, 23 Nov 2022 15:37:08 -0800 Subject: [PATCH 160/233] nushell: support darwin config file locations Previously the nushell module did not differentiate between Linux and Darwin when deciding where to place config files, whereas nushell does. This commit fixes that. --- modules/programs/nushell.nix | 12 ++++++++---- tests/modules/programs/nushell/example-settings.nix | 13 +++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/modules/programs/nushell.nix b/modules/programs/nushell.nix index c31c6c65..da01672b 100644 --- a/modules/programs/nushell.nix +++ b/modules/programs/nushell.nix @@ -6,6 +6,11 @@ let cfg = config.programs.nushell; + configDir = if pkgs.stdenv.isDarwin then + "Library/Application Support/nushell" + else + "${config.xdg.configHome}/nushell"; + linesOrSource = name: types.submodule ({ config, ... }: { options = { @@ -110,16 +115,15 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - - xdg.configFile = mkMerge [ + home.file = mkMerge [ (mkIf (cfg.configFile != null || cfg.extraConfig != "") { - "nushell/config.nu".text = mkMerge [ + "${configDir}/config.nu".text = mkMerge [ (mkIf (cfg.configFile != null) cfg.configFile.text) cfg.extraConfig ]; }) (mkIf (cfg.envFile != null || cfg.extraEnv != "") { - "nushell/env.nu".text = mkMerge [ + "${configDir}/env.nu".text = mkMerge [ (mkIf (cfg.envFile != null) cfg.envFile.text) cfg.extraEnv ]; diff --git a/tests/modules/programs/nushell/example-settings.nix b/tests/modules/programs/nushell/example-settings.nix index d1eca320..21d94a70 100644 --- a/tests/modules/programs/nushell/example-settings.nix +++ b/tests/modules/programs/nushell/example-settings.nix @@ -1,4 +1,4 @@ -{ ... }: +{ pkgs, ... }: { programs.nushell = { @@ -19,12 +19,17 @@ test.stubs.nushell = { }; - nmt.script = '' + nmt.script = let + configDir = if pkgs.stdenv.isDarwin then + "home-files/Library/Application Support/nushell" + else + "home-files/.config/nushell"; + in '' assertFileContent \ - home-files/.config/nushell/config.nu \ + "${configDir}/config.nu" \ ${./config-expected.nu} assertFileContent \ - home-files/.config/nushell/env.nu \ + "${configDir}/env.nu" \ ${./env-expected.nu} ''; } From eb9ff9556d60f9763aac88de7a50b1a1c7a1e235 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 23 Dec 2022 10:02:39 +0100 Subject: [PATCH 161/233] bash: escape historyIgnore value Since this option is very unlikely to contain a shell variable we should be safe doing a full shell escaping. Fixes #3249 --- modules/programs/bash.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/bash.nix b/modules/programs/bash.nix index 0f9fd922..742087b7 100644 --- a/modules/programs/bash.nix +++ b/modules/programs/bash.nix @@ -202,7 +202,7 @@ in HISTCONTROL = concatStringsSep ":" cfg.historyControl; } // optionalAttrs (cfg.historyIgnore != []) { - HISTIGNORE = concatStringsSep ":" cfg.historyIgnore; + HISTIGNORE = escapeShellArg (concatStringsSep ":" cfg.historyIgnore); } )); in mkIf cfg.enable { From d7eee202e597bc7789498a8664082cf0ffedaa8f Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 23 Dec 2022 22:40:33 +0100 Subject: [PATCH 162/233] home-environment: explicitly use coreutils Before we used dirname and readlink from the ambient environment, which caused problems when they don't behave as expected. Fixes #3516 --- modules/home-environment.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 9d61cc99..bf83f0d2 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -679,7 +679,6 @@ in gnused ncurses # For `tput`. ] - ++ optional (config.nix.enable && config.nix.package != null) config.nix.package ++ config.home.extraActivationPath ) + ( @@ -688,7 +687,7 @@ in if config.nix.enable && config.nix.package != null then ":${config.nix.package}/bin" else - ":$(dirname $(readlink -m $(type -p nix-env)))" + ":$(${pkgs.coreutils}/bin/dirname $(${pkgs.coreutils}/bin/readlink -m $(type -p nix-env)))" ) + optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH"; From 939731b8cb75fb451170cb8f935186a6a7424444 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Thu, 27 Oct 2022 19:08:14 +0200 Subject: [PATCH 163/233] cachix-agent: add module --- modules/misc/news.nix | 8 ++ modules/modules.nix | 1 + modules/services/cachix-agent.nix | 84 +++++++++++++++++++ tests/default.nix | 1 + .../services/cachix-agent/basic-setup.nix | 32 +++++++ .../modules/services/cachix-agent/default.nix | 1 + 6 files changed, 127 insertions(+) create mode 100644 modules/services/cachix-agent.nix create mode 100644 tests/modules/services/cachix-agent/basic-setup.nix create mode 100644 tests/modules/services/cachix-agent/default.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 79229dc4..1be3e26f 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -861,6 +861,14 @@ in A new module is available: 'services.megasync'. ''; } + + { + time = "2022-12-25T08:41:32+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.cachix-agent'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index a96fae90..44aa17da 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -204,6 +204,7 @@ let ./services/betterlockscreen.nix ./services/blueman-applet.nix ./services/borgmatic.nix + ./services/cachix-agent.nix ./services/caffeine.nix ./services/cbatticon.nix ./services/clipmenu.nix diff --git a/modules/services/cachix-agent.nix b/modules/services/cachix-agent.nix new file mode 100644 index 00000000..01eca05b --- /dev/null +++ b/modules/services/cachix-agent.nix @@ -0,0 +1,84 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + + cfg = config.services.cachix-agent; + +in { + meta.maintainers = [ maintainers.rycee ]; + + options.services.cachix-agent = { + enable = mkEnableOption '' + Cachix Deploy Agent: ''; + + name = mkOption { + type = types.str; + description = "The unique agent name."; + }; + + verbose = mkEnableOption "verbose output"; + + profile = mkOption { + type = types.str; + default = "home-manager"; + description = '' + The Nix profile name. + ''; + }; + + host = mkOption { + type = types.nullOr types.str; + default = null; + description = "Cachix URI to use."; + }; + + package = mkPackageOption pkgs "cachix" { }; + + credentialsFile = mkOption { + type = types.path; + default = "${config.xdg.configHome}/cachix-agent.token"; + defaultText = + literalExpression ''"''${config.xdg.configHome}/cachix-agent.token"''; + description = '' + Required file that needs to contain + CACHIX_AGENT_TOKEN=.... + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.cachix-agent" pkgs + lib.platforms.linux) + ]; + + systemd.user.services.cachix-agent = { + Unit.Description = "Cachix Deploy Agent"; + + Service = { + Environment = [ + "PATH=${ + if config.nix.enable && config.nix.package != null then + config.nix.package + else + pkgs.nix + }/bin" + ]; + EnvironmentFile = cfg.credentialsFile; + + # We don't want to kill children processes as those are deployments. + KillMode = "process"; + Restart = "on-failure"; + ExecStart = escapeShellArgs ([ "${cfg.package}/bin/cachix" ] + ++ optional cfg.verbose "--verbose" + ++ optional (cfg.host != null) "--host ${cfg.host}" + ++ [ "deploy" "agent" cfg.name ] + ++ optional (cfg.profile != null) cfg.profile); + }; + + Install.WantedBy = [ "default.target" ]; + }; + }; +} diff --git a/tests/default.nix b/tests/default.nix index f4f8d877..21ae251d 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -166,6 +166,7 @@ import nmt { ./modules/programs/yt-dlp ./modules/services/barrier ./modules/services/borgmatic + ./modules/services/cachix-agent ./modules/services/devilspie2 ./modules/services/dropbox ./modules/services/emacs diff --git a/tests/modules/services/cachix-agent/basic-setup.nix b/tests/modules/services/cachix-agent/basic-setup.nix new file mode 100644 index 00000000..0f84ae35 --- /dev/null +++ b/tests/modules/services/cachix-agent/basic-setup.nix @@ -0,0 +1,32 @@ +{ config, ... }: + +{ + services.cachix-agent = { + enable = true; + package = config.lib.test.mkStubPackage { outPath = "@cachix-agent@"; }; + name = "test-agent"; + }; + + test.stubs.nix = { }; + + nmt.script = '' + assertFileContent \ + home-files/.config/systemd/user/cachix-agent.service \ + ${ + builtins.toFile "cachix-agent.service" '' + [Install] + WantedBy=default.target + + [Service] + Environment=PATH=@nix@/bin + EnvironmentFile=/home/hm-user/.config/cachix-agent.token + ExecStart='@cachix-agent@/bin/cachix' 'deploy' 'agent' 'test-agent' 'home-manager' + KillMode=process + Restart=on-failure + + [Unit] + Description=Cachix Deploy Agent + '' + } + ''; +} diff --git a/tests/modules/services/cachix-agent/default.nix b/tests/modules/services/cachix-agent/default.nix new file mode 100644 index 00000000..48f88e0a --- /dev/null +++ b/tests/modules/services/cachix-agent/default.nix @@ -0,0 +1 @@ +{ cachix = ./basic-setup.nix; } From c55fa26ce05fee8e063db22918d05a73d430b2ea Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Sat, 24 Dec 2022 22:48:45 -0800 Subject: [PATCH 164/233] home-manager: pass -L/--print-build-logs to nix build When building from a flake, `nix build` hides the build output by default, with a `-L`/`--print-build-logs` option to show it. Pass this option along from `home-manager` if the user provides it. Signed-off-by: Anders Kaseorg --- docs/man-home-manager.xml | 28 ++++++++++++++++++++++++++++ home-manager/completion.bash | 1 + home-manager/completion.fish | 1 + home-manager/completion.zsh | 1 + home-manager/home-manager | 6 ++++++ 5 files changed, 37 insertions(+) diff --git a/docs/man-home-manager.xml b/docs/man-home-manager.xml index cbc977ab..513973e9 100644 --- a/docs/man-home-manager.xml +++ b/docs/man-home-manager.xml @@ -155,6 +155,18 @@ --keep-going + + + + -L + + + + --print-build-logs + + + + --show-trace @@ -546,6 +558,22 @@ + + + + + + + + + + Passed on to + nix build + + when building from a flake. + + + diff --git a/home-manager/completion.bash b/home-manager/completion.bash index ec20bbc1..c5512299 100644 --- a/home-manager/completion.bash +++ b/home-manager/completion.bash @@ -293,6 +293,7 @@ _home-manager_completions () Options=( "-f" "--file" "-b" "-A" "-I" "-h" "--help" "-n" "--dry-run" "-v" \ "--verbose" "--cores" "--debug" "--impure" "--keep-failed" \ "--keep-going" "-j" "--max-jobs" "--no-substitute" "--no-out-link" \ + "-L" "--print-build-logs" \ "--show-trace" "--substitute" "--builders" "--version" \ "--update-input" "--override-input" "--experimental-features" \ "--extra-experimental-features" ) diff --git a/home-manager/completion.fish b/home-manager/completion.fish index aca4943f..58ce386e 100644 --- a/home-manager/completion.fish +++ b/home-manager/completion.fish @@ -60,6 +60,7 @@ complete -c home-manager -f -l "keep-going" -d "Keep going in case of failed bui complete -c home-manager -x -s j -l "max-jobs" -d "Max number of build jobs in parallel" complete -c home-manager -x -l "option" -d "Set Nix configuration option" complete -c home-manager -x -l "builders" -d "Remote builders" +complete -c home-manager -f -s L -l "print-build-logs" -d "Print full build logs on standard error" complete -c home-manager -f -l "show-trace" -d "Print stack trace of evaluation errors" complete -c home-manager -f -l "substitute" complete -c home-manager -f -l "no-substitute" diff --git a/home-manager/completion.zsh b/home-manager/completion.zsh index 6e20d17d..3babc1fe 100644 --- a/home-manager/completion.zsh +++ b/home-manager/completion.zsh @@ -19,6 +19,7 @@ _arguments \ '(-j --max-jobs)'{--max-jobs,-j}'[max jobs]:NUM:()' \ '--option[option]:NAME VALUE:()' \ '--builders[builders]:SPEC:()' \ + '(-L --print-build-logs)'{--print-build-logs,-L}'[print build logs]' \ '--show-trace[show trace]' \ '--override-input[override flake input]:NAME VALUE:()' \ '--update-input[update flake input]:NAME:()' \ diff --git a/home-manager/home-manager b/home-manager/home-manager index 459908f2..86623972 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -289,6 +289,7 @@ function doBuild() { "$FLAKE_CONFIG_URI.activationPackage" \ ${DRY_RUN+--dry-run} \ ${NO_OUT_LINK+--no-link} \ + ${PRINT_BUILD_LOGS+--print-build-logs} \ || return else doBuildAttr \ @@ -319,6 +320,7 @@ function doSwitch() { doBuildFlake \ "$FLAKE_CONFIG_URI.activationPackage" \ --out-link "$generation" \ + ${PRINT_BUILD_LOGS+--print-build-logs} \ && "$generation/activate" || return else doBuildAttr \ @@ -551,6 +553,7 @@ function doHelp() { echo " --keep-going" echo " -j, --max-jobs NUM" echo " --option NAME VALUE" + echo " -L, --print-build-logs" echo " --show-trace" echo " --(no-)substitute" echo " --no-out-link Do not create a symlink to the output path" @@ -648,6 +651,9 @@ while [[ $# -gt 0 ]]; do --no-out-link) NO_OUT_LINK=1 ;; + -L|--print-build-logs) + PRINT_BUILD_LOGS=1 + ;; -h|--help) doHelp exit 0 From 646ac0ad17e295c2dbe338ff62c18f78d54f3d40 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sat, 24 Dec 2022 15:48:22 +1300 Subject: [PATCH 165/233] starship: fix nushell integration Overwrite starship/init.nu if already exists, since this is a cache file for sourcing in `init.nu`. --- modules/programs/starship.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 0a83a7b8..0fb4d39a 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -134,7 +134,7 @@ in { if not ($starship_cache | path exists) { mkdir $starship_cache } - ${starshipCmd} init nu | save ${config.xdg.cacheHome}/starship/init.nu + ${starshipCmd} init nu | save --force ${config.xdg.cacheHome}/starship/init.nu ''; extraConfig = '' source ${config.xdg.cacheHome}/starship/init.nu From a62e4c88d7b84ac54a96084f3490703ba34bdd2e Mon Sep 17 00:00:00 2001 From: Marcel Transier <34482842+marceltransier@users.noreply.github.com> Date: Tue, 27 Dec 2022 13:00:56 +0100 Subject: [PATCH 166/233] starship: re-add ion integration which was apparently mistakenly removed in commit 7ae7250 --- modules/programs/starship.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/programs/starship.nix b/modules/programs/starship.nix index 0fb4d39a..05763c0b 100644 --- a/modules/programs/starship.nix +++ b/modules/programs/starship.nix @@ -124,6 +124,12 @@ in { end ''; + programs.ion.initExtra = mkIf cfg.enableIonIntegration '' + if test $TERM != "dumb" && not exists -s INSIDE_EMACS || test $INSIDE_EMACS = "vterm" + eval $(${starshipCmd} init ion) + end + ''; + programs.nushell = mkIf cfg.enableNushellIntegration { # Unfortunately nushell doesn't allow conditionally sourcing nor # conditionally setting (global) environment variables, which is why the From 18b56e3f7d5265ccf023b0bce0540a237988423c Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 28 Dec 2022 20:34:43 +0100 Subject: [PATCH 167/233] broot: update test to match upstream changes Fixes #3527 --- tests/modules/programs/broot/broot.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/modules/programs/broot/broot.nix b/tests/modules/programs/broot/broot.nix index 440691cf..d55438eb 100644 --- a/tests/modules/programs/broot/broot.nix +++ b/tests/modules/programs/broot/broot.nix @@ -13,12 +13,16 @@ with lib; assertFileExists home-files/.config/broot/conf.toml assertFileContent home-files/.config/broot/conf.toml ${ pkgs.writeText "broot.expected" '' + content_search_max_file_size = "10MB" imports = ["verbs.hjson", {file = "dark-blue-skin.hjson", luma = ["dark", "unknown"]}, {file = "white-skin.hjson", luma = "light"}] modal = true show_selection_mark = true verbs = [] [skin] + + [special_paths] + "/media" = "no-enter" '' } ''; From d7a3c268542eadfc480c0dd362cd7d4b6eb2a536 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 28 Dec 2022 20:49:19 +0100 Subject: [PATCH 168/233] broot: simplify test slightly --- tests/modules/programs/broot/broot.nix | 48 ++++++++++++-------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/tests/modules/programs/broot/broot.nix b/tests/modules/programs/broot/broot.nix index d55438eb..b39929e3 100644 --- a/tests/modules/programs/broot/broot.nix +++ b/tests/modules/programs/broot/broot.nix @@ -1,30 +1,26 @@ -{ config, lib, pkgs, ... }: - -with lib; +{ ... }: { - config = { - programs.broot = { - enable = true; - settings.modal = true; - }; - - nmt.script = '' - assertFileExists home-files/.config/broot/conf.toml - assertFileContent home-files/.config/broot/conf.toml ${ - pkgs.writeText "broot.expected" '' - content_search_max_file_size = "10MB" - imports = ["verbs.hjson", {file = "dark-blue-skin.hjson", luma = ["dark", "unknown"]}, {file = "white-skin.hjson", luma = "light"}] - modal = true - show_selection_mark = true - verbs = [] - - [skin] - - [special_paths] - "/media" = "no-enter" - '' - } - ''; + programs.broot = { + enable = true; + settings.modal = true; }; + + nmt.script = '' + assertFileExists home-files/.config/broot/conf.toml + assertFileContent home-files/.config/broot/conf.toml ${ + builtins.toFile "broot.expected" '' + content_search_max_file_size = "10MB" + imports = ["verbs.hjson", {file = "dark-blue-skin.hjson", luma = ["dark", "unknown"]}, {file = "white-skin.hjson", luma = "light"}] + modal = true + show_selection_mark = true + verbs = [] + + [skin] + + [special_paths] + "/media" = "no-enter" + '' + } + ''; } From 5a570962a918050e63aeb168d70fd2eaaf32588b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 28 Dec 2022 03:59:19 +0000 Subject: [PATCH 169/233] 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/757b82211463dd5ba1475b6851d3731dfe14d377' (2022-12-16) → 'github:nixos/nixpkgs/fad51abd42ca17a60fc1d4cb9382e2d79ae31836' (2022-12-25) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 483046f5..a334b24b 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1671200928, - "narHash": "sha256-mZfzDyzojwj6I0wyooIjGIn81WtGVnx6+avU5Wv+VKU=", + "lastModified": 1671983799, + "narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=", "owner": "nixos", "repo": "nixpkgs", - "rev": "757b82211463dd5ba1475b6851d3731dfe14d377", + "rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836", "type": "github" }, "original": { From 3ad22341a27c856a8dd390ef7a036e0007153acf Mon Sep 17 00:00:00 2001 From: Mika Naylor Date: Sat, 24 Dec 2022 14:00:20 +0100 Subject: [PATCH 170/233] direnv: enable nushell integration This enables nushell integration by default for direnv, similar to bash/zsh/fish. The slightly verbose way of setting this is to ensure that peoples' existing nushell configuration isn't overwritten, only appended to, as would be the case if we just used the integration example from the nushell docs: https://www.nushell.sh/cookbook/direnv.html Closes #3520 --- modules/programs/direnv.nix | 25 +++++++++++++++++++++++ tests/modules/programs/direnv/default.nix | 1 + tests/modules/programs/direnv/nushell.nix | 19 +++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 tests/modules/programs/direnv/nushell.nix diff --git a/modules/programs/direnv.nix b/modules/programs/direnv.nix index ad294b2e..1d6ef212 100644 --- a/modules/programs/direnv.nix +++ b/modules/programs/direnv.nix @@ -80,6 +80,15 @@ in { ''; }; + enableNushellIntegration = mkOption { + default = true; + type = types.bool; + readOnly = true; + description = '' + Whether to enable Nushell integration. + ''; + }; + nix-direnv = { enable = mkEnableOption '' Date: Wed, 21 Dec 2022 18:02:53 -0500 Subject: [PATCH 171/233] fish: set tmp $HOME to silence errors --- modules/programs/fish.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index 55a7c1cc..fe6c4a92 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -150,7 +150,7 @@ let nativeBuildInputs = [ cfg.package ]; inherit text; passAsFile = [ "text" ]; - } "fish_indent < $textPath > $out"; + } "env HOME=$(mktemp -d) fish_indent < $textPath > $out"; in { imports = [ From d38dbec8094681a02812adda752f934c3489b6db Mon Sep 17 00:00:00 2001 From: Even Brenden Date: Thu, 8 Dec 2022 12:24:04 +0100 Subject: [PATCH 172/233] parcellite: add extraOptions option Even though `--no-icon` is currently the only viable option for both parcellite and clipit, other options may be added to later releases. --- modules/services/parcellite.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/services/parcellite.nix b/modules/services/parcellite.nix index 6ed9946b..a5cf8859 100644 --- a/modules/services/parcellite.nix +++ b/modules/services/parcellite.nix @@ -12,6 +12,15 @@ in { options.services.parcellite = { enable = mkEnableOption "Parcellite"; + extraOptions = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ "--no-icon" ]; + description = '' + Command line arguments passed to Parcellite. + ''; + }; + package = mkOption { type = types.package; default = pkgs.parcellite; @@ -40,7 +49,9 @@ in { Install = { WantedBy = [ "graphical-session.target" ]; }; Service = { - ExecStart = "${cfg.package}/bin/${cfg.package.pname}"; + ExecStart = "${cfg.package}/bin/${cfg.package.pname} ${ + lib.concatStringsSep " " cfg.extraOptions + }"; Restart = "on-abort"; }; }; From 8745cc9a21658260437b20968278f16565021662 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 28 Dec 2022 22:16:14 +0100 Subject: [PATCH 173/233] parcellite: add basic test case --- modules/services/parcellite.nix | 2 +- tests/default.nix | 1 + tests/modules/services/parcellite/default.nix | 1 + .../parcellite/parcellite-expected.service | 13 +++++++++++++ .../modules/services/parcellite/parcellite.nix | 18 ++++++++++++++++++ 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tests/modules/services/parcellite/default.nix create mode 100644 tests/modules/services/parcellite/parcellite-expected.service create mode 100644 tests/modules/services/parcellite/parcellite.nix diff --git a/modules/services/parcellite.nix b/modules/services/parcellite.nix index a5cf8859..39b81e86 100644 --- a/modules/services/parcellite.nix +++ b/modules/services/parcellite.nix @@ -50,7 +50,7 @@ in { Service = { ExecStart = "${cfg.package}/bin/${cfg.package.pname} ${ - lib.concatStringsSep " " cfg.extraOptions + escapeShellArgs cfg.extraOptions }"; Restart = "on-abort"; }; diff --git a/tests/default.nix b/tests/default.nix index 21ae251d..1459f86b 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -185,6 +185,7 @@ import nmt { ./modules/services/mpd ./modules/services/mpdris2 ./modules/services/pantalaimon + ./modules/services/parcellite ./modules/services/pbgopy ./modules/services/picom ./modules/services/playerctld diff --git a/tests/modules/services/parcellite/default.nix b/tests/modules/services/parcellite/default.nix new file mode 100644 index 00000000..5cf326b1 --- /dev/null +++ b/tests/modules/services/parcellite/default.nix @@ -0,0 +1 @@ +{ parcellite = ./parcellite.nix; } diff --git a/tests/modules/services/parcellite/parcellite-expected.service b/tests/modules/services/parcellite/parcellite-expected.service new file mode 100644 index 00000000..02d8243a --- /dev/null +++ b/tests/modules/services/parcellite/parcellite-expected.service @@ -0,0 +1,13 @@ +[Install] +WantedBy=graphical-session.target + +[Service] +ExecStart=@parcellite@/bin/parcellite '--no-icon' +Restart=on-abort + +[Unit] +After=graphical-session-pre.target +After=tray.target +Description=Lightweight GTK+ clipboard manager +PartOf=graphical-session.target +Requires=tray.target diff --git a/tests/modules/services/parcellite/parcellite.nix b/tests/modules/services/parcellite/parcellite.nix new file mode 100644 index 00000000..25e553bc --- /dev/null +++ b/tests/modules/services/parcellite/parcellite.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: + +{ + services.parcellite = { + enable = true; + package = config.lib.test.mkStubPackage { + name = "parcellite"; + outPath = "@parcellite@"; + }; + extraOptions = [ "--no-icon" ]; + }; + + nmt.script = '' + assertFileContent \ + "home-files/.config/systemd/user/parcellite.service" \ + ${./parcellite-expected.service} + ''; +} From fb49fbc3684154df979618670ccc55819d4b9759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Wygoda?= Date: Sat, 27 Aug 2022 20:52:41 +0200 Subject: [PATCH 174/233] clipman: add module --- .github/CODEOWNERS | 3 + modules/lib/maintainers.nix | 6 ++ modules/misc/news.nix | 8 +++ modules/modules.nix | 1 + modules/services/clipman.nix | 58 +++++++++++++++++++ tests/default.nix | 1 + .../clipman/clipman-sway-session-target.nix | 20 +++++++ .../clipman-sway-session-target.service | 13 +++++ tests/modules/services/clipman/default.nix | 1 + 9 files changed, 111 insertions(+) create mode 100644 modules/services/clipman.nix create mode 100644 tests/modules/services/clipman/clipman-sway-session-target.nix create mode 100644 tests/modules/services/clipman/clipman-sway-session-target.service create mode 100644 tests/modules/services/clipman/default.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 22c23275..9ade1106 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -369,6 +369,9 @@ Makefile @thiagokokada /modules/services/cbatticon.nix @pmiddend +/modules/services/clipman.nix @jwygoda +/tests/modules/services/clipman @jwygoda + /modules/services/clipmenu.nix @DamienCassou /modules/services/devilspie2.nix @dawidsowa diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 5b557644..7aa1842a 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -233,6 +233,12 @@ githubId = 1553581; name = "Josh Robson Chase"; }; + jwygoda = { + name = "Jarosław Wygoda"; + email = "jaroslaw@wygoda.me"; + github = "jwygoda"; + githubId = 20658981; + }; hawkw = { name = "Eliza Weisman"; email = "eliza@elizas.website"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 1be3e26f..9ed95f3d 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -869,6 +869,14 @@ in A new module is available: 'services.cachix-agent'. ''; } + + { + time = "2022-12-28T21:48:22+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.clipman'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 44aa17da..7e6d2e71 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -207,6 +207,7 @@ let ./services/cachix-agent.nix ./services/caffeine.nix ./services/cbatticon.nix + ./services/clipman.nix ./services/clipmenu.nix ./services/devilspie2.nix ./services/dropbox.nix diff --git a/modules/services/clipman.nix b/modules/services/clipman.nix new file mode 100644 index 00000000..4afee9a3 --- /dev/null +++ b/modules/services/clipman.nix @@ -0,0 +1,58 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.clipman; + +in { + meta.maintainers = [ maintainers.jwygoda ]; + + options.services.clipman = { + enable = mkEnableOption "clipman, a simple clipboard manager for Wayland"; + + package = mkPackageOption pkgs "clipman" { }; + + systemdTarget = mkOption { + type = types.str; + default = "graphical-session.target"; + example = "sway-session.target"; + description = '' + The systemd target that will automatically start the Waybar service. + + + When setting this value to "sway-session.target", + make sure to also enable , + otherwise the service may never be started. + ''; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.clipman" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + systemd.user.services.clipman = { + Unit = { + Description = "Clipboard management daemon"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" ]; + }; + + Service = { + ExecStart = + "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${cfg.package}/bin/clipman store"; + ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID"; + Restart = "on-failure"; + KillMode = "mixed"; + }; + + Install = { WantedBy = [ cfg.systemdTarget ]; }; + }; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 1459f86b..ac31f3b5 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -167,6 +167,7 @@ import nmt { ./modules/services/barrier ./modules/services/borgmatic ./modules/services/cachix-agent + ./modules/services/clipman ./modules/services/devilspie2 ./modules/services/dropbox ./modules/services/emacs diff --git a/tests/modules/services/clipman/clipman-sway-session-target.nix b/tests/modules/services/clipman/clipman-sway-session-target.nix new file mode 100644 index 00000000..129ab554 --- /dev/null +++ b/tests/modules/services/clipman/clipman-sway-session-target.nix @@ -0,0 +1,20 @@ +{ ... }: + +{ + home.stateVersion = "21.11"; + + services.clipman = { + enable = true; + systemdTarget = "sway-session.target"; + }; + + test.stubs = { + clipman = { }; + wl-clipboard = { }; + }; + + nmt.script = '' + serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/clipman.service) + assertFileContent "$serviceFile" ${./clipman-sway-session-target.service} + ''; +} diff --git a/tests/modules/services/clipman/clipman-sway-session-target.service b/tests/modules/services/clipman/clipman-sway-session-target.service new file mode 100644 index 00000000..0d0478cc --- /dev/null +++ b/tests/modules/services/clipman/clipman-sway-session-target.service @@ -0,0 +1,13 @@ +[Install] +WantedBy=sway-session.target + +[Service] +ExecReload=/nix/store/00000000000000000000000000000000-coreutils/bin/kill -SIGUSR2 $MAINPID +ExecStart=@wl-clipboard@/bin/wl-paste -t text --watch @clipman@/bin/clipman store +KillMode=mixed +Restart=on-failure + +[Unit] +After=graphical-session.target +Description=Clipboard management daemon +PartOf=graphical-session.target diff --git a/tests/modules/services/clipman/default.nix b/tests/modules/services/clipman/default.nix new file mode 100644 index 00000000..abca59c0 --- /dev/null +++ b/tests/modules/services/clipman/default.nix @@ -0,0 +1 @@ +{ clipman-sway-session-target = ./clipman-sway-session-target.nix; } From fa1bc088ea7b20c0204e8d5c20fec4be938bd5eb Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 28 Dec 2022 23:20:17 +0100 Subject: [PATCH 175/233] gitui: update default theme to match upstream Fixes #3506 --- modules/programs/gitui.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/programs/gitui.nix b/modules/programs/gitui.nix index ee6572bc..710e3fd9 100644 --- a/modules/programs/gitui.nix +++ b/modules/programs/gitui.nix @@ -41,6 +41,8 @@ in { selected_tab: Reset, command_fg: White, selection_bg: Blue, + selection_fg: White, + cmdbar_bg: Blue, cmdbar_extra_lines_bg: Blue, disabled_fg: DarkGray, diff_line_add: Green, @@ -55,6 +57,8 @@ in { danger_fg: Red, push_gauge_bg: Blue, push_gauge_fg: Reset, + tag_fg: LightMagenta, + branch_fg: LightYellow, ) ''; description = '' From a993eac1065c6ce63a8d724b7bccf624d0e91ca2 Mon Sep 17 00:00:00 2001 From: Ramses <141248+R-VdP@users.noreply.github.com> Date: Thu, 29 Dec 2022 01:48:45 +0100 Subject: [PATCH 176/233] neovim: fix extraLuaPackages type. (#3533) Assigning to `programs.neovim.extraLuaPackages` a function taking a lua package set as input and returning a list of packages, as described in the documentation, threw an error because the rest of the code assumed that the value was always a plain list. Using `lib.types.coercedTo`, we can accept such functions, as per the documentation, as well as plain lists, which we then convert to a function ignoring its input argument. We print a warning when a plain list is assigned, since the function form is preferred, as it ensures that the right lua package set is used. For the lua packages, we also get the lua package set from the finalPackage, to make sure that we are always using the same package set as the actual unwrapped neovim package being built. For `programs.neovim.extraPythonPackages` I did the same. I updated the test case so that we test both ways of setting these options. --- modules/programs/neovim.nix | 98 +++++++++++++---------- tests/modules/programs/neovim/runtime.nix | 44 +++++----- 2 files changed, 81 insertions(+), 61 deletions(-) diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index 4560c930..41b81c63 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -13,25 +13,6 @@ let jsonFormat = pkgs.formats.json { }; - extraPython3PackageType = mkOptionType { - name = "extra-python3-packages"; - description = "python3 packages in python.withPackages format"; - check = with types; - (x: if isFunction x then isList (x pkgs.python3Packages) else false); - merge = mergeOneOption; - }; - - # Currently, upstream Neovim is pinned on Lua 5.1 for LuaJIT support. - # This will need to be updated if Neovim ever migrates to a newer - # version of Lua. - extraLua51PackageType = mkOptionType { - name = "extra-lua51-packages"; - description = "lua5.1 packages in lua5_1.withPackages format"; - check = with types; - (x: if isFunction x then isList (x pkgs.lua51Packages) else false); - merge = mergeOneOption; - }; - pluginWithConfigType = types.submodule { options = { config = mkOption { @@ -80,19 +61,23 @@ let optional = false; }; + luaPackages = cfg.finalPackage.unwrapped.lua.pkgs; + resolvedExtraLuaPackages = cfg.extraLuaPackages luaPackages; + extraMakeWrapperArgs = lib.optionalString (cfg.extraPackages != [ ]) ''--suffix PATH : "${lib.makeBinPath cfg.extraPackages}"''; - extraMakeWrapperLuaCArgs = lib.optionalString (cfg.extraLuaPackages != [ ]) '' - --suffix LUA_CPATH ";" "${ - lib.concatMapStringsSep ";" pkgs.lua51Packages.getLuaCPath - cfg.extraLuaPackages - }"''; - extraMakeWrapperLuaArgs = lib.optionalString (cfg.extraLuaPackages != [ ]) '' - --suffix LUA_PATH ";" "${ - lib.concatMapStringsSep ";" pkgs.lua51Packages.getLuaPath - cfg.extraLuaPackages - }"''; - + extraMakeWrapperLuaCArgs = + lib.optionalString (resolvedExtraLuaPackages != [ ]) '' + --suffix LUA_CPATH ";" "${ + lib.concatMapStringsSep ";" luaPackages.getLuaCPath + resolvedExtraLuaPackages + }"''; + extraMakeWrapperLuaArgs = lib.optionalString (resolvedExtraLuaPackages != [ ]) + '' + --suffix LUA_PATH ";" "${ + lib.concatMapStringsSep ";" luaPackages.getLuaPath + resolvedExtraLuaPackages + }"''; in { imports = [ (mkRemovedOptionModule [ "programs" "neovim" "withPython" ] @@ -164,24 +149,51 @@ in { }; extraPython3Packages = mkOption { - type = with types; either extraPython3PackageType (listOf package); - default = (_: [ ]); + # In case we get a plain list, we need to turn it into a function, + # as expected by the function in nixpkgs. + # The only way to do so is to call `const`, which will ignore its input. + type = with types; + let fromType = listOf package; + in coercedTo fromType (flip warn const '' + Assigning a plain list to extraPython3Packages is deprecated. + Please assign a function taking a package set as argument, so + extraPython3Packages = [ pkgs.python3Packages.xxx ]; + should become + extraPython3Packages = ps: [ ps.xxx ]; + '') (functionTo fromType); + default = _: [ ]; defaultText = literalExpression "ps: [ ]"; - example = literalExpression "(ps: with ps; [ python-language-server ])"; + example = + literalExpression "pyPkgs: with pyPkgs; [ python-language-server ]"; description = '' - A function in python.withPackages format, which returns a - list of Python 3 packages required for your plugins to work. + The extra Python 3 packages required for your plugins to work. + This option accepts a function that takes a Python 3 package set as an argument, + and selects the required Python 3 packages from this package set. + See the example for more info. ''; }; + # We get the Lua package from the final package and use its + # Lua packageset to evaluate the function that this option was set to. + # This ensures that we always use the same Lua version as the Neovim package. extraLuaPackages = mkOption { - type = with types; either extraLua51PackageType (listOf package); - default = [ ]; - defaultText = literalExpression "[ ]"; - example = literalExpression "(ps: with ps; [ luautf8 ])"; + type = with types; + let fromType = listOf package; + in coercedTo fromType (flip warn const '' + Assigning a plain list to extraLuaPackages is deprecated. + Please assign a function taking a package set as argument, so + extraLuaPackages = [ pkgs.lua51Packages.xxx ]; + should become + extraLuaPackages = ps: [ ps.xxx ]; + '') (functionTo fromType); + default = _: [ ]; + defaultText = literalExpression "ps: [ ]"; + example = literalExpression "luaPkgs: with luaPkgs; [ luautf8 ]"; description = '' - A function in lua5_1.withPackages format, which returns a - list of Lua packages required for your plugins to work. + The extra Lua packages required for your plugins to work. + This option accepts a function that takes a Lua package set as an argument, + and selects the required Lua packages from this package set. + See the example for more info. ''; }; @@ -280,7 +292,7 @@ in { }; settings = mkOption { - type = jsonFormat.type; + inherit (jsonFormat) type; default = { }; example = literalExpression '' { @@ -354,7 +366,7 @@ in { grouped = lib.lists.groupBy (x: x.type) pluginsNormalized; concatConfigs = lib.concatMapStrings (p: p.config); configsOnly = lib.foldl - (acc: p: if p.config != null then acc ++ [ (p.config) ] else acc) [ ]; + (acc: p: if p.config != null then acc ++ [ p.config ] else acc) [ ]; in mapAttrs (name: vals: lib.concatStringsSep "\n" (configsOnly vals)) grouped; diff --git a/tests/modules/programs/neovim/runtime.nix b/tests/modules/programs/neovim/runtime.nix index 839b2790..b9d9638a 100644 --- a/tests/modules/programs/neovim/runtime.nix +++ b/tests/modules/programs/neovim/runtime.nix @@ -4,28 +4,36 @@ with lib; { config = { - programs.neovim = { - enable = true; - plugins = with pkgs.vimPlugins; [ - vim-nix - { - plugin = vim-commentary; - runtime = { - "after/ftplugin/c.vim".text = '' - " plugin-specific config - setlocal commentstring=//\ %s - setlocal comments=:// - ''; - }; - } - ]; + programs.neovim = lib.mkMerge [ + { + enable = true; + plugins = with pkgs.vimPlugins; [ + vim-nix + { + plugin = vim-commentary; + runtime = { + "after/ftplugin/c.vim".text = '' + " plugin-specific config + setlocal commentstring=//\ %s + setlocal comments=:// + ''; + }; + } + ]; + } + { + extraPython3Packages = ps: with ps; [ jedi pynvim ]; + extraLuaPackages = ps: with ps; [ luacheck ]; + } + { + extraPython3Packages = with pkgs.python3Packages; [ jedi pynvim ]; + extraLuaPackages = with pkgs.lua51Packages; [ luacheck ]; + } + ]; - extraPython3Packages = (ps: with ps; [ jedi pynvim ]); - }; nmt.script = '' ftplugin="home-files/.config/nvim/after/ftplugin/c.vim" assertFileExists "$ftplugin" ''; }; } - From f97f191fe7a8c190a59d7f22a0f895ccebc8f0d1 Mon Sep 17 00:00:00 2001 From: Loric Brevet Date: Thu, 29 Dec 2022 13:42:24 +0100 Subject: [PATCH 177/233] kakoune: update hooks (#3418) Some hooks were removed in Kakoune, and some were added. This PR updates the list so they are aligned with the latest version of Kakoune. Removed mawww/kakoune@e4fb70e NormalBegin NormalEnd InsertBegin InsertEnd mawww/kakoune@78419bc InsertCompletionSelect Added mawww/kakoune@c8839e7 ClientCreate ClientClose mawww/kakoune@47ba36c RegisterModified mawww/kakoune@f2cc7bc User --- modules/programs/kakoune.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/programs/kakoune.nix b/modules/programs/kakoune.nix index 042b6ee3..32f71890 100644 --- a/modules/programs/kakoune.nix +++ b/modules/programs/kakoune.nix @@ -10,13 +10,9 @@ let options = { name = mkOption { type = types.enum [ - "NormalBegin" "NormalIdle" - "NormalEnd" "NormalKey" - "InsertBegin" "InsertIdle" - "InsertEnd" "InsertKey" "InsertChar" "InsertDelete" @@ -48,8 +44,11 @@ let "RawKey" "InsertCompletionShow" "InsertCompletionHide" - "InsertCompletionSelect" "ModuleLoaded" + "ClientCreate" + "ClientClose" + "RegisterModified" + "User" ]; example = "SetOption"; description = '' From cbacdaba3c7b361defb36e1cdfa03ae4e74eb4a8 Mon Sep 17 00:00:00 2001 From: Stanislav Asunkin <1353637+stasjok@users.noreply.github.com> Date: Thu, 29 Dec 2022 11:40:05 +0300 Subject: [PATCH 178/233] man: update database cache generation Specifically, use the configured man-db package for generating the database cache. --- modules/programs/man.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/man.nix b/modules/programs/man.nix index f3134b37..69ae5cac 100644 --- a/modules/programs/man.nix +++ b/modules/programs/man.nix @@ -69,7 +69,7 @@ in { echo "MANDB_MAP ${manualPages}/share/man $out" > man.conf # Run mandb to generate cache files: - ${pkgs.man-db}/bin/mandb -C man.conf --no-straycats --create \ + ${cfg.package}/bin/mandb -C man.conf --no-straycats --create \ ${manualPages}/share/man ''; in '' From 079a33a0152a39c41e862a7576fa6d57d4b5dbc2 Mon Sep 17 00:00:00 2001 From: leifhelm <31693262+leifhelm@users.noreply.github.com> Date: Thu, 29 Dec 2022 17:37:09 +0100 Subject: [PATCH 179/233] i3: Fix escaping in documentation In nix `${` is escaped like this `''${` and not like this `\${` --- modules/services/window-managers/i3-sway/i3.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/window-managers/i3-sway/i3.nix b/modules/services/window-managers/i3-sway/i3.nix index 277cbe39..dc4ffc2f 100644 --- a/modules/services/window-managers/i3-sway/i3.nix +++ b/modules/services/window-managers/i3-sway/i3.nix @@ -105,7 +105,7 @@ let in lib.mkOptionDefault { "''${modifier}+Return" = "exec i3-sensible-terminal"; "''${modifier}+Shift+q" = "kill"; - "''${modifier}+d" = "exec \${pkgs.dmenu}/bin/dmenu_run"; + "''${modifier}+d" = "exec ''${pkgs.dmenu}/bin/dmenu_run"; } ''; }; From c8f6322303486ab597be92f4b815969e1446438f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Thu, 29 Dec 2022 22:33:15 +0100 Subject: [PATCH 180/233] home-environment: use `lazyAttrsOf` for `home.sessionVariables` (#3541) * home-environment: use `lazyAttrsOf` for `home.sessionVariables` `attrs` has unreasonable merge semantics and is deprecated. `attrsOf` doesn't support variables depending on each other as is recommended in the option's description. * home-environment: restrict `sessionVariables` type The consumer is `toString`, but we don't want to accept e.g. lists. --- modules/home-environment.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index bf83f0d2..098e10b2 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -256,7 +256,7 @@ in home.sessionVariables = mkOption { default = {}; - type = types.attrs; + type = with types; lazyAttrsOf (oneOf [ str path int float ]); example = { EDITOR = "emacs"; GS_OPTIONS = "-sPAPERSIZE=a4"; }; description = '' Environment variables to always set at login. From dd99675ee81fef051809bc87d67eb07f5ba022e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Thu, 29 Dec 2022 22:36:05 +0100 Subject: [PATCH 181/233] vim,neovim: add `defaultEditor` (#3496) Also rename `vim_configurable` to `vim-full` per https://github.com/NixOS/nixpkgs/pull/204438 --- modules/programs/neovim.nix | 11 +++++++++++ modules/programs/vim.nix | 18 +++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index 41b81c63..c8edd225 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -241,6 +241,15 @@ in { description = "Resulting customized neovim package."; }; + defaultEditor = mkOption { + type = types.bool; + default = false; + description = '' + Whether to configure nvim as the default + editor using the EDITOR environment variable. + ''; + }; + extraConfig = mkOption { type = types.lines; default = ""; @@ -372,6 +381,8 @@ in { home.packages = [ cfg.finalPackage ]; + home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "nvim"; }; + xdg.configFile = let hasLuaConfig = hasAttr "lua" config.programs.neovim.generatedConfigs; in mkMerge ( diff --git a/modules/programs/vim.nix b/modules/programs/vim.nix index 46e5f95d..e4d993a6 100644 --- a/modules/programs/vim.nix +++ b/modules/programs/vim.nix @@ -127,9 +127,19 @@ in { packageConfigurable = mkOption { type = types.package; - description = "Configurable vim package"; - default = pkgs.vim_configurable; - defaultText = "pkgs.vim_configurable"; + description = "Vim package to customize"; + default = pkgs.vim-full or pkgs.vim_configurable; + defaultText = literalExpression "pkgs.vim-full"; + example = literalExpression "pkgs.vim"; + }; + + defaultEditor = mkOption { + type = types.bool; + default = false; + description = '' + Whether to configure vim as the default + editor using the EDITOR environment variable. + ''; }; }; }; @@ -170,6 +180,8 @@ in { home.packages = [ cfg.package ]; + home.sessionVariables = mkIf cfg.defaultEditor { EDITOR = "vim"; }; + programs.vim = { package = vim; plugins = defaultPlugins; From c1a830c8fabb13f95f51ecf48552f0a794d8718a Mon Sep 17 00:00:00 2001 From: Wiseh <55264980+Wisehh@users.noreply.github.com> Date: Mon, 2 Jan 2023 14:36:23 -0500 Subject: [PATCH 182/233] feh: Add package option (#3552) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Naïm Favier Co-authored-by: Sumner Evans --- modules/programs/feh.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/programs/feh.nix b/modules/programs/feh.nix index e098342b..15aac175 100644 --- a/modules/programs/feh.nix +++ b/modules/programs/feh.nix @@ -27,6 +27,8 @@ in { options.programs.feh = { enable = mkEnableOption "feh - a fast and light image viewer"; + package = mkPackageOption pkgs "feh" { }; + buttons = mkOption { default = { }; type = with types; bindingsOf (either str int); @@ -69,7 +71,7 @@ in { "To disable a keybinding, use `null` instead of an empty string."; }]; - home.packages = [ pkgs.feh ]; + home.packages = [ cfg.package ]; xdg.configFile."feh/buttons" = mkIf (cfg.buttons != { }) { text = renderBindings cfg.buttons + "\n"; }; From d01e7280ad7d13a5a0fae57355bd0dbfe5b81969 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 3 Jan 2023 19:26:08 +0100 Subject: [PATCH 183/233] i3-sway: Use foot as default terminal on sway (#3490) --- modules/services/window-managers/i3-sway/lib/options.nix | 5 +---- .../window-managers/sway/sway-bar-focused-colors.conf | 2 +- .../sway/sway-bindkeys-to-code-and-extra-config.conf | 2 +- .../modules/services/window-managers/sway/sway-default.conf | 2 +- .../window-managers/sway/sway-followmouse-expected.conf | 2 +- .../sway/sway-followmouse-legacy-expected.conf | 2 +- .../modules/services/window-managers/sway/sway-modules.conf | 2 +- .../services/window-managers/sway/sway-null-package.conf | 2 +- tests/modules/services/window-managers/sway/sway-stubs.nix | 2 +- .../sway/sway-workspace-default-expected.conf | 2 +- .../window-managers/sway/sway-workspace-output-expected.conf | 2 +- 11 files changed, 11 insertions(+), 14 deletions(-) diff --git a/modules/services/window-managers/i3-sway/lib/options.nix b/modules/services/window-managers/i3-sway/lib/options.nix index cae9c3a6..600121e0 100644 --- a/modules/services/window-managers/i3-sway/lib/options.nix +++ b/modules/services/window-managers/i3-sway/lib/options.nix @@ -835,10 +835,7 @@ in { terminal = mkOption { type = types.str; - default = if isI3 then - "i3-sensible-terminal" - else - "${pkgs.rxvt-unicode-unwrapped}/bin/urxvt"; + default = if isI3 then "i3-sensible-terminal" else "${pkgs.foot}/bin/foot"; description = "Default terminal to run."; example = "alacritty"; }; diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf index 22d00e6a..a3b9905d 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf @@ -27,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf index 9ed389bc..65780062 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf @@ -29,7 +29,7 @@ bindsym --to-code Mod1+8 workspace number 8 bindsym --to-code Mod1+9 workspace number 9 bindsym --to-code Mod1+Down focus down bindsym --to-code Mod1+Left focus left -bindsym --to-code Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym --to-code Mod1+Return exec @foot@/bin/foot bindsym --to-code Mod1+Right focus right bindsym --to-code Mod1+Shift+1 move container to workspace number 1 bindsym --to-code Mod1+Shift+2 move container to workspace number 2 diff --git a/tests/modules/services/window-managers/sway/sway-default.conf b/tests/modules/services/window-managers/sway/sway-default.conf index dc1ff8b8..e1fa6626 100644 --- a/tests/modules/services/window-managers/sway/sway-default.conf +++ b/tests/modules/services/window-managers/sway/sway-default.conf @@ -27,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf index c1a62721..bf996637 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-expected.conf @@ -27,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf index 65e96575..d93031c9 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-followmouse-legacy-expected.conf @@ -27,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 diff --git a/tests/modules/services/window-managers/sway/sway-modules.conf b/tests/modules/services/window-managers/sway/sway-modules.conf index 551fafd7..b217f884 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.conf +++ b/tests/modules/services/window-managers/sway/sway-modules.conf @@ -27,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 diff --git a/tests/modules/services/window-managers/sway/sway-null-package.conf b/tests/modules/services/window-managers/sway/sway-null-package.conf index dc1ff8b8..e1fa6626 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.conf +++ b/tests/modules/services/window-managers/sway/sway-null-package.conf @@ -27,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 diff --git a/tests/modules/services/window-managers/sway/sway-stubs.nix b/tests/modules/services/window-managers/sway/sway-stubs.nix index 55a74e1c..2ae673c7 100644 --- a/tests/modules/services/window-managers/sway/sway-stubs.nix +++ b/tests/modules/services/window-managers/sway/sway-stubs.nix @@ -3,7 +3,7 @@ # not containing hashes, version numbers etc. test.stubs = { dmenu = { }; - rxvt-unicode-unwrapped = { }; + foot = { }; i3status = { }; sway = { }; sway-unwrapped = { version = "1"; }; diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf index c5daf6ec..b783d4c2 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf @@ -26,7 +26,7 @@ bindsym Mod1+7 workspace number 7 bindsym Mod1+8 workspace number 8 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf index 4c91dc7e..94ba5e27 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf @@ -27,7 +27,7 @@ bindsym Mod1+8 workspace number 8 bindsym Mod1+9 workspace number 9 bindsym Mod1+Down focus down bindsym Mod1+Left focus left -bindsym Mod1+Return exec @rxvt-unicode-unwrapped@/bin/urxvt +bindsym Mod1+Return exec @foot@/bin/foot bindsym Mod1+Right focus right bindsym Mod1+Shift+1 move container to workspace number 1 bindsym Mod1+Shift+2 move container to workspace number 2 From 498c46ea5d7e05b74049730582153535be5a4c54 Mon Sep 17 00:00:00 2001 From: corbinallison <97998726+corbinallison@users.noreply.github.com> Date: Tue, 3 Jan 2023 14:09:52 -0600 Subject: [PATCH 184/233] fluxbox: fix a typo, windowMenu -> windowmenu (#3544) --- modules/services/window-managers/fluxbox.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/services/window-managers/fluxbox.nix b/modules/services/window-managers/fluxbox.nix index a41b97fc..6b05d295 100644 --- a/modules/services/window-managers/fluxbox.nix +++ b/modules/services/window-managers/fluxbox.nix @@ -112,7 +112,7 @@ in { ".fluxbox/menu" = mkIf (cfg.menu != "") { text = cfg.menu; }; ".fluxbox/slitlist" = mkIf (cfg.slitlist != "") { text = cfg.slitlist; }; ".fluxbox/windowmenu" = - mkIf (cfg.windowMenu != "") { text = cfg.windowmenu; }; + mkIf (cfg.windowmenu != "") { text = cfg.windowmenu; }; }; xsession.windowManager.command = concatStringsSep " " From 54245e1820caabd8a0b53ce4d47e4d0fefe04cd4 Mon Sep 17 00:00:00 2001 From: polykernel <81340136+polykernel@users.noreply.github.com> Date: Tue, 3 Jan 2023 16:21:40 -0500 Subject: [PATCH 185/233] home.pointerCursor: use mkDefault to set XCURSOR_PATH (#3553) fixes https://github.com/nix-community/home-manager/issues/3551 --- modules/config/home-cursor.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/config/home-cursor.nix b/modules/config/home-cursor.nix index d8cbb539..a2467736 100644 --- a/modules/config/home-cursor.nix +++ b/modules/config/home-cursor.nix @@ -131,8 +131,8 @@ in { # https://github.com/nix-community/home-manager/issues/2812 # https://wiki.archlinux.org/title/Cursor_themes#Environment_variable home.sessionVariables = { - XCURSOR_PATH = "$XCURSOR_PATH\${XCURSOR_PATH:+:}" - + "${config.home.profileDirectory}/share/icons"; + XCURSOR_PATH = mkDefault ("$XCURSOR_PATH\${XCURSOR_PATH:+:}" + + "${config.home.profileDirectory}/share/icons"); }; } From 3ecd5305a41b6dd87f6cdf8cfe83ac07bdc47a0f Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sun, 1 Jan 2023 01:02:45 +0100 Subject: [PATCH 186/233] docs: bump nmd - Simplifies DocBook build by generation version DocBook 5 files directly. - Make DocBook generate consistent anchor IDs. --- docs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index dc304ae2..23b0bbc6 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,8 +7,8 @@ let nmdSrc = fetchTarball { url = - "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169"; - sha256 = "0c2nq28rw4v559s3f1nf6y2p6fladgmbqgbsyf3vzs2przn5qn37"; + "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=fb9cf8e991487c6923f3c654b8ae51b6f0f205ce"; + sha256 = "05233fy7mnn1l7ylwdmmig4ny1kwk3a2cs740gnbs0d5p28kas2r"; }; nmd = import nmdSrc { inherit lib pkgs; }; From 1786883425208d3bf726ab6a1889beddeb46cdbc Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 6 Jan 2023 06:49:20 +0200 Subject: [PATCH 187/233] easyeffects: add package option (#3568) --- modules/services/easyeffects.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/services/easyeffects.nix b/modules/services/easyeffects.nix index 001ff5d0..9dd01b94 100644 --- a/modules/services/easyeffects.nix +++ b/modules/services/easyeffects.nix @@ -20,6 +20,13 @@ in { to your system configuration for the daemon to work correctly''; + package = mkOption { + type = types.package; + default = pkgs.easyeffects; + defaultText = literalExpression "pkgs.easyeffects"; + description = "The easyeffects package to use."; + }; + preset = mkOption { type = types.str; default = ""; @@ -38,7 +45,7 @@ in { # running easyeffects 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 = with pkgs; [ easyeffects at-spi2-core ]; + home.packages = with pkgs; [ cfg.package at-spi2-core ]; systemd.user.services.easyeffects = { Unit = { @@ -52,8 +59,8 @@ in { Service = { ExecStart = - "${pkgs.easyeffects}/bin/easyeffects --gapplication-service ${presetOpts}"; - ExecStop = "${pkgs.easyeffects}/bin/easyeffects --quit"; + "${cfg.package}/bin/easyeffects --gapplication-service ${presetOpts}"; + ExecStop = "${cfg.package}/bin/easyeffects --quit"; Restart = "on-failure"; RestartSec = 5; }; From 709a87fe3300fc791734956125c4666a4fd42c69 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 6 Jan 2023 22:41:20 +0100 Subject: [PATCH 188/233] docs: bump nmd - Introduces support for Markdown documentation in modules. --- docs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 23b0bbc6..48ac5cfd 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,8 +7,8 @@ let nmdSrc = fetchTarball { url = - "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=fb9cf8e991487c6923f3c654b8ae51b6f0f205ce"; - sha256 = "05233fy7mnn1l7ylwdmmig4ny1kwk3a2cs740gnbs0d5p28kas2r"; + "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=0a41b6979f6ce238c5e3795d63fdaa15f650d839"; + sha256 = "0f4jxnnc77z9fksfa6kx0qysbwiahbd26dm2xkdhdgaxxb1pgj0g"; }; nmd = import nmdSrc { inherit lib pkgs; }; From 2cff1c764209c79d0a09a19384bfef285bc42ef1 Mon Sep 17 00:00:00 2001 From: Olmo Kramer Date: Sat, 7 Jan 2023 11:59:51 +0100 Subject: [PATCH 189/233] ncmpcpp: Allow `str` type values for `mpdMusicDir` option (#3565) The default value of `programs.ncmpcpp.mpdMusicDir` is taken from `services.mpd.musicDirectory` if the mpd module is enabled, which has type `either path str`. `programs.ncmpcpp.mpdMusicDir` did not accept `str` values, though, so an error was raised when the default value was used and `services.mpd.musicDirectory` was set to a value of type `str`. This commit changes the type of `programs.ncmpcpp.mpdMusicDir` to also accept `str` to reflect the type of `services.mpd.musicDirectory`. Fixes #3560 --- modules/programs/ncmpcpp.nix | 4 +-- .../programs/ncmpcpp-linux/default.nix | 5 +++- .../ncmpcpp-issue-3560-expected-config | 1 + .../ncmpcpp-linux/ncmpcpp-issue-3560.nix | 25 +++++++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560-expected-config create mode 100644 tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix diff --git a/modules/programs/ncmpcpp.nix b/modules/programs/ncmpcpp.nix index e3784951..5f9bd36e 100644 --- a/modules/programs/ncmpcpp.nix +++ b/modules/programs/ncmpcpp.nix @@ -62,7 +62,7 @@ in { }; mpdMusicDir = mkOption { - type = types.nullOr types.path; + type = with types; nullOr (coercedTo path toString str); default = let mpdCfg = config.services.mpd; in if pkgs.stdenv.hostPlatform.isLinux && mpdCfg.enable then mpdCfg.musicDirectory @@ -123,7 +123,7 @@ in { xdg.configFile = { "ncmpcpp/config" = let settings = cfg.settings // optionalAttrs (cfg.mpdMusicDir != null) { - mpd_music_dir = toString cfg.mpdMusicDir; + mpd_music_dir = cfg.mpdMusicDir; }; in mkIf (settings != { }) { text = renderSettings settings + "\n"; }; diff --git a/tests/modules/programs/ncmpcpp-linux/default.nix b/tests/modules/programs/ncmpcpp-linux/default.nix index b1185c85..41933927 100644 --- a/tests/modules/programs/ncmpcpp-linux/default.nix +++ b/tests/modules/programs/ncmpcpp-linux/default.nix @@ -1 +1,4 @@ -{ ncmpcpp-use-mpd-config = ./ncmpcpp-use-mpd-config.nix; } +{ + ncmpcpp-use-mpd-config = ./ncmpcpp-use-mpd-config.nix; + ncmpcpp-issue-3560 = ./ncmpcpp-issue-3560.nix; +} diff --git a/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560-expected-config b/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560-expected-config new file mode 100644 index 00000000..24a2f3bc --- /dev/null +++ b/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560-expected-config @@ -0,0 +1 @@ +mpd_music_dir=~/music diff --git a/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix b/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix new file mode 100644 index 00000000..ba1607ab --- /dev/null +++ b/tests/modules/programs/ncmpcpp-linux/ncmpcpp-issue-3560.nix @@ -0,0 +1,25 @@ +{ pkgs, ... }: + +{ + config = { + # Minimal config reproducing + # https://github.com/nix-community/home-manager/issues/3560 + programs.ncmpcpp.enable = true; + + services.mpd.enable = true; + services.mpd.musicDirectory = "~/music"; + + test.stubs = { + ncmpcpp = { }; + mpd = { }; + }; + + nmt.script = '' + assertFileContent \ + home-files/.config/ncmpcpp/config \ + ${./ncmpcpp-issue-3560-expected-config} + + assertPathNotExists home-files/.config/ncmpcpp/bindings + ''; + }; +} From 9e565f0d9d41c19a94f55af205c328ec5177fc0a Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sat, 7 Jan 2023 11:46:08 +0100 Subject: [PATCH 190/233] docs: bump nmd Fixes #3573 --- docs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 48ac5cfd..aa521229 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,8 +7,8 @@ let nmdSrc = fetchTarball { url = - "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=0a41b6979f6ce238c5e3795d63fdaa15f650d839"; - sha256 = "0f4jxnnc77z9fksfa6kx0qysbwiahbd26dm2xkdhdgaxxb1pgj0g"; + "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=ea7cde202c32199c1d904d8ebadc55cd1aa1425a"; + sha256 = "1di73d2vmbzrxcmrxan1xpdnmb54kydmzlpadrn2bb29h17nfk6m"; }; nmd = import nmdSrc { inherit lib pkgs; }; From 684bdb386cec7d4f16e0da9f694c8ab50ad2cf2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=A9tan=20Lepage?= <33058747+GaetanLepage@users.noreply.github.com> Date: Sun, 8 Jan 2023 22:05:36 +0100 Subject: [PATCH 191/233] i3: remove i3/i3-gaps distinction (#3563) --- docs/release-notes/rl-2305.adoc | 6 ++- modules/misc/news.nix | 9 ++++ .../services/window-managers/i3-sway/i3.nix | 17 +------- .../window-managers/i3-sway/lib/options.nix | 43 ++++++++++++------- 4 files changed, 43 insertions(+), 32 deletions(-) diff --git a/docs/release-notes/rl-2305.adoc b/docs/release-notes/rl-2305.adoc index 8c737db1..6d16e784 100644 --- a/docs/release-notes/rl-2305.adoc +++ b/docs/release-notes/rl-2305.adoc @@ -16,4 +16,8 @@ This release has the following notable changes: The state version in this release includes the changes below. These changes are only active if the `home.stateVersion` option is set to "23.05" or later. -* No changes. +* The <>, +<>, +<>, +<>, options now default to `true` which +is consistent with the default values for those options used by `i3` and `sway`. diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 9ed95f3d..f59d50b5 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -877,6 +877,15 @@ in A new module is available: 'services.clipman'. ''; } + + { + time = "2023-01-07T10:47:03+00:00"; + condition = hostPlatform.isLinux; + message = '' + 'xsession.windowManager.i3.config.[window|floating].titlebar' and + 'wayland.windowManager.sway.config.[window|floating].titlebar' now default to 'true'. + ''; + } ]; }; } diff --git a/modules/services/window-managers/i3-sway/i3.nix b/modules/services/window-managers/i3-sway/i3.nix index dc4ffc2f..453367ce 100644 --- a/modules/services/window-managers/i3-sway/i3.nix +++ b/modules/services/window-managers/i3-sway/i3.nix @@ -9,7 +9,6 @@ let commonOptions = import ./lib/options.nix { inherit config lib cfg pkgs; moduleName = "i3"; - isGaps = cfg.package == pkgs.i3-gaps; }; configModule = types.submodule { @@ -209,16 +208,7 @@ in { xsession.windowManager.i3 = { enable = mkEnableOption "i3 window manager"; - package = mkOption { - type = types.package; - default = pkgs.i3; - defaultText = literalExpression "pkgs.i3"; - example = literalExpression "pkgs.i3-gaps"; - description = '' - i3 package to use. - If 'i3.config.gaps' settings are specified, 'pkgs.i3-gaps' will be set as a default package. - ''; - }; + package = mkPackageOption pkgs "i3" { }; config = mkOption { type = types.nullOr configModule; @@ -260,10 +250,7 @@ in { }; } - (mkIf (cfg.config != null) { - xsession.windowManager.i3.package = - mkDefault (if (cfg.config.gaps != null) then pkgs.i3-gaps else pkgs.i3); - }) + (mkIf (cfg.config != null) { xsession.windowManager.i3.package = pkgs.i3; }) (mkIf (cfg.config != null) { warnings = (optional (isList cfg.config.fonts) diff --git a/modules/services/window-managers/i3-sway/lib/options.nix b/modules/services/window-managers/i3-sway/lib/options.nix index 600121e0..d04a1176 100644 --- a/modules/services/window-managers/i3-sway/lib/options.nix +++ b/modules/services/window-managers/i3-sway/lib/options.nix @@ -1,5 +1,4 @@ -{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName -, isGaps ? true }: +{ config, lib, moduleName, cfg, pkgs, capitalModuleName ? moduleName }: with lib; @@ -7,6 +6,8 @@ let isI3 = moduleName == "i3"; isSway = !isI3; + inherit (config.home) stateVersion; + fontOptions = types.submodule { options = { names = mkOption { @@ -77,7 +78,7 @@ let barModule = types.submodule { options = let - versionAtLeast2009 = versionAtLeast config.home.stateVersion "20.09"; + versionAtLeast2009 = versionAtLeast stateVersion "20.09"; mkNullableOption = { type, default, ... }@args: mkOption (args // { type = types.nullOr type; @@ -158,7 +159,7 @@ let defaultText = "i3bar"; description = "Command that will be used to start a bar."; example = if isI3 then - "\${pkgs.i3-gaps}/bin/i3bar -t" + "\${pkgs.i3}/bin/i3bar -t" else "\${pkgs.waybar}/bin/waybar"; }; @@ -389,11 +390,17 @@ in { options = { titlebar = mkOption { type = types.bool; - default = !isGaps; - defaultText = if isI3 then - "xsession.windowManager.i3.package != nixpkgs.i3-gaps (titlebar should be disabled for i3-gaps)" + default = if versionOlder stateVersion "23.05" then + (isI3 && (cfg.config.gaps == null)) else - "false"; + true; + defaultText = if isI3 then '' + true for state version ≥ 23.05 + config.gaps == null for state version < 23.05 + '' else '' + true for state version ≥ 23.05 + false for state version < 23.05 + ''; description = "Whether to show window titlebars."; }; @@ -432,11 +439,17 @@ in { options = { titlebar = mkOption { type = types.bool; - default = !isGaps; - defaultText = if isI3 then - "xsession.windowManager.i3.package != nixpkgs.i3-gaps (titlebar should be disabled for i3-gaps)" + default = if versionOlder stateVersion "23.05" then + (isI3 && (cfg.config.gaps == null)) else - "false"; + true; + defaultText = if isI3 then '' + true for state version ≥ 23.05 + config.gaps == null for state version < 23.05 + '' else '' + true for state version ≥ 23.05 + false for state version < 23.05 + ''; description = "Whether to show floating window titlebars."; }; @@ -670,7 +683,7 @@ in { bars = mkOption { type = types.listOf barModule; - default = if versionAtLeast config.home.stateVersion "20.09" then [{ + default = if versionAtLeast stateVersion "20.09" then [{ mode = "dock"; hiddenState = "hide"; position = "bottom"; @@ -826,10 +839,8 @@ in { }; }); default = null; - description = if isSway then '' + description = '' Gaps related settings. - '' else '' - i3Gaps related settings. The i3-gaps package must be used for these features to work. ''; }; From 4f0c1afba75e2c3910cf4037f2b51025902cab24 Mon Sep 17 00:00:00 2001 From: Yurii Matsiuk <24990891+ymatsiuk@users.noreply.github.com> Date: Mon, 9 Jan 2023 08:19:17 +0100 Subject: [PATCH 192/233] firefox: remove https-everywhere from example See https://gitlab.com/rycee/nur-expressions/-/commit/b70c44e8575e65ff63c5f52eb726aa3fc9a86af7 --- modules/programs/firefox.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index a2eebdb4..a0620e28 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -153,7 +153,6 @@ in { default = [ ]; example = literalExpression '' with pkgs.nur.repos.rycee.firefox-addons; [ - https-everywhere privacy-badger ] ''; From 69806e937881c75269e058daecf49d9c39bd034e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Mon, 9 Jan 2023 13:00:21 +0100 Subject: [PATCH 193/233] files: avoid surprises when linking files (#3018) --- modules/files.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/files.nix b/modules/files.nix index a7fd67f5..daeeb0b1 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -185,8 +185,9 @@ in $VERBOSE_ECHO "Skipping '$targetPath' as it is identical to '$sourcePath'" else # Place that symlink, --force + # This can still fail if the target is a directory, in which case we bail out. $DRY_RUN_CMD mkdir -p $VERBOSE_ARG "$(dirname "$targetPath")" - $DRY_RUN_CMD ln -nsf $VERBOSE_ARG "$sourcePath" "$targetPath" + $DRY_RUN_CMD ln -Tsf $VERBOSE_ARG "$sourcePath" "$targetPath" || exit 1 fi done ''; From f1b1594e7b8503dba812c4c1b1392d39da32793d Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 9 Jan 2023 22:47:36 +0100 Subject: [PATCH 194/233] docs: bump nmd Fixes #3579 --- docs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index aa521229..83ac2a32 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,8 +7,8 @@ let nmdSrc = fetchTarball { url = - "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=ea7cde202c32199c1d904d8ebadc55cd1aa1425a"; - sha256 = "1di73d2vmbzrxcmrxan1xpdnmb54kydmzlpadrn2bb29h17nfk6m"; + "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=06c80103396a1a950586c23da1882c977b24bbda"; + sha256 = "15axmplkl7m7fs4c8m53dawhgwkb64hm2v67m59xdknbjjgfrpqb"; }; nmd = import nmdSrc { inherit lib pkgs; }; From 53441838615e4662bb9b69678157eba11cbe5fde Mon Sep 17 00:00:00 2001 From: Petter K Date: Mon, 9 Jan 2023 12:33:58 +0100 Subject: [PATCH 195/233] =?UTF-8?q?Translate=20using=20Weblate=20(Norwegia?= =?UTF-8?q?n=20Bokm=C3=A5l)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 87.5% (28 of 32 strings) Co-authored-by: Petter K Translate-URL: https://hosted.weblate.org/projects/home-manager/cli/nb_NO/ Translation: Home Manager/Home Manager CLI --- home-manager/po/nb_NO.po | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/home-manager/po/nb_NO.po b/home-manager/po/nb_NO.po index 55127791..4ab763af 100644 --- a/home-manager/po/nb_NO.po +++ b/home-manager/po/nb_NO.po @@ -8,16 +8,16 @@ msgstr "" "Project-Id-Version: Home Manager\n" "Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" "POT-Creation-Date: 2022-03-26 15:08+0100\n" -"PO-Revision-Date: 2021-12-13 20:50+0000\n" -"Last-Translator: Allan Nordhøy \n" -"Language-Team: Norwegian Bokmål \n" +"PO-Revision-Date: 2023-01-08 11:50+0000\n" +"Last-Translator: Petter K \n" +"Language-Team: Norwegian Bokmål \n" "Language: nb_NO\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.10-dev\n" +"X-Generator: Weblate 4.15.1-dev\n" #: home-manager/home-manager:60 msgid "No configuration file found at %s" @@ -139,12 +139,13 @@ msgid "Unknown command: %s" msgstr "Ukjent kommando: %s" #: home-manager/install.nix:22 +#, fuzzy msgid "Creating initial Home Manager configuration..." -msgstr "" +msgstr "Oppretter ny Home Manager-konfigurasjon..." #: home-manager/install.nix:66 msgid "Creating initial Home Manager generation..." -msgstr "" +msgstr "Oppretter ny Home Manager-generasjon..." #. translators: The "%s" specifier will be replaced by a file path. #: home-manager/install.nix:71 From 19dccb46f41ecf96663a715a588b5101804c2990 Mon Sep 17 00:00:00 2001 From: Eric Ho Date: Mon, 9 Jan 2023 12:33:58 +0100 Subject: [PATCH 196/233] Translate using Weblate (Chinese (Traditional)) Currently translated at 92.8% (13 of 14 strings) Co-authored-by: Eric Ho Translate-URL: https://hosted.weblate.org/projects/home-manager/modules/zh_Hant/ Translation: Home Manager/Home Manager Modules --- modules/po/zh_Hant.po | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/modules/po/zh_Hant.po b/modules/po/zh_Hant.po index 06f379e0..0e7fc6f8 100644 --- a/modules/po/zh_Hant.po +++ b/modules/po/zh_Hant.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: 2022-03-26 15:08+0100\n" -"PO-Revision-Date: 2021-12-29 08:48+0000\n" -"Last-Translator: WhiredPlanck \n" +"PO-Revision-Date: 2023-01-08 11:50+0000\n" +"Last-Translator: Eric Ho \n" "Language-Team: Chinese (Traditional) \n" "Language: zh_Hant\n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Weblate 4.10.1\n" +"X-Generator: Weblate 4.15.1-dev\n" #: modules/files.nix:233 msgid "Creating home file links in %s" @@ -50,6 +50,18 @@ msgid "" "\n" "Then try activating your Home Manager configuration again." msgstr "" +"糟糕,Nix 未能安裝您的新 Home Manager 配置文件!\n" +"\n" +"也許這裏和使用 \"%s\" 安裝的包有衝突?\n" +"嘗試運行\n" +"\n" +" %s\n" +"\n" +"如果有衝突的包,你可以用\n" +"\n" +" %s\n" +"\n" +"來移除。然後嘗試再次啟用您的 Home Manager 配置。" #: modules/home-environment.nix:639 msgid "Activating %s" @@ -57,7 +69,7 @@ msgstr "正在啟用 %s" #: modules/lib-bash/activation-init.sh:31 msgid "Sanity checking oldGenNum and oldGenPath" -msgstr "" +msgstr "正在進行 oldGenNum 和 oldGenPath 的完整性檢查" #: modules/lib-bash/activation-init.sh:34 msgid "" @@ -81,20 +93,20 @@ msgstr "正在啟動 Home Manager 初始化程式" #: modules/lib-bash/activation-init.sh:55 msgid "Sanity checking Nix" -msgstr "" +msgstr "正在進行 Nix 完整性檢查" #: modules/lib-bash/activation-init.sh:61 msgid "This is a dry run" -msgstr "" +msgstr "這是試運行" #: modules/lib-bash/activation-init.sh:64 msgid "This is a live run" -msgstr "" +msgstr "這是在實際運行" #: modules/lib-bash/activation-init.sh:69 msgid "Using Nix version: %s" -msgstr "" +msgstr "正在使用的 Nix 版本: %s" #: modules/lib-bash/activation-init.sh:72 msgid "Activation variables:" -msgstr "" +msgstr "啟用的變數:" From 6816934f410a80bca858fa130790d4ac6e1a363a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornelijus=20Tvarijanavi=C4=8Dius?= Date: Mon, 9 Jan 2023 12:33:59 +0100 Subject: [PATCH 197/233] Add translation using Weblate (Lithuanian) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kornelijus Tvarijanavičius --- home-manager/po/lt.po | 168 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 home-manager/po/lt.po diff --git a/home-manager/po/lt.po b/home-manager/po/lt.po new file mode 100644 index 00000000..86d63975 --- /dev/null +++ b/home-manager/po/lt.po @@ -0,0 +1,168 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: lt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n % 10 == 1 && (n % 100 < 11 || n % 100 > " +"19)) ? 0 : ((n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) ? " +"1 : 2);\n" + +#: home-manager/home-manager:60 +msgid "No configuration file found at %s" +msgstr "" + +#: home-manager/home-manager:79 +msgid "No configuration file found. Please create one at %s" +msgstr "" + +#: home-manager/home-manager:122 +msgid "Can't inspect options of a flake configuration" +msgstr "" + +#: home-manager/home-manager:162 +msgid "Can't instantiate a flake configuration" +msgstr "" + +#: home-manager/home-manager:237 +msgid "" +"There is %d unread and relevant news item.\n" +"Read it by running the command \"%s news\"." +msgid_plural "" +"There are %d unread and relevant news items.\n" +"Read them by running the command \"%s news\"." +msgstr[0] "" +msgstr[1] "" + +#: home-manager/home-manager:251 +msgid "Unknown \"news.display\" setting \"%s\"." +msgstr "" + +#: home-manager/home-manager:258 +#, sh-format +msgid "Please set the $EDITOR environment variable" +msgstr "" + +#: home-manager/home-manager:273 +msgid "Cannot run build in read-only directory" +msgstr "" + +#: home-manager/home-manager:355 +msgid "No generation with ID %s" +msgstr "" + +#: home-manager/home-manager:357 +msgid "Cannot remove the current generation %s" +msgstr "" + +#: home-manager/home-manager:359 +msgid "Removing generation %s" +msgstr "" + +#: home-manager/home-manager:385 +msgid "No generations to expire" +msgstr "" + +#: home-manager/home-manager:396 +msgid "No home-manager packages seem to be installed." +msgstr "" + +#: home-manager/home-manager:453 +msgid "Unknown argument %s" +msgstr "" + +#: home-manager/home-manager:469 +msgid "This will remove Home Manager from your system." +msgstr "" + +#: home-manager/home-manager:472 +msgid "This is a dry run, nothing will actually be uninstalled." +msgstr "" + +#: home-manager/home-manager:476 +msgid "Really uninstall Home Manager?" +msgstr "" + +#: home-manager/home-manager:481 +msgid "Switching to empty Home Manager configuration..." +msgstr "" + +#: home-manager/home-manager:493 +msgid "Yay!" +msgstr "" + +#: home-manager/home-manager:500 +msgid "Remove all Home Manager generations?" +msgstr "" + +#: home-manager/home-manager:507 +msgid "All generations are now eligible for garbage collection." +msgstr "" + +#: home-manager/home-manager:510 +msgid "Leaving generations but they may still be garbage collected." +msgstr "" + +#: home-manager/home-manager:514 +msgid "Home Manager is uninstalled but your home.nix is left untouched." +msgstr "" + +#: home-manager/home-manager:673 +msgid "%s: unknown option '%s'" +msgstr "" + +#: home-manager/home-manager:674 +msgid "Run '%s --help' for usage help" +msgstr "" + +#: home-manager/home-manager:708 +msgid "expire-generations expects one argument, got %d." +msgstr "" + +#: home-manager/home-manager:730 +msgid "Unknown command: %s" +msgstr "" + +#: home-manager/install.nix:22 +msgid "Creating initial Home Manager configuration..." +msgstr "" + +#: home-manager/install.nix:66 +msgid "Creating initial Home Manager generation..." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a file path. +#: home-manager/install.nix:71 +msgid "" +"All done! The home-manager tool should now be installed and you can edit\n" +"\n" +" %s\n" +"\n" +"to configure Home Manager. Run 'man home-configuration.nix' to\n" +"see all available options." +msgstr "" + +#. translators: The "%s" specifier will be replaced by a URL. +#: home-manager/install.nix:76 +msgid "" +"Uh oh, the installation failed! Please create an issue at\n" +"\n" +" %s\n" +"\n" +"if the error seems to be the fault of Home Manager." +msgstr "" + +#: home-manager/install.nix:83 +msgid "This derivation is not buildable, please run it using nix-shell." +msgstr "" From efb7b11974d711a4c72c0fa577724710b3b73ee7 Mon Sep 17 00:00:00 2001 From: Weblate Date: Mon, 9 Jan 2023 12:33:59 +0100 Subject: [PATCH 198/233] Add translation using Weblate (Lithuanian) Co-authored-by: Weblate --- modules/po/lt.po | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 modules/po/lt.po diff --git a/modules/po/lt.po b/modules/po/lt.po new file mode 100644 index 00000000..166bf808 --- /dev/null +++ b/modules/po/lt.po @@ -0,0 +1,97 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR Home Manager contributors +# This file is distributed under the same license as the Home Manager Modules package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Home Manager Modules\n" +"Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" +"POT-Creation-Date: 2022-03-26 15:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: lt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: modules/files.nix:233 +msgid "Creating home file links in %s" +msgstr "" + +#: modules/files.nix:246 +msgid "Cleaning up orphan links from %s" +msgstr "" + +#: modules/files.nix:262 +msgid "Creating profile generation %s" +msgstr "" + +#: modules/files.nix:276 +msgid "No change so reusing latest profile generation %s" +msgstr "" + +#: modules/home-environment.nix:607 +msgid "" +"Oops, Nix failed to install your new Home Manager profile!\n" +"\n" +"Perhaps there is a conflict with a package that was installed using\n" +"\"%s\"? Try running\n" +"\n" +" %s\n" +"\n" +"and if there is a conflicting package you can remove it with\n" +"\n" +" %s\n" +"\n" +"Then try activating your Home Manager configuration again." +msgstr "" + +#: modules/home-environment.nix:639 +msgid "Activating %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:31 +msgid "Sanity checking oldGenNum and oldGenPath" +msgstr "" + +#: modules/lib-bash/activation-init.sh:34 +msgid "" +"The previous generation number and path are in conflict! These\n" +"must be either both empty or both set but are now set to\n" +"\n" +" '%s' and '%s'\n" +"\n" +"If you don't mind losing previous profile generations then\n" +"the easiest solution is probably to run\n" +"\n" +" rm %s/home-manager*\n" +" rm %s/current-home\n" +"\n" +"and trying home-manager switch again. Good luck!" +msgstr "" + +#: modules/lib-bash/activation-init.sh:51 +msgid "Starting Home Manager activation" +msgstr "" + +#: modules/lib-bash/activation-init.sh:55 +msgid "Sanity checking Nix" +msgstr "" + +#: modules/lib-bash/activation-init.sh:61 +msgid "This is a dry run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:64 +msgid "This is a live run" +msgstr "" + +#: modules/lib-bash/activation-init.sh:69 +msgid "Using Nix version: %s" +msgstr "" + +#: modules/lib-bash/activation-init.sh:72 +msgid "Activation variables:" +msgstr "" From b0a3689878d4c2e8a1b02cecf8319ba8c53da519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kornelijus=20Tvarijanavi=C4=8Dius?= Date: Mon, 9 Jan 2023 12:33:59 +0100 Subject: [PATCH 199/233] Translate using Weblate (Lithuanian) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently translated at 84.3% (27 of 32 strings) Co-authored-by: Kornelijus Tvarijanavičius Translate-URL: https://hosted.weblate.org/projects/home-manager/cli/lt/ Translation: Home Manager/Home Manager CLI --- home-manager/po/lt.po | 72 +++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 27 deletions(-) diff --git a/home-manager/po/lt.po b/home-manager/po/lt.po index 86d63975..52b3cab6 100644 --- a/home-manager/po/lt.po +++ b/home-manager/po/lt.po @@ -8,9 +8,10 @@ msgstr "" "Project-Id-Version: Home Manager\n" "Report-Msgid-Bugs-To: https://github.com/nix-community/home-manager/issues\n" "POT-Creation-Date: 2022-03-26 15:08+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Automatically generated\n" -"Language-Team: none\n" +"PO-Revision-Date: 2023-01-09 11:33+0000\n" +"Last-Translator: Kornelijus Tvarijanavičius \n" +"Language-Team: Lithuanian \n" "Language: lt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -18,22 +19,23 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n % 10 == 1 && (n % 100 < 11 || n % 100 > " "19)) ? 0 : ((n % 10 >= 2 && n % 10 <= 9 && (n % 100 < 11 || n % 100 > 19)) ? " "1 : 2);\n" +"X-Generator: Weblate 4.15.1-dev\n" #: home-manager/home-manager:60 msgid "No configuration file found at %s" -msgstr "" +msgstr "Nerastas konfigūracijos failas %s" #: home-manager/home-manager:79 msgid "No configuration file found. Please create one at %s" -msgstr "" +msgstr "Nerastas konfigūracijos failas. Sukurkite jį adresu %s" #: home-manager/home-manager:122 msgid "Can't inspect options of a flake configuration" -msgstr "" +msgstr "Negalima patikrinti flake konfigūracijos pasirinkimų" #: home-manager/home-manager:162 msgid "Can't instantiate a flake configuration" -msgstr "" +msgstr "Negalima sukurti pradinės flake konfigūracijos" #: home-manager/home-manager:237 msgid "" @@ -43,16 +45,23 @@ msgid_plural "" "There are %d unread and relevant news items.\n" "Read them by running the command \"%s news\"." msgstr[0] "" +"Yra %d neperskaityta ir aktuali naujiena.\n" +"Perskaitykite ją paleidus komandą \"%s news\"." msgstr[1] "" +"Yra %d neperskaitytos ir aktualios naujienos.\n" +"Perskaitykite jas paleidus komandą \"%s news\"." +msgstr[2] "" +"Yra %d neperskaitytų ir aktualių naujienų.\n" +"Perskaitykite jas paleidus komandą \"%s news\"." #: home-manager/home-manager:251 msgid "Unknown \"news.display\" setting \"%s\"." -msgstr "" +msgstr "Nežinomas \"news.display\" nustatymas \"%s\"." #: home-manager/home-manager:258 #, sh-format msgid "Please set the $EDITOR environment variable" -msgstr "" +msgstr "Prašome nustatyti $EDITOR aplinkos kintamąjį" #: home-manager/home-manager:273 msgid "Cannot run build in read-only directory" @@ -60,15 +69,15 @@ msgstr "" #: home-manager/home-manager:355 msgid "No generation with ID %s" -msgstr "" +msgstr "Nėra generacijos su ID %s" #: home-manager/home-manager:357 msgid "Cannot remove the current generation %s" -msgstr "" +msgstr "Negalima pašalinti esamos generacijos %s" #: home-manager/home-manager:359 msgid "Removing generation %s" -msgstr "" +msgstr "Pašalinama generacija %s" #: home-manager/home-manager:385 msgid "No generations to expire" @@ -76,39 +85,40 @@ msgstr "" #: home-manager/home-manager:396 msgid "No home-manager packages seem to be installed." -msgstr "" +msgstr "Nėra instaliuotų home-manager paketų." #: home-manager/home-manager:453 msgid "Unknown argument %s" -msgstr "" +msgstr "Nežinomas argumentas %s" #: home-manager/home-manager:469 msgid "This will remove Home Manager from your system." -msgstr "" +msgstr "Tai pašalins Home Manager iš jūsų sistemos." #: home-manager/home-manager:472 msgid "This is a dry run, nothing will actually be uninstalled." -msgstr "" +msgstr "Tai bandomasis paleidimas, niekas nebus ištrinta." #: home-manager/home-manager:476 msgid "Really uninstall Home Manager?" -msgstr "" +msgstr "Tikrai išdiegti Home Manager?" #: home-manager/home-manager:481 msgid "Switching to empty Home Manager configuration..." -msgstr "" +msgstr "Perjungiama į tuščią Home Manager konfigūraciją..." #: home-manager/home-manager:493 msgid "Yay!" -msgstr "" +msgstr "Valio!" #: home-manager/home-manager:500 msgid "Remove all Home Manager generations?" -msgstr "" +msgstr "Pašalinti visas Home Manager generacijas?" #: home-manager/home-manager:507 msgid "All generations are now eligible for garbage collection." msgstr "" +"Visos generacijos jau tinkamos šiukšlių surinkimui (garbage collection)." #: home-manager/home-manager:510 msgid "Leaving generations but they may still be garbage collected." @@ -116,31 +126,31 @@ msgstr "" #: home-manager/home-manager:514 msgid "Home Manager is uninstalled but your home.nix is left untouched." -msgstr "" +msgstr "Home Manager yra išdiegtas, bet jūsų home.nix liko nepaliestas." #: home-manager/home-manager:673 msgid "%s: unknown option '%s'" -msgstr "" +msgstr "%s: nežinomas pasirinkimas „%s“" #: home-manager/home-manager:674 msgid "Run '%s --help' for usage help" -msgstr "" +msgstr "Paleiskite „%s --help“, kad gautumėte naudojimosi instrukcijas" #: home-manager/home-manager:708 msgid "expire-generations expects one argument, got %d." -msgstr "" +msgstr "expire-generations tikisi vieno argumento, gauta %d." #: home-manager/home-manager:730 msgid "Unknown command: %s" -msgstr "" +msgstr "Nežinoma komanda: %s" #: home-manager/install.nix:22 msgid "Creating initial Home Manager configuration..." -msgstr "" +msgstr "Kuriama pradinė Home Manager konfigūracija..." #: home-manager/install.nix:66 msgid "Creating initial Home Manager generation..." -msgstr "" +msgstr "Kuriama pradinė Home Manager generacija..." #. translators: The "%s" specifier will be replaced by a file path. #: home-manager/install.nix:71 @@ -152,6 +162,14 @@ msgid "" "to configure Home Manager. Run 'man home-configuration.nix' to\n" "see all available options." msgstr "" +"Viskas baigta! Įrankis home-manager turėtų būti įdiegtas ir dabar galite " +"redaguoti\n" +"\n" +". . . .%s\n" +"\n" +", kad konfigūruotumėte Home Manager. Paleiskite „man home-configuration.nix“," +"\n" +"jei norite pamatyti visus pasirinkimus." #. translators: The "%s" specifier will be replaced by a URL. #: home-manager/install.nix:76 From 950aace44e23327a9df1c93fa799a0421091f04a Mon Sep 17 00:00:00 2001 From: stephaneyfx Date: Tue, 10 Jan 2023 02:57:38 -0600 Subject: [PATCH 200/233] i3: Do not set i3 package (#3585) Resolves https://github.com/nix-community/home-manager/issues/3584 --- modules/services/window-managers/i3-sway/i3.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/services/window-managers/i3-sway/i3.nix b/modules/services/window-managers/i3-sway/i3.nix index 453367ce..f28b9b67 100644 --- a/modules/services/window-managers/i3-sway/i3.nix +++ b/modules/services/window-managers/i3-sway/i3.nix @@ -250,8 +250,6 @@ in { }; } - (mkIf (cfg.config != null) { xsession.windowManager.i3.package = pkgs.i3; }) - (mkIf (cfg.config != null) { warnings = (optional (isList cfg.config.fonts) "Specifying i3.config.fonts as a list is deprecated. Use the attrset version instead.") From 176e455371a8371586e8a3ff0d56ee9f3ca2324e Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Tue, 10 Jan 2023 02:35:00 -0700 Subject: [PATCH 201/233] home-manager: Add home-manager search path to EXTRA_NIX_PATH (#3241) --- docs/installation.adoc | 10 ---------- home-manager/home-manager | 7 +++---- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/docs/installation.adoc b/docs/installation.adoc index 6291fba0..afdbe35e 100644 --- a/docs/installation.adoc +++ b/docs/installation.adoc @@ -58,16 +58,6 @@ and if you follow a Nixpkgs version 22.11 channel you can run $ nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager $ nix-channel --update ---- -+ -On non-NixOS, you may have to add -+ -[source,bash] -export NIX_PATH=$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/root/channels${NIX_PATH:+:$NIX_PATH} -+ -to your shell (see https://github.com/NixOS/nix/issues/2033[nix#2033] -and -https://discourse.nixos.org/t/where-is-nix-path-supposed-to-be-set/16434/8[this -reply on the Nix Discourse]). 3. Run the Home Manager installation command and create the first Home Manager generation: diff --git a/home-manager/home-manager b/home-manager/home-manager index 86623972..89f58c4d 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -87,7 +87,7 @@ function setHomeManagerNixPath() { "${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home-manager" \ "$HOME/.nixpkgs/home-manager" ; do if [[ -e "$path" || "$path" =~ ^https?:// ]] ; then - export NIX_PATH="home-manager=$path${NIX_PATH:+:}$NIX_PATH" + EXTRA_NIX_PATH+=("home-manager=$path") return fi done @@ -130,7 +130,6 @@ function doInspectOption() { exit 1 fi setConfigFile - setHomeManagerNixPath local extraArgs=("$@") @@ -170,7 +169,6 @@ function doInstantiate() { exit 1 fi setConfigFile - setHomeManagerNixPath local extraArgs=() @@ -192,7 +190,6 @@ function doInstantiate() { function doBuildAttr() { setConfigFile - setHomeManagerNixPath local extraArgs=("$@") @@ -602,6 +599,8 @@ COMMAND="" COMMAND_ARGS=() FLAKE_ARG="" +setHomeManagerNixPath + while [[ $# -gt 0 ]]; do opt="$1" shift From 2827b5306462d91edec16a3d069b2d6e54c3079f Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Sat, 14 Jan 2023 20:00:44 +0100 Subject: [PATCH 202/233] docs: bump nmd - Fix paragraphs in option field texts containing Markdown. - Fix generation of documentation for options with Markdown in multiple fields. - Support AsciiDoc in module option documentation. --- docs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 83ac2a32..522a70eb 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,8 +7,8 @@ let nmdSrc = fetchTarball { url = - "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=06c80103396a1a950586c23da1882c977b24bbda"; - sha256 = "15axmplkl7m7fs4c8m53dawhgwkb64hm2v67m59xdknbjjgfrpqb"; + "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=f6ca9dfbae290e2133b4ff567e1a48c0eaf9d681"; + sha256 = "1ivikjlh6vs0131fb945bjal7xrp2wxblbbk1zbz0yqi41xbvny8"; }; nmd = import nmdSrc { inherit lib pkgs; }; From d633afe0d96d47e6fc40327386608c9c068197d0 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Sun, 15 Jan 2023 10:20:13 -0800 Subject: [PATCH 203/233] i3-sway: config.focus.wrapping deprecates forceWrapping (#3467) Stop using the legacy syntax described in the i3 documentation: https://i3wm.org/docs/userguide.html#_focus_wrapping --- .../services/window-managers/i3-sway/i3.nix | 21 +++++++++---------- .../window-managers/i3-sway/lib/options.nix | 19 +++++++++++++++-- .../services/window-managers/i3-sway/sway.nix | 7 +++++-- .../i3/i3-bar-focused-colors-expected.conf | 2 +- .../i3/i3-followmouse-expected.conf | 2 +- .../window-managers/i3/i3-fonts-expected.conf | 2 +- .../i3/i3-keybindings-expected.conf | 2 +- .../i3/i3-workspace-default-expected.conf | 2 +- .../i3/i3-workspace-output-expected.conf | 2 +- 9 files changed, 38 insertions(+), 21 deletions(-) diff --git a/modules/services/window-managers/i3-sway/i3.nix b/modules/services/window-managers/i3-sway/i3.nix index f28b9b67..b4742c78 100644 --- a/modules/services/window-managers/i3-sway/i3.nix +++ b/modules/services/window-managers/i3-sway/i3.nix @@ -160,7 +160,7 @@ let "floating_modifier ${floating.modifier}" (windowBorderString window floating) "hide_edge_borders ${window.hideEdgeBorders}" - "force_focus_wrapping ${lib.hm.booleans.yesNo focus.forceWrapping}" + "focus_wrapping ${focus.wrapping}" "focus_follows_mouse ${lib.hm.booleans.yesNo focus.followMouse}" "focus_on_window_activation ${focus.newWindow}" "mouse_warping ${if focus.mouseWarping then "output" else "none"}" @@ -256,16 +256,15 @@ in { ++ flatten (map (b: optional (isList b.fonts) "Specifying i3.config.bars[].fonts as a list is deprecated. Use the attrset version instead.") - cfg.config.bars); + cfg.config.bars) ++ [ + (mkIf (any (s: s.workspace != null) cfg.config.startup) + ("'xsession.windowManager.i3.config.startup.*.workspace' is deprecated, " + + "use 'xsession.windowManager.i3.config.assigns' instead." + + "See https://github.com/nix-community/home-manager/issues/265.")) + (mkIf cfg.config.focus.forceWrapping + ("'xsession.windowManager.i3.config.focus.forceWrapping' is deprecated, " + + "use 'xsession.windowManager.i3.config.focus.wrapping' instead.")) + ]; }) - - (mkIf (cfg.config != null - && (any (s: s.workspace != null) cfg.config.startup)) { - warnings = [ - ("'xsession.windowManager.i3.config.startup.*.workspace' is deprecated, " - + "use 'xsession.windowManager.i3.config.assigns' instead." - + "See https://github.com/nix-community/home-manager/issues/265.") - ]; - }) ]); } diff --git a/modules/services/window-managers/i3-sway/lib/options.nix b/modules/services/window-managers/i3-sway/lib/options.nix index d04a1176..3fe0b755 100644 --- a/modules/services/window-managers/i3-sway/lib/options.nix +++ b/modules/services/window-managers/i3-sway/lib/options.nix @@ -510,13 +510,28 @@ in { if (isSway && isBool val) then (lib.hm.booleans.yesNo val) else val; }; + wrapping = mkOption { + type = types.enum [ "yes" "no" "force" "workspace" ]; + default = { + i3 = if cfg.config.focus.forceWrapping then "force" else "yes"; + # the sway module's logic was inverted and incorrect, + # so preserve it for backwards compatibility purposes + sway = if cfg.config.focus.forceWrapping then "yes" else "no"; + }.${moduleName}; + description = '' + Whether the window focus commands automatically wrap around the edge of containers. + + See + ''; + }; + forceWrapping = mkOption { type = types.bool; default = false; description = '' - Whether to force focus wrapping in tabbed or stacked container. + Whether to force focus wrapping in tabbed or stacked containers. - See + This option is deprecated, use instead. ''; }; diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index fdcbaabc..a18a4212 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -271,7 +271,7 @@ let "floating_modifier ${floating.modifier}" (windowBorderString window floating) "hide_edge_borders ${window.hideEdgeBorders}" - "focus_wrapping ${lib.hm.booleans.yesNo focus.forceWrapping}" + "focus_wrapping ${focus.wrapping}" "focus_follows_mouse ${focus.followMouse}" "focus_on_window_activation ${focus.newWindow}" "mouse_warping ${ @@ -442,7 +442,10 @@ in { ++ flatten (map (b: optional (isList b.fonts) "Specifying sway.config.bars[].fonts as a list is deprecated. Use the attrset version instead.") - cfg.config.bars); + cfg.config.bars) ++ [ + (mkIf cfg.config.focus.forceWrapping + "sway.config.focus.forceWrapping is deprecated, use focus.wrapping instead.") + ]; }) { diff --git a/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf b/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf index 92f23a92..3b8fca8a 100644 --- a/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-bar-focused-colors-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf b/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf index 27234b96..dccf535a 100644 --- a/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-followmouse-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse no focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-fonts-expected.conf b/tests/modules/services/window-managers/i3/i3-fonts-expected.conf index d85d978e..8e8cb9da 100644 --- a/tests/modules/services/window-managers/i3/i3-fonts-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-fonts-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf b/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf index b3b4c33d..2b7251d2 100644 --- a/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-keybindings-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf b/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf index d7fe4b61..baca1411 100644 --- a/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-workspace-default-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output diff --git a/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf b/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf index dedad29e..a51edb9a 100644 --- a/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/i3/i3-workspace-output-expected.conf @@ -3,7 +3,7 @@ floating_modifier Mod1 default_border normal 2 default_floating_border normal 2 hide_edge_borders none -force_focus_wrapping no +focus_wrapping yes focus_follows_mouse yes focus_on_window_activation smart mouse_warping output From 3e42035fc013ed4d8af6ee8dc0079c0c551c45a5 Mon Sep 17 00:00:00 2001 From: Bikal Lem <315907+bikallem@users.noreply.github.com> Date: Sun, 15 Jan 2023 20:48:02 +0000 Subject: [PATCH 204/233] opam: fix enableFishIntegration (#3597) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fish shell doesn't require arguments to `eval` to be double quoted like in a bash shell. At the moment doing so gives us the following error: ~/.config/fish/config.fish (line 12): $(...) is not supported. In fish, please use '(/nix/store/8asq…)'. eval "$(/nix/store/8asqgnhs89wzyjvs8p1n5hvxn7lkn9wa-opam-2.1.3/bin/opam env --shell=fish)" ^ from sourcing file ~/.config/fish/config.fish called during startup source: Error while reading file “/home/user/.config/fish/config.fish” This commit fixes the above error. --- modules/programs/opam.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/programs/opam.nix b/modules/programs/opam.nix index 2916fb19..0606d35b 100644 --- a/modules/programs/opam.nix +++ b/modules/programs/opam.nix @@ -56,7 +56,7 @@ in { ''; programs.fish.shellInit = mkIf cfg.enableFishIntegration '' - eval "$(${cfg.package}/bin/opam env --shell=fish)" + eval (${cfg.package}/bin/opam env --shell=fish) ''; }; } From bd3efacb82c721edad1ce9eda583df5fb62ab00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 17 Jan 2023 10:35:01 +0100 Subject: [PATCH 205/233] docs: mention how to override the home-manager flake input (#3556) --- docs/contributing.adoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/contributing.adoc b/docs/contributing.adoc index 82a07a9a..7ab95289 100644 --- a/docs/contributing.adoc +++ b/docs/contributing.adoc @@ -28,6 +28,11 @@ Assuming your clone is at `$HOME/devel/home-manager` then you can make the `home [source,console] $ home-manager -I home-manager=$HOME/devel/home-manager + +or, if using <>: ++ +[source,console] +$ home-manager --override-input home-manager ~/devel/home-manager ++ or 2. changing the default path by ensuring your configuration includes From 6c5b08a0c1fd54e7a5aa8ae088a7d981d441c57b Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 18 Jan 2023 12:24:05 +0100 Subject: [PATCH 206/233] docs: fetch nmd from sourcehut --- docs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/default.nix b/docs/default.nix index 522a70eb..b42b2d09 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,7 +7,7 @@ let nmdSrc = fetchTarball { url = - "https://gitlab.com/api/v4/projects/rycee%2Fnmd/repository/archive.tar.gz?sha=f6ca9dfbae290e2133b4ff567e1a48c0eaf9d681"; + "https://git.sr.ht/~rycee/nmd/archive/f6ca9dfbae290e2133b4ff567e1a48c0eaf9d681.tar.gz"; sha256 = "1ivikjlh6vs0131fb945bjal7xrp2wxblbbk1zbz0yqi41xbvny8"; }; From 2c29ae48f9a149151bdd82f429ac61d4412c312a Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Wed, 18 Jan 2023 12:25:27 +0100 Subject: [PATCH 207/233] docs: bump nmd --- docs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index b42b2d09..994c16eb 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,8 +7,8 @@ let nmdSrc = fetchTarball { url = - "https://git.sr.ht/~rycee/nmd/archive/f6ca9dfbae290e2133b4ff567e1a48c0eaf9d681.tar.gz"; - sha256 = "1ivikjlh6vs0131fb945bjal7xrp2wxblbbk1zbz0yqi41xbvny8"; + "https://git.sr.ht/~rycee/nmd/archive/4579bba4c006e6991c9719c267c6bdc0ea0416de.tar.gz"; + sha256 = "1x1m8lpxw6q4s257vqikfd9z1dway587zzvcryxfp0yf7gkva8fy"; }; nmd = import nmdSrc { inherit lib pkgs; }; From 866a4ddcb3d3f21b1a0ce9dc1accd1704ecabbb9 Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Fri, 6 Jan 2023 18:38:09 -0500 Subject: [PATCH 208/233] firefox: refactor search.json.mozlz4 generation The new setup should be easier to read. --- modules/programs/firefox.nix | 149 +++++++++++++++++++---------------- 1 file changed, 82 insertions(+), 67 deletions(-) diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index a0620e28..bf1c5779 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -533,79 +533,94 @@ in { source = let settings = { version = 6; - engines = let - allEngines = (profile.search.engines // - # If search.default isn't in search.engines, assume it's app - # provided and include it in the set of all engines - optionalAttrs (profile.search.default != null - && !(hasAttr profile.search.default - profile.search.engines)) { - ${profile.search.default} = { }; - }); + # Map of nice field names to internal field names. + # This is intended to be exhaustive and should be + # updated at every version bump. + internalFieldNames = (genAttrs [ + "name" + "isAppProvided" + "loadPath" + "hasPreferredIcon" + "updateInterval" + "updateURL" + "iconUpdateURL" + "iconURL" + "iconMapObj" + "metaData" + "orderHint" + "definedAliases" + "urls" + ] (name: "_${name}")) // { + searchForm = "__searchForm"; + }; - # Map allEngines to a list and order by search.order - orderedEngineList = (imap (order: name: - let engine = allEngines.${name} or { }; - in engine // { - inherit name; - metaData = (engine.metaData or { }) // { inherit order; }; - }) profile.search.order) ++ (mapAttrsToList - (name: config: config // { inherit name; }) - (removeAttrs allEngines profile.search.order)); + processCustomEngineInput = input: + (removeAttrs input [ "icon" ]) + // optionalAttrs (input ? icon) { + # Convenience to specify absolute path to icon + iconURL = "file://${input.icon}"; + } // (optionalAttrs (input ? iconUpdateURL) { + # Convenience to default iconURL to iconUpdateURL so + # the icon is immediately downloaded from the URL + iconURL = input.iconURL or input.iconUpdateURL; + } // { + # Required for custom engine configurations, loadPaths + # are unique identifiers that are generally formatted + # like: [source]/path/to/engine.xml + loadPath = '' + [home-manager]/programs.firefox.profiles.${profile.name}.search.engines."${ + replaceStrings [ "\\" ] [ "\\\\" ] input.name + }"''; + }); - engines = map (config: + processEngineInput = name: input: let - name = config.name; - isAppProvided = removeAttrs config [ "name" "metaData" ] - == { }; - metaData = config.metaData or { }; - in mapAttrs' (name: value: { - # Map nice field names to internal field names. This is - # intended to be exhaustive, but any future fields will - # either have to be specified with an underscore, or added - # to this map. - name = ((genAttrs [ - "name" - "isAppProvided" - "loadPath" - "hasPreferredIcon" - "updateInterval" - "updateURL" - "iconUpdateURL" - "iconURL" - "iconMapObj" - "metaData" - "orderHint" - "definedAliases" - "urls" - ] (name: "_${name}")) // { - "searchForm" = "__searchForm"; - }).${name} or name; + requiredInput = { + inherit name; + isAppProvided = input.isAppProvided or removeAttrs input + [ "metaData" ] == { }; + metaData = input.metaData or { }; + }; + in if requiredInput.isAppProvided then + requiredInput + else + processCustomEngineInput (input // requiredInput); + buildEngineConfig = name: input: + mapAttrs' (name: value: { + name = internalFieldNames.${name} or name; inherit value; - }) ((removeAttrs config [ "icon" ]) - // (optionalAttrs (!isAppProvided) - (optionalAttrs (config ? iconUpdateURL) { - # Convenience to default iconURL to iconUpdateURL so - # the icon is immediately downloaded from the URL - iconURL = config.iconURL or config.iconUpdateURL; - } // optionalAttrs (config ? icon) { - # Convenience to specify absolute path to icon - iconURL = "file://${config.icon}"; - } // { - # Required for custom engine configurations, loadPaths - # are unique identifiers that are generally formatted - # like: [source]/path/to/engine.xml - loadPath = '' - [home-manager]/programs.firefox.profiles.${profile.name}.search.engines."${ - replaceStrings [ "\\" ] [ "\\\\" ] name - }"''; - })) // { - # Required fields for all engine configurations - inherit name isAppProvided metaData; - })) orderedEngineList; - in engines; + }) (processEngineInput name input); + + sortEngineConfigs = configs: + let + buildEngineConfigWithOrder = order: name: + let + config = configs.${name} or { + _name = name; + _isAppProvided = true; + _metaData = { }; + }; + in config // { + _metaData = config._metaData // { inherit order; }; + }; + + engineConfigsWithoutOrder = + attrValues (removeAttrs configs profile.search.order); + + sortedEngineConfigs = + (imap buildEngineConfigWithOrder profile.search.order) + ++ engineConfigsWithoutOrder; + in sortedEngineConfigs; + + engineInput = profile.search.engines // { + # Infer profile.search.default as an app provided + # engine if it's not in profile.search.engines + ${profile.search.default} = + profile.search.engines.${profile.search.default} or { }; + }; + in sortEngineConfigs (mapAttrs buildEngineConfig engineInput); metaData = optionalAttrs (profile.search.default != null) { current = profile.search.default; From 7026e1a934abfa02623c9870378dbcdac3cd7f80 Mon Sep 17 00:00:00 2001 From: Dixon Sean Low Yan Feng Date: Sun, 8 Jan 2023 12:44:21 +0800 Subject: [PATCH 209/233] gpg-agent: fix SSH support for fish --- modules/services/gpg-agent.nix | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/services/gpg-agent.nix b/modules/services/gpg-agent.nix index ca70406f..fb59d709 100644 --- a/modules/services/gpg-agent.nix +++ b/modules/services/gpg-agent.nix @@ -9,11 +9,18 @@ let homedir = config.programs.gpg.homedir; + gpgSshSupportStr = '' + ${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null + ''; + gpgInitStr = '' GPG_TTY="$(tty)" export GPG_TTY - '' + optionalString cfg.enableSshSupport - "${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null"; + '' + optionalString cfg.enableSshSupport gpgSshSupportStr; + + gpgFishInitStr = '' + set -gx GPG_TTY (tty) + '' + optionalString cfg.enableSshSupport gpgSshSupportStr; # mimic `gpgconf` output for use in `systemd` unit definitions. # we cannot use `gpgconf` directly because it heavily depends on system @@ -238,9 +245,8 @@ in { programs.bash.initExtra = mkIf cfg.enableBashIntegration gpgInitStr; programs.zsh.initExtra = mkIf cfg.enableZshIntegration gpgInitStr; - programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration '' - set -gx GPG_TTY (tty) - ''; + programs.fish.interactiveShellInit = + mkIf cfg.enableFishIntegration gpgFishInitStr; } (mkIf (cfg.sshKeys != null) { From 275ab728912006eecb549338a50f24f294a7cfb7 Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 20 Jan 2023 22:30:25 +0100 Subject: [PATCH 210/233] docs: bump nmd Fixes #3605 --- docs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 994c16eb..5a41a88a 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,8 +7,8 @@ let nmdSrc = fetchTarball { url = - "https://git.sr.ht/~rycee/nmd/archive/4579bba4c006e6991c9719c267c6bdc0ea0416de.tar.gz"; - sha256 = "1x1m8lpxw6q4s257vqikfd9z1dway587zzvcryxfp0yf7gkva8fy"; + "https://git.sr.ht/~rycee/nmd/archive/5129cc2a68837c223c0dfba9a37857e5c8d9891e.tar.gz"; + sha256 = "0z1gqwwnjrrz07w847xf0dqgzimclf4qvqvdm46scgqcbhnhwqk0"; }; nmd = import nmdSrc { inherit lib pkgs; }; From ab25abf9e5c07b3c90d78aa06c44a4085ecba003 Mon Sep 17 00:00:00 2001 From: home-manager-bot <106474382+home-manager-bot@users.noreply.github.com> Date: Mon, 23 Jan 2023 13:41:59 +0100 Subject: [PATCH 211/233] flake.lock: Update (#3549) 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 a334b24b..797ace51 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1671983799, - "narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=", + "lastModified": 1674211260, + "narHash": "sha256-xU6Rv9sgnwaWK7tgCPadV6HhI2Y/fl4lKxJoG2+m9qs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836", + "rev": "5ed481943351e9fd354aeb557679624224de38d5", "type": "github" }, "original": { From 12d43fd40a7658976c18eaa05bba62b6045e5b3e Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 23 Jan 2023 22:14:05 +0100 Subject: [PATCH 212/233] docs: bump nmd Fixes #3612 --- docs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index 5a41a88a..54719b91 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -7,8 +7,8 @@ let nmdSrc = fetchTarball { url = - "https://git.sr.ht/~rycee/nmd/archive/5129cc2a68837c223c0dfba9a37857e5c8d9891e.tar.gz"; - sha256 = "0z1gqwwnjrrz07w847xf0dqgzimclf4qvqvdm46scgqcbhnhwqk0"; + "https://git.sr.ht/~rycee/nmd/archive/409f1310b168f96c6c8b556d24731a3e7c26c255.tar.gz"; + sha256 = "1v43qgfwa9s84728lv1njz2zdsfzp8kas3w4s3jan7w813c8flh8"; }; nmd = import nmdSrc { inherit lib pkgs; }; From c59f0eac51da91c6989fd13a68e156f63c0e60b6 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Tue, 24 Jan 2023 05:30:04 -0500 Subject: [PATCH 213/233] treewide: fix typos (#3618) --- docs/nix-flakes.adoc | 2 +- modules/config/home-cursor.nix | 2 +- modules/programs/fish.nix | 2 +- modules/programs/kodi.nix | 2 +- modules/programs/mbsync.nix | 2 +- modules/programs/mujmap.nix | 2 +- modules/services/mako.nix | 8 ++++---- tests/modules/misc/debug/default.nix | 2 +- tests/modules/programs/aerc/extraAccounts.expected | 6 +++--- tests/modules/programs/aerc/settings.nix | 6 +++--- .../programs/mbsync/mbsync-master-slave-change.nix | 2 +- tests/modules/programs/mbsync/mbsync.nix | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/nix-flakes.adoc b/docs/nix-flakes.adoc index d426e337..2e00c9e6 100644 --- a/docs/nix-flakes.adoc +++ b/docs/nix-flakes.adoc @@ -6,7 +6,7 @@ Home Manager includes a `flake.nix` file for compatibility with {nixos-wiki-flakes}[Nix Flakes]. The support is still experimental and may change in backwards incompatible ways. -[[sec-flakes-prerequisties]] +[[sec-flakes-prerequisites]] === Prerequisites * Install Nix 2.4 or later, or have it in `nix-shell`. diff --git a/modules/config/home-cursor.nix b/modules/config/home-cursor.nix index a2467736..18bc04c1 100644 --- a/modules/config/home-cursor.nix +++ b/modules/config/home-cursor.nix @@ -97,7 +97,7 @@ in { description = '' Cursor configuration. Set to null to disable. - Top-level options declared under this submodule are backend indepedent + Top-level options declared under this submodule are backend independent options. Options declared under namespaces such as x11 are backend specific options. By default, only backend independent cursor configurations are generated. If you need configurations for specific diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index fe6c4a92..39dc246c 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -375,7 +375,7 @@ in { # Aliases ${aliasesStr} - # Interactive shell intialisation + # Interactive shell initialisation ${cfg.interactiveShellInit} end diff --git a/modules/programs/kodi.nix b/modules/programs/kodi.nix index 0441eebc..bae862ae 100644 --- a/modules/programs/kodi.nix +++ b/modules/programs/kodi.nix @@ -82,7 +82,7 @@ let attrsetToXml = attrs: name: stylesheet: pkgs.runCommand name { # Package splicing for libxslt does not work correctly leading to errors - # when cross-compiling. Use the version from buildPackages explicitely to + # when cross-compiling. Use the version from buildPackages explicitly to # fix this. nativeBuildInputs = [ pkgs.buildPackages.libxslt.bin ]; xml = builtins.toXML attrs; diff --git a/modules/programs/mbsync.nix b/modules/programs/mbsync.nix index 373828a0..d43f6455 100644 --- a/modules/programs/mbsync.nix +++ b/modules/programs/mbsync.nix @@ -174,7 +174,7 @@ let flatten (optionals (group.channels != { }) ([ "Group ${group.name}" ] ++ (genChannelStrings group.name group.channels))); # Given set of groups, generates list of strings, where each string is one - # of the groups and its consituent channels. + # of the groups and its constituent channels. genGroupsStrings = mapAttrsToList (name: info: concatStringsSep "\n" (genGroupChannelString groups.${name})) groups; # Join all non-empty groups. diff --git a/modules/programs/mujmap.nix b/modules/programs/mujmap.nix index 9d290fef..291b9656 100644 --- a/modules/programs/mujmap.nix +++ b/modules/programs/mujmap.nix @@ -186,7 +186,7 @@ let default = null; example = "https://jmap.example.com/.well-known/jmap"; description = '' - Sesion URL to connect to. + Session URL to connect to. Mutually exclusive with . diff --git a/modules/services/mako.nix b/modules/services/mako.nix index fc9e2161..fb711ca4 100644 --- a/modules/services/mako.nix +++ b/modules/services/mako.nix @@ -130,8 +130,8 @@ in { description = '' Set margin of each edge specified in pixels. Specify single value to apply margin on all sides. Two comma-separated values will set - vertical and horizontal edges separately. Four comma-seperated will - give each edge a seperate value. + vertical and horizontal edges separately. Four comma-separated will + give each edge a separate value. For example: 10,20,5 will set top margin to 10, left and right to 20 and bottom to five. ''; @@ -143,8 +143,8 @@ in { description = '' Set padding of each edge specified in pixels. Specify single value to apply margin on all sides. Two comma-separated values will set - vertical and horizontal edges separately. Four comma-seperated will - give each edge a seperate value. + vertical and horizontal edges separately. Four comma-separated will + give each edge a separate value. For example: 10,20,5 will set top margin to 10, left and right to 20 and bottom to five. ''; diff --git a/tests/modules/misc/debug/default.nix b/tests/modules/misc/debug/default.nix index 19ff4e2b..7eb28666 100644 --- a/tests/modules/misc/debug/default.nix +++ b/tests/modules/misc/debug/default.nix @@ -15,7 +15,7 @@ assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \ 'NIX_DEBUG_INFO_DIRS=.*/lib/debug' - # We need to override NIX_DEBUG_INFO_DIRS here as $HOME evalutes to the home + # We need to override NIX_DEBUG_INFO_DIRS here as $HOME evaluates to the home # of the user who executes this testcase :/ { echo quit | PATH="$TESTED/home-path/bin''${PATH:+:}$PATH" NIX_DEBUG_INFO_DIRS=$TESTED/home-path/lib/debug \ gdb curl 2>&1 | \ diff --git a/tests/modules/programs/aerc/extraAccounts.expected b/tests/modules/programs/aerc/extraAccounts.expected index 15749c03..9377384f 100644 --- a/tests/modules/programs/aerc/extraAccounts.expected +++ b/tests/modules/programs/aerc/extraAccounts.expected @@ -59,15 +59,15 @@ source = maildir:///home/hm-user/Maildir/i_maildir-mbsync from = Foo Bar source = maildir:///home/hm-user/Maildir/j_maildir-offlineimap -[l_smpt-auth-none] +[l_smtp-auth-none] from = Foo Bar outgoing = smtps+none://foobar@smtp.host.invalid:42 -[m_smpt-auth-plain] +[m_smtp-auth-plain] from = Foo Bar outgoing = smtps+plain://foobar@smtp.host.invalid:42 -[n_smpt-auth-login] +[n_smtp-auth-login] from = Foo Bar outgoing = smtps+login://foobar@smtp.host.invalid:42 diff --git a/tests/modules/programs/aerc/settings.nix b/tests/modules/programs/aerc/settings.nix index 2fded9cc..1f3c25a9 100644 --- a/tests/modules/programs/aerc/settings.nix +++ b/tests/modules/programs/aerc/settings.nix @@ -193,7 +193,7 @@ with lib; i_maildir-mbsync = basics // { mbsync.enable = true; }; j_maildir-offlineimap = basics // { offlineimap.enable = true; }; k_notEnabled = basics // { aerc.enable = false; }; - l_smpt-auth-none = basics // { + l_smtp-auth-none = basics // { smtp = { host = "smtp.host.invalid"; port = 42; @@ -203,7 +203,7 @@ with lib; smtpAuth = "none"; }; }; - m_smpt-auth-plain = basics // { + m_smtp-auth-plain = basics // { smtp = { host = "smtp.host.invalid"; port = 42; @@ -213,7 +213,7 @@ with lib; smtpAuth = "plain"; }; }; - n_smpt-auth-login = basics // { + n_smtp-auth-login = basics // { smtp = { host = "smtp.host.invalid"; port = 42; diff --git a/tests/modules/programs/mbsync/mbsync-master-slave-change.nix b/tests/modules/programs/mbsync/mbsync-master-slave-change.nix index 2e877320..c6861374 100644 --- a/tests/modules/programs/mbsync/mbsync-master-slave-change.nix +++ b/tests/modules/programs/mbsync/mbsync-master-slave-change.nix @@ -16,7 +16,7 @@ with lib; # programs.mbsync.groups and # accounts.email.accounts..mbsync.groups should NOT be used at the # same time. - # If they are, then the new version will take precendence. + # If they are, then the new version will take precedence. groups.inboxes = { "hm@example.com" = [ "Inbox1" "Inbox2" ]; hm-account = [ "Inbox" ]; diff --git a/tests/modules/programs/mbsync/mbsync.nix b/tests/modules/programs/mbsync/mbsync.nix index 862e1c0e..ffc1635e 100644 --- a/tests/modules/programs/mbsync/mbsync.nix +++ b/tests/modules/programs/mbsync/mbsync.nix @@ -11,7 +11,7 @@ with lib; # programs.mbsync.groups and # accounts.email.accounts..mbsync.groups should NOT be used at the # same time. - # If they are, then the new version will take precendence. + # If they are, then the new version will take precedence. groups.inboxes = { "hm@example.com" = [ "Inbox1" "Inbox2" ]; hm-account = [ "Inbox" ]; From 7efca2ca18062791cbaa838f4d3e23d629bb1473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20M=C3=BChmel?= Date: Wed, 25 Jan 2023 22:58:35 +0100 Subject: [PATCH 214/233] files: allow disabling creation of a file PR #3622 --- modules/files.nix | 2 +- modules/lib/file-type.nix | 8 ++++++++ tests/modules/files/default.nix | 1 + tests/modules/files/disabled.nix | 14 ++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/modules/files/disabled.nix diff --git a/modules/files.nix b/modules/files.nix index daeeb0b1..0f4207fe 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -4,7 +4,7 @@ with lib; let - cfg = config.home.file; + cfg = filterAttrs (n: f: f.enable) config.home.file; homeDirectory = config.home.homeDirectory; diff --git a/modules/lib/file-type.nix b/modules/lib/file-type.nix index cc23292b..b12b3262 100644 --- a/modules/lib/file-type.nix +++ b/modules/lib/file-type.nix @@ -15,6 +15,14 @@ in fileType = basePathDesc: basePath: types.attrsOf (types.submodule ( { name, config, ... }: { options = { + enable = mkOption { + type = types.bool; + default = true; + description = '' + Whether this file should be generated. This option allows specific + files to be disabled. + ''; + }; target = mkOption { type = types.str; apply = p: diff --git a/tests/modules/files/default.nix b/tests/modules/files/default.nix index 52e44d22..2c35b9a2 100644 --- a/tests/modules/files/default.nix +++ b/tests/modules/files/default.nix @@ -1,4 +1,5 @@ { + files-disabled = ./disabled.nix; files-executable = ./executable.nix; files-hidden-source = ./hidden-source.nix; files-out-of-store-symlink = ./out-of-store-symlink.nix; diff --git a/tests/modules/files/disabled.nix b/tests/modules/files/disabled.nix new file mode 100644 index 00000000..b9ed858a --- /dev/null +++ b/tests/modules/files/disabled.nix @@ -0,0 +1,14 @@ +{ ... }: + +{ + home.file."disabled" = { + enable = false; + text = '' + This file should not exist + ''; + }; + + nmt.script = '' + assertPathNotExists home-files/disabled + ''; +} From 8f39c67c4c87c137f33858123abadf70e4f00e76 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Jan 2023 21:58:41 +0000 Subject: [PATCH 215/233] ci: bump DeterminateSystems/update-flake-lock from 15 to 16 Bumps [DeterminateSystems/update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) from 15 to 16. - [Release notes](https://github.com/DeterminateSystems/update-flake-lock/releases) - [Commits](https://github.com/DeterminateSystems/update-flake-lock/compare/v15...v16) --- updated-dependencies: - dependency-name: DeterminateSystems/update-flake-lock dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/update-flake.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml index b06db161..924287d7 100644 --- a/.github/workflows/update-flake.yml +++ b/.github/workflows/update-flake.yml @@ -14,7 +14,7 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v18 - name: Update flake.lock - uses: DeterminateSystems/update-flake-lock@v15 + uses: DeterminateSystems/update-flake-lock@v16 with: token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} pr-labels: dependencies From bb4b25b302dbf0f527f190461b080b5262871756 Mon Sep 17 00:00:00 2001 From: Lin Jian Date: Sat, 21 Jan 2023 18:27:05 +0800 Subject: [PATCH 216/233] bash: format using nixfmt PR #3609 --- format | 1 - modules/programs/bash.nix | 153 +++++++++++++++++--------------------- 2 files changed, 69 insertions(+), 85 deletions(-) diff --git a/format b/format index 68751a3f..ef5528b7 100755 --- a/format +++ b/format @@ -21,7 +21,6 @@ find . -name '*.nix' \ ! -path ./modules/lib/default.nix \ ! -path ./modules/lib/file-type.nix \ ! -path ./modules/misc/news.nix \ - ! -path ./modules/programs/bash.nix \ ! -path ./modules/programs/ssh.nix \ ! -path ./modules/programs/zsh.nix \ ! -path ./tests/default.nix \ diff --git a/modules/programs/bash.nix b/modules/programs/bash.nix index 742087b7..0c0643da 100644 --- a/modules/programs/bash.nix +++ b/modules/programs/bash.nix @@ -6,16 +6,15 @@ let cfg = config.programs.bash; - writeBashScript = name: text: pkgs.writeTextFile { - inherit name text; - checkPhase = '' - ${pkgs.stdenv.shellDryRun} "$target" - ''; - }; + writeBashScript = name: text: + pkgs.writeTextFile { + inherit name text; + checkPhase = '' + ${pkgs.stdenv.shellDryRun} "$target" + ''; + }; -in - -{ +in { meta.maintainers = [ maintainers.rycee ]; imports = [ @@ -70,20 +69,18 @@ in }; historyControl = mkOption { - type = types.listOf (types.enum [ - "erasedups" - "ignoredups" - "ignorespace" - ]); - default = []; + type = + types.listOf (types.enum [ "erasedups" "ignoredups" "ignorespace" ]); + default = [ ]; description = "Controlling how commands are saved on the history list."; }; historyIgnore = mkOption { type = types.listOf types.str; - default = []; + default = [ ]; example = [ "ls" "cd" "exit" ]; - description = "List of commands that should not be saved to the history list."; + description = + "List of commands that should not be saved to the history list."; }; shellOptions = mkOption { @@ -103,10 +100,7 @@ in # Warn if closing shell with running jobs. "checkjobs" ]; - example = [ - "extglob" - "-cdspell" - ]; + example = [ "extglob" "-cdspell" ]; description = '' Shell options to set. Prefix an option with - to unset. @@ -114,7 +108,7 @@ in }; sessionVariables = mkOption { - default = {}; + default = { }; type = types.attrs; example = { MAILCHECK = 30; }; description = '' @@ -123,7 +117,7 @@ in }; shellAliases = mkOption { - default = {}; + default = { }; type = types.attrsOf types.str; example = literalExpression '' { @@ -175,80 +169,71 @@ in }; }; - config = ( - let - aliasesStr = concatStringsSep "\n" ( - mapAttrsToList (k: v: "alias ${k}=${escapeShellArg v}") cfg.shellAliases - ); + config = let + aliasesStr = concatStringsSep "\n" + (mapAttrsToList (k: v: "alias ${k}=${escapeShellArg v}") + cfg.shellAliases); - shoptsStr = let - switch = v: if hasPrefix "-" v then "-u" else "-s"; - in concatStringsSep "\n" ( - map (v: "shopt ${switch v} ${removePrefix "-" v}") cfg.shellOptions - ); + shoptsStr = let switch = v: if hasPrefix "-" v then "-u" else "-s"; + in concatStringsSep "\n" + (map (v: "shopt ${switch v} ${removePrefix "-" v}") cfg.shellOptions); - sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables; + sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables; - historyControlStr = - concatStringsSep "\n" (mapAttrsToList (n: v: "${n}=${v}") ( - { - HISTFILESIZE = toString cfg.historyFileSize; - HISTSIZE = toString cfg.historySize; - } - // optionalAttrs (cfg.historyFile != null) { - HISTFILE = "\"${cfg.historyFile}\""; - } - // optionalAttrs (cfg.historyControl != []) { - HISTCONTROL = concatStringsSep ":" cfg.historyControl; - } - // optionalAttrs (cfg.historyIgnore != []) { - HISTIGNORE = escapeShellArg (concatStringsSep ":" cfg.historyIgnore); - } - )); - in mkIf cfg.enable { - home.file.".bash_profile".source = writeBashScript "bash_profile" '' - # include .profile if it exists - [[ -f ~/.profile ]] && . ~/.profile + historyControlStr = concatStringsSep "\n" + (mapAttrsToList (n: v: "${n}=${v}") ({ + HISTFILESIZE = toString cfg.historyFileSize; + HISTSIZE = toString cfg.historySize; + } // optionalAttrs (cfg.historyFile != null) { + HISTFILE = ''"${cfg.historyFile}"''; + } // optionalAttrs (cfg.historyControl != [ ]) { + HISTCONTROL = concatStringsSep ":" cfg.historyControl; + } // optionalAttrs (cfg.historyIgnore != [ ]) { + HISTIGNORE = escapeShellArg (concatStringsSep ":" cfg.historyIgnore); + })); + in mkIf cfg.enable { + home.file.".bash_profile".source = writeBashScript "bash_profile" '' + # include .profile if it exists + [[ -f ~/.profile ]] && . ~/.profile - # include .bashrc if it exists - [[ -f ~/.bashrc ]] && . ~/.bashrc - ''; + # include .bashrc if it exists + [[ -f ~/.bashrc ]] && . ~/.bashrc + ''; - # If completion is enabled then make sure it is sourced very early. This - # is to avoid problems if any other initialization code attempts to set up - # completion. - programs.bash.initExtra = mkIf cfg.enableCompletion (mkOrder 100 '' - if [[ ! -v BASH_COMPLETION_VERSINFO ]]; then - . "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh" - fi - ''); + # If completion is enabled then make sure it is sourced very early. This + # is to avoid problems if any other initialization code attempts to set up + # completion. + programs.bash.initExtra = mkIf cfg.enableCompletion (mkOrder 100 '' + if [[ ! -v BASH_COMPLETION_VERSINFO ]]; then + . "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh" + fi + ''); - home.file.".profile".source = writeBashScript "profile" '' - . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" + home.file.".profile".source = writeBashScript "profile" '' + . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" - ${sessionVarsStr} + ${sessionVarsStr} - ${cfg.profileExtra} - ''; + ${cfg.profileExtra} + ''; - home.file.".bashrc".source = writeBashScript "bashrc" '' - ${cfg.bashrcExtra} + home.file.".bashrc".source = writeBashScript "bashrc" '' + ${cfg.bashrcExtra} - # Commands that should be applied only for interactive shells. - [[ $- == *i* ]] || return + # Commands that should be applied only for interactive shells. + [[ $- == *i* ]] || return - ${historyControlStr} + ${historyControlStr} - ${shoptsStr} + ${shoptsStr} - ${aliasesStr} + ${aliasesStr} - ${cfg.initExtra} - ''; + ${cfg.initExtra} + ''; - home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") { - source = writeBashScript "bash_logout" cfg.logoutExtra; - }; - } - ); + home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") { + source = writeBashScript "bash_logout" cfg.logoutExtra; + }; + }; } From 08a778d80308353f4f65c9dcd3790b5da02d6306 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Fri, 27 Jan 2023 04:20:00 +0000 Subject: [PATCH 217/233] papis: add module --- .github/CODEOWNERS | 3 + modules/misc/news.nix | 7 ++ modules/modules.nix | 1 + modules/programs/papis.nix | 91 ++++++++++++++++++++++++ tests/default.nix | 1 + tests/modules/programs/papis/default.nix | 1 + tests/modules/programs/papis/papis.nix | 46 ++++++++++++ 7 files changed, 150 insertions(+) create mode 100644 modules/programs/papis.nix create mode 100644 tests/modules/programs/papis/default.nix create mode 100644 tests/modules/programs/papis/papis.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9ade1106..e2668548 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -249,6 +249,9 @@ Makefile @thiagokokada /modules/programs/pandoc.nix @kirelagin /tests/modules/programs/pandoc @kirelagin +/modules/programs/papis.nix @marsam +/tests/modules/programs/papis @marsam + /modules/programs/password-store.nix @pacien /modules/programs/pazi.nix @marsam diff --git a/modules/misc/news.nix b/modules/misc/news.nix index f59d50b5..6626e109 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -886,6 +886,13 @@ in 'wayland.windowManager.sway.config.[window|floating].titlebar' now default to 'true'. ''; } + + { + time = "2023-01-28T17:35:49+00:00"; + message = '' + A new module is available: 'programs.papis'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 7e6d2e71..f831bcac 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -144,6 +144,7 @@ let ./programs/oh-my-posh.nix ./programs/opam.nix ./programs/pandoc.nix + ./programs/papis.nix ./programs/password-store.nix ./programs/pazi.nix ./programs/pet.nix diff --git a/modules/programs/papis.nix b/modules/programs/papis.nix new file mode 100644 index 00000000..8e127e26 --- /dev/null +++ b/modules/programs/papis.nix @@ -0,0 +1,91 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.papis; + + defaultLibraries = remove null + (mapAttrsToList (n: v: if v.isDefault then n else null) cfg.libraries); + + settingsIni = (lib.mapAttrs (n: v: v.settings) cfg.libraries) // { + settings = cfg.settings // { "default-library" = head defaultLibraries; }; + }; + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.papis = { + enable = mkEnableOption "papis"; + + settings = mkOption { + type = with types; attrsOf (oneOf [ bool int str ]); + default = { }; + example = literalExpression '' + { + editor = "nvim"; + file-browser = "ranger" + add-edit = true; + } + ''; + description = '' + Configuration written to + $XDG_CONFIG_HOME/papis/config. See + + for supported values. + ''; + }; + + libraries = mkOption { + type = types.attrsOf (types.submodule ({ config, name, ... }: { + options = { + name = mkOption { + type = types.str; + default = name; + readOnly = true; + description = "This library's name."; + }; + + isDefault = mkOption { + type = types.bool; + default = false; + example = true; + description = '' + Whether this is a default library. There must be exactly one + default library. + ''; + }; + + settings = mkOption { + type = with types; attrsOf (oneOf [ bool int str ]); + default = { }; + example = literalExpression '' + { + dir = "~/papers/"; + } + ''; + description = '' + Configuration for this library. + ''; + }; + }; + })); + }; + }; + + config = mkIf cfg.enable { + assertions = [{ + assertion = cfg.libraries == { } || length defaultLibraries == 1; + message = "Must have exactly one default papis library, but found " + + toString (length defaultLibraries) + + optionalString (length defaultLibraries > 1) + (", namely " + concatStringsSep "," defaultLibraries); + }]; + + home.packages = [ pkgs.papis ]; + + xdg.configFile."papis/config" = + mkIf (cfg.libraries != { }) { text = generators.toINI { } settingsIni; }; + }; +} diff --git a/tests/default.nix b/tests/default.nix index ac31f3b5..9c60acea 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -102,6 +102,7 @@ import nmt { ./modules/programs/nushell ./modules/programs/oh-my-posh ./modules/programs/pandoc + ./modules/programs/papis ./modules/programs/pet ./modules/programs/pistol ./modules/programs/pls diff --git a/tests/modules/programs/papis/default.nix b/tests/modules/programs/papis/default.nix new file mode 100644 index 00000000..a849be85 --- /dev/null +++ b/tests/modules/programs/papis/default.nix @@ -0,0 +1 @@ +{ papis = ./papis.nix; } diff --git a/tests/modules/programs/papis/papis.nix b/tests/modules/programs/papis/papis.nix new file mode 100644 index 00000000..507056be --- /dev/null +++ b/tests/modules/programs/papis/papis.nix @@ -0,0 +1,46 @@ +{ ... }: + +{ + programs.papis = { + enable = true; + settings = { + picktool = "fzf"; + file-browser = "ranger"; + add-edit = true; + }; + libraries = { + papers = { + isDefault = true; + settings = { + dir = "~/papers"; + opentool = "okular"; + }; + }; + books.settings = { + dir = "~/books"; + opentool = "firefox"; + }; + }; + }; + + test.stubs.papis = { }; + + nmt.script = '' + assertFileContent home-files/.config/papis/config \ + ${builtins.toFile "papis-expected-settings.ini" '' + [books] + dir=~/books + opentool=firefox + + [papers] + dir=~/papers + opentool=okular + + [settings] + add-edit=true + default-library=papers + file-browser=ranger + picktool=fzf + ''} + ''; +} From 69696fe53940562a047bf2ec675cc1dcd1bc09b3 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Tue, 31 Jan 2023 17:06:18 +0100 Subject: [PATCH 218/233] wlogout: add module (#3629) --- modules/misc/news.nix | 7 + modules/modules.nix | 1 + modules/programs/wlogout.nix | 151 ++++++++++++++++++ tests/default.nix | 1 + tests/modules/programs/wlogout/default.nix | 5 + .../wlogout/layout-multiple-expected.json | 6 + .../programs/wlogout/layout-multiple.nix | 62 +++++++ .../wlogout/layout-single-expected.json | 1 + .../programs/wlogout/layout-single.nix | 27 ++++ .../programs/wlogout/styling-expected.css | 16 ++ tests/modules/programs/wlogout/styling.nix | 39 +++++ 11 files changed, 316 insertions(+) create mode 100644 modules/programs/wlogout.nix create mode 100644 tests/modules/programs/wlogout/default.nix create mode 100644 tests/modules/programs/wlogout/layout-multiple-expected.json create mode 100644 tests/modules/programs/wlogout/layout-multiple.nix create mode 100644 tests/modules/programs/wlogout/layout-single-expected.json create mode 100644 tests/modules/programs/wlogout/layout-single.nix create mode 100644 tests/modules/programs/wlogout/styling-expected.css create mode 100644 tests/modules/programs/wlogout/styling.nix diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 6626e109..950ad289 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -893,6 +893,13 @@ in A new module is available: 'programs.papis'. ''; } + + { + time = "2023-01-30T10:39:11+00:00"; + message = '' + A new module is available: 'programs.wlogout'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index f831bcac..b5056417 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -192,6 +192,7 @@ let ./programs/watson.nix ./programs/waybar.nix ./programs/wezterm.nix + ./programs/wlogout.nix ./programs/xmobar.nix ./programs/yt-dlp.nix ./programs/z-lua.nix diff --git a/modules/programs/wlogout.nix b/modules/programs/wlogout.nix new file mode 100644 index 00000000..49e59b07 --- /dev/null +++ b/modules/programs/wlogout.nix @@ -0,0 +1,151 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) all filterAttrs isStorePath literalExpression types; + inherit (lib.options) mkEnableOption mkPackageOption mkOption; + inherit (lib.modules) mkIf; + inherit (lib.strings) concatMapStrings; + inherit (builtins) toJSON; + + cfg = config.programs.wlogout; + + jsonFormat = pkgs.formats.json { }; + + wlogoutLayoutConfig = with types; + submodule { + freeformType = jsonFormat.type; + + options = { + label = mkOption { + type = str; + default = ""; + example = "shutdown"; + description = "CSS label of button."; + }; + + action = mkOption { + type = either path str; + default = ""; + example = "systemctl poweroff"; + description = "Command to execute when clicked."; + }; + + text = mkOption { + type = str; + default = ""; + example = "Shutdown"; + description = "Text displayed on button."; + }; + + keybind = mkOption { + type = str; + default = ""; + example = "s"; + description = "Keyboard character to trigger this action."; + }; + + height = mkOption { + type = nullOr (numbers.between 0 1); + default = null; + example = 0.5; + description = "Relative height of tile."; + }; + + width = mkOption { + type = nullOr (numbers.between 0 1); + default = null; + example = 0.5; + description = "Relative width of tile."; + }; + + circular = mkOption { + type = nullOr bool; + default = null; + example = true; + description = "Make button circular."; + }; + }; + }; +in { + meta.maintainers = [ lib.maintainers.Scrumplex ]; + + options.programs.wlogout = with lib.types; { + enable = mkEnableOption "wlogout"; + + package = mkPackageOption pkgs "wlogout" { }; + + layout = mkOption { + type = listOf wlogoutLayoutConfig; + default = [ ]; + description = '' + Layout configuration for wlogout, see + for supported values. + ''; + example = literalExpression '' + [ + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + } + ] + ''; + }; + + style = mkOption { + type = nullOr (either path str); + default = null; + description = '' + CSS style of the bar. + + + See + for the documentation. + + + If the value is set to a path literal, then the path will be used as the css file. + ''; + example = '' + window { + background: #16191C; + } + + button { + color: #AAB2BF; + } + ''; + }; + }; + + config = let + # Removes nulls because wlogout ignores them. + # This is not recursive. + removeTopLevelNulls = filterAttrs (_: v: v != null); + cleanJSON = foo: toJSON (removeTopLevelNulls foo); + + # wlogout doesn't want a JSON array, it just wants a list of JSON objects + layoutJsons = map cleanJSON cfg.layout; + layoutContent = concatMapStrings (l: l + "\n") layoutJsons; + + in mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "programs.wlogout" pkgs + lib.platforms.linux) + ]; + + home.packages = [ cfg.package ]; + + xdg.configFile."wlogout/layout" = mkIf (cfg.layout != [ ]) { + source = pkgs.writeText "wlogout/layout" layoutContent; + }; + + xdg.configFile."wlogout/style.css" = mkIf (cfg.style != null) { + source = if builtins.isPath cfg.style || isStorePath cfg.style then + cfg.style + else + pkgs.writeText "wlogout/style.css" cfg.style; + }; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 9c60acea..57dedbb8 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -163,6 +163,7 @@ import nmt { ./modules/programs/terminator ./modules/programs/thunderbird ./modules/programs/waybar + ./modules/programs/wlogout ./modules/programs/xmobar ./modules/programs/yt-dlp ./modules/services/barrier diff --git a/tests/modules/programs/wlogout/default.nix b/tests/modules/programs/wlogout/default.nix new file mode 100644 index 00000000..294772e7 --- /dev/null +++ b/tests/modules/programs/wlogout/default.nix @@ -0,0 +1,5 @@ +{ + wlogout-styling = ./styling.nix; + wlogout-layout-single = ./layout-single.nix; + wlogout-layout-multiple = ./layout-multiple.nix; +} diff --git a/tests/modules/programs/wlogout/layout-multiple-expected.json b/tests/modules/programs/wlogout/layout-multiple-expected.json new file mode 100644 index 00000000..9e69d4e9 --- /dev/null +++ b/tests/modules/programs/wlogout/layout-multiple-expected.json @@ -0,0 +1,6 @@ +{"action":"systemctl poweroff","keybind":"s","label":"shutdown","text":"Shutdown"} +{"action":"systemctl hibernate","height":0.5,"keybind":"h","label":"hibernate","text":"Hibernate","width":0.5} +{"action":"systemctl suspend","circular":true,"keybind":"u","label":"suspend","text":"Suspend"} +{"action":"swaymsg exit","keybind":"e","label":"exit","text":"Exit"} +{"action":"systemctl reboot","keybind":"r","label":"reboot","text":"Reboot"} +{"action":"gtklock","keybind":"l","label":"lock","text":"Lock"} diff --git a/tests/modules/programs/wlogout/layout-multiple.nix b/tests/modules/programs/wlogout/layout-multiple.nix new file mode 100644 index 00000000..108961aa --- /dev/null +++ b/tests/modules/programs/wlogout/layout-multiple.nix @@ -0,0 +1,62 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + home.stateVersion = "22.11"; + + programs.wlogout = { + package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; + enable = true; + layout = [ + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + } + { + label = "hibernate"; + action = "systemctl hibernate"; + text = "Hibernate"; + keybind = "h"; + height = 0.5; + width = 0.5; + } + { + label = "suspend"; + action = "systemctl suspend"; + text = "Suspend"; + keybind = "u"; + circular = true; + } + { + label = "exit"; + action = "swaymsg exit"; + text = "Exit"; + keybind = "e"; + } + { + label = "reboot"; + action = "systemctl reboot"; + text = "Reboot"; + keybind = "r"; + } + { + label = "lock"; + action = "gtklock"; + text = "Lock"; + keybind = "l"; + } + ]; + }; + + nmt.script = '' + assertPathNotExists home-files/.config/wlogout/style.css + assertFileContent \ + home-files/.config/wlogout/layout \ + ${./layout-multiple-expected.json} + ''; + }; +} diff --git a/tests/modules/programs/wlogout/layout-single-expected.json b/tests/modules/programs/wlogout/layout-single-expected.json new file mode 100644 index 00000000..d4d43dde --- /dev/null +++ b/tests/modules/programs/wlogout/layout-single-expected.json @@ -0,0 +1 @@ +{"action":"systemctl poweroff","keybind":"s","label":"shutdown","text":"Shutdown"} diff --git a/tests/modules/programs/wlogout/layout-single.nix b/tests/modules/programs/wlogout/layout-single.nix new file mode 100644 index 00000000..bbb5d61e --- /dev/null +++ b/tests/modules/programs/wlogout/layout-single.nix @@ -0,0 +1,27 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + home.stateVersion = "22.11"; + + programs.wlogout = { + package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; + enable = true; + layout = [{ + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + }]; + }; + + nmt.script = '' + assertPathNotExists home-files/.config/wlogout/style.css + assertFileContent \ + home-files/.config/wlogout/layout \ + ${./layout-single-expected.json} + ''; + }; +} diff --git a/tests/modules/programs/wlogout/styling-expected.css b/tests/modules/programs/wlogout/styling-expected.css new file mode 100644 index 00000000..49050beb --- /dev/null +++ b/tests/modules/programs/wlogout/styling-expected.css @@ -0,0 +1,16 @@ +* { + border: none; + border-radius: 0; + font-family: Source Code Pro; + font-weight: bold; + color: #abb2bf; + font-size: 18px; + min-height: 0px; +} +window { + background: #16191C; + color: #aab2bf; +} +#window { + padding: 0 0px; +} diff --git a/tests/modules/programs/wlogout/styling.nix b/tests/modules/programs/wlogout/styling.nix new file mode 100644 index 00000000..6df6290f --- /dev/null +++ b/tests/modules/programs/wlogout/styling.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + home.stateVersion = "22.11"; + + programs.wlogout = { + package = config.lib.test.mkStubPackage { outPath = "@wlogout@"; }; + enable = true; + style = '' + * { + border: none; + border-radius: 0; + font-family: Source Code Pro; + font-weight: bold; + color: #abb2bf; + font-size: 18px; + min-height: 0px; + } + window { + background: #16191C; + color: #aab2bf; + } + #window { + padding: 0 0px; + } + ''; + }; + + nmt.script = '' + assertPathNotExists home-files/.config/wlogout/layout + assertFileContent \ + home-files/.config/wlogout/style.css \ + ${./styling-expected.css} + ''; + }; +} From 1c6f3054ca36466a45972bf163fa934c33d69a15 Mon Sep 17 00:00:00 2001 From: Mario Rodas Date: Tue, 17 Jan 2023 04:20:00 +0000 Subject: [PATCH 219/233] rbenv: add module --- .github/CODEOWNERS | 2 + modules/misc/news.nix | 7 +++ modules/modules.nix | 1 + modules/programs/rbenv.nix | 93 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 modules/programs/rbenv.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e2668548..375be75a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -276,6 +276,8 @@ Makefile @thiagokokada /modules/programs/pylint.nix @florpe +/modules/programs/rbenv.nix @marsam + /modules/programs/rbw.nix @ambroisie /tests/modules/programs/rbw @ambroisie diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 950ad289..12d83bd4 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -900,6 +900,13 @@ in A new module is available: 'programs.wlogout'. ''; } + + { + time = "2023-01-31T22:08:41+00:00"; + message = '' + A new module is available: 'programs.rbenv'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index b5056417..7bd4a49b 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -189,6 +189,7 @@ let ./programs/vscode.nix ./programs/vscode/haskell.nix ./programs/pywal.nix + ./programs/rbenv.nix ./programs/watson.nix ./programs/waybar.nix ./programs/wezterm.nix diff --git a/modules/programs/rbenv.nix b/modules/programs/rbenv.nix new file mode 100644 index 00000000..b204d4f0 --- /dev/null +++ b/modules/programs/rbenv.nix @@ -0,0 +1,93 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.rbenv; + + pluginModule = types.submodule { + options = { + src = mkOption { + type = types.path; + description = '' + Path to the plugin folder. + ''; + }; + name = mkOption { + type = types.str; + description = '' + Name of the plugin. + ''; + }; + }; + }; + +in { + meta.maintainers = [ maintainers.marsam ]; + + options.programs.rbenv = { + enable = mkEnableOption "rbenv"; + + package = mkPackageOption pkgs "rbenv" { }; + + plugins = mkOption { + type = types.listOf pluginModule; + default = [ ]; + example = literalExpression '' + [ + { + name = "ruby-build"; + src = pkgs.fetchFromGitHub { + owner = "rbenv"; + repo = "ruby-build"; + rev = "v20221225"; + hash = "sha256-Kuq0Z1kh2mvq7rHEgwVG9XwzR5ZUtU/h8SQ7W4/mBU0="; + }; + } + ] + ''; + description = '' + rbenv plugins to install in $HOME/.rbenv/plugins/. + + See + for the full list of plugins. + ''; + }; + + enableBashIntegration = mkEnableOption "Bash integration" // { + default = true; + }; + + enableZshIntegration = mkEnableOption "Zsh integration" // { + default = true; + }; + + enableFishIntegration = mkEnableOption "Fish integration" // { + default = true; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + home.file.".rbenv/plugins" = mkIf (cfg.plugins != [ ]) { + source = pkgs.linkFarm "rbenv-plugins" (builtins.map (p: { + name = p.name; + path = p.src; + }) cfg.plugins); + }; + + programs.bash.initExtra = mkIf cfg.enableBashIntegration '' + eval "$(${cfg.package}/bin/rbenv init - bash)" + ''; + + programs.zsh.initExtra = mkIf cfg.enableZshIntegration '' + eval "$(${cfg.package}/bin/rbenv init - zsh)" + ''; + + programs.fish.shellInit = mkIf cfg.enableFishIntegration '' + ${cfg.package}/bin/rbenv init - fish | source + ''; + }; +} From 1d94de5604935591494eeb6ea80bc34ac84a9f23 Mon Sep 17 00:00:00 2001 From: David Houston Date: Sat, 7 May 2022 14:05:10 -0400 Subject: [PATCH 220/233] pass-secret-service: various improvements Allow setting the application package and storePath used by the config. Since the `programs.password-store` Home Manager module sets config values via global environment variables, the default behavior of the module should continue to behave as before for the user. Additionally, - Adds a few tests. - Use "escapeShellArg" function call to the path parameter call to ensure paths with spaces work. - Allow not setting storePath, which will cause `pass_secret_service` to default to using `~/.password-store`. - If `pass-secret-service` is enabled, set its store path to default to the one defined in our password-store environment settings. - Add myself (houstdav000) as maintainer. --- modules/programs/password-store.nix | 3 ++ modules/services/pass-secret-service.nix | 43 +++++++++++++------ tests/default.nix | 1 + .../basic-configuration.nix | 17 ++++++++ .../default-configuration.nix | 15 +++++++ .../services/pass-secret-service/default.nix | 4 ++ 6 files changed, 69 insertions(+), 14 deletions(-) create mode 100644 tests/modules/services/pass-secret-service/basic-configuration.nix create mode 100644 tests/modules/services/pass-secret-service/default-configuration.nix create mode 100644 tests/modules/services/pass-secret-service/default.nix diff --git a/modules/programs/password-store.nix b/modules/programs/password-store.nix index e2f463ec..076db93e 100644 --- a/modules/programs/password-store.nix +++ b/modules/programs/password-store.nix @@ -59,6 +59,9 @@ in { home.packages = [ cfg.package ]; home.sessionVariables = cfg.settings; + services.pass-secret-service.storePath = + mkDefault cfg.settings.PASSWORD_STORE_DIR; + xsession.importedVariables = mkIf config.xsession.enable (mapAttrsToList (name: value: name) cfg.settings); }; diff --git a/modules/services/pass-secret-service.nix b/modules/services/pass-secret-service.nix index 06b5be1f..8459099c 100644 --- a/modules/services/pass-secret-service.nix +++ b/modules/services/pass-secret-service.nix @@ -2,31 +2,46 @@ with lib; -let serviceCfg = config.services.pass-secret-service; +let + cfg = config.services.pass-secret-service; + + serviceArgs = + optionalString (cfg.storePath != null) "--path ${cfg.storePath}"; in { - meta.maintainers = [ maintainers.cab404 ]; + meta.maintainers = with maintainers; [ cab404 houstdav000 ]; + options.services.pass-secret-service = { enable = mkEnableOption "Pass libsecret service"; + + package = mkPackageOption pkgs "pass-secret-service" { }; + + storePath = mkOption { + type = with types; nullOr str; + default = null; + defaultText = "~/.password-store"; + example = "/home/user/.local/share/password-store"; + description = "Absolute path to password store."; + }; }; - config = mkIf serviceCfg.enable { + + config = mkIf cfg.enable { assertions = [ (hm.assertions.assertPlatform "services.pass-secret-service" pkgs platforms.linux) - - { - assertion = config.programs.password-store.enable; - message = "The 'services.pass-secret-service' module requires" - + " 'programs.password-store.enable = true'."; - } ]; systemd.user.services.pass-secret-service = { - Unit = { Description = "Pass libsecret service"; }; - Service = { - # pass-secret-service doesn't use environment variables for some reason. - ExecStart = - "${pkgs.pass-secret-service}/bin/pass_secret_service --path ${config.programs.password-store.settings.PASSWORD_STORE_DIR}"; + Unit = { + AssertFileIsExecutable = "${cfg.package}/bin/pass_secret_service"; + Description = "Pass libsecret service"; + Documentation = "https://github.com/mdellweg/pass_secret_service"; + PartOf = [ "default.target" ]; }; + + Service = { + ExecStart = "${cfg.package}/bin/pass_secret_service ${serviceArgs}"; + }; + Install = { WantedBy = [ "default.target" ]; }; }; }; diff --git a/tests/default.nix b/tests/default.nix index 57dedbb8..295254b9 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -189,6 +189,7 @@ import nmt { ./modules/services/mpdris2 ./modules/services/pantalaimon ./modules/services/parcellite + ./modules/services/pass-secret-service ./modules/services/pbgopy ./modules/services/picom ./modules/services/playerctld diff --git a/tests/modules/services/pass-secret-service/basic-configuration.nix b/tests/modules/services/pass-secret-service/basic-configuration.nix new file mode 100644 index 00000000..f5568df7 --- /dev/null +++ b/tests/modules/services/pass-secret-service/basic-configuration.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +{ + services.pass-secret-service = { + enable = true; + package = config.lib.test.mkStubPackage { }; + storePath = "/mnt/password-store"; + }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/pass-secret-service.service + + assertFileExists $serviceFile + assertFileRegex $serviceFile 'ExecStart=.*/bin/pass_secret_service' + assertFileRegex $serviceFile '/mnt/password-store' + ''; +} diff --git a/tests/modules/services/pass-secret-service/default-configuration.nix b/tests/modules/services/pass-secret-service/default-configuration.nix new file mode 100644 index 00000000..d418d823 --- /dev/null +++ b/tests/modules/services/pass-secret-service/default-configuration.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +{ + services.pass-secret-service = { + enable = true; + package = config.lib.test.mkStubPackage { }; + }; + + nmt.script = '' + serviceFile=home-files/.config/systemd/user/pass-secret-service.service + + assertFileExists $serviceFile + assertFileRegex $serviceFile 'ExecStart=.*/bin/pass_secret_service' + ''; +} diff --git a/tests/modules/services/pass-secret-service/default.nix b/tests/modules/services/pass-secret-service/default.nix new file mode 100644 index 00000000..d841c97e --- /dev/null +++ b/tests/modules/services/pass-secret-service/default.nix @@ -0,0 +1,4 @@ +{ + pass-secret-service-default-configuration = ./default-configuration.nix; + pass-secret-service-basic-configuration = ./basic-configuration.nix; +} From 782cb855b2f23c485011a196c593e2d7e4fce746 Mon Sep 17 00:00:00 2001 From: Zack <43693810+zaporter@users.noreply.github.com> Date: Wed, 1 Feb 2023 05:25:13 -0500 Subject: [PATCH 221/233] home-manager: edit `homeManagerConfiguration` err (#3632) * home-manager: edit `homeManagerConfiguration` err This adds https://nix-community.github.io/home-manager/release-notes.html#sec-release-22.11-highlights to the homeManagerConfiguration arguments error. * home-manager: `homeManagerConfiguration` indent Moved URL of the release notes for 22.11 to the same line so that ./format doesn't add extra whitespace --------- Co-authored-by: zaporter --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 51211170..e64b2ea7 100644 --- a/flake.nix +++ b/flake.nix @@ -56,7 +56,7 @@ - 'system' have been removed. Instead use the arguments 'pkgs' and - 'modules'. See the 22.11 release notes for more. + 'modules'. See the 22.11 release notes for more: https://nix-community.github.io/home-manager/release-notes.html#sec-release-22.11-highlights ''; throwForRemovedArgs = v: From 2f62da9837f6f38c329c9d763df2fc152a97a49b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Reynier?= <88983487+loicreynier@users.noreply.github.com> Date: Thu, 2 Feb 2023 02:58:17 +0100 Subject: [PATCH 222/233] git: unset `pager` while using difftastic (#3633) --- modules/programs/git.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/programs/git.nix b/modules/programs/git.nix index 2b0d8a2f..5bd828b3 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -527,10 +527,7 @@ in { "--background ${cfg.difftastic.background}" "--display ${cfg.difftastic.display}" ]; - in { - diff.external = difftCommand; - core.pager = "${pkgs.less}/bin/less -XF"; - }; + in { diff.external = difftCommand; }; }) (mkIf cfg.delta.enable { From 4a958524903e6019f5f69a23e0c0f16e5af01eb0 Mon Sep 17 00:00:00 2001 From: home-manager-bot <106474382+home-manager-bot@users.noreply.github.com> Date: Thu, 2 Feb 2023 03:00:28 +0100 Subject: [PATCH 223/233] flake.lock: Update (#3619) 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/5ed481943351e9fd354aeb557679624224de38d5' (2023-01-20) → 'github:nixos/nixpkgs/2caf4ef5005ecc68141ecb4aac271079f7371c44' (2023-01-30) 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 797ace51..f8d0f32e 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1674211260, - "narHash": "sha256-xU6Rv9sgnwaWK7tgCPadV6HhI2Y/fl4lKxJoG2+m9qs=", + "lastModified": 1675115703, + "narHash": "sha256-4zetAPSyY0D77x+Ww9QBe8RHn1akvIvHJ/kgg8kGDbk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "5ed481943351e9fd354aeb557679624224de38d5", + "rev": "2caf4ef5005ecc68141ecb4aac271079f7371c44", "type": "github" }, "original": { From d1c7730bb707bf8124d997952f7babd2a281ae68 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 26 Jan 2023 16:08:17 +0100 Subject: [PATCH 224/233] services.autorandr: add module --- .github/CODEOWNERS | 2 ++ modules/misc/news.nix | 8 +++++ modules/modules.nix | 1 + modules/services/autorandr.nix | 53 ++++++++++++++++++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 modules/services/autorandr.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 375be75a..6f810af3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -360,6 +360,8 @@ Makefile @thiagokokada /modules/programs/zsh/prezto.nix @NickHu +/modules/services/autorandr.nix @GaetanLepage + /modules/services/barrier.nix @Kritnich /tests/modules/services/barrier @Kritnich diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 12d83bd4..57c5574f 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -907,6 +907,14 @@ in A new module is available: 'programs.rbenv'. ''; } + + { + time = "2023-02-02T20:49:05+00:00"; + condition = hostPlatform.isLinux; + message = '' + A new module is available: 'services.autorandr'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 7bd4a49b..0e71ea3a 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -203,6 +203,7 @@ let ./programs/zplug.nix ./programs/zsh.nix ./programs/zsh/prezto.nix + ./services/autorandr.nix ./services/barrier.nix ./services/betterlockscreen.nix ./services/blueman-applet.nix diff --git a/modules/services/autorandr.nix b/modules/services/autorandr.nix new file mode 100644 index 00000000..84791a66 --- /dev/null +++ b/modules/services/autorandr.nix @@ -0,0 +1,53 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.services.autorandr; + +in { + + meta.maintainers = [ maintainers.GaetanLepage ]; + + options = { + services.autorandr = { + enable = mkEnableOption "" // { + description = '' + Whether to enable the Autorandr systemd service. + This module is complementary to programs.autorandr which handles the + configuration (profiles). + ''; + }; + + ignoreLid = mkOption { + default = false; + type = types.bool; + description = + "Treat outputs as connected even if their lids are closed."; + }; + }; + }; + + config = mkIf cfg.enable { + assertions = [ + (lib.hm.assertions.assertPlatform "services.autorandr" pkgs + lib.platforms.linux) + ]; + + systemd.user.services.autorandr = { + Unit = { + Description = "autorandr"; + After = [ "graphical-session-pre.target" ]; + PartOf = [ "graphical-session.target" ]; + }; + + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.autorandr}/bin/autorandr --change ${ + optionalString cfg.ignoreLid "--ignore-lid" + }"; + }; + + Install.WantedBy = [ "graphical-session.target" ]; + }; + }; +} From e2c1756e3ae001ca8696912016dd31cb1503ccf3 Mon Sep 17 00:00:00 2001 From: Jarkad <109739558+IWYpPtD49k1OHyy3AqwT9vOBJEaZ4S@users.noreply.github.com> Date: Sat, 4 Feb 2023 00:22:11 +0200 Subject: [PATCH 225/233] mbsync: make passwordCommand escaping consistent (#3630) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix mbsync passwordCommand escaping * email: use lib.escapeShellArgs Co-authored-by: Naïm Favier * mbsync: update tests --------- Co-authored-by: Naïm Favier --- modules/programs/mbsync.nix | 2 +- tests/modules/programs/mbsync/mbsync-expected.conf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/programs/mbsync.nix b/modules/programs/mbsync.nix index d43f6455..8694d200 100644 --- a/modules/programs/mbsync.nix +++ b/modules/programs/mbsync.nix @@ -84,7 +84,7 @@ let genSection "IMAPAccount ${name}" ({ Host = imap.host; User = userName; - PassCmd = toString passwordCommand; + PassCmd = lib.escapeShellArgs passwordCommand; } // genTlsConfig imap.tls // optionalAttrs (imap.port != null) { Port = toString imap.port; } // mbsync.extraConfig.account) + "\n" diff --git a/tests/modules/programs/mbsync/mbsync-expected.conf b/tests/modules/programs/mbsync/mbsync-expected.conf index 17110978..b6c77ea1 100644 --- a/tests/modules/programs/mbsync/mbsync-expected.conf +++ b/tests/modules/programs/mbsync/mbsync-expected.conf @@ -3,7 +3,7 @@ IMAPAccount hm-account CertificateFile /etc/ssl/certs/ca-certificates.crt Host imap.example.org -PassCmd "password-command 2" +PassCmd "'password-command' '2'" SSLType IMAPS User home.manager.jr @@ -55,7 +55,7 @@ Channel hm-account-strangeHostBoxName IMAPAccount hm@example.com CertificateFile /etc/ssl/certs/ca-certificates.crt Host imap.example.com -PassCmd password-command +PassCmd 'password-command' SSLType IMAPS SSLVersions TLSv1.3 TLSv1.2 User home.manager From 2ffc6d64961cb46d58d80fc344795837d6f227c2 Mon Sep 17 00:00:00 2001 From: Sleroq <52239427+sleroq@users.noreply.github.com> Date: Sun, 5 Feb 2023 16:02:14 +0600 Subject: [PATCH 226/233] tmux: mouse support (#3642) Co-authored-by: Sleroq --- modules/programs/tmux.nix | 3 ++ .../modules/programs/tmux/default-shell.conf | 1 + tests/modules/programs/tmux/default.nix | 1 + .../tmux/disable-confirmation-prompt.conf | 1 + .../programs/tmux/emacs-with-plugins.conf | 1 + .../modules/programs/tmux/mouse-enabled.conf | 29 +++++++++++++++++++ tests/modules/programs/tmux/mouse-enabled.nix | 26 +++++++++++++++++ tests/modules/programs/tmux/prefix.conf | 1 + .../tmux/shortcut-without-prefix.conf | 1 + tests/modules/programs/tmux/vi-all-true.conf | 1 + 10 files changed, 65 insertions(+) create mode 100644 tests/modules/programs/tmux/mouse-enabled.conf create mode 100644 tests/modules/programs/tmux/mouse-enabled.nix diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix index bf98a3f3..ed9876ea 100644 --- a/modules/programs/tmux.nix +++ b/modules/programs/tmux.nix @@ -94,6 +94,7 @@ let bind-key -N "Kill the current pane" x kill-pane ''} + set -g mouse ${boolToStr cfg.mouse} setw -g aggressive-resize ${boolToStr cfg.aggressiveResize} setw -g clock-mode-style ${if cfg.clock24 then "24" else "12"} set -s escape-time ${toString cfg.escapeTime} @@ -204,6 +205,8 @@ in { description = "VI or Emacs style shortcuts."; }; + mouse = mkEnableOption "mouse support"; + newSession = mkOption { default = false; type = types.bool; diff --git a/tests/modules/programs/tmux/default-shell.conf b/tests/modules/programs/tmux/default-shell.conf index a3362363..8eb4e40f 100644 --- a/tests/modules/programs/tmux/default-shell.conf +++ b/tests/modules/programs/tmux/default-shell.conf @@ -23,6 +23,7 @@ set -g mode-keys emacs +set -g mouse off setw -g aggressive-resize off setw -g clock-mode-style 12 set -s escape-time 500 diff --git a/tests/modules/programs/tmux/default.nix b/tests/modules/programs/tmux/default.nix index be78c262..979774a7 100644 --- a/tests/modules/programs/tmux/default.nix +++ b/tests/modules/programs/tmux/default.nix @@ -7,4 +7,5 @@ tmux-default-shell = ./default-shell.nix; tmux-shortcut-without-prefix = ./shortcut-without-prefix.nix; tmux-prefix = ./prefix.nix; + tmux-mouse-enabled = ./mouse-enabled.nix; } diff --git a/tests/modules/programs/tmux/disable-confirmation-prompt.conf b/tests/modules/programs/tmux/disable-confirmation-prompt.conf index e97a94d1..b4359316 100644 --- a/tests/modules/programs/tmux/disable-confirmation-prompt.conf +++ b/tests/modules/programs/tmux/disable-confirmation-prompt.conf @@ -23,6 +23,7 @@ bind-key -N "Kill the current window" & kill-window bind-key -N "Kill the current pane" x kill-pane +set -g mouse off setw -g aggressive-resize off setw -g clock-mode-style 12 set -s escape-time 500 diff --git a/tests/modules/programs/tmux/emacs-with-plugins.conf b/tests/modules/programs/tmux/emacs-with-plugins.conf index d0150192..54ddce13 100644 --- a/tests/modules/programs/tmux/emacs-with-plugins.conf +++ b/tests/modules/programs/tmux/emacs-with-plugins.conf @@ -23,6 +23,7 @@ set -g mode-keys emacs +set -g mouse off setw -g aggressive-resize on setw -g clock-mode-style 24 set -s escape-time 500 diff --git a/tests/modules/programs/tmux/mouse-enabled.conf b/tests/modules/programs/tmux/mouse-enabled.conf new file mode 100644 index 00000000..2069920d --- /dev/null +++ b/tests/modules/programs/tmux/mouse-enabled.conf @@ -0,0 +1,29 @@ +# ============================================= # +# Start with defaults from the Sensible plugin # +# --------------------------------------------- # +run-shell @sensible_rtp@ +# ============================================= # + +set -g default-terminal "screen" +set -g base-index 0 +setw -g pane-base-index 0 + + + + + +set -g status-keys emacs +set -g mode-keys emacs + + + + + + + +set -g mouse on +setw -g aggressive-resize off +setw -g clock-mode-style 12 +set -s escape-time 500 +set -g history-limit 2000 + diff --git a/tests/modules/programs/tmux/mouse-enabled.nix b/tests/modules/programs/tmux/mouse-enabled.nix new file mode 100644 index 00000000..6fc5b526 --- /dev/null +++ b/tests/modules/programs/tmux/mouse-enabled.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.tmux = { + enable = true; + mouse = true; + }; + + nixpkgs.overlays = [ + (self: super: { + tmuxPlugins = super.tmuxPlugins // { + sensible = super.tmuxPlugins.sensible // { rtp = "@sensible_rtp@"; }; + }; + }) + ]; + + nmt.script = '' + assertFileExists home-files/.config/tmux/tmux.conf + assertFileContent home-files/.config/tmux/tmux.conf \ + ${./mouse-enabled.conf} + ''; + }; +} diff --git a/tests/modules/programs/tmux/prefix.conf b/tests/modules/programs/tmux/prefix.conf index 831ec3b0..00f950e0 100644 --- a/tests/modules/programs/tmux/prefix.conf +++ b/tests/modules/programs/tmux/prefix.conf @@ -26,6 +26,7 @@ bind -N "Send the prefix key through to the application" \ +set -g mouse off setw -g aggressive-resize off setw -g clock-mode-style 12 set -s escape-time 500 diff --git a/tests/modules/programs/tmux/shortcut-without-prefix.conf b/tests/modules/programs/tmux/shortcut-without-prefix.conf index 4fd89ad2..938ecfa8 100644 --- a/tests/modules/programs/tmux/shortcut-without-prefix.conf +++ b/tests/modules/programs/tmux/shortcut-without-prefix.conf @@ -27,6 +27,7 @@ bind C-a last-window +set -g mouse off setw -g aggressive-resize off setw -g clock-mode-style 12 set -s escape-time 500 diff --git a/tests/modules/programs/tmux/vi-all-true.conf b/tests/modules/programs/tmux/vi-all-true.conf index 6a6fd611..03bf2f5a 100644 --- a/tests/modules/programs/tmux/vi-all-true.conf +++ b/tests/modules/programs/tmux/vi-all-true.conf @@ -23,6 +23,7 @@ set -g mode-keys vi +set -g mouse off setw -g aggressive-resize on setw -g clock-mode-style 24 set -s escape-time 500 From e716961d780b70295076f1b16f9174ea31273f2a Mon Sep 17 00:00:00 2001 From: Jacob Birkett Date: Sun, 5 Feb 2023 03:02:57 -0700 Subject: [PATCH 227/233] modules: java: fix setting JAVA_HOME (#3638) Some JVMs pass through `home` as a derivation rather than as a string, as `openjdk` does. Since the module option for session variables expects a string, this is a type error. I suspect that this incorrect, and have changed the assignment here to coerce the `cfg.package.home` attribute to a string to be safe. After discussing with @NobbZ, we have decided it is best to mitigate this problem in HM rather than to make potentially breaking changes to Nixpkgs. Please do mention if you think we ought to propose a change to Nixpkgs instead. --- modules/programs/java.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/programs/java.nix b/modules/programs/java.nix index 24467a25..d10f64c5 100644 --- a/modules/programs/java.nix +++ b/modules/programs/java.nix @@ -36,6 +36,8 @@ in { config = mkIf cfg.enable { home.packages = [ cfg.package ]; - home.sessionVariables.JAVA_HOME = cfg.package.home; + # some instances of `jdk-linux-base.nix` pass through `result` without turning it onto a path-string. + # while I suspect this is incorrect, the documentation is unclear. + home.sessionVariables.JAVA_HOME = "${cfg.package.home}"; }; } From ffc022b6a7fcd8ae1d9310dc1713257f0aaf5f8e Mon Sep 17 00:00:00 2001 From: Tomo <68489118+tomodachi94@users.noreply.github.com> Date: Sun, 5 Feb 2023 02:12:28 -0800 Subject: [PATCH 228/233] vim-vint: add module (#3604) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * vim-vint: add module * vim-vint: add tests * maintainers: add tomodachi94 * vim-vint: fix tests --------- Co-authored-by: Naïm Favier --- .github/CODEOWNERS | 3 ++ modules/lib/maintainers.nix | 7 ++++ modules/modules.nix | 1 + modules/programs/vim-vint.nix | 36 +++++++++++++++++++ tests/default.nix | 1 + .../programs/vim-vint/basic-configuration.nix | 27 ++++++++++++++ .../vim-vint/basic-configuration.yaml | 16 +++++++++ tests/modules/programs/vim-vint/default.nix | 1 + 8 files changed, 92 insertions(+) create mode 100644 modules/programs/vim-vint.nix create mode 100644 tests/modules/programs/vim-vint/basic-configuration.nix create mode 100644 tests/modules/programs/vim-vint/basic-configuration.yaml create mode 100644 tests/modules/programs/vim-vint/default.nix diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6f810af3..f5d43483 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -335,6 +335,9 @@ Makefile @thiagokokada /modules/programs/topgrade.nix @msfjarvis /tests/modules/programs/topgrade @msfjarvis +/modules/programs/vim-vint.nix @tomodachi94 +/tests/modules/programs/vim-vint @tomodachi94 + /modules/programs/watson.nix @polykernel /tests/modules/programs/watson @polykernel diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index 7aa1842a..267a42a3 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -360,4 +360,11 @@ keys = [{ fingerprint = "7944 74B7 D236 DAB9 C9EF E7F9 5CCE 6F14 66D4 7C9E"; }]; }; + tomodachi94 = { + email = "tomodachi94+nixpkgs@protonmail.com"; + matrix = "@tomodachi94:matrix.org"; + github = "tomodachi94"; + githubId = 68489118; + name = "tomodachi94"; + }; } diff --git a/modules/modules.nix b/modules/modules.nix index 0e71ea3a..391ad5bd 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -186,6 +186,7 @@ let ./programs/topgrade.nix ./programs/urxvt.nix ./programs/vim.nix + ./programs/vim-vint.nix ./programs/vscode.nix ./programs/vscode/haskell.nix ./programs/pywal.nix diff --git a/modules/programs/vim-vint.nix b/modules/programs/vim-vint.nix new file mode 100644 index 00000000..e44d96e4 --- /dev/null +++ b/modules/programs/vim-vint.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.vim-vint; + + yamlFormat = pkgs.formats.yaml { }; + +in { + meta.maintainers = [ maintainers.tomodachi94 ]; + + options = { + programs.vim-vint = { + enable = mkEnableOption "the Vint linter for Vimscript"; + package = mkPackageOption pkgs "vim-vint" { }; + + settings = mkOption { + type = yamlFormat.type; + default = { }; + description = '' + Configuration written to + $XDG_CONFIG_HOME/.vintrc.yaml + ''; + }; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ cfg.package ]; + + xdg.configFile.".vintrc.yaml".source = + yamlFormat.generate "vim-vint-config" cfg.settings; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 295254b9..9bbdaebb 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -122,6 +122,7 @@ import nmt { ./modules/programs/tmate ./modules/programs/tmux ./modules/programs/topgrade + ./modules/programs/vim-vint ./modules/programs/vscode ./modules/programs/watson ./modules/programs/wezterm diff --git a/tests/modules/programs/vim-vint/basic-configuration.nix b/tests/modules/programs/vim-vint/basic-configuration.nix new file mode 100644 index 00000000..59bfafa5 --- /dev/null +++ b/tests/modules/programs/vim-vint/basic-configuration.nix @@ -0,0 +1,27 @@ +{ config, pkgs, lib, xdg, ... }: + +{ + programs.vim-vint = { + enable = true; + settings = { + cmdargs = { + severity = "error"; + color = true; + env = { neovim = true; }; + }; + policies = { + ProhibitEqualTildeOperator.enabled = false; + ProhibitUsingUndeclaredVariable.enabled = false; + ProhibitAbbreviationOption.enabled = false; + ProhibitImplicitScopeVariable.enabled = false; + ProhibitSetNoCompatible.enabled = false; + }; + }; + }; + + nmt.script = '' + assertFileContent home-files/.config/.vintrc.yaml ${ + ./basic-configuration.yaml + } + ''; +} diff --git a/tests/modules/programs/vim-vint/basic-configuration.yaml b/tests/modules/programs/vim-vint/basic-configuration.yaml new file mode 100644 index 00000000..1273b14e --- /dev/null +++ b/tests/modules/programs/vim-vint/basic-configuration.yaml @@ -0,0 +1,16 @@ +cmdargs: + color: true + env: + neovim: true + severity: error +policies: + ProhibitAbbreviationOption: + enabled: false + ProhibitEqualTildeOperator: + enabled: false + ProhibitImplicitScopeVariable: + enabled: false + ProhibitSetNoCompatible: + enabled: false + ProhibitUsingUndeclaredVariable: + enabled: false diff --git a/tests/modules/programs/vim-vint/default.nix b/tests/modules/programs/vim-vint/default.nix new file mode 100644 index 00000000..0066eaf8 --- /dev/null +++ b/tests/modules/programs/vim-vint/default.nix @@ -0,0 +1 @@ +{ vim-vint-basic-configuration = ./basic-configuration.nix; } From ca69be9335def2e31525ea0dc7abd5062700f5ab Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Sun, 5 Feb 2023 11:13:04 +0100 Subject: [PATCH 229/233] borgmatic: Do not inhibit idle in service (#3637) This reflects a systemd service sample file change made in borgmatic 1.7.6, commit 2e9f70d49647d47fb4ca05f428c592b0e4319544: When backing up a machine with a monitor using logind to control idle timeout and things like DPMS, borgmatic can block the screen from turning on/off with systemd-inhibit. This is because by default systemd-inhibit will block "idle:sleep:shutdown". Borgmatic does not need to care about idle, only about suspend and shutdown. So, add an explicit `--what` flag for what borgmatic should inhibit. For more information see systemd-inhibit(1). --- modules/services/borgmatic.nix | 1 + tests/modules/services/borgmatic/basic-configuration.service | 1 + 2 files changed, 2 insertions(+) diff --git a/modules/services/borgmatic.nix b/modules/services/borgmatic.nix index f5368cdf..c2f2963a 100644 --- a/modules/services/borgmatic.nix +++ b/modules/services/borgmatic.nix @@ -63,6 +63,7 @@ in { ExecStart = '' ${pkgs.systemd}/bin/systemd-inhibit \ --who="borgmatic" \ + --what="sleep:shutdown" \ --why="Prevent interrupting scheduled backup" \ ${programConfig.package}/bin/borgmatic \ --stats \ diff --git a/tests/modules/services/borgmatic/basic-configuration.service b/tests/modules/services/borgmatic/basic-configuration.service index 4840f11b..80713fd9 100644 --- a/tests/modules/services/borgmatic/basic-configuration.service +++ b/tests/modules/services/borgmatic/basic-configuration.service @@ -2,6 +2,7 @@ CPUSchedulingPolicy=batch ExecStart=/nix/store/00000000000000000000000000000000-systemd/bin/systemd-inhibit \ --who="borgmatic" \ + --what="sleep:shutdown" \ --why="Prevent interrupting scheduled backup" \ @borgmatic@/bin/borgmatic \ --stats \ From 6d2ba4654d6fc7f7eac504938316889058b1fe0a Mon Sep 17 00:00:00 2001 From: Bernardo Meurer Date: Sun, 5 Feb 2023 05:14:03 -0500 Subject: [PATCH 230/233] home-manager: pass --refresh to nix (#3624) This flag is useful to force Nix to re-fetch cached flakes. Without it, you cannot deploy from a non-local flake in quick succession, since the caching causes the flake to not be re-fetched. --- docs/man-home-manager.xml | 16 ++++++++++++++++ home-manager/completion.bash | 2 +- home-manager/completion.fish | 1 + home-manager/completion.zsh | 1 + home-manager/home-manager | 3 ++- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/man-home-manager.xml b/docs/man-home-manager.xml index 513973e9..e83cab89 100644 --- a/docs/man-home-manager.xml +++ b/docs/man-home-manager.xml @@ -179,6 +179,10 @@ --no-out-link + + --refresh + + @@ -611,6 +615,18 @@ + + + + + + + Passed on to + nix-build + 1 + + + diff --git a/home-manager/completion.bash b/home-manager/completion.bash index c5512299..152f8c32 100644 --- a/home-manager/completion.bash +++ b/home-manager/completion.bash @@ -296,7 +296,7 @@ _home-manager_completions () "-L" "--print-build-logs" \ "--show-trace" "--substitute" "--builders" "--version" \ "--update-input" "--override-input" "--experimental-features" \ - "--extra-experimental-features" ) + "--extra-experimental-features" "--refresh") # ^ « home-manager »'s options. diff --git a/home-manager/completion.fish b/home-manager/completion.fish index 58ce386e..3781d3a7 100644 --- a/home-manager/completion.fish +++ b/home-manager/completion.fish @@ -69,3 +69,4 @@ complete -c home-manager -f -l "update-input" complete -c home-manager -f -l "override-input" complete -c home-manager -f -l "experimental-features" complete -c home-manager -f -l "extra-experimental-features" +complete -c home-manager -f -l "refresh" -d "Consider all previously downloaded files out-of-date" diff --git a/home-manager/completion.zsh b/home-manager/completion.zsh index 3babc1fe..c5d3b493 100644 --- a/home-manager/completion.zsh +++ b/home-manager/completion.zsh @@ -63,6 +63,7 @@ case "$state" in '--show-trace[show trace]' \ '--substitute[substitute]' \ '--builders[builders]:SPEC:()' \ + '--refresh[refresh]' \ '--override-input[override flake input]:NAME VALUE:()' \ '--update-input[update flake input]:NAME:()' \ '--experimental-features[set experimental Nix features]:VALUE:()' \ diff --git a/home-manager/home-manager b/home-manager/home-manager index 89f58c4d..9e0f4ae0 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -556,6 +556,7 @@ function doHelp() { echo " --no-out-link Do not create a symlink to the output path" echo " --no-write-lock-file" echo " --builders VALUE" + echo " --refresh Consider all previously downloaded files out-of-date" echo echo "Commands" echo @@ -628,7 +629,7 @@ while [[ $# -gt 0 ]]; do FLAKE_ARG="$1" shift ;; - --recreate-lock-file|--no-update-lock-file|--no-write-lock-file|--no-registries|--commit-lock-file) + --recreate-lock-file|--no-update-lock-file|--no-write-lock-file|--no-registries|--commit-lock-file|--refresh) PASSTHROUGH_OPTS+=("$opt") ;; --update-input) From e3f28ddb0dc270819b0a4b5563ca34bdc995721d Mon Sep 17 00:00:00 2001 From: Stanislav Asunkin <1353637+stasjok@users.noreply.github.com> Date: Sun, 5 Feb 2023 13:22:41 +0300 Subject: [PATCH 231/233] tmux: fix secureSocket environment variable (#3593) --- modules/programs/tmux.nix | 2 +- tests/modules/programs/tmux/secure-socket-enabled.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix index ed9876ea..df3ed11d 100644 --- a/modules/programs/tmux.nix +++ b/modules/programs/tmux.nix @@ -336,7 +336,7 @@ in { (mkIf cfg.secureSocket { home.sessionVariables = { - TMUX_TMPDIR = ''''${XDG_RUNTIME_DIR:-"/run/user/\$(id -u)"}''; + TMUX_TMPDIR = ''''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}''; }; }) diff --git a/tests/modules/programs/tmux/secure-socket-enabled.nix b/tests/modules/programs/tmux/secure-socket-enabled.nix index ca2de663..60b3f708 100644 --- a/tests/modules/programs/tmux/secure-socket-enabled.nix +++ b/tests/modules/programs/tmux/secure-socket-enabled.nix @@ -12,7 +12,7 @@ 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 TMUX_TMPDIR="''${XDG_RUNTIME_DIR:-"/run/user/\$(id -u)"}"' + 'export TMUX_TMPDIR="''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}"' ''; }; } From 9f4268e6b630497e289b18473775dff9c2d6635d Mon Sep 17 00:00:00 2001 From: Kira Bruneau Date: Sun, 5 Feb 2023 05:23:22 -0500 Subject: [PATCH 232/233] firefox: support passing any json value to settings (#3580) Firefox internally only supports bool, int, and string types for preferences, but often stores objects, arrays and floats as strings. This change makes it nicer to specify those type of preferences in Nix, and it also makes it possible to merge objects & arrays across multiple modules. --- modules/programs/firefox.nix | 25 ++++++++++++++++--- .../firefox/profile-settings-expected-user.js | 1 + .../programs/firefox/profile-settings.nix | 8 +++++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index bf1c5779..4b3f288c 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -42,6 +42,12 @@ let profilesIni = generators.toINI { } profiles; + userPrefValue = pref: + builtins.toJSON (if isBool pref || isInt pref || isString pref then + pref + else + builtins.toJSON pref); + mkUserJs = prefs: extraPrefs: bookmarks: let prefs' = lib.optionalAttrs ([ ] != bookmarks) { @@ -52,7 +58,7 @@ let // Generated by Home Manager. ${concatStrings (mapAttrsToList (name: value: '' - user_pref("${name}", ${builtins.toJSON value}); + user_pref("${name}", ${userPrefValue value}); '') prefs')} ${extraPrefs} @@ -201,7 +207,10 @@ in { }; settings = mkOption { - type = with types; attrsOf (either bool (either int str)); + type = types.attrsOf (jsonFormat.type // { + description = + "Firefox preference (int, bool, string, and also attrs, list, float as a JSON string)"; + }); default = { }; example = literalExpression '' { @@ -211,9 +220,19 @@ in { "distribution.searchplugins.defaultLocale" = "en-GB"; "general.useragent.locale" = "en-GB"; "browser.bookmarks.showMobileBookmarks" = true; + "browser.newtabpage.pinned" = [{ + title = "NixOS"; + url = "https://nixos.org"; + }]; } ''; - description = "Attribute set of Firefox preferences."; + description = '' + Attribute set of Firefox preferences. + + Firefox only supports int, bool, and string types for + preferences, but home-manager will automatically + convert all other JSON-compatible values into strings. + ''; }; extraConfig = mkOption { diff --git a/tests/modules/programs/firefox/profile-settings-expected-user.js b/tests/modules/programs/firefox/profile-settings-expected-user.js index 0edd47b9..d929df2b 100644 --- a/tests/modules/programs/firefox/profile-settings-expected-user.js +++ b/tests/modules/programs/firefox/profile-settings-expected-user.js @@ -1,5 +1,6 @@ // Generated by Home Manager. +user_pref("browser.newtabpage.pinned", "[{\"title\":\"NixOS\",\"url\":\"https://nixos.org\"}]"); user_pref("general.smoothScroll", false); diff --git a/tests/modules/programs/firefox/profile-settings.nix b/tests/modules/programs/firefox/profile-settings.nix index b28e6459..278f3dbb 100644 --- a/tests/modules/programs/firefox/profile-settings.nix +++ b/tests/modules/programs/firefox/profile-settings.nix @@ -9,7 +9,13 @@ lib.mkIf config.test.enableBig { profiles.test = { id = 1; - settings = { "general.smoothScroll" = false; }; + settings = { + "general.smoothScroll" = false; + "browser.newtabpage.pinned" = [{ + title = "NixOS"; + url = "https://nixos.org"; + }]; + }; }; profiles.bookmarks = { From 9621e9ab80a038cd11c7cfcae4df46a59d62b16a Mon Sep 17 00:00:00 2001 From: Guillaume Desforges Date: Sun, 5 Feb 2023 12:09:26 +0100 Subject: [PATCH 233/233] programs.neovim: add extraLuaConfig (#3639) * programs.neovim: add extraLuaConfig Add a configuration option to add custom lua configuration lines to `lua.init`. * apply review: formatting * apply review: fix test --- modules/programs/neovim.nix | 14 ++++++++++- tests/modules/programs/neovim/default.nix | 1 + .../programs/neovim/extra-lua-init.nix | 23 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 tests/modules/programs/neovim/extra-lua-init.nix diff --git a/modules/programs/neovim.nix b/modules/programs/neovim.nix index c8edd225..df4b487d 100644 --- a/modules/programs/neovim.nix +++ b/modules/programs/neovim.nix @@ -261,6 +261,17 @@ in { ''; }; + extraLuaConfig = mkOption { + type = types.lines; + default = ""; + example = '' + vim.opt.nobackup = true + ''; + description = '' + Custom lua lines. + ''; + }; + extraPackages = mkOption { type = with types; listOf package; default = [ ]; @@ -394,7 +405,8 @@ in { "vim.cmd [[source ${ pkgs.writeText "nvim-init-home-manager.vim" neovimConfig.neovimRcContent - }]]" + lib.optionalString hasLuaConfig + }]]" + config.programs.neovim.extraLuaConfig + + lib.optionalString hasLuaConfig config.programs.neovim.generatedConfigs.lua; in mkIf (luaRcContent != "") { text = luaRcContent; }; diff --git a/tests/modules/programs/neovim/default.nix b/tests/modules/programs/neovim/default.nix index 3950dc8b..d3224666 100644 --- a/tests/modules/programs/neovim/default.nix +++ b/tests/modules/programs/neovim/default.nix @@ -5,4 +5,5 @@ # waiting for a nixpkgs patch neovim-no-init = ./no-init.nix; + neovim-extra-lua-init = ./extra-lua-init.nix; } diff --git a/tests/modules/programs/neovim/extra-lua-init.nix b/tests/modules/programs/neovim/extra-lua-init.nix new file mode 100644 index 00000000..2abaa6e9 --- /dev/null +++ b/tests/modules/programs/neovim/extra-lua-init.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.neovim = { + enable = true; + + extraLuaConfig = '' + -- extraLuaConfig + ''; + }; + nmt.script = '' + nvimFolder="home-files/.config/nvim" + assertFileContent "$nvimFolder/init.lua" ${ + pkgs.writeText "init.lua-expected" '' + -- extraLuaConfig + '' + } + ''; + }; +}