ctucx.git: mobile-coverage-map

a map that allows comparison of various mobile networks

commit fbb1d8bd4521f0f08b6a690a56f6d38c86966f21
parent 30a69ef5132b8d53b68bde9149e8e8f43414745f
Author: Katja (ctucx) <git@ctu.cx>
Date: Wed, 5 Mar 2025 20:32:15 +0100

flake: refactor, remove `flake-utils` dependency
2 files changed, 35 insertions(+), 50 deletions(-)
M
flake.lock
|
22
+++-------------------
M
flake.nix
|
63
++++++++++++++++++++++++++++++++-------------------------------
diff --git a/flake.lock b/flake.lock
@@ -1,27 +1,12 @@
 {
   "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": 1670543317,
-        "narHash": "sha256-4mMR56rtxKr+Gwz399jFr4i76SQZxsLWxxyfQlPXRm0=",
+        "lastModified": 1688392541,
+        "narHash": "sha256-lHrKvEkCPTUO+7tPfjIcb7Trk6k31rz18vkyqmkeJfY=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "7a6a010c3a1d00f8470a5ca888f2f927f1860a19",
+        "rev": "ea4c80b39be4c09702b0cb3b42eab59e2ba4f24b",
         "type": "github"
       },
       "original": {

@@ -33,7 +18,6 @@
     },
     "root": {
       "inputs": {
-        "flake-utils": "flake-utils",
         "nixpkgs": "nixpkgs"
       }
     }
diff --git a/flake.nix b/flake.nix
@@ -1,18 +1,41 @@
 {
+
   description = "";
 
-  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.mobile-coverage-map;
+      mobile-coverage-map = pkgs.mobile-coverage-map;
+    });
 
+    devShells = forAllSystems (pkgs: {
+      default = pkgs.mkShell {
+        nativeBuildInputs = [ pkgs.yarn pkgs.yarn2nix pkgs.php ];
+        shellHook = ''
+          export NODE_OPTIONS=--openssl-legacy-provider
+          alias serve="yarn build && php -S localhost:8080"
+        '';
+      };
+    });
+
+    overlays.default = final: prev: {
       mobile-coverage-map = final.mkYarnPackage rec {
         name = "mobile-coverage-map";
-        src  = self;
+        src  = inputs.self;
 
         packageJSON = ./package.json;
         yarnLock    = ./yarn.lock;

@@ -29,29 +52,8 @@
           cp -r deps/mobile-coverage-map/{index.html,bundle.js} $out
         '';
       };
-
     };
 
-  } // (flake-utils.lib.eachDefaultSystem (system:
-    let
-      pkgs = import nixpkgs {
-        inherit system;
-        overlays = [ self.overlay ];
-      };
-
-    in rec {
-
-      packages.default             = pkgs.mobile-coverage-map;
-      packages.mobile-coverage-map = pkgs.mobile-coverage-map;
-
-      devShells.default = pkgs.mkShell {
-        nativeBuildInputs = [ pkgs.yarn pkgs.yarn2nix pkgs.php ];
-        shellHook = ''
-          export NODE_OPTIONS=--openssl-legacy-provider
-          alias serve="yarn build && php -S localhost:8080"
-        '';
-      };
+  };
 
-    }
-  ));
-}-
\ No newline at end of file
+}