From 460d3f1d30b4f7587e7f9a91e0c100f115dd4b43 Mon Sep 17 00:00:00 2001 From: derped Date: Fri, 18 Jul 2025 15:56:02 +0200 Subject: [PATCH] pkgsets/python3: pkgs should be mergable function --- options/machine.nix | 7 +++++-- pkgsets/python3.nix | 44 ++++++++++++++++++++++++----------------- services/desktop/i3.nix | 2 +- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/options/machine.nix b/options/machine.nix index a2cde7c..50f2e55 100644 --- a/options/machine.nix +++ b/options/machine.nix @@ -12,7 +12,7 @@ let serviceList = fn.makeOptionTypeList (toString ../services); pkgOption = pname: { name = pname; - value = rec { + value = { pkgwrap = mkOption { type = with types; @@ -26,7 +26,10 @@ let ''; }; pkgs = mkOption { - type = types.unspecified; + type = types.oneOf [ + (types.listOf types.package) + (types.functionTo (types.listOf types.package)) + ]; default = [ ]; description = '' ${pname} package list. diff --git a/pkgsets/python3.nix b/pkgsets/python3.nix index 469eae2..95dedad 100644 --- a/pkgsets/python3.nix +++ b/pkgsets/python3.nix @@ -1,25 +1,33 @@ { config, - lib, pkgs, ... }: -with lib; + { - machine.pkgsets.python3.pkgwrap = pkgs.python3.withPackages ( - ps: (fn.pkgFilter config.machine.pkgsets.python3.pkgs) - ); - machine.pkgsets.python3.pkgs = with pkgs.python3Packages; [ - bpython - flake8 - genanki - matplotlib - mypy - mysqlclient - numpy - pandas - pillow - scipy - virtualenv - ]; + machine.pkgsets.python3 = { + pkgwrap = pkgs.python3.withPackages (config.machine.pkgsets.python3.pkgs); + pkgs = ps: with ps; [ + bpython + click + flake8 + genanki + holidays + matplotlib + mypy + mysqlclient + numpy + pandas + pillow + pyaml + scipy + jupyter + jupyterlab + requests + pip + notebook + seaborn + virtualenv + ]; + }; } diff --git a/services/desktop/i3.nix b/services/desktop/i3.nix index daf8f78..5253e1e 100644 --- a/services/desktop/i3.nix +++ b/services/desktop/i3.nix @@ -20,7 +20,7 @@ mkIf (elem "desktop::i3" config.machine.services) { ]; }; }; - machine.pkgsets.python3.pkgs = with pkgs.python3Packages; [ + machine.pkgsets.python3.pkgs = ps: with ps; [ py3status pytz tzlocal