-
Notifications
You must be signed in to change notification settings - Fork 36
/
flake.nix
56 lines (54 loc) · 1.74 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
50
51
52
53
54
55
56
{
inputs = {
fenix.url = "github:nix-community/fenix";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, fenix, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
rustToolchains = fenix.packages.${system}.complete;
rdeps = with pkgs; [
curl
fontconfig
fribidi
harfbuzz
libjpeg
libpng
libtiff
libxml2
openssl
pkg-config
];
# Build r-polars from source
rpolars = pkgs.rPackages.buildRPackage {
name = "polars";
src = self;
patchPhase = ''
patchShebangs ./configure
'';
cargoDeps = pkgs.rustPlatform.importCargoLock {
lockFile = "${self}/${rpolars.cargoRoot}/Cargo.lock";
outputHashes = {};
allowBuiltinFetchGit = true;
};
cargoRoot = "src/rust";
nativeBuildInputs = with pkgs;
[ cmake rPackages.codetools rustPlatform.cargoSetupHook ]
++ pkgs.lib.singleton rustToolchains.toolchain;
};
# Create R development environment with r-polars and other useful libraries
rvenv = pkgs.rWrapper.override {
packages = with pkgs.rPackages; [ devtools languageserver rextendr ];
};
in {
packages.default = rpolars;
devShells.default = pkgs.mkShell {
buildInputs = rdeps;
inputsFrom = pkgs.lib.singleton rpolars;
packages = pkgs.lib.singleton rvenv;
LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath rdeps;
};
});
}