beets: warn on implicit enable default
Before 19.03, programs.beets.enable implicitly followed whether programs.beets.settings was non-empty. That compatibility branch was still active for older state versions, but it was silent. Route the default through the shared state-version helper so legacy users get a consistent deprecation warning before the implicit enablement is cleaned up. Add focused tests for the legacy and current default branches alongside the existing beets coverage. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
@@ -27,9 +27,24 @@ in
|
||||
programs.beets = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default =
|
||||
if lib.versionAtLeast config.home.stateVersion "19.03" then false else cfg.settings != { };
|
||||
defaultText = "false";
|
||||
inherit
|
||||
(lib.hm.deprecations.mkStateVersionOptionDefault {
|
||||
inherit (config.home) stateVersion;
|
||||
since = "19.03";
|
||||
optionPath = [
|
||||
"programs"
|
||||
"beets"
|
||||
"enable"
|
||||
];
|
||||
legacy = {
|
||||
value = cfg.settings != { };
|
||||
text = "config.programs.beets.settings != { }";
|
||||
};
|
||||
current.value = false;
|
||||
})
|
||||
default
|
||||
defaultText
|
||||
;
|
||||
description = ''
|
||||
Whether to enable the beets music library manager. This
|
||||
defaults to `false` for state
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
home.stateVersion = "19.03";
|
||||
|
||||
programs.beets.settings = {
|
||||
directory = "~/Music";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/beets/config.yaml
|
||||
'';
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
{ lib, pkgs, ... }:
|
||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
beets-current-disable-default = ./current-disable-default.nix;
|
||||
beets-legacy-enable-default = ./legacy-enable-default.nix;
|
||||
beets-mpdstats = ./mpdstats.nix;
|
||||
beets-mpdstats-external = ./mpdstats-external.nix;
|
||||
beets-mpdupdate = ./mpdupdate.nix;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
home.stateVersion = "18.09";
|
||||
|
||||
programs.beets.settings = {
|
||||
directory = "~/Music";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/beets/config.yaml
|
||||
assertFileContains home-files/.config/beets/config.yaml 'directory: ~/Music'
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user