diff --git a/modules/kernels/coq/module.nix b/modules/kernels/coq/module.nix index ccd0451..6671e93 100644 --- a/modules/kernels/coq/module.nix +++ b/modules/kernels/coq/module.nix @@ -1,4 +1,4 @@ -{ config, options, lib, pkgs, nixosOptionsToSettingsSchema, boilerplate, ... }: +{ config, options, lib, nixosOptionsToSettingsSchema, boilerplate, ... }: with lib; @@ -16,7 +16,9 @@ with lib; example = "List of Coq packages to use"; type = types.listOf types.str; default = []; + visible = false; }; + coqPackages = mkOption { example = "Coq packages set"; type = types.enum ( diff --git a/modules/kernels/cpp/module.nix b/modules/kernels/cpp/module.nix index e0f5327..17a9030 100644 --- a/modules/kernels/cpp/module.nix +++ b/modules/kernels/cpp/module.nix @@ -1,4 +1,4 @@ -{ config, options, lib, pkgs, nixosOptionsToSettingsSchema, boilerplate, ... }: +{ config, options, lib, nixosOptionsToSettingsSchema, boilerplate, ... }: with lib; @@ -16,6 +16,7 @@ with lib; example = "List of packages"; type = types.listOf types.str; default = []; + visible = false; }; flavor = mkOption { diff --git a/modules/kernels/go/module.nix b/modules/kernels/go/module.nix index 1ea1043..a804f05 100644 --- a/modules/kernels/go/module.nix +++ b/modules/kernels/go/module.nix @@ -1,4 +1,4 @@ -{ config, options, lib, pkgs, nixosOptionsToSettingsSchema, boilerplate, ... }: +{ config, options, lib, nixosOptionsToSettingsSchema, boilerplate, ... }: with lib; @@ -16,6 +16,7 @@ with lib; example = "List of packages"; type = types.listOf types.str; default = []; + visible = false; }; goPackage = mkOption { diff --git a/modules/kernels/haskell/module.nix b/modules/kernels/haskell/module.nix index 1f90d9d..da12152 100644 --- a/modules/kernels/haskell/module.nix +++ b/modules/kernels/haskell/module.nix @@ -1,4 +1,4 @@ -{ config, options, lib, pkgs, nixosOptionsToSettingsSchema, boilerplate, ... }: +{ config, options, lib, nixosOptionsToSettingsSchema, boilerplate, ... }: with lib; @@ -16,7 +16,9 @@ with lib; example = "List of packages"; type = types.listOf types.str; default = []; + visible = false; }; + ghcPackage = mkOption { example = "GHC version"; type = types.enum ["ghc92" "ghc94" "ghc96" "ghc98"]; diff --git a/modules/kernels/julia/module.nix b/modules/kernels/julia/module.nix index d8a744f..ac5f282 100644 --- a/modules/kernels/julia/module.nix +++ b/modules/kernels/julia/module.nix @@ -1,4 +1,4 @@ -{ config, options, lib, pkgs, nixosOptionsToSettingsSchema, boilerplate, ... }: +{ config, options, lib, nixosOptionsToSettingsSchema, boilerplate, ... }: with lib; @@ -16,6 +16,7 @@ with lib; example = "List of packages"; type = types.listOf types.str; default = []; + visible = false; }; juliaPackage = mkOption { diff --git a/modules/kernels/octave/module.nix b/modules/kernels/octave/module.nix index df3cf77..8ec29a7 100644 --- a/modules/kernels/octave/module.nix +++ b/modules/kernels/octave/module.nix @@ -1,4 +1,4 @@ -{ config, options, lib, pkgs, nixosOptionsToSettingsSchema, boilerplate, ... }: +{ config, options, lib, nixosOptionsToSettingsSchema, boilerplate, ... }: with lib; @@ -16,6 +16,7 @@ with lib; example = "List of packages"; type = types.listOf types.str; default = []; + visible = false; }; interface.attrs = mkOption { diff --git a/modules/kernels/postgres/module.nix b/modules/kernels/postgres/module.nix index 6d03d73..0473435 100644 --- a/modules/kernels/postgres/module.nix +++ b/modules/kernels/postgres/module.nix @@ -1,4 +1,4 @@ -{ config, options, lib, pkgs, nixosOptionsToSettingsSchema, boilerplate, ... }: +{ config, options, lib, nixosOptionsToSettingsSchema, boilerplate, ... }: with lib; @@ -15,6 +15,7 @@ with lib; example = "List of packages"; type = types.listOf types.str; default = []; + visible = false; }; interface.attrs = mkOption { diff --git a/modules/kernels/python/module.nix b/modules/kernels/python/module.nix index 3173cf7..9954093 100644 --- a/modules/kernels/python/module.nix +++ b/modules/kernels/python/module.nix @@ -13,8 +13,20 @@ let packages = mkOption { example = "List of packages"; - type = types.listOf types.str; + type = types.listOf (types.either types.str (types.submodule { + options = { + name = mkOption { + description = "Package name"; + type = types.str; + }; + outputs = mkOption { + example = "Package outputs to include"; + type = types.listOf types.str; + }; + }; + })); default = []; + visible = false; }; python3Package = packageOption; diff --git a/modules/kernels/r/module.nix b/modules/kernels/r/module.nix index 988f4cd..2285ec1 100644 --- a/modules/kernels/r/module.nix +++ b/modules/kernels/r/module.nix @@ -1,4 +1,4 @@ -{ config, options, lib, pkgs, nixosOptionsToSettingsSchema, boilerplate, ... }: +{ config, options, lib, nixosOptionsToSettingsSchema, boilerplate, ... }: with lib; @@ -16,6 +16,7 @@ with lib; example = "List of packages"; type = types.listOf types.str; default = []; + visible = false; }; interface.attrs = mkOption { diff --git a/modules/kernels/ruby/module.nix b/modules/kernels/ruby/module.nix index 1a42d39..49aa367 100644 --- a/modules/kernels/ruby/module.nix +++ b/modules/kernels/ruby/module.nix @@ -21,6 +21,7 @@ in example = "List of packages"; type = types.listOf types.str; default = []; + visible = false; }; rubyPackage = mkOption { diff --git a/modules/kernels/rust/module.nix b/modules/kernels/rust/module.nix index cef65b4..bac84e7 100644 --- a/modules/kernels/rust/module.nix +++ b/modules/kernels/rust/module.nix @@ -16,11 +16,11 @@ with lib; example = "List of packages"; type = types.listOf (types.either types.str (types.submodule { options = { - name = mkOption rec { + name = mkOption { description = "Package name"; type = types.str; }; - features = mkOption rec { + features = mkOption { example = "Features to enable for the package"; type = types.listOf types.str; }; diff --git a/nix/makeEnvironment.nix b/nix/makeEnvironment.nix index 4561470..ba1668e 100644 --- a/nix/makeEnvironment.nix +++ b/nix/makeEnvironment.nix @@ -43,15 +43,19 @@ let mkSubPackageMetadata = pkg: p: { name = packageName p; - meta = if lib.hasAttrByPath ["packageOptions" (packageName p)] pkg then chooseMeta (pkg.packageOptions.${packageName p}) else {}; - } // (lib.optionalAttrs (lib.isAttrs p && p ? "settings") { - inherit (p) settings; - }); + meta = let + meta = chooseMeta (pkg.packageOptions.${packageName p} or {}); + settings = if lib.isAttrs p then lib.removeAttrs p ["name"] else {}; + in + meta // (lib.optionalAttrs (builtins.length (builtins.attrNames settings) != 0) { + inherit settings; + }); + }; in pkg: { # Dry name = pkg.name; - settings = pkg.settings or {}; + settings = lib.removeAttrs (pkg.settings or {}) ["packages"]; # Different for hydrated packages = map (p: mkSubPackageMetadata pkg p) (pkg.settings.packages or []); diff --git a/sample_environments/python3.nix b/sample_environments/python3.nix index 8bb304a..889d834 100644 --- a/sample_environments/python3.nix +++ b/sample_environments/python3.nix @@ -5,7 +5,10 @@ codedown.makeEnvironment { kernels.python3.enable = true; kernels.python3.packages = [ - "matplotlib" + { + name = "matplotlib"; + outputs = ["out" "dist"]; + } "scipy" "rope" ];