1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

treewide: remove with lib (#6735)

Continuation of `with lib;` cleanup.
This commit is contained in:
Austin Horstman 2025-03-31 22:32:16 -05:00 committed by GitHub
parent ccd7df836e
commit 0b491b460f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
200 changed files with 2421 additions and 2817 deletions

View file

@ -1,25 +1,23 @@
{ config, lib, ... }:
with lib;
let
inherit (lib) mkIf mkOption types;
cfg = config.programs.matplotlib;
formatLine = o: n: v:
let
formatValue = v:
if isBool v then (if v then "True" else "False") else toString v;
in if isAttrs v then
concatStringsSep "\n" (mapAttrsToList (formatLine "${o}${n}.") v)
if lib.isBool v then (if v then "True" else "False") else toString v;
in if lib.isAttrs v then
lib.concatStringsSep "\n" (lib.mapAttrsToList (formatLine "${o}${n}.") v)
else
(if v == "" then "" else "${o}${n}: ${formatValue v}");
in {
meta.maintainers = [ maintainers.rprospero ];
meta.maintainers = [ lib.maintainers.rprospero ];
options.programs.matplotlib = {
enable = mkEnableOption "matplotlib, a plotting library for python";
enable = lib.mkEnableOption "matplotlib, a plotting library for python";
config = mkOption {
default = { };
@ -28,7 +26,7 @@ in {
Add terms to the {file}`matplotlibrc` file to
control the default matplotlib behavior.
'';
example = literalExpression ''
example = lib.literalExpression ''
{
backend = "Qt5Agg";
axes = {
@ -52,8 +50,8 @@ in {
};
config = mkIf cfg.enable {
xdg.configFile."matplotlib/matplotlibrc".text = concatStringsSep "\n" ([ ]
++ mapAttrsToList (formatLine "") cfg.config
++ optional (cfg.extraConfig != "") cfg.extraConfig) + "\n";
xdg.configFile."matplotlib/matplotlibrc".text = lib.concatStringsSep "\n"
([ ] ++ lib.mapAttrsToList (formatLine "") cfg.config
++ lib.optional (cfg.extraConfig != "") cfg.extraConfig) + "\n";
};
}