TP-traitement-audio-visuel/flake.nix
2024-09-07 13:44:56 +02:00

65 lines
1.6 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 = ./julia;
dontUnpack = true;
buildInputs = [
(pkgs.julia.withPackages [
"Pluto"
"Plots"
"Statistics"
"PlutoUI"
"LinearAlgebra"
"StatsPlots"
"Distributions"
"MAT"
"DSP"
])
];
buildPhase = ''
# copy the notebooks, Pluto needs write permission
cp $src/notebook.jl index.jl
cp $src/donnees.mat donnees.mat
chmod +w index.jl
# julia needs permission to create .julia directory
export HOME=$TMPDIR
# run and export the notebooks
julia $src/export_html.jl index.jl
'';
installPhase = ''
mkdir -p $out
cp index.html $out
cp -r $src/content $out
'';
};
};
};
}