TP-reinforcement-learning/flake.nix

62 lines
1.5 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
systems.url = "github:nix-systems/default";
};
outputs = {flake-parts, ...} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = import inputs.systems;
perSystem = {
pkgs,
system,
...
}: rec {
devShells.default = pkgs.mkShell {
packages = packages.notebooks.buildInputs;
};
packages.notebooks = pkgs.stdenvNoCC.mkDerivation {
name = "notebooks";
src = ./.;
dontUnpack = true;
buildInputs = [
(pkgs.julia.withPackages [
"Pluto"
"Plots"
"PlutoUI"
"LinearAlgebra"
"SparseArrays"
"LaTeXStrings"
])
];
buildPhase = ''
# copy the notebooks, Pluto needs write permission
cp $src/TP1/notebook.jl index.jl
cp $src/TD/notebook.jl exos.jl
chmod +w index.jl exos.jl
# julia needs permission to create .julia directory
export HOME=$TMPDIR
# run and export the notebooks
julia $src/export_html.jl exos.jl index.jl
'';
installPhase = ''
mkdir -p $out
cp index.html $out
cp exos.html $out
'';
};
};
};
}