All my system configs and packages in one repo
at main 44 lines 1.0 kB view raw
1{ 2 config, 3 pkgs, 4 lib, 5 ... 6}: 7let 8 cfg = config.ext.programs.hyfetch; 9 format = pkgs.formats.json { }; 10 configFile = format.generate "hyfetch.json" cfg.settings; 11in 12{ 13 options.ext.programs.hyfetch = { 14 enable = lib.mkEnableOption "Hyfetch"; 15 package = lib.mkPackageOption pkgs "hyfetch" { }; 16 17 settings = lib.mkOption { 18 type = lib.types.submodule { 19 freeformType = format.type; 20 21 options = { 22 backend = lib.mkOption { 23 type = lib.types.enum [ 24 "neofetch" 25 "fastfetch" 26 "qwqfetch" 27 ]; 28 }; 29 }; 30 }; 31 default = { }; 32 }; 33 }; 34 35 config = lib.mkIf cfg.enable { 36 packages = 37 [ cfg.package ] 38 ++ lib.optional (cfg.settings.backend == "fastfetch") pkgs.fastfetch 39 ++ lib.optional (cfg.settings.backend == "neofetch") pkgs.neofetch; 40 # TODO: add qwqfetch when it's added to nixpkgs 41 42 xdg.config.files."hyfetch.json".source = lib.mkIf (cfg.settings != { }) configFile; 43 }; 44}