1
0
Fork 0
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:
Lily Foster 2022-08-01 19:58:38 -04:00 committed by GitHub
parent d1c677ac25
commit 77648a07e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 3 deletions

View file

@ -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;
};
};
}

View file

@ -1 +1,4 @@
{ hyfetch-settings = ./settings.nix; }
{
hyfetch-settings = ./settings.nix;
hyfetch-empty-settings = ./empty-settings.nix;
}

View 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
'';
};
}