mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-09 10:16:55 +00:00
btop: remove with lib;
This commit is contained in:
parent
bf2a029bcd
commit
20fd9686b8
1 changed files with 11 additions and 16 deletions
|
@ -1,14 +1,10 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.programs.btop;
|
cfg = config.programs.btop;
|
||||||
|
|
||||||
finalConfig = let
|
finalConfig = let
|
||||||
toKeyValue = generators.toKeyValue {
|
toKeyValue = lib.generators.toKeyValue {
|
||||||
mkKeyValue = generators.mkKeyValueDefault {
|
mkKeyValue = lib.generators.mkKeyValueDefault {
|
||||||
mkValueString = v:
|
mkValueString = v:
|
||||||
with builtins;
|
with builtins;
|
||||||
if isBool v then
|
if isBool v then
|
||||||
|
@ -21,19 +17,18 @@ let
|
||||||
};
|
};
|
||||||
in ''
|
in ''
|
||||||
${toKeyValue cfg.settings}
|
${toKeyValue cfg.settings}
|
||||||
${optionalString (cfg.extraConfig != "") cfg.extraConfig}
|
${lib.optionalString (cfg.extraConfig != "") cfg.extraConfig}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with lib.maintainers; [ GaetanLepage khaneliman ];
|
meta.maintainers = with lib.maintainers; [ GaetanLepage khaneliman ];
|
||||||
|
|
||||||
options.programs.btop = {
|
options.programs.btop = {
|
||||||
enable = mkEnableOption "btop";
|
enable = lib.mkEnableOption "btop";
|
||||||
|
|
||||||
package = mkPackageOption pkgs "btop" { };
|
package = lib.mkPackageOption pkgs "btop" { };
|
||||||
|
|
||||||
settings = mkOption {
|
settings = lib.mkOption {
|
||||||
type = with types; attrsOf (oneOf [ bool float int str ]);
|
type = with lib.types; attrsOf (oneOf [ bool float int str ]);
|
||||||
default = { };
|
default = { };
|
||||||
example = {
|
example = {
|
||||||
color_theme = "Default";
|
color_theme = "Default";
|
||||||
|
@ -46,8 +41,8 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = lib.mkOption {
|
||||||
type = types.lines;
|
type = lib.types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
description = ''
|
description = ''
|
||||||
Extra lines added to the {file}`btop.conf` file.
|
Extra lines added to the {file}`btop.conf` file.
|
||||||
|
@ -55,10 +50,10 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
home.packages = [ cfg.package ];
|
||||||
|
|
||||||
xdg.configFile."btop/btop.conf" =
|
xdg.configFile."btop/btop.conf" =
|
||||||
mkIf (cfg.settings != { }) { text = finalConfig; };
|
lib.mkIf (cfg.settings != { }) { text = finalConfig; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue