-
Notifications
You must be signed in to change notification settings - Fork 8
/
flake.nix
49 lines (47 loc) · 1.42 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{
description = "A s3 client written in Rust";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.dependency-refresh.url = "github:yanganto/dependency-refresh";
outputs = { self, nixpkgs, flake-utils, dependency-refresh }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
dr = dependency-refresh.defaultPackage.${system};
updateDependencyScript = pkgs.writeShellScriptBin "update-dependency" ''
dr ./Cargo.toml
if [ -f "Cargo.toml.old" ]; then
rm Cargo.toml.old
exit 1
fi
'';
publishScript = pkgs.writeShellScriptBin "crate-publish" ''
cargo login $1
cargo publish
'';
in
with pkgs;
rec {
packages.${system}.s3rs = pkgs.rustPlatform.buildRustPackage {
name = "s3rs";
src = self;
cargoSha256 = "sha256-HI0gJGfEZyOyTq52aQVGizyJ221CcZjZNTYW+GUumvw=";
buildInputs = [ openssl ];
nativeBuildInputs = [ pkg-config ];
};
defaultPackage = packages.${system}.s3rs;
devShell = mkShell {
buildInputs = [
openssl
pkg-config
rustup
dr
publishScript
updateDependencyScript
];
};
}
);
}