commit e2fe4b309df7f0403e8bc1bb9b13f3587e6630a9
parent 41a0e352cc99ccfb918af7a5316842fb37b1fd4f
Author: Katja (ctucx) <git@ctu.cx>
Date: Wed, 5 Mar 2025 21:10:36 +0100
parent 41a0e352cc99ccfb918af7a5316842fb37b1fd4f
Author: Katja (ctucx) <git@ctu.cx>
Date: Wed, 5 Mar 2025 21:10:36 +0100
flake: refactor, remove `flake-utils` dependency
2 files changed, 30 insertions(+), 47 deletions(-)
diff --git a/flake.lock b/flake.lock @@ -1,20 +1,5 @@ { "nodes": { - "flake-utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1670772952, @@ -33,7 +18,6 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } }
diff --git a/flake.nix b/flake.nix @@ -1,15 +1,33 @@ { + description = "Send kvg-kiel bus departures to mqtt"; - inputs = { - flake-utils.url = "github:numtide/flake-utils"; - nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; - }; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; + + 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 ]; + })); - outputs = { self, nixpkgs, flake-utils }: { + in { - overlay = final: prev: { + packages = forAllSystems (pkgs: { + default = pkgs.departures2mqtt; + departures2mqtt = pkgs.departures2mqtt; + }); + apps = forAllSystems (pkgs: { + default.type = "app"; + default.program = "${pkgs.departures2mqtt}/bin/departures2mqtt"; + }); + + overlays.default = final: prev: { departures2mqtt = ( let nmqtt = final.fetchFromGitHub { @@ -20,35 +38,17 @@ }; in final.nimPackages.buildNimPackage { - name = "departures2mqtt"; - src = self; + name = "departures2mqtt"; + src = inputs.self; buildInputs = [ nmqtt ]; - nimBinOnly = true; - nimRelease = true; + nimBinOnly = true; + nimRelease = true; } ); - }; - } // (flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { - inherit system; - overlays = [ self.overlay ]; - }; - - in rec { - - packages.default = pkgs.departures2mqtt; - packages.departures2mqtt = pkgs.departures2mqtt; - - apps.default = { - type = "app"; - program = "${pkgs.departures2mqtt}/bin/departures2mqtt"; - }; + }; - } - )); -}- \ No newline at end of file +}