Arkadiusz Ryś преди 2 години
родител
ревизия
a03c3bc75d
променени са 4 файла, в които са добавени 49 реда и са изтрити 20 реда
  1. 3 0
      .gitignore
  2. 1 0
      AUTHORS.rst
  3. 43 19
      flake.nix
  4. 2 1
      pyproject.toml

+ 3 - 0
.gitignore

@@ -10,3 +10,6 @@ dist/
 # Generated example files
 data/example.csv
 data/example.parquet
+
+# Generated nix files
+result

+ 1 - 0
AUTHORS.rst

@@ -6,6 +6,7 @@ Development Lead
 ----------------
 
 * Arkadiusz Michał Ryś <Arkadiusz.Michal.Rys@gmail.com>
+* Joeri Exelmans <Joeri.Exelmans@uantwerpen.be>
 
 Contributors
 ------------

+ 43 - 19
flake.nix

@@ -4,10 +4,12 @@
     nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
     flake-utils.url = github:numtide/flake-utils;
   };
+
   outputs = { self, nixpkgs, flake-utils }:
     flake-utils.lib.eachDefaultSystem (system:
       let
         pkgs = nixpkgs.legacyPackages.${system};
+        python = pkgs.python3.withPackages (ps: with ps; []);
         arklog = pkgs.python3Packages.buildPythonPackage rec {
           pname = "arklog";
           version = "0.5.1";
@@ -28,9 +30,9 @@
             description = "Custom python logging formatter with color output.";
           };
         };
-      in rec {
+      in {
         packages = rec {
-          spendpoint = pkgs.python3Packages.buildPythonPackage rec {
+          spendpoint = pkgs.python3Packages.buildPythonApplication {
             pname = "spendpoint";
             version = "0.4.0";
             format = "pyproject";
@@ -51,25 +53,47 @@
               python-magic
               uvicorn
             ];
-            checkInputs = with pkgs.python3Packages; [
-              pytest
-              sparqlwrapper
-            ];
-            buildInputs = with pkgs.python3Packages; [
-              sphinx
-              tox
-              pip
-              flit
-              twine
-              numpy
-              invoke
-              jinja2
-              flake8
-              coverage
-            ];
+#            checkInputs = with pkgs.python3Packages; [
+#              pytest
+#              sparqlwrapper
+#            ];
+#            buildInputs = with pkgs.python3Packages; [
+#              sphinx
+#              tox
+#              pip
+#              flit
+#              twine
+#              numpy
+#              invoke
+#              jinja2
+#              flake8
+#              coverage
+#            ];
+          };
+
+          # https://discourse.nixos.org/t/basic-flake-run-existing-python-bash-script/19886/2
+          server = pkgs.writeScriptBin "run-python" ''
+            ${python}/bin/python -m spendpoint
+          '';
+
+          launchScript = pkgs.writeTextFile {
+            name = "run.sh";
+            text = ''${python}/bin/python -m spendpoint'';
+            executable = true;
+          };
+
+          default = spendpoint;
+        };
+
+        apps = rec {
+          # App that starts when invoking `nix run .#spendpoint`
+          spendpoint = {
+            type = "app";
+            program = "${self.packages.${system}.launchScript}";
           };
+          # App that starts when invoking `nix run .`
+          default=spendpoint;
         };
-        defaultPackage = packages.spendpoint;
       });
   nixConfig.bash-prompt-prefix = "\\e\[94;1m[spendpoint]\\e\[m ";
 }

+ 2 - 1
pyproject.toml

@@ -6,6 +6,7 @@ build-backend = "flit_core.buildapi"
 name = "spendpoint"
 authors = [
     {name = "Arkadiusz Michał Ryś", email = "Arkadiusz.Michal.Rys@gmail.com"},
+    {name = "Joeri Exelmans", email = "Joeri.Exelmans@uantwerpen.be"},
 ]
 readme = "README.rst"
 requires-python = ">=3.9"
@@ -54,4 +55,4 @@ dev = [
 ]
 
 [project.urls]
-source = "https://git.rys.one/dtdesign/spendpoint"
+source = "https://git.rys.one/dtdesign/spendpoint"