From 45df063a3434cc0a8db241379377112e6a1ccaff Mon Sep 17 00:00:00 2001 From: Sebastian Wendel Date: Tue, 27 Sep 2022 19:40:00 +0200 Subject: [PATCH] latest changes --- LICENSE | 20 ++++++++++++ README.md | 12 ++++++++ flake.nix | 66 ++++++++++++++++++---------------------- requirements/dev.txt | 12 -------- requirements/release.txt | 12 -------- 5 files changed, 62 insertions(+), 60 deletions(-) create mode 100644 LICENSE delete mode 100644 requirements/dev.txt delete mode 100644 requirements/release.txt diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..aca3b58 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2022 Sebastian Wendel + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index e69de29..08596f5 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,12 @@ +# Cyanovision Nix Flake + +## Commands + +```sh + +``` + +## Links + +* +* diff --git a/flake.nix b/flake.nix index e74d6d7..ac78add 100644 --- a/flake.nix +++ b/flake.nix @@ -36,21 +36,20 @@ cyanovision = { name = "cyanovision"; + src = pkgs.fetchFromGitHub { owner = "IoannouPanayiotis"; repo = "Sensor-CDT-Team-Challenge-2021-2022"; rev = "fd7e538b8afc2227a1100bdd42903b282fcf46bb"; sha256 = "sha256-e4kEuvH3my4gzOhP9zWCWSUOYokJJ7JBRXSpeMQkkp0="; }; - requirements = { - release = builtins.readFile ./requirements/release.txt; - dev = builtins.readFile ./requirements/dev.txt; - all = cyanovision.requirements.release + cyanovision.requirements.dev; - }; + packagesExtra = with pkgs; [ + bash libusb1 libsndfile ]; + pythonPackages = with pkgs.python310Packages; [ matplotlib numpy @@ -60,12 +59,16 @@ tensorflow tkinter ]; + packages = { - # cyanovision-deps = machNix.mkPython { - # packagesExtra = cyanovision.packagesExtra; - # requirements = cyanovision.requirements.release; - # providers.tensorflow = "nixpkgs"; - # }; + tflite-model-maker = machNix.buildPythonPackage { + src = builtins.fetchGit { + url = "https://github.com/tensorflow/examples/tree/master/tensorflow_examples/lite/model_maker"; + ref = "master"; + rev = "32b080729d0a995fc06c3df4441d685ff1ca3e55"; + }; + extras = ["grpc" "libsndfile"]; + }; cyanovision-ui = pkgs.python3Packages.buildPythonApplication rec { pname = "${cyanovision.name}-ui"; @@ -73,16 +76,7 @@ src = cyanovision.src; propagatedBuildInputs = cyanovision.packagesExtra; - - pythonPath = with pkgs.python310Packages; [ - matplotlib - numpy - pathlib2 - pillow - pycocotools - tensorflow - tkinter - ]; + pythonPath = cyanovision.pythonPackages; format = "other"; doCheck = false; @@ -109,6 +103,7 @@ patchShebangs --host $out/bin/${pname} ''; }; + cyanovision-model = pkgs.stdenv.mkDerivation { name = cyanovision.name + "-model"; src = cyanovision.src; @@ -119,6 +114,7 @@ ''; doCheck = false; }; + cyanovision-dataset = pkgs.stdenv.mkDerivation { name = cyanovision.name + "-dataset"; src = cyanovision.src; @@ -132,9 +128,12 @@ }; }; - venv = machNix.mkPython { + python-venv = machNix.mkPython { packagesExtra = cyanovision.packagesExtra; - requirements = cyanovision.requirements.release; + requirements = '' + tensorflow + # tflite-model-maker==0.3.2 + ''; providers.tensorflow = "nixpkgs"; _.pytest-cov.propagatedBuildInputs.mod = pySelf: self: oldVal: oldVal ++ [pySelf.tomli]; }; @@ -146,39 +145,34 @@ defaultApp = apps.jupyterlab; - # packages.cyanovision-deps = cyanovision.packages.cyanovision-deps; packages.cyanovision-ui = cyanovision.packages.cyanovision-ui; packages.cyanovision-model = cyanovision.packages.cyanovision-model; packages.cyanovision-dataset = cyanovision.packages.cyanovision-dataset; - packages.venv = venv; + packages.tflite-model-maker = cyanovision.packages.tflite-model-maker; + packages.python-venv = python-venv; packages.docker = (machNix.mkDockerImage { - packagesExtra = with pkgs; [bash libusb1 libsndfile]; - requirements = builtins.readFile ./requirements/release.txt; + packagesExtra = cyanovision.packagesExtra; + requirements = cyanovision.pythonPackages; _.pytest-cov.propagatedBuildInputs.mod = pySelf: self: oldVal: oldVal ++ [pySelf.tomli]; }) .override (oldAttrs: { - name = "cyanovision"; + name = cyanovision.name; config.Cmd = ["jupyter" "lab" "--notebook-dir=/mnt" "--allow-root" "--ip=0.0.0.0"]; }); defaultPackage = packages.cyanovision-ui; - # devShell = jupyterEnvironment.env; devShell = pkgs.mkShell { - name = "nix-cyanovision"; + name = "nix-${cyanovision.name}"; buildInputs = [ - # cyanovision-dataset - # cyanovision-model - # cyanovision-ui - venv + cyanovision.packagesExtra + cyanovision.pythonPackages + python-venv pkgs.git - pkgs.libusb1 ]; - shellHook = '' - ''; }; }); } diff --git a/requirements/dev.txt b/requirements/dev.txt deleted file mode 100644 index 02f97f6..0000000 --- a/requirements/dev.txt +++ /dev/null @@ -1,12 +0,0 @@ -autopep8 -coverage -flake8 -pep8 -pycodestyle -pyflakes -pylint -pytest -pytest-cov -python-dateutil -PyYAML -toml diff --git a/requirements/release.txt b/requirements/release.txt deleted file mode 100644 index 4ffdfaf..0000000 --- a/requirements/release.txt +++ /dev/null @@ -1,12 +0,0 @@ -matplotlib -numpy -pathlib -# PIL -pycocotools -# tensorflow -tflite -# tflite-model-maker -# tflite-support -# tflite-model-maker==0.3.2 -# tkinter -jupyterlab \ No newline at end of file