Browse Source

Add flake

Arkadiusz Ryś 2 years ago
parent
commit
c79c39890e
3 changed files with 198 additions and 2 deletions
  1. 61 0
      flake.lock
  2. 135 0
      flake.nix
  3. 2 2
      pyproject.toml

+ 61 - 0
flake.lock

@@ -0,0 +1,61 @@
+{
+  "nodes": {
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1692799911,
+        "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1693377291,
+        "narHash": "sha256-vYGY9bnqEeIncNarDZYhm6KdLKgXMS+HA2mTRaWEc80=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "e7f38be3775bab9659575f192ece011c033655f0",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs"
+      }
+    },
+    "systems": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}

+ 135 - 0
flake.nix

@@ -0,0 +1,135 @@
+{
+  description = "A flake for building get";
+  inputs = {
+    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};
+        arklog = pkgs.python3Packages.buildPythonPackage rec {
+          pname = "arklog";
+          version = "0.5.1";
+          format = "pyproject";
+          src = pkgs.python3Packages.fetchPypi {
+            inherit pname version;
+            sha256 = "334059a336e400cafbc9a1c382e747bee2c7660115c2d0612aa725beb845acd4";
+          };
+          propagatedBuildInputs = with pkgs.python3Packages; [
+            setuptools
+            flit-core
+            toml
+            pyaml
+          ];
+          doCheck = false;
+          meta = {
+            homepage = "https://git.rys.one/arrys/arklog";
+            description = "Custom python logging formatter with color output.";
+          };
+        };
+        owly = pkgs.python3Packages.buildPythonPackage rec {
+          pname = "owly";
+          version = "0.0.3";
+          format = "pyproject";
+          src = pkgs.python3Packages.fetchPypi {
+            inherit pname version;
+            sha256 = "e412c67c0c19c419fa630eb6d123f397d1d3eebd9bd5c8820cd0b52144bb94f3";
+          };
+          propagatedBuildInputs = with pkgs.python3Packages; [
+            setuptools
+            flit-core
+            toml
+            pyaml
+          ];
+          doCheck = false;
+          meta = {
+            homepage = "https://git.rys.one/arrys/owly-lib";
+            description = "SPARQL helper.";
+          };
+        };
+        dearpygui = pkgs.python3Packages.buildPythonPackage rec {
+          pname = "dearpygui";
+          version = "1.9.1";
+          src = pkgs.python3Packages.fetchPypi {
+            inherit pname version;
+            sha256 = "sha256-WgBv5EWQw2KgP+RRI3B07ZlWPQM08bxuxsfUmOykHkY=";
+            format = "wheel";
+            python = "cp310";
+            dist = "cp310";
+            abi = "cp310";
+            platform = "manylinux1_x86_64";
+          };
+          propagatedBuildInputs = with pkgs.python3Packages; [
+            setuptools
+          ];
+          doCheck = false;
+          meta = {
+            homepage = "https://github.com/hoffstadt/DearPyGui";
+            description = "dearpygui.";
+          };
+        };
+      in {
+        packages = rec {
+          get = pkgs.python3Packages.buildPythonPackage {
+            pname = "graph-exploring-tool";
+            version = "0.2.4";
+            format = "pyproject";
+            src = ./.;
+            nativeBuildInputs = [];
+            propagatedBuildInputs = with pkgs.python3Packages; [
+              #setuptools
+              flit-core
+              toml
+              arklog
+              rdflib
+              dacite
+              owly
+              certifi
+              dearpygui
+            ];
+#            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 = let python = pkgs.python3.withPackages (ps: with ps; [ get ]); in pkgs.writeScriptBin "run-python" ''
+            ${python}/bin/python -m graph_exploring_tool
+          '';
+
+          launchScript = let python = pkgs.python3.withPackages (ps: with ps; [ get ]); in pkgs.writeTextFile {
+            name = "run.sh";
+            text = ''${python}/bin/python -m graph_exploring_tool'';
+            executable = true;
+          };
+
+          default = get;
+        };
+
+        apps = rec {
+          # App that starts when invoking `nix run .#graph-exploring-tool`
+          get = {
+            type = "app";
+            program = "${self.packages.${system}.launchScript}";
+          };
+          # App that starts when invoking `nix run .`
+          default=get;
+        };
+      });
+  nixConfig.bash-prompt-prefix = "\\e\[94;1m[graph-exploring-tool]\\e\[m ";
+}

+ 2 - 2
pyproject.toml

@@ -24,7 +24,7 @@ dependencies = [
     "toml~=0.10.2",
     "arklog~=0.5.1",
     "dacite~=1.8.1",
-    "rdflib~=6.3.2",
+    "rdflib~=6.2.0",
     "certifi~=2023.7.22",
 ]
 
@@ -52,4 +52,4 @@ graphical = [
 ]
 
 [project.urls]
-source = "https://git.rys.one/dtdesign/graph-exploring-tool"
+source = "https://git.rys.one/dtdesign/graph-exploring-tool"