From 890c47a0ac08f5557259618624c1697be1c01650 Mon Sep 17 00:00:00 2001 From: "Leah (ctucx)" Date: Sat, 10 Dec 2022 14:49:08 +0100 Subject: [PATCH] add flake.nix --- .gitignore | 3 ++- flake.lock | 43 ++++++++++++++++++++++++++++++++++++++++ flake.nix | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 5d08de8..58fbe97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ oeffisearch cache data -node_modules \ No newline at end of file +node_modules +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..98f5464 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "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=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7a6a010c3a1d00f8470a5ca888f2f927f1860a19", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ecb1be4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,58 @@ +{ + description = "fast and simple tripplanner"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; + }; + + outputs = { self, nixpkgs, flake-utils }: { + + overlay = final: prev: { + + oeffisearch = ( + let + nimhafas = final.fetchgit { + url = "https://cgit.ctu.cx/nimhafas"; + rev = "1909376e6c33d9b5c1f56139fe53e6866692dde0"; + sha256 = "1xaj3dd8i2izja3zzvy4db7hz3q1qdsp6csf3ww24f523dyxl8rn"; + }; + + in final.nimPackages.buildNimPackage { + name = "oeffisearch"; + src = self; + + buildInputs = [ nimhafas ]; + + nimBinOnly = true; + nimRelease = true; + + postInstall = '' + mkdir $out/share; + cp -r $src/client $out/share/oeffisearch; + ''; + } + ); + + }; + + } // (flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + }; + + in rec { + + packages.default = packages.oeffisearch; + packages.oeffisearch = pkgs.oeffisearch; + + apps.default = { + type = "app"; + program = "${pkgs.oeffisearch}/bin/oeffisearch"; + }; + + } + )); +} \ No newline at end of file