ctucx.git: lacrosse2mqtt

Publish data from LaCrosse sensors via MQTT

commit 39dc47fbfe117a1552583b9eb84aa70d2c3fdd4e
parent 0214d1ff753cebddbb39d017e2e2f368dc1a1c54
Author: Katja (ctucx) <git@ctu.cx>
Date: Wed, 5 Mar 2025 21:43:25 +0100

flake: refactor, remove `flake-utils` dependency
2 files changed, 46 insertions(+), 84 deletions(-)
M
flake.lock
|
34
----------------------------------
M
flake.nix
|
96
++++++++++++++++++++++++++++++++++++++-----------------------------------------
diff --git a/flake.lock b/flake.lock
@@ -1,23 +1,5 @@
 {
   "nodes": {
-    "flake-utils": {
-      "inputs": {
-        "systems": "systems"
-      },
-      "locked": {
-        "lastModified": 1710146030,
-        "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
-        "owner": "numtide",
-        "repo": "flake-utils",
-        "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
-        "type": "github"
-      },
-      "original": {
-        "owner": "numtide",
-        "repo": "flake-utils",
-        "type": "github"
-      }
-    },
     "nixpkgs": {
       "locked": {
         "lastModified": 1719426051,

@@ -36,24 +18,8 @@
     },
     "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",
diff --git a/flake.nix b/flake.nix
@@ -1,55 +1,52 @@
 {
-  description = "Exporter for LaCrosse sensors to mqtt, written in nim";
-
-  inputs = {
-    flake-utils.url = "github:numtide/flake-utils";
-    nixpkgs.url     = "github:NixOS/nixpkgs/nixos-24.05";
-  };
-
-  outputs = { self, nixpkgs, flake-utils }: {
-
-    overlay = final: prev: {
-
-      lacrosse2mqtt = (
-        let
-          nmqtt = final.fetchFromGitHub {
-            owner  = "zevv";
-            repo   = "nmqtt";
-            rev    = "v1.0.4";
-            sha256 = "1by0xyqz754dny19lf8rpkg42passnj0rs6rk3jr763m1zr803mc";
-          };
-
-        in final.buildNimPackage {
-          name        = "lacrosse2mqtt";
-          src         = self;
-
-          nimFlags = [
-            "--path:${nmqtt}"
-          ];
 
-          nimRelease  = true;
-        }
-      );
-
-    };
+  description = "Exporter for LaCrosse sensors to mqtt, written in nim";
 
-  } // (flake-utils.lib.eachDefaultSystem (system:
-    let
-      pkgs = import nixpkgs {
-        inherit system;
-        overlays = [ self.overlay ];
+  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
+
+  outputs = inputs: let
+    forAllSystems = function:
+      inputs.nixpkgs.lib.genAttrs [
+        "x86_64-linux"
+        "aarch64-linux"
+        "aarch64-darwin"
+      ] (system: function (import inputs.nixpkgs {
+        system   = system;
+        overlays = [ inputs.self.overlays.default ];
+      }));
+
+  in {
+
+    packages = forAllSystems (pkgs: {
+      default       = pkgs.lacrosse2mqtt;
+      lacrosse2mqtt = pkgs.lacrosse2mqtt;
+    });
+
+    apps = forAllSystems (pkgs: {
+      default.type    = "app";
+      default.program = "${pkgs.lacrosse2mqtt}/bin/lacrosse2mqtt";
+    });
+
+    overlays.default = final: prev: {
+      lacrosse2mqtt = let
+        nmqtt = final.fetchFromGitHub {
+          owner  = "zevv";
+          repo   = "nmqtt";
+          rev    = "v1.0.4";
+          sha256 = "1by0xyqz754dny19lf8rpkg42passnj0rs6rk3jr763m1zr803mc";
+        };
+
+      in final.buildNimPackage {
+        name = "lacrosse2mqtt";
+        src  = inputs.self;
+
+        nimRelease = true;
+        nimFlags   = [
+          "--path:${nmqtt}"
+        ];
       };
+    };
 
-    in rec {
-
-      packages.default       = pkgs.lacrosse2mqtt;
-      packages.lacrosse2mqtt = pkgs.lacrosse2mqtt;
-
-      apps.default = {
-        type = "app";
-        program = "${pkgs.lacrosse2mqtt}/bin/lacrosse2mqtt";
-      };
+  };
 
-    }
-  ));
-}-
\ No newline at end of file
+}