diff --git a/modules/dream2nix/buildPythonPackage/default.nix b/modules/dream2nix/buildPythonPackage/default.nix index e0a7730f9a..d1a931585a 100644 --- a/modules/dream2nix/buildPythonPackage/default.nix +++ b/modules/dream2nix/buildPythonPackage/default.nix @@ -1,6 +1,21 @@ { + config, + dream2nix, + lib, + ... +}: let + l = lib // builtins; +in { imports = [ - ./implementation.nix ./interface.nix + ../mkDerivation ]; + config = { + package-func.func = config.deps.python.pkgs.buildPythonPackage; + package-func.args = config.buildPythonPackage; + + deps = {nixpkgs, ...}: { + python = l.mkOptionDefault nixpkgs.python3; + }; + }; } diff --git a/modules/dream2nix/buildPythonPackage/implementation.nix b/modules/dream2nix/buildPythonPackage/implementation.nix deleted file mode 100644 index d090e3b654..0000000000 --- a/modules/dream2nix/buildPythonPackage/implementation.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - config, - lib, - ... -}: let - l = lib // builtins; -in { - config = { - package-func.func = config.deps.python.pkgs.buildPythonPackage; - package-func.args = config.buildPythonPackage; - - deps = {nixpkgs, ...}: { - python = l.mkOptionDefault nixpkgs.python3; - }; - }; -} diff --git a/modules/dream2nix/core/docs/default.nix b/modules/dream2nix/core/docs/default.nix index 46c630d609..9c5f748637 100644 --- a/modules/dream2nix/core/docs/default.nix +++ b/modules/dream2nix/core/docs/default.nix @@ -69,6 +69,9 @@ ''; }; in { + imports = [ + ../deps + ]; options = { public.docs = l.mkOption { type = t.package; diff --git a/modules/dream2nix/core/eval-cache/default.nix b/modules/dream2nix/core/eval-cache/default.nix index f914371340..f3946f1b5e 100644 --- a/modules/dream2nix/core/eval-cache/default.nix +++ b/modules/dream2nix/core/eval-cache/default.nix @@ -130,6 +130,7 @@ in { imports = [ ./interface.nix + ../deps ]; config = l.mkMerge [configIfEnabled configIfDisabled]; diff --git a/modules/dream2nix/core/paths/default.nix b/modules/dream2nix/core/paths/default.nix index bb35ac68cd..bf6c2c6f30 100644 --- a/modules/dream2nix/core/paths/default.nix +++ b/modules/dream2nix/core/paths/default.nix @@ -5,6 +5,7 @@ }: { imports = [ ./interface.nix + ../deps ]; deps = {nixpkgs, ...}: { python3 = nixpkgs.python3; diff --git a/modules/dream2nix/core/ui/default.nix b/modules/dream2nix/core/ui/default.nix index 29a8c234f3..b1f2d592c2 100644 --- a/modules/dream2nix/core/ui/default.nix +++ b/modules/dream2nix/core/ui/default.nix @@ -1,6 +1,7 @@ {config, ...}: { imports = [ ./interface.nix + ../public ]; config.public.name = config.name; diff --git a/modules/dream2nix/mkDerivation-sane-defaults/default.nix b/modules/dream2nix/mkDerivation-sane-defaults/default.nix deleted file mode 100644 index 3652a668b7..0000000000 --- a/modules/dream2nix/mkDerivation-sane-defaults/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - config, - lib, - ... -}: { - mkDerivation = { - strictDeps = lib.mkDefault true; - }; -} diff --git a/modules/dream2nix/nixpkgs-overrides/default.nix b/modules/dream2nix/nixpkgs-overrides/default.nix index 72383aa518..e532f355d5 100644 --- a/modules/dream2nix/nixpkgs-overrides/default.nix +++ b/modules/dream2nix/nixpkgs-overrides/default.nix @@ -1,5 +1,6 @@ { config, + dream2nix, lib, options, ... @@ -50,15 +51,16 @@ in { imports = [ ./interface.nix + dream2nix.modules.dream2nix.buildPythonPackage ]; - config = l.mkMerge [ - (l.mkIf cfg.enable { - mkDerivation = extractedMkDerivation; - buildPythonPackage = extractedBuildPythonPackage; - env = extractedEnv; - }) + config = { + mkDerivation = lib.mkIf cfg.enable extractedMkDerivation; + buildPythonPackage = lib.mkIf cfg.enable extractedBuildPythonPackage; + env = lib.mkIf cfg.enable extractedEnv; + } + // { nixpkgs-overrides.lib = {inherit extractOverrideAttrs extractPythonAttrs;}; nixpkgs-overrides.exclude = [ "all" @@ -70,6 +72,5 @@ in { "src" "outputs" ]; - } - ]; + }; } diff --git a/modules/dream2nix/nixpkgs-overrides/interface.nix b/modules/dream2nix/nixpkgs-overrides/interface.nix index 70c81059d2..c5bfd91ee5 100644 --- a/modules/dream2nix/nixpkgs-overrides/interface.nix +++ b/modules/dream2nix/nixpkgs-overrides/interface.nix @@ -22,6 +22,7 @@ in { type = t.nullOr t.package; description = "package from which to extract the attributes"; default = config.deps.python.pkgs.${config.name} or null; + defaultText = "config.deps.python.pkgs.\${config.name} or null"; }; lib.extractOverrideAttrs = l.mkOption { diff --git a/modules/flake-parts/core-modules.nix b/modules/flake-parts/core-modules.nix index 83cf5a1f1b..e88db4a420 100644 --- a/modules/flake-parts/core-modules.nix +++ b/modules/flake-parts/core-modules.nix @@ -14,20 +14,24 @@ ; inherit (lib) - mapAttrs' filterAttrs + mapAttrs' nameValuePair removeSuffix ; - mapModules = path: + path = self + "/modules/dream2nix/core"; + + dirs = filterAttrs (name: _: name != "default.nix") (readDir path); + + modules = mapAttrs' (fn: _: nameValuePair (removeSuffix ".nix" fn) (path + "/${fn}")) - (filterAttrs (_: type: type == "regular" || type == "directory") (readDir path)); + (filterAttrs (_: type: type == "regular" || type == "directory") dirs); in { # generates future flake outputs: `modules..` - config.flake.modules.dream2nix = mapModules (self + "/modules/dream2nix/core"); + config.flake.modules.dream2nix = modules; } diff --git a/modules/flake-parts/website.nix b/modules/flake-parts/website.nix index 2978f12f39..5f5c994cff 100644 --- a/modules/flake-parts/website.nix +++ b/modules/flake-parts/website.nix @@ -9,44 +9,28 @@ inputs', pkgs, ... - }: { + }: let + excludes = [ + # NOT WORKING + # TODO: fix those + "nixpkgs-overrides" + "core" + "flags" + "ui" + "docs" + "env" + "assertions" + + # doesn't need to be rendered + "_template" + ]; + in { render.inputs = lib.flip lib.mapAttrs - (lib.filterAttrs (name: module: - lib.elem name [ - # "buildPythonPackage" - # "buildRustPackage" - # "builtins-derivation" - "core" - # "groups" - # "mkDerivation" - # "mkDerivation-sane-defaults" - # "nixpkgs-overrides" - "nodejs-devshell" - "nodejs-granular" - "nodejs-granular-v3" - "nodejs-node-modules" - "nodejs-package-json" - "nodejs-package-lock" - "nodejs-package-lock-v3" - "package-func" - "php-composer-lock" - "php-granular" - - "pip" - "rust-cargo-lock" - "WIP-python-pdm" - "WIP-python-pyproject" - "WIP-spago" - - "lock" - "mkDerivation" - "public" - - # NOT WORKING - # "rust-crane" - # "_template" - ]) (self.modules.dream2nix)) + (lib.filterAttrs + (name: module: + ! (lib.elem name excludes)) + (self.modules.dream2nix)) (name: module: { title = name; module = self.modules.dream2nix.${name};