aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Audron <audron@cocaine.farm>2022-06-07 12:28:18 +0200
committerMaximilian Manz <maximilian.manz@de.clara.net>2022-06-20 11:33:04 +0200
commit0fe38f6b06118107f9fbe89ff5dab6a287f76f7b (patch)
tree8df36a36cd75db8600c6d63a0a6fc167829c20f6
parentprocess sync and update in parallel (diff)
add nix flake
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock12
-rw-r--r--Cargo.toml8
-rw-r--r--flake.lock100
-rw-r--r--flake.nix103
5 files changed, 217 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index ea8c4bf..d787b70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/target
+/result
diff --git a/Cargo.lock b/Cargo.lock
index 75c0bc5..413b800 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -463,9 +463,9 @@ checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
[[package]]
name = "git2"
-version = "0.13.25"
+version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6"
+checksum = "d0155506aab710a86160ddb504a480d2964d7ab5b9e62419be69e0032bc5931c"
dependencies = [
"bitflags",
"libc",
@@ -793,9 +793,9 @@ checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f"
[[package]]
name = "libgit2-sys"
-version = "0.12.26+1.3.0"
+version = "0.13.4+1.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494"
+checksum = "d0fa6563431ede25f5cc7f6d803c6afbc1c5d3ad3d4925d12c882bf2b526f5d1"
dependencies = [
"cc",
"libc",
@@ -961,9 +961,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
[[package]]
name = "openssl-src"
-version = "111.18.0+1.1.1n"
+version = "111.20.0+1.1.1o"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7897a926e1e8d00219127dc020130eca4292e5ca666dd592480d72c3eca2ff6c"
+checksum = "92892c4f87d56e376e469ace79f1128fdaded07646ddf73aa0be4706ff712dec"
dependencies = [
"cc",
]
diff --git a/Cargo.toml b/Cargo.toml
index 88e490c..63610d4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ once_cell = "1"
gitlab = "0.1408"
graphql_client = "0.10"
-git2 = { version = "0.13", features = ["vendored-libgit2", "vendored-openssl"] }
+git2 = { version = "0.14" }
walkdir = "2"
@@ -41,3 +41,9 @@ xdg = "2"
# terminal coloring
ansi_term = "0.12"
+
+[features]
+default = []
+
+vendored-openssl = [ "git2/vendored-openssl" ]
+vendored-libgit2 = [ "git2/vendored-libgit2" ]
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..ab2cf07
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,100 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "locked": {
+ "lastModified": 1637014545,
+ "narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "naersk": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1653413650,
+ "narHash": "sha256-wojDHjb+eU80MPH+3HQaK0liUy8EgR95rvmCl24i58Y=",
+ "owner": "nmattia",
+ "repo": "naersk",
+ "rev": "69daaceebe12c070cd5ae69ba38f277bbf033695",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nmattia",
+ "repo": "naersk",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1654595132,
+ "narHash": "sha256-Te8d7qAUzTumXbby9sthEuTBpFprikjiyphyNV3GdhI=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "ab7173f6db30fcffe01a23d85138449fa990cabf",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "naersk": "naersk",
+ "nixpkgs": "nixpkgs",
+ "rust-overlay": "rust-overlay",
+ "utils": "utils"
+ }
+ },
+ "rust-overlay": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1654396786,
+ "narHash": "sha256-stM8eWx51WDwptsByQFwmAvPBT1N0XUhcGaMq5Nx7T8=",
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "rev": "2d306305e1a52d3e18bf10a5d88f3eca99033ba8",
+ "type": "github"
+ },
+ "original": {
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "type": "github"
+ }
+ },
+ "utils": {
+ "locked": {
+ "lastModified": 1653893745,
+ "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..851c72c
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,103 @@
+{
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs";
+ rust-overlay = {
+ url = "github:oxalica/rust-overlay";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ naersk = {
+ url = "github:nmattia/naersk";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, rust-overlay, utils, naersk }:
+ with nixpkgs.lib;
+ recursiveUpdate (utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+
+ rust = rust-overlay.packages."${system}".rust;
+
+ naersk-lib = naersk.lib."${system}".override {
+ cargo = rust;
+ rustc = rust;
+ };
+ in rec {
+ packages.default = packages.gtree;
+
+ packages.gtree = naersk-lib.buildPackage {
+ pname = "gtree";
+ root = ./.;
+
+ nativeBuildInputs = [ pkgs.perl ];
+
+ cargoBuildOptions = prev:
+ prev ++ [ "--features=vendored-libgit2,vendored-openssl" ];
+ };
+
+ apps.default = utils.lib.mkApp { drv = packages.default; };
+
+ devShell = pkgs.mkShell { nativeBuildInputs = [ rust pkgs.perl ]; };
+ })) (utils.lib.eachSystem [
+ utils.lib.system.x86_64-linux
+ utils.lib.system.aarch64-linux
+ ] (system:
+ let
+ pkgs = nixpkgs.legacyPackages.${system};
+
+ staticInputs = with pkgs; [
+ pkgsStatic.stdenv.cc
+ pkgsStatic.openssl.dev
+ rust
+ perl
+ ];
+
+ target =
+ "${elemAt (strings.splitString "-" system) 0}-unknown-linux-musl";
+
+ rust = rust-overlay.packages."${system}".rust.override {
+ extensions = [ "rust-src" ];
+ targets = [ target ];
+ };
+
+ naersk-lib = naersk.lib."${system}".override {
+ cargo = rust;
+ rustc = rust;
+ };
+ in rec {
+ # `nix build`
+ packages.gtreeStatic = naersk-lib.buildPackage {
+ pname = "gtree";
+ root = ./.;
+
+ nativeBuildInputs = staticInputs;
+
+ CARGO_BUILD_TARGET = target;
+ CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS =
+ "-C target-feature=+crt-static";
+ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS =
+ "-C target-feature=+crt-static";
+
+ OPENSSL_STATIC = true;
+ OPENSSL_DIR = "${pkgs.pkgsStatic.openssl}";
+ OPENSSL_LIB_DIR = "${pkgs.pkgsStatic.openssl.out}/lib";
+ OPENSSL_INCLUDE_DIR = "${pkgs.pkgsStatic.openssl.dev}/include";
+ };
+
+ devShell = pkgs.mkShell {
+ nativeBuildInputs = staticInputs;
+
+ shellHook = ''
+ export CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=+crt-static"
+ export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=+crt-static"
+
+ export OPENSSL_STATIC=1
+ export OPENSSL_DIR="${pkgs.pkgsStatic.openssl}"
+ export OPENSSL_LIB_DIR="${pkgs.pkgsStatic.openssl.out}/lib"
+ export OPENSSL_INCLUDE_DIR="${pkgs.pkgsStatic.openssl.dev}/include"
+ '';
+ };
+ }));
+}