Browse Source

Add flake

asonix 1 year ago
parent
commit
afd4105d0f
6 changed files with 287 additions and 169 deletions
  1. 3 0
      .gitignore
  2. 179 168
      Cargo.lock
  3. 1 1
      Cargo.toml
  4. 43 0
      flake.lock
  5. 34 0
      flake.nix
  6. 27 0
      relay.nix

+ 3 - 0
.gitignore

@@ -1,3 +1,6 @@
 /target
 /artifacts
 /sled
+/.direnv
+/.envrc
+/result

File diff suppressed because it is too large
+ 179 - 168
Cargo.lock


+ 1 - 1
Cargo.toml

@@ -41,7 +41,7 @@ console-subscriber = { version = "0.1", optional = true }
 dashmap = "5.1.0"
 dotenv = "0.15.0"
 futures-util = "0.3.17"
-lru = "0.9.0"
+lru = "0.10.0"
 metrics = "0.20.1"
 metrics-exporter-prometheus = { version = "0.11.0", default-features = false, features = [
   "http-listener",

+ 43 - 0
flake.lock

@@ -0,0 +1,43 @@
+{
+  "nodes": {
+    "flake-utils": {
+      "locked": {
+        "lastModified": 1678901627,
+        "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "nixpkgs": {
+      "locked": {
+        "lastModified": 1679437018,
+        "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-unstable",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "root": {
+      "inputs": {
+        "flake-utils": "flake-utils",
+        "nixpkgs": "nixpkgs"
+      }
+    }
+  },
+  "root": "root",
+  "version": 7
+}

+ 34 - 0
flake.nix

@@ -0,0 +1,34 @@
+{
+  description = "relay";
+
+  inputs = {
+    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+    flake-utils.url = "github:numtide/flake-utils";
+  };
+
+  outputs = { self, nixpkgs, flake-utils }:
+    flake-utils.lib.eachDefaultSystem (system:
+      let
+        pkgs = import nixpkgs {
+          inherit system;
+        };
+      in
+      {
+        packages = rec {
+          relay = pkgs.callPackage ./relay.nix { };
+
+          default = relay;
+        };
+
+        apps = rec {
+          dev = flake-utils.lib.mkApp { drv = self.packages.${system}.pict-rs-proxy; };
+          default = dev;
+        };
+
+        devShell = with pkgs; mkShell {
+          nativeBuildInputs = [ cargo cargo-outdated cargo-zigbuild clippy gcc protobuf rust-analyzer rustc rustfmt ];
+
+          RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
+        };
+      });
+}

+ 27 - 0
relay.nix

@@ -0,0 +1,27 @@
+{ lib
+, makeWrapper
+, nixosTests
+, protobuf
+, rustPlatform
+, stdenv
+}:
+
+rustPlatform.buildRustPackage {
+  pname = "relay";
+  version = "0.4.0-beta.1";
+  src = ./.;
+  cargoSha256 = "Kbicf3alz/QZJppBH4+dRhIf4extIONwBYnGF3TtqJ4=";
+
+  PROTOC = "${protobuf}/bin/protoc";
+  PROTOC_INCLUDE = "${protobuf}/include";
+
+  nativeBuildInputs = [ ];
+
+  passthru.tests = { inherit (nixosTests) relay; };
+
+  meta = with lib; {
+    description = "A simple image hosting service";
+    homepage = "https://git.asonix.dog/asonix/relay";
+    license = with licenses; [ agpl3Plus ];
+  };
+}

Some files were not shown because too many files changed in this diff