Skip to content

Commit

Permalink
refactor: update dream2nix
Browse files Browse the repository at this point in the history
  • Loading branch information
GTrunSec committed Feb 24, 2024
1 parent 5996af3 commit 1899433
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 40 deletions.
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# All packages defined in ./packages/<name> are automatically added to the flake outputs
# e.g., 'packages/hello/default.nix' becomes '.#packages.hello'
devShells = eachSystem (system: {
default = self.packages.${system}.default.devShell;
default = self.packages.${system}.default.devShellNew;
std = std.devShells.${system}.default;
});
packages = eachSystem (system: {
Expand Down
24 changes: 8 additions & 16 deletions nix/my-project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,19 @@ in
inherit src;
buildInputs = [ config.deps.python.pkgs.pdm-backend ];
};
buildPythonPackage.catchConflicts = false;
deps =
{ nixpkgs, ... }:
{
python = nixpkgs.python310;
mkShell =
let
pythonEnv = (
config.deps.python.withPackages (ps: config.mkDerivation.propagatedBuildInputs)
);
in
nixpkgs.mkShell {
buildInputs = [
nixpkgs.pdm
pythonEnv
];
passthru = {
inherit pythonEnv;
};
};
};
public = {
devShell = config.deps.mkShell;
# devShell = config.deps.mkShell;
devShellNew = config.public.devShell.overrideAttrs (old: {
buildInputs = old.buildInputs ++ [ packageSets.nixpkgs.pdm ];
});
env = config.deps.python.withPackages (
ps: config.mkDerivation.propagatedBuildInputs
);
};
}
2 changes: 1 addition & 1 deletion nix/std/cells/repo/jupyenv/example.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ in
# pkgs.bashInteractive
# pkgs.d2
# ];
env = inputs.main.devShells.default.passthru.pythonEnv;
env = inputs.main.packages.default.env;
};
kernel.bash.data-science = {
enable = true;
Expand Down
9 changes: 8 additions & 1 deletion nix/std/cells/repo/shells/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ l.mapAttrs (_: std.lib.dev.mkShell) {
{
name = "jupyenv";
category = "data-science";
command = cell.jupyenv.example.config.build + ''/bin/jupyter "$@"'';
command = ''
if [[ "$HOME" == "/home/user" ]]; then
# Running in a container
(cd $HOME && ${cell.jupyenv.example.config.build + /bin/jupyter} "$@")
else
${cell.jupyenv.example.config.build + /bin/jupyter} "$@"
fi
'';
help = "Run Jupyter env";
}
];
Expand Down
6 changes: 3 additions & 3 deletions nix/std/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions nix/std/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@
{ omnibus, ... }@inputs:
let
inherit (omnibus.flake.inputs) std;
stdLib =
inputsSource =
inputs
// (omnibus.call-flake ../lock).inputs
// rec {
inherit std;
main = omnibus.call-flake ../..;
nixpkgs = main.inputs.nixpkgs;
};

omnibusStd =
(omnibus.pops.std {
inputs.inputs = {
inherit std;
Expand All @@ -30,16 +39,7 @@
in
std.growOn
{
inputs =
inputs
// {
inherit std;
}
// ((omnibus.call-flake ../lock).inputs)
// rec {
main = omnibus.call-flake ../..;
nixpkgs = main.inputs.nixpkgs;
};
inputs = inputsSource;
cellsFrom = ./cells;

cellBlocks = with std.blockTypes; [
Expand All @@ -58,7 +58,7 @@

(functions "pops")

(stdLib.blockTypes.jupyenv "jupyenv")
(omnibusStd.blockTypes.jupyenv "jupyenv")
(containers "containers")

(data "config")
Expand Down

0 comments on commit 1899433

Please sign in to comment.