Skip to content

Commit

Permalink
Progress on converting mkEnvironment -> makeEnvironment
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Aug 20, 2024
1 parent d616d1e commit fdceebf
Show file tree
Hide file tree
Showing 31 changed files with 213 additions and 348 deletions.
5 changes: 4 additions & 1 deletion codedown/makeEnvironment.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ let
attr = concatStringsSep "." (tail parts);
};

repackPackages = packages: if builtins.isList packages then packages else
mapAttrsToList (n: v: { name = n; settings = v; }) packages;

in

mkCodeDownEnvironment {
Expand All @@ -45,7 +48,7 @@ mkCodeDownEnvironment {
kernels = mapAttrsToList (n: v: {
name = builtins.substring (builtins.stringLength "codedown.kernels.") (builtins.stringLength n) n;
channel = "codedown";
args = v;
args = if hasAttr "packages" v then v // { packages = repackPackages v.packages; } else v;
}) kernelPackages;

otherPackages = let
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
sample_environments = import ./sample_environments.nix {
inherit codedown pkgsStable;
channels = {
# nixpkgs = pkgsStable;
inherit codedown nixpkgs;
};
};
sample_environments_farm = pkgsStable.linkFarm "sample_environments_farm" (
Expand Down
2 changes: 1 addition & 1 deletion languages/python/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ lib.listToAttrs (map (x:
let
settingsToUse = (common.makeDefaultSettings settingsSchema) // settings;
ps = packageOptions;
chosenPackages = map (x: builtins.getAttr x ps) packages;
chosenPackages = map (x: builtins.getAttr x ps) (map common.packageName packages);
allPackages = [ps.ipykernel ps.ipywidgets] ++ chosenPackages;
python = basePython.withPackages (_: allPackages);
pythonWithPackages = f: basePython.withPackages (_: allPackages ++ f ps);
Expand Down
2 changes: 1 addition & 1 deletion languages/r/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ listToAttrs [{
let
settingsToUse = (common.makeDefaultSettings settingsSchema) // settings;

basePackages = [rPackages.IRkernel] ++ (map (x: lib.getAttr x rPackages) packages);
basePackages = [rPackages.IRkernel] ++ (map (x: lib.getAttr x rPackages) (map common.packageName packages));

rWithPackages = rWrapper.override {
packages = basePackages;
Expand Down
5 changes: 5 additions & 0 deletions languages/rust/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ let
"rust_1_75"
"rust_1_76"
"rust_1_77"
"rust_1_78"
"rust_1_79"
"rust_1_80"
"rust_1_81"
"rust_1_82"
];

in
Expand Down
20 changes: 6 additions & 14 deletions sample_environments/bash.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "bash";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "bash";
channel = "codedown";
args = {
packages = [];
};
})
];

otherPackages = [];
packages = {
"codedown.kernels.bash" = {
packages = {};
};
};
}
20 changes: 6 additions & 14 deletions sample_environments/clojure.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "clojure";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "clojure";
channel = "codedown";
args = {
packages = [];
};
})
];

otherPackages = [];
packages = {
"codedown.kernels.clojure" = {
packages = {};
};
};
}
20 changes: 6 additions & 14 deletions sample_environments/coq.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "coq";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "coq";
channel = "codedown";
args = {
packages = [];
};
})
];

otherPackages = [];
packages = {
"codedown.kernels.coq" = {
packages = {};
};
};
}
22 changes: 7 additions & 15 deletions sample_environments/cpp11.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "cpp11";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "cpp11";
channel = "codedown";
args = {
packages = [];
attrs = ["cpp11" "cpp"];
};
})
];

otherPackages = [];
packages = {
"codedown.kernels.cpp11" = {
packages = [];
attrs = ["cpp11" "cpp"];
};
};
}
22 changes: 7 additions & 15 deletions sample_environments/cpp14.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "cpp14";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "cpp14";
channel = "codedown";
args = {
packages = [];
attrs = ["cpp14" "cpp"];
};
})
];

otherPackages = [];
packages = {
"codedown.kernels.cpp14" = {
packages = [];
attrs = ["cpp14" "cpp"];
};
};
}
22 changes: 7 additions & 15 deletions sample_environments/cpp17.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "cpp17";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "cpp17";
channel = "codedown";
args = {
packages = [];
attrs = ["cpp17" "cpp"];
};
})
];

otherPackages = [];
packages = {
"codedown.kernels.cpp17" = {
packages = [];
attrs = ["cpp17" "cpp"];
};
};
}
22 changes: 7 additions & 15 deletions sample_environments/cpp20.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "cpp20";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "cpp20";
channel = "codedown";
args = {
packages = [];
attrs = ["cpp20" "cpp"];
};
})
];

otherPackages = [];
packages = {
"codedown.kernels.cpp20" = {
packages = [];
attrs = ["cpp20" "cpp"];
};
};
}
22 changes: 7 additions & 15 deletions sample_environments/cpp23.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "cpp23";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "cpp23";
channel = "codedown";
args = {
packages = [];
attrs = ["cpp23" "cpp"];
};
})
];

otherPackages = [];
packages = {
"codedown.kernels.cpp23" = {
packages = [];
attrs = ["cpp23" "cpp"];
};
};
}
9 changes: 8 additions & 1 deletion sample_environments/exporters-large.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "exporters-large";
inherit channels;
Expand All @@ -14,3 +13,11 @@ codedown.mkCodeDownEnvironment {
{ channel = "codedown"; attr = "exporters.nbconvert-large"; contents = codedown.exporters.nbconvert-large; }
];
}

# codedown.makeEnvironment {
# inherit channels;

# packages = {
# "codedown.exporters.nbconvert-large" = {};
# };
# }
8 changes: 8 additions & 0 deletions sample_environments/exporters-small.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ codedown.mkCodeDownEnvironment {
{ channel = "codedown"; attr = "exporters.nbconvert-small"; contents = codedown.exporters.nbconvert-small; }
];
}

# codedown.makeEnvironment {
# inherit channels;

# packages = {
# "codedown.exporters.nbconvert-small" = {};
# };
# }
24 changes: 8 additions & 16 deletions sample_environments/ghc92.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "ghc92";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "haskell-ghc92";
channel = "codedown";
args = {
packages = ["aeson"];
settings = {
"lsp.haskell-language-server.debug" = true;
};
packages = {
"codedown.kernels.haskell-ghc92" = {
packages = ["aeson"];
settings = {
"lsp.haskell-language-server.debug" = true;
};
})
];

otherPackages = [];
};
};
}
24 changes: 8 additions & 16 deletions sample_environments/ghc94.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@
, ...
}:


codedown.mkCodeDownEnvironment {
environmentName = "ghc94";
codedown.makeEnvironment {
inherit channels;

kernels = [
({
name = "haskell-ghc94";
channel = "codedown";
args = {
packages = ["aeson"];
settings = {
"lsp.haskell-language-server.debug" = true;
};
packages = {
"codedown.kernels.haskell-ghc94" = {
packages = ["aeson"];
settings = {
"lsp.haskell-language-server.debug" = true;
};
})
];

otherPackages = [];
};
};
}
Loading

0 comments on commit fdceebf

Please sign in to comment.