ctucx.git: trainsearch

web based trip-planner, fork of https://cyberchaos.dev/yuka/trainsearch

commit f3287c3363ba079d0a5554bb3f0e539d58bb6ffd
parent d7adac8555233041d62ac42343e9ac6a2e6e4bc6
Author: Katja (ctucx) <git@ctu.cx>
Date: Tue, 21 Jan 2025 13:42:09 +0100

add flake
2 files changed, 118 insertions(+), 0 deletions(-)
A
flake.lock
|
61
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
flake.nix
|
57
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/flake.lock b/flake.lock
@@ -0,0 +1,61 @@
+{
+  "nodes": {
+    "flake-utils": {
+      "inputs": {
+        "systems": "systems"
+      },
+      "locked": {
+        "lastModified": 1731533236,
+        "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1737299813,
+        "narHash": "sha256-Qw2PwmkXDK8sPQ5YQ/y/icbQ+TYgbxfjhgnkNJyT1X8=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "107d5ef05c0b1119749e381451389eded30fb0d5",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-24.11",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "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",
+  "version": 7
+}
diff --git a/flake.nix b/flake.nix
@@ -0,0 +1,56 @@
+{
+
+  description = "trainsearch";
+
+  inputs = {
+    flake-utils.url = "github:numtide/flake-utils";
+    nixpkgs.url     = "github:NixOS/nixpkgs/nixos-24.11";
+  };
+
+  outputs = { self, nixpkgs, flake-utils }: {
+
+    overlay = final: prev: {
+
+      trainsearch = final.buildNpmPackage {
+        name = "trainsearch";
+        src  = self;
+
+        npmDepsHash = "sha256-igkZCnk4i+0Mrb2vFxYMhwY2Y89bEbvfTJXnJW9xJck=";
+        makeCacheWritable = true;
+
+        npmBuildScript = "build";
+
+        installPhase = ''
+          cp -r dist $out
+        '';
+      };
+
+    };
+
+  } // (flake-utils.lib.eachDefaultSystem (system:
+    let
+      pkgs = import nixpkgs {
+        inherit system;
+        overlays = [ self.overlay ];
+      };
+
+    in rec {
+
+      packages.default     = pkgs.trainsearch;
+      packages.trainsearch = pkgs.trainsearch;
+
+      devShells.default = pkgs.mkShell {
+        nativeBuildInputs = with pkgs; [
+          nodejs
+          nodePackages.webpack
+          nodePackages.webpack-cli
+          nodePackages.webpack-dev-server
+        ];
+        shellHook = ''
+          export NODE_OPTIONS=--openssl-legacy-provider
+        '';
+      };
+
+    }
+  ));
+}+
\ No newline at end of file