mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
hyfetch: prevent writing config with default/empty settings (#3124)
This commit is contained in:
parent
d1c677ac25
commit
77648a07e4
3 changed files with 22 additions and 3 deletions
|
@ -37,7 +37,8 @@ in {
|
|||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
xdg.configFile."hyfetch.json".source =
|
||||
jsonFormat.generate "hyfetch.json" cfg.settings;
|
||||
xdg.configFile."hyfetch.json" = mkIf (cfg.settings != { }) {
|
||||
source = jsonFormat.generate "hyfetch.json" cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
{ hyfetch-settings = ./settings.nix; }
|
||||
{
|
||||
hyfetch-settings = ./settings.nix;
|
||||
hyfetch-empty-settings = ./empty-settings.nix;
|
||||
}
|
||||
|
|
15
tests/modules/programs/hyfetch/empty-settings.nix
Normal file
15
tests/modules/programs/hyfetch/empty-settings.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.hyfetch.enable = true;
|
||||
|
||||
test.stubs.hyfetch = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/hyfetch.json
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue