ctucx.git: nixfiles

ctucx' nixfiles

commit 2b452bf69321c34be5540d5d484ce8ae76c749d2
parent 6249b9920aabd295071fe7806c82930191db2d12
Author: Leah (ctucx) <leah@ctu.cx>
Date: Thu, 9 Jun 2022 21:20:57 +0200

pkgs: add smartied
2 files changed, 33 insertions(+), 26 deletions(-)
M
machines/lollo/smarthome/smartied.nix
|
27
+--------------------------
A
pkgs/smartied.nix
|
32
++++++++++++++++++++++++++++++++
diff --git a/machines/lollo/smarthome/smartied.nix b/machines/lollo/smarthome/smartied.nix
@@ -3,32 +3,7 @@
 let
   secrets = import ../../../secrets;
 
-  ws = pkgs.fetchFromGitHub {
-    owner  = "treeform";
-    repo   = "ws";
-    rev    = "0.4.3";
-    sha256 = "03dyd36y5r8zbvcwih3nsvd7fa13vm6hdz7v0wglgv7mjpwpfik5";
-  };
-
-  nmqtt = pkgs.fetchFromGitHub {
-    owner  = "zevv";
-    repo   = "nmqtt";
-    rev    = "v1.0.4";
-    sha256 = "1by0xyqz754dny19lf8rpkg42passnj0rs6rk3jr763m1zr803mc";
-  };
-
-  smartied = pkgs.nimPackages.buildNimPackage {
-    pname       = "smartied";
-    version     = "0.1.0";
-    nimBinOnly  = true;
-    buildInputs = [ pkgs.libmodbus ws nmqtt ];
-
-    src = pkgs.fetchgit {
-      url    = "https://cgit.ctu.cx/smartied";
-      rev    = "6b0b4163a30caf95468f1bf724b53b9e02344b29";
-      sha256 = "0zv91hxhxsqs1qrijlkqkr81w4p14qrn33xh0kj4sxiplgxfz78v";
-    };
-  };
+  smartied = pkgs.callPackage ../../../pkgs/smartied.nix {};
 
   kvg-station-departures  = pkgs.nimPackages.buildNimPackage {
     pname       = "kvg-kiel-station-departures";
diff --git a/pkgs/smartied.nix b/pkgs/smartied.nix
@@ -0,0 +1,32 @@
+{ nimPackages, fetchgit, fetchFromGitHub, libmodbus }:
+
+let
+
+  ws = fetchFromGitHub {
+    owner  = "treeform";
+    repo   = "ws";
+    rev    = "0.4.3";
+    sha256 = "03dyd36y5r8zbvcwih3nsvd7fa13vm6hdz7v0wglgv7mjpwpfik5";
+  };
+
+  nmqtt = fetchFromGitHub {
+    owner  = "zevv";
+    repo   = "nmqtt";
+    rev    = "v1.0.4";
+    sha256 = "1by0xyqz754dny19lf8rpkg42passnj0rs6rk3jr763m1zr803mc";
+  };
+
+in nimPackages.buildNimPackage {
+
+  name       = "smartied";
+
+  nimBinOnly  = true;
+  buildInputs = [ libmodbus ws nmqtt ];
+
+  src = fetchgit {
+    url    = "https://cgit.ctu.cx/smartied";
+    rev    = "c2ad1433709b263f30c266a35a6d78240b6f8a95";
+    sha256 = "0zv91hxhxsqs1qrijlkqkr81w4p14qrn33xh0kj4sxiplgxfz78v";
+  };
+
+}