mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
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.
This commit is contained in:
parent
948d1f8a5c
commit
c0f9cbcf93
1 changed files with 14 additions and 3 deletions
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue