Skip to content

Commit 520f6be

Browse files
authored
Merge pull request #5 from foundationdb-rs/split_override
Add FDB 7.{2,3}
2 parents a03ecfe + df287ef commit 520f6be

File tree

12 files changed

+186
-30
lines changed

12 files changed

+186
-30
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ on:
55
- main
66
pull_request:
77
jobs:
8-
tests:
8+
examples:
99
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
example: ["simple", "simple-71", "simple-72", "simple-73", "override"]
1013
steps:
11-
- uses: actions/checkout@v2.4.0
12-
- uses: cachix/install-nix-action@v15
13-
- run: nix flake check
14-
- run: nix flake check ./examples/simple/
14+
- uses: actions/checkout@v3
15+
- uses: cachix/install-nix-action@v22
16+
- run: cd examples/${{ matrix.example }} && nix develop --command "ls"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
result
2-
examples/simple/flake.lock

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ A Nix overlay to download elements for FoundationDB.
33

44
## Packages provided
55

6-
* libfdb_c
6+
* libfdb_c.x86_64.so
7+
* 7.1
8+
* 7.2
9+
* 7.3
710

811
## How-to use it
912

10-
Please see the [example folder](./examples/).
13+
Please see the [example folder](./examples/) to see examples on how to use and override the flake.

examples/override/flake.nix

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
4+
flake-utils.url = github:numtide/flake-utils;
5+
fdb-overlay.url = path:./../..;
6+
};
7+
8+
outputs = { nixpkgs, flake-utils, fdb-overlay, ... }:
9+
flake-utils.lib.eachSystem [ "x86_64-linux" ] (
10+
system:
11+
let
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
overlays = [ fdb-overlay.overlays.default ];
15+
};
16+
libfdb7149 = pkgs.libfdb71.overrideAttrs (finalAttrs: previousAttrs: {
17+
version = "7.1.49";
18+
sha256 = "7464326281f8d3d6bad2e4fe85f494e84cd54a842fbed237c1fcbe3f1387f9d1";
19+
});
20+
in
21+
{
22+
devShell = pkgs.mkShell {
23+
nativeBuildInputs = [ libfdb7149 ];
24+
FDB_LIB_PATH = "${libfdb7149}/include";
25+
};
26+
}
27+
);
28+
}

examples/simple-71/flake.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
4+
flake-utils.url = github:numtide/flake-utils;
5+
fdb-overlay.url = path:./../..;
6+
};
7+
8+
outputs = { nixpkgs, flake-utils, fdb-overlay, ... }:
9+
flake-utils.lib.eachSystem [ "x86_64-linux" ] (
10+
system:
11+
let
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
overlays = [ fdb-overlay.overlays.default ];
15+
};
16+
in
17+
{
18+
devShells.default = pkgs.mkShell {
19+
nativeBuildInputs = with pkgs; [ libfdb71 ];
20+
FDB_LIB_PATH = "${pkgs.libfdb71}/include";
21+
};
22+
}
23+
);
24+
}

examples/simple-72/flake.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
4+
flake-utils.url = github:numtide/flake-utils;
5+
fdb-overlay.url = path:./../..;
6+
};
7+
8+
outputs = { nixpkgs, flake-utils, fdb-overlay, ... }:
9+
flake-utils.lib.eachSystem [ "x86_64-linux" ] (
10+
system:
11+
let
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
overlays = [ fdb-overlay.overlays.default ];
15+
};
16+
in
17+
{
18+
devShells.default = pkgs.mkShell {
19+
nativeBuildInputs = with pkgs; [ libfdb72 ];
20+
FDB_LIB_PATH = "${pkgs.libfdb72}/include";
21+
};
22+
}
23+
);
24+
}

examples/simple-73/flake.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
4+
flake-utils.url = github:numtide/flake-utils;
5+
fdb-overlay.url = path:./../..;
6+
};
7+
8+
outputs = { nixpkgs, flake-utils, fdb-overlay, ... }:
9+
flake-utils.lib.eachSystem [ "x86_64-linux" ] (
10+
system:
11+
let
12+
pkgs = import nixpkgs {
13+
inherit system;
14+
overlays = [ fdb-overlay.overlays.default ];
15+
};
16+
in
17+
{
18+
devShells.default = pkgs.mkShell {
19+
nativeBuildInputs = with pkgs; [ libfdb73 ];
20+
FDB_LIB_PATH = "${pkgs.libfdb73}/include";
21+
};
22+
}
23+
);
24+
}

examples/simple/flake.nix

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,21 @@
22
inputs = {
33
nixpkgs.url = github:nixos/nixpkgs/nixos-unstable;
44
flake-utils.url = github:numtide/flake-utils;
5-
rust-overlay.url = github:oxalica/rust-overlay;
65
fdb-overlay.url = path:./../..;
76
};
87

9-
outputs = { nixpkgs, flake-utils, rust-overlay, fdb-overlay, ... }:
8+
outputs = { nixpkgs, flake-utils, fdb-overlay, ... }:
109
flake-utils.lib.eachSystem [ "x86_64-linux" ] (
1110
system:
1211
let
1312
pkgs = import nixpkgs {
1413
inherit system;
15-
overlays = [ rust-overlay.overlay fdb-overlay.overlays.default ];
14+
overlays = [ fdb-overlay.overlays.default ];
1615
};
1716
in
1817
{
19-
devShell = pkgs.mkShell {
20-
nativeBuildInputs = with pkgs; [
21-
rust-bin.stable.latest.default
22-
pkg-config
23-
libfdb
24-
];
18+
devShells.default = pkgs.mkShell {
19+
nativeBuildInputs = with pkgs; [ libfdb ];
2520
FDB_LIB_PATH = "${pkgs.libfdb}/include";
2621
};
2722
}

flake.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212
in
1313
{
1414
overlays.default = final: prev: {
15-
libfdb = final.callPackage ./pkgs/libfdb { };
15+
# Keep default to 7.1 to avoid breaking current user
16+
libfdb = final.callPackage ./pkgs/libfdb/libfdb_71.nix { };
17+
libfdb71 = final.callPackage ./pkgs/libfdb/libfdb_71.nix { };
18+
libfdb72 = final.callPackage ./pkgs/libfdb/libfdb_72.nix { };
19+
libfdb73 = final.callPackage ./pkgs/libfdb/libfdb_73.nix { };
1620
};
1721
};
1822
}
Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
1-
# This derivation just extracts out `libfdb_c_X.Y.Z.so` from GitHub
2-
# and patches the library using `autoPatchelfHook`.
3-
#
4-
# In this derivation we don't care where `libfdb_c_X.Y.Z.so` will
5-
# eventually get placed in the file system.
61
{ stdenv
72
, autoPatchelfHook
83
, fetchurl
94
, lib
105
}:
116

12-
stdenv.mkDerivation rec {
7+
stdenv.mkDerivation (finalAttrs: {
138
pname = "libfdb_c";
149
version = "7.1.19";
1510
sha256 = "51b2bc6d3e60d22ed0e393ed814026d1e529acc6a3a644405788f2749f4dd54d";
1611

1712
src = fetchurl {
18-
url = "https://github.com/apple/foundationdb/releases/download/${version}/libfdb_c.x86_64.so";
19-
inherit sha256;
13+
url = "https://github.com/apple/foundationdb/releases/download/${finalAttrs.version}/libfdb_c.x86_64.so";
14+
sha256 = "${finalAttrs.sha256}";
2015
};
2116

22-
nativeBuildInputs = [
23-
autoPatchelfHook
24-
];
17+
nativeBuildInputs = [ autoPatchelfHook ];
2518

2619
unpackPhase = ":";
2720

@@ -32,4 +25,4 @@ stdenv.mkDerivation rec {
3225
chmod 555 $out/include/libfdb_c.so
3326
''
3427
];
35-
}
28+
})

pkgs/libfdb/libfdb_72.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{ stdenv
2+
, autoPatchelfHook
3+
, fetchurl
4+
, lib
5+
, xz
6+
, zlib
7+
}:
8+
9+
stdenv.mkDerivation (finalAttrs: {
10+
pname = "libfdb_c";
11+
version = "7.2.8";
12+
sha256 = "425c68f254333a8b12cc99a0d0df02992b5beb6db0302ba9819e317d7bcc813d";
13+
14+
src = fetchurl {
15+
url = "https://github.com/apple/foundationdb/releases/download/${finalAttrs.version}/libfdb_c.x86_64.so";
16+
sha256 = "${finalAttrs.sha256}";
17+
};
18+
19+
nativeBuildInputs = [ autoPatchelfHook xz zlib ];
20+
21+
unpackPhase = ":";
22+
23+
installPhase = [
24+
''
25+
mkdir -p $out/include
26+
cp $src $out/include/libfdb_c.so
27+
chmod 555 $out/include/libfdb_c.so
28+
''
29+
];
30+
})

pkgs/libfdb/libfdb_73.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{ stdenv
2+
, autoPatchelfHook
3+
, fetchurl
4+
, lib
5+
, xz
6+
, zlib
7+
}:
8+
9+
stdenv.mkDerivation (finalAttrs: {
10+
pname = "libfdb_c";
11+
version = "7.3.27";
12+
sha256 = "9b8db407ae5898d03e882a39839d5b3873fb41081f08b8e87bd067562d20f36b";
13+
14+
src = fetchurl {
15+
url = "https://github.com/apple/foundationdb/releases/download/${finalAttrs.version}/libfdb_c.x86_64.so";
16+
sha256 = "${finalAttrs.sha256}";
17+
};
18+
19+
nativeBuildInputs = [ autoPatchelfHook xz zlib ];
20+
21+
unpackPhase = ":";
22+
23+
installPhase = [
24+
''
25+
mkdir -p $out/include
26+
cp $src $out/include/libfdb_c.so
27+
chmod 555 $out/include/libfdb_c.so
28+
''
29+
];
30+
})

0 commit comments

Comments
 (0)