diff --git a/modules/misc/xdg-portal.nix b/modules/misc/xdg-portal.nix index 72d66376d..34a1aa40c 100644 --- a/modules/misc/xdg-portal.nix +++ b/modules/misc/xdg-portal.nix @@ -127,19 +127,6 @@ in portalsDir = "${config.home.profileDirectory}/share/xdg-desktop-portal/portals"; in mkIf cfg.enable { - warnings = optional (cfg.configPackages == [ ] && cfg.config == { }) '' - xdg-desktop-portal 1.17 reworked how portal implementations are loaded, you - should either set `xdg.portal.config` or `xdg.portal.configPackages` - to specify which portal backend to use for the requested interface. - - https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in - - If you simply want to keep the behaviour in < 1.17, which uses the first - portal implementation found in lexicographical order, use the following: - - xdg.portal.config.common.default = "*"; - ''; - assertions = [ (lib.hm.assertions.assertPlatform "xdg.portal" pkgs lib.platforms.linux) @@ -168,6 +155,19 @@ in } ]; + warnings = optional (cfg.configPackages == [ ] && cfg.config == { }) '' + xdg-desktop-portal 1.17 reworked how portal implementations are loaded, you + should either set `xdg.portal.config` or `xdg.portal.configPackages` + to specify which portal backend to use for the requested interface. + + https://github.com/flatpak/xdg-desktop-portal/blob/1.18.1/doc/portals.conf.rst.in + + If you simply want to keep the behaviour in < 1.17, which uses the first + portal implementation found in lexicographical order, use the following: + + xdg.portal.config.common.default = "*"; + ''; + home = { packages = packages ++ cfg.configPackages; sessionVariables = mkMerge [ diff --git a/modules/programs/aerc/default.nix b/modules/programs/aerc/default.nix index 28d3d146a..822d11533 100644 --- a/modules/programs/aerc/default.nix +++ b/modules/programs/aerc/default.nix @@ -221,22 +221,6 @@ in in mkIf cfg.enable { - warnings = - if genAccountsConf && (cfg.extraConfig.general.unsafe-accounts-conf or false) == false then - [ - '' - aerc: `programs.aerc.enable` is set, but `...extraConfig.general.unsafe-accounts-conf` is set to false or unset. - This will prevent aerc from starting; see `unsafe-accounts-conf` in the man page aerc-config(5): - > By default, the file permissions of accounts.conf must be restrictive and only allow reading by the file owner (0600). - > Set this option to true to ignore this permission check. Use this with care as it may expose your credentials. - These permissions are not possible with home-manager, since the generated file is in the nix-store (permissions 0444). - Therefore, please set `programs.aerc.extraConfig.general.unsafe-accounts-conf = true`. - This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store. - '' - ] - else - [ ]; - assertions = [ { assertion = @@ -254,6 +238,22 @@ in } ]; + warnings = + if genAccountsConf && (cfg.extraConfig.general.unsafe-accounts-conf or false) == false then + [ + '' + aerc: `programs.aerc.enable` is set, but `...extraConfig.general.unsafe-accounts-conf` is set to false or unset. + This will prevent aerc from starting; see `unsafe-accounts-conf` in the man page aerc-config(5): + > By default, the file permissions of accounts.conf must be restrictive and only allow reading by the file owner (0600). + > Set this option to true to ignore this permission check. Use this with care as it may expose your credentials. + These permissions are not possible with home-manager, since the generated file is in the nix-store (permissions 0444). + Therefore, please set `programs.aerc.extraConfig.general.unsafe-accounts-conf = true`. + This option is safe; if `passwordCommand` is properly set, no credentials will be written to the nix store. + '' + ] + else + [ ]; + home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; home.file = { diff --git a/modules/programs/lieer.nix b/modules/programs/lieer.nix index 15781dd39..4390ac1c9 100644 --- a/modules/programs/lieer.nix +++ b/modules/programs/lieer.nix @@ -252,25 +252,6 @@ in config = mkIf cfg.enable ( lib.mkMerge [ - (mkIf (missingNotmuchAccounts != [ ]) { - warnings = [ - '' - lieer is enabled for the following email accounts, but notmuch is not: - - ${concatStringsSep "\n " missingNotmuchAccounts} - - Notmuch can be enabled with: - - ${concatStringsSep "\n " notmuchConfigHelp} - - If you have configured notmuch outside of Home Manager, you can suppress this - warning with: - - programs.lieer.notmuchSetupWarning = false; - '' - ]; - }) - { assertions = [ { @@ -297,6 +278,25 @@ in home.file = lib.listToAttrs (map configFile lieerAccounts); } + + (mkIf (missingNotmuchAccounts != [ ]) { + warnings = [ + '' + lieer is enabled for the following email accounts, but notmuch is not: + + ${concatStringsSep "\n " missingNotmuchAccounts} + + Notmuch can be enabled with: + + ${concatStringsSep "\n " notmuchConfigHelp} + + If you have configured notmuch outside of Home Manager, you can suppress this + warning with: + + programs.lieer.notmuchSetupWarning = false; + '' + ]; + }) ] ); } diff --git a/modules/programs/neomutt/default.nix b/modules/programs/neomutt/default.nix index 732a4d47b..f0a154992 100644 --- a/modules/programs/neomutt/default.nix +++ b/modules/programs/neomutt/default.nix @@ -484,6 +484,13 @@ in }; config = mkIf cfg.enable { + assertions = [ + { + assertion = ((filter (b: (lib.length (lib.toList b.map)) == 0) (cfg.binds ++ cfg.macros)) == [ ]); + message = "The 'programs.neomutt.(binds|macros).map' list must contain at least one element."; + } + ]; + home.packages = [ cfg.package ]; home.file = let @@ -541,13 +548,6 @@ in ); }; - assertions = [ - { - assertion = ((filter (b: (lib.length (lib.toList b.map)) == 0) (cfg.binds ++ cfg.macros)) == [ ]); - message = "The 'programs.neomutt.(binds|macros).map' list must contain at least one element."; - } - ]; - warnings = let hasOldBinds = binds: (filter (b: !(lib.isList b.map)) binds) != [ ]; diff --git a/modules/programs/nix-search-tv.nix b/modules/programs/nix-search-tv.nix index 70153a8d3..244fc3cc3 100644 --- a/modules/programs/nix-search-tv.nix +++ b/modules/programs/nix-search-tv.nix @@ -55,6 +55,13 @@ in }; config = lib.mkIf cfg.enable { + assertions = [ + { + assertion = cfg.package != null || cfg.enableTelevisionIntegration; + message = "Cannot enable television integration when config.programs.nix-search-tv.package is null."; + } + ]; + home.packages = lib.mkIf (cfg.package != null) [ cfg.package ]; xdg.configFile."nix-search-tv/config.json" = lib.mkIf (cfg.settings != { }) { @@ -75,12 +82,5 @@ in preview.command = ''${path} preview "{}"''; } ); - - assertions = [ - { - assertion = cfg.package != null || cfg.enableTelevisionIntegration; - message = "Cannot enable television integration when config.programs.nix-search-tv.package is null."; - } - ]; }; } diff --git a/modules/programs/thunderbird.nix b/modules/programs/thunderbird.nix index d87a87f14..1fa1e8dca 100644 --- a/modules/programs/thunderbird.nix +++ b/modules/programs/thunderbird.nix @@ -785,13 +785,6 @@ in }; config = mkIf cfg.enable { - warnings = lib.optionals (!cfg.darwinSetupWarning) [ - '' - Using programs.thunderbird.darwinSetupWarning is deprecated and will be - removed in the future. Thunderbird is now supported on Darwin. - '' - ]; - assertions = [ ( let @@ -884,6 +877,13 @@ in ) ]; + warnings = lib.optionals (!cfg.darwinSetupWarning) [ + '' + Using programs.thunderbird.darwinSetupWarning is deprecated and will be + removed in the future. Thunderbird is now supported on Darwin. + '' + ]; + home.packages = [ cfg.package ] diff --git a/modules/programs/zed-editor.nix b/modules/programs/zed-editor.nix index d95f59e88..e3009df22 100644 --- a/modules/programs/zed-editor.nix +++ b/modules/programs/zed-editor.nix @@ -219,6 +219,13 @@ in }; config = mkIf cfg.enable { + assertions = [ + { + assertion = cfg.extraPackages != [ ] -> cfg.package != null; + message = "{option}programs.zed-editor.extraPackages requires non null {option}programs.zed-editor.package"; + } + ]; + home.packages = mkIf (cfg.package != null) ( if cfg.extraPackages != [ ] then [ @@ -307,12 +314,5 @@ in "zed/debug.json".source = jsonFormat.generate "zed-user-debug" cfg.userDebug; }) ]; - - assertions = [ - { - assertion = cfg.extraPackages != [ ] -> cfg.package != null; - message = "{option}programs.zed-editor.extraPackages requires non null {option}programs.zed-editor.package"; - } - ]; }; } diff --git a/modules/services/kdeconnect.nix b/modules/services/kdeconnect.nix index 68bafeb24..2344ad5b6 100644 --- a/modules/services/kdeconnect.nix +++ b/modules/services/kdeconnect.nix @@ -30,12 +30,12 @@ in config = lib.mkMerge [ (lib.mkIf cfg.enable { - home.packages = [ cfg.package ]; - assertions = [ (lib.hm.assertions.assertPlatform "services.kdeconnect" pkgs lib.platforms.linux) ]; + home.packages = [ cfg.package ]; + systemd.user.services.kdeconnect = { Unit = { Description = "Adds communication between your desktop and your smartphone"; diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 3fb08dfc8..57ed27294 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -704,20 +704,6 @@ in config = mkIf cfg.enable ( lib.mkMerge [ - (mkIf (cfg.config != null) { - warnings = - (optional (lib.isList cfg.config.fonts) "Specifying sway.config.fonts as a list is deprecated. Use the attrset version instead.") - ++ lib.flatten ( - map ( - b: - optional (lib.isList b.fonts) "Specifying sway.config.bars[].fonts as a list is deprecated. Use the attrset version instead." - ) cfg.config.bars - ) - ++ [ - (mkIf cfg.config.focus.forceWrapping "sway.config.focus.forceWrapping is deprecated, use focus.wrapping instead.") - ]; - }) - { assertions = [ (lib.hm.assertions.assertPlatform "wayland.windowManager.sway" pkgs lib.platforms.linux) @@ -753,6 +739,20 @@ in }; }; } + + (mkIf (cfg.config != null) { + warnings = + (optional (lib.isList cfg.config.fonts) "Specifying sway.config.fonts as a list is deprecated. Use the attrset version instead.") + ++ lib.flatten ( + map ( + b: + optional (lib.isList b.fonts) "Specifying sway.config.bars[].fonts as a list is deprecated. Use the attrset version instead." + ) cfg.config.bars + ) + ++ [ + (mkIf cfg.config.focus.forceWrapping "sway.config.focus.forceWrapping is deprecated, use focus.wrapping instead.") + ]; + }) ] ); }