From 0a0a108b4ff551af2f23a858c1fc75bcf6d9370b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Sun, 17 Dec 2023 16:16:59 +0100 Subject: [PATCH] nixify --- .gitignore | 2 + docs/example.py | 32 ---------------- docs/{ => figs}/circle.webm | Bin docs/{ => figs}/demo_noshow.webm | Bin docs/{ => figs}/demo_show.webm | Bin docs/{ => figs}/full_noshow.webm | Bin docs/{ => figs}/full_show.webm | Bin docs/{ => figs}/island.webm | Bin docs/{ => figs}/tuto.webm | Bin docs/{ => figs}/waterfall.webm | Bin docs/rapport.md | 22 +++++------ flake.lock | 64 +++++++++++++++++++++++++++++++ flake.nix | 34 ++++++++++++++++ 13 files changed, 111 insertions(+), 43 deletions(-) delete mode 100644 docs/example.py rename docs/{ => figs}/circle.webm (100%) rename docs/{ => figs}/demo_noshow.webm (100%) rename docs/{ => figs}/demo_show.webm (100%) rename docs/{ => figs}/full_noshow.webm (100%) rename docs/{ => figs}/full_show.webm (100%) rename docs/{ => figs}/island.webm (100%) rename docs/{ => figs}/tuto.webm (100%) rename docs/{ => figs}/waterfall.webm (100%) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 379520c..2f89a97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +result + bin/ build/ .gradle/ diff --git a/docs/example.py b/docs/example.py deleted file mode 100644 index 9a8a44a..0000000 --- a/docs/example.py +++ /dev/null @@ -1,32 +0,0 @@ -import matplotlib.pyplot as plt -import numpy as np -from math import comb - - -def B(n, k, t): - return comb(n, k) * t**k * (1 - t)**(n - k) - - -P = np.array([[0, 0], [0, 2], [1, 2], [1, 0], [1, -2], [2, -1], [2, 0]]) - -n = 3 - -S1 = np.array([sum(P[k] * B(n, k, t) for k in range(n + 1)) for t in np.linspace(0, 1, 100)]) -S2 = np.array([sum(P[k + n] * B(n, k, t) for k in range(n + 1)) for t in np.linspace(0, 1, 100)]) - -S1p = np.array([n * sum((P[k + 1] - P[k]) * B(n - 1, k, t) for k in range(n)) for t in np.linspace(0, 1, 100)]) -S2p = np.array([n * sum((P[k + 1 + n] - P[k + n]) * B(n - 1, k, t) for k in range(n)) for t in np.linspace(0, 1, 100)]) - -plt.subplot(121) -plt.plot(S1[:,0], S1[:,1]) -plt.plot(S2[:,0], S2[:,1]) -plt.plot(P[:,0], P[:,1], 'ro') -plt.axis('equal') - -plt.subplot(122) -plt.plot(S1p[:,0], S1p[:,1]) -plt.plot(S2p[:,0], S2p[:,1]) -plt.axis('equal') -plt.show() - - diff --git a/docs/circle.webm b/docs/figs/circle.webm similarity index 100% rename from docs/circle.webm rename to docs/figs/circle.webm diff --git a/docs/demo_noshow.webm b/docs/figs/demo_noshow.webm similarity index 100% rename from docs/demo_noshow.webm rename to docs/figs/demo_noshow.webm diff --git a/docs/demo_show.webm b/docs/figs/demo_show.webm similarity index 100% rename from docs/demo_show.webm rename to docs/figs/demo_show.webm diff --git a/docs/full_noshow.webm b/docs/figs/full_noshow.webm similarity index 100% rename from docs/full_noshow.webm rename to docs/figs/full_noshow.webm diff --git a/docs/full_show.webm b/docs/figs/full_show.webm similarity index 100% rename from docs/full_show.webm rename to docs/figs/full_show.webm diff --git a/docs/island.webm b/docs/figs/island.webm similarity index 100% rename from docs/island.webm rename to docs/figs/island.webm diff --git a/docs/tuto.webm b/docs/figs/tuto.webm similarity index 100% rename from docs/tuto.webm rename to docs/figs/tuto.webm diff --git a/docs/waterfall.webm b/docs/figs/waterfall.webm similarity index 100% rename from docs/waterfall.webm rename to docs/figs/waterfall.webm diff --git a/docs/rapport.md b/docs/rapport.md index e08b77d..8b02063 100644 --- a/docs/rapport.md +++ b/docs/rapport.md @@ -12,12 +12,12 @@ body {

-Laurent Fainsin — -Damien Guillotin + Laurent Fainsin — + Damien Guillotin

-Lien vers le répertoire + Lien vers le répertoire

## Description @@ -89,34 +89,34 @@ video {
- + - +
- + - +
- + - +
- + - +
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..af9faf5 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1702312524, + "narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a9bf124c46ef298113270b1f84a164865987a91c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1701253981, + "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c74be6e --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + }; + + outputs = inputs@{ nixpkgs, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" ]; + + perSystem = { pkgs, system, ... }: { + devShells.default = pkgs.mkShell { packages = with pkgs; [ pandoc ]; }; + + packages.report = pkgs.stdenvNoCC.mkDerivation { + name = "report"; + + src = ./docs; + dontUnpack = true; + buildInputs = with pkgs; [ pandoc ]; + + buildPhase = '' + pandoc $src/rapport.md -s -o index.html --katex + ''; + + installPhase = '' + mkdir -p $out + cp -r $src/figs $out/figs + cp index.html $out/index.html + ''; + }; + }; + }; +} +