2024-01-02 10:44:10 +00:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
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 = ''
|
2024-01-02 11:01:58 +00:00
|
|
|
# copy the notebooks, Pluto needs write permission
|
2024-01-02 10:44:10 +00:00
|
|
|
cp $src/TP1/notebook.jl index.jl
|
|
|
|
cp $src/TD/notebook.jl exos.jl
|
|
|
|
chmod +w index.jl exos.jl
|
|
|
|
|
2024-01-02 11:01:58 +00:00
|
|
|
# julia needs permission to create .julia directory
|
|
|
|
export HOME=$TMPDIR
|
2024-01-02 10:44:10 +00:00
|
|
|
|
2024-01-02 11:01:58 +00:00
|
|
|
# run and export the notebooks
|
|
|
|
julia $src/export_html.jl exos.jl index.jl
|
2024-01-02 10:44:10 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp index.html $out
|
|
|
|
cp exos.html $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|