Skip to content

Commit c957459

Browse files
committed
build: add nix flake
1 parent 627b16d commit c957459

File tree

2 files changed

+149
-0
lines changed

2 files changed

+149
-0
lines changed

flake.lock

Lines changed: 96 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
description = "Nix flake for rv, a reproducible package manager for R, written in rust";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
rust-overlay.url = "github:oxalica/rust-overlay";
8+
};
9+
10+
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
11+
flake-utils.lib.eachDefaultSystem (system:
12+
let
13+
overlays = [ (import rust-overlay) ];
14+
pkgs = import nixpkgs {
15+
inherit system overlays;
16+
};
17+
18+
rustToolchain = pkgs.rust-bin.stable.latest.default;
19+
20+
rvPackage = pkgs.rustPlatform.buildRustPackage {
21+
pname = "rv";
22+
version = with builtins; (fromTOML (readFile ./Cargo.toml)).package.version;
23+
24+
src = ./.;
25+
26+
cargoLock = {
27+
lockFile = ./Cargo.lock;
28+
};
29+
30+
buildFeatures = [ "cli" ];
31+
32+
nativeBuildInputs = [ pkgs.pkg-config ];
33+
buildInputs = [ pkgs.zlib ];
34+
35+
meta = with pkgs.lib; {
36+
description = "A reproducible, fast and declarative package manager for R";
37+
homepage = "https://github.com/A2-ai/rv";
38+
license = licenses.mit;
39+
maintainers = [ ];
40+
mainProgram = "rv";
41+
};
42+
};
43+
in {
44+
packages.default = rvPackage;
45+
46+
devShells.default = pkgs.mkShell {
47+
buildInputs = [
48+
rustToolchain
49+
# add any tool useful for a dev shell
50+
];
51+
};
52+
});
53+
}

0 commit comments

Comments
 (0)