From f82369fdd07b1c93a856cf5be89a9d33a7c16b89 Mon Sep 17 00:00:00 2001 From: thomasjm Date: Tue, 5 Mar 2024 13:52:34 -0800 Subject: [PATCH] Hydration progress --- codedown/uiMetadata.nix | 11 ++++++++++- flake.nix | 6 ++++++ languages/rust/default.nix | 11 +++++++---- sample_environments/go.nix | 4 +++- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/codedown/uiMetadata.nix b/codedown/uiMetadata.nix index cb417d21..019fd263 100644 --- a/codedown/uiMetadata.nix +++ b/codedown/uiMetadata.nix @@ -25,13 +25,22 @@ rec { name = name; }; + packageName = p: if lib.isString p then p else p.name; + + mkKernelPackageMetadata = kernel: p: { + name = packageName p; + meta = if lib.hasAttrByPath ["packageOptions" (packageName p)] kernel then chooseInterestingMeta (kernel.packageOptions.${p}) else {}; + }; + mkKernelUiMetadata = kernel: { # Dry channel = kernel.channel; name = kernel.name; - packages = kernel.args.packages; settings = if kernel ? "settings" then kernel.settings else {}; + # Different for hydrated + packages = map (p: mkKernelPackageMetadata kernel p) kernel.args.packages; + # Hydrated display_name = if kernel.meta ? "displayName" then kernel.meta.displayName else null; icon = if kernel.meta ? "icon" then kernel.meta.icon else null; diff --git a/flake.nix b/flake.nix index 8d299b10..c1e18723 100644 --- a/flake.nix +++ b/flake.nix @@ -50,6 +50,8 @@ inherit (codedown) settingsSchemas; + inherit pkgsStable; + jupyter-runner = with pkgsUnstable; let pythonEnv = python3.withPackages (ps: with ps; [papermill]); @@ -70,6 +72,10 @@ pkgsStable.lib.mapAttrsToList (name: path: { inherit name path; }) sample_environments ); + ui_metadata_farm = pkgsStable.linkFarm "ui_metadata_farm" ( + pkgsStable.lib.mapAttrsToList (name: deriv: { inherit name; path = deriv.ui_metadata_yaml; }) + sample_environments + ); compilers = pkgsStable.callPackage ./languages/haskell/compilers.nix { ihaskell-source = pkgsStable.fetchFromGitHub { diff --git a/languages/rust/default.nix b/languages/rust/default.nix index cd22f31a..69375168 100644 --- a/languages/rust/default.nix +++ b/languages/rust/default.nix @@ -77,11 +77,14 @@ listToAttrs (map (x: in { name = x; value = rec { - packageOptions = listToAttrs (map (x: { name = x; value = { - meta = { - name = x; + packageOptions = listToAttrs (map (x: { + name = x; + value = { + meta = { + name = x; + }; }; - }; }) allPackageNames); + }) allPackageNames); packageSearch = common.searcher' { packageMustBeDerivation = false; diff --git a/sample_environments/go.nix b/sample_environments/go.nix index 3f4dad39..bb3b0ce4 100644 --- a/sample_environments/go.nix +++ b/sample_environments/go.nix @@ -13,7 +13,9 @@ codedown.mkCodeDownEnvironment { name = "go"; channel = "codedown"; args = { - packages = ["rand"]; + packages = [ + "rand" + ]; }; }) ];