ctucx.git: nixfiles

ctucx' nixfiles

commit 9279328c97fdbf88d8c12d78b3f978e3e0933730
parent 9ff42ff21967990f839f635f45fd4c3c27c23c0b
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 13 Sep 2022 19:56:08 +0200

machines/lollo/smarthome/mbusd: move package to pkgs
3 files changed, 19 insertions(+), 17 deletions(-)
M
machines/lollo/smarthome/mbusd.nix
|
19
++-----------------
M
pkgs/default.nix
|
2
++
A
pkgs/mbusd.nix
|
15
+++++++++++++++
diff --git a/machines/lollo/smarthome/mbusd.nix b/machines/lollo/smarthome/mbusd.nix
@@ -1,21 +1,6 @@
 { pkgs, ... }:
 
-let
-  mbusd = pkgs.stdenv.mkDerivation rec {
-    pname = "mbusd";
-    version = "0.5.0";
-
-    src = pkgs.fetchFromGitHub {
-      owner = "3cky";
-      repo = pname;
-      rev = "v${version}";
-      sha256 = "1mvrwr02vcsgf9lc9bq4mhr0s6ww5z7ml7lwpyrl4axpz59i4l9s";
-    };
-
-    nativeBuildInputs = with pkgs; [ cmake pkgconfig ];
-  };
-
-in {
+{
 
   services.udev.extraRules = ''SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{serial}=="1337", SYMLINK+="modbus0"'';
 

@@ -27,7 +12,7 @@ in {
     onFailure = [ "notify-failure@%i.service" ];
 
     serviceConfig = {
-      ExecStart      = "${mbusd}/bin/mbusd -d -v2 -L - -p /dev/modbus0 -s 9600 -m 8n1 -C 32 -N 3 -R 100 -W 500 -T 60";
+      ExecStart      = "${pkgs.mbusd}/bin/mbusd -d -v2 -L - -p /dev/modbus0 -s 9600 -m 8n1 -C 32 -N 3 -R 100 -W 500 -T 60";
       Restart        = "on-failure";
       RestartSec     = "1";
       StandardOutput = "journal";
diff --git a/pkgs/default.nix b/pkgs/default.nix
@@ -33,6 +33,8 @@
       gotosocial             = final.callPackage ./gotosocial {};
       AirSane                = final.callPackage ./AirSane {};
       cinny                  = final.callPackage ./cinny.nix {};
+      mbusd                  = final.callPackage ./mbusd.nix {};
+
       ctucx-gallery          = final.callPackage ./gallery.nix {};
       oeffi-web              = final.callPackage ./oeffi-web.nix {};
       oeffisearch            = final.callPackage ./oeffisearch.nix {};
diff --git a/pkgs/mbusd.nix b/pkgs/mbusd.nix
@@ -0,0 +1,15 @@
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, ... }:
+
+stdenv.mkDerivation rec {
+  pname = "mbusd";
+  version = "0.5.0";
+
+  src = fetchFromGitHub {
+    owner = "3cky";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "1mvrwr02vcsgf9lc9bq4mhr0s6ww5z7ml7lwpyrl4axpz59i4l9s";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig ];
+}