Skip to content

Commit 9e5cce7

Browse files
committed
build(nix): add dev environment flake
Basic flake to enable development under nixos. Not really flushed out, but in a good enough state to add it. Probably needs improvement in the future. Refs: #409
1 parent cb04a8f commit 9e5cce7

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ Cargo.lock
33
/.vscode
44
/.idea
55
/tmp
6-
expand.rs
6+
/.direnv
7+
expand.rs

flake.lock

Lines changed: 48 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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
description = "ext-php-rs dev environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6+
rust-overlay = {
7+
url = "github:oxalica/rust-overlay";
8+
inputs = {
9+
nixpkgs.follows = "nixpkgs";
10+
};
11+
};
12+
};
13+
14+
outputs =
15+
{ nixpkgs, rust-overlay, ... }:
16+
let
17+
system = "x86_64-linux";
18+
overlays = [ (import rust-overlay) ];
19+
pkgs = import nixpkgs { inherit system overlays; };
20+
php-dev = pkgs.php.unwrapped.dev;
21+
in
22+
{
23+
devShells.${system} = {
24+
default = pkgs.mkShell {
25+
buildInputs = with pkgs; [
26+
php
27+
php-dev
28+
libclang.lib
29+
clang
30+
];
31+
32+
nativeBuildInputs = [ pkgs.rust-bin.stable.latest.default ];
33+
34+
shellHook = ''
35+
export LIBCLANG_PATH="''$LIBCLANG_PATH ${pkgs.libclang.lib}/lib"
36+
'';
37+
};
38+
};
39+
};
40+
}

0 commit comments

Comments
 (0)