mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-21 17:59:39 +01:00
ncspot: make package nullable
This commit is contained in:
parent
6e36b1be0b
commit
dceefa87dc
1 changed files with 6 additions and 4 deletions
|
|
@ -5,6 +5,8 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
inherit (lib) mkIf;
|
||||||
|
|
||||||
cfg = config.programs.ncspot;
|
cfg = config.programs.ncspot;
|
||||||
|
|
||||||
tomlFormat = pkgs.formats.toml { };
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
|
@ -15,7 +17,7 @@ in
|
||||||
options.programs.ncspot = {
|
options.programs.ncspot = {
|
||||||
enable = lib.mkEnableOption "ncspot";
|
enable = lib.mkEnableOption "ncspot";
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "ncspot" { };
|
package = lib.mkPackageOption pkgs "ncspot" { nullable = true; };
|
||||||
|
|
||||||
settings = lib.mkOption {
|
settings = lib.mkOption {
|
||||||
type = tomlFormat.type;
|
type = tomlFormat.type;
|
||||||
|
|
@ -36,10 +38,10 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile."ncspot/config.toml" = lib.mkIf (cfg.settings != { }) {
|
xdg.configFile."ncspot/config.toml" = mkIf (cfg.settings != { }) {
|
||||||
source = tomlFormat.generate "ncspot-config" cfg.settings;
|
source = tomlFormat.generate "ncspot-config" cfg.settings;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue