Skip to content

Commit

Permalink
Merge pull request #36 from traP-jp/fix/#34-symlink-join
Browse files Browse the repository at this point in the history
🐛 use symlinkJoin and nix-filter
  • Loading branch information
comavius authored Oct 19, 2024
2 parents 5704754 + 5f0295f commit 6c64f52
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 129 deletions.
18 changes: 10 additions & 8 deletions exec-container/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,26 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-filter.url = "github:numtide/nix-filter";
};

outputs = { nixpkgs, flake-utils,... }:
outputs = { nixpkgs, flake-utils, nix-filter,... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
bin_flatten_drv = import ./utils/bin_flatten.nix { inherit pkgs; };
bin_link_drv = import ./utils/bin_link.nix { inherit pkgs; };
python_drv = import ./python/python-all.nix {
filter = nix-filter.lib;
python-all = import ./python/python-all.nix {
inherit pkgs;
inherit bin_flatten_drv;
inherit bin_link_drv;
inherit filter;
};
in
{
packages = {
default = bin_flatten_drv {
drvs = [ python_drv ];
default = pkgs.symlinkJoin {
name = "default-all";
paths = [
python-all
];
};
};
}
Expand Down
55 changes: 34 additions & 21 deletions exec-container/python/python-3-11.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
{
pkgs, bin_link_drv, ...
}: bin_link_drv {
drv = pkgs.python311.withPackages ( python-pkgs: with python-pkgs; [
numpy
scipy
networkx
sympy
sortedcontainers
more-itertools
shapely
bitarray
pulp
mpmath
pandas
z3-solver
scikit-learn
]);
sources = [
{ path = "bin/python3.11"; alias = "python3.11"; }
];
}
pkgs, filter, ...
}:
let
python = pkgs.python311.withPackages (
python-pkgs: with python-pkgs; [
numpy
scipy
networkx
sympy
sortedcontainers
more-itertools
shapely
bitarray
pulp
mpmath
pandas
z3-solver
scikit-learn
]
);
in
pkgs.stdenv.mkDerivation {
name = "python311";
src = filter {
root = python;
include = [
"bin/python3.11"
];
};
phases = "installPhase";
installPhase = ''
ln -s $src $out
'';
}
55 changes: 34 additions & 21 deletions exec-container/python/python-3-12.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
{
pkgs, bin_link_drv, ...
}: bin_link_drv {
drv = pkgs.python312.withPackages ( python-pkgs: with python-pkgs; [
numpy
scipy
networkx
sympy
sortedcontainers
more-itertools
shapely
bitarray
pulp
mpmath
pandas
z3-solver
scikit-learn
]);
sources = [
{ path = "bin/python3.12"; alias = "python3.12"; }
];
}
pkgs, filter, ...
}:
let
python = pkgs.python312.withPackages (
python-pkgs: with python-pkgs; [
numpy
scipy
networkx
sympy
sortedcontainers
more-itertools
shapely
bitarray
pulp
mpmath
pandas
z3-solver
scikit-learn
]
);
in
pkgs.stdenv.mkDerivation {
name = "python312";
src = filter {
root = python;
include = [
"bin/python3.12"
];
};
phases = "installPhase";
installPhase = ''
ln -s $src $out
'';
}
15 changes: 9 additions & 6 deletions exec-container/python/python-all.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
pkgs, bin_flatten_drv, bin_link_drv, ...
pkgs, filter, ...
}: let
python311drv = import ./python-3-11.nix { inherit pkgs; inherit bin_link_drv; };
python312drv = import ./python-3-12.nix { inherit pkgs; inherit bin_link_drv; };
python311 = import ./python-3-11.nix { inherit pkgs; inherit filter; };
python312 = import ./python-3-12.nix { inherit pkgs; inherit filter; };
in
bin_flatten_drv {
pkgs = pkgs;
drvs = [ python311drv python312drv ];
pkgs.symlinkJoin {
name = "python-all";
paths = [
python311
python312
];
}
31 changes: 0 additions & 31 deletions exec-container/utils/bin_flatten.nix

This file was deleted.

42 changes: 0 additions & 42 deletions exec-container/utils/bin_link.nix

This file was deleted.

0 comments on commit 6c64f52

Please sign in to comment.