Skip to content

Commit

Permalink
Hydration progress
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Mar 5, 2024
1 parent b1c4a43 commit f82369f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
11 changes: 10 additions & 1 deletion codedown/uiMetadata.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@

inherit (codedown) settingsSchemas;

inherit pkgsStable;

jupyter-runner = with pkgsUnstable;
let
pythonEnv = python3.withPackages (ps: with ps; [papermill]);
Expand All @@ -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 {
Expand Down
11 changes: 7 additions & 4 deletions languages/rust/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion sample_environments/go.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ codedown.mkCodeDownEnvironment {
name = "go";
channel = "codedown";
args = {
packages = ["rand"];
packages = [
"rand"
];
};
})
];
Expand Down

0 comments on commit f82369f

Please sign in to comment.