Skip to content

Commit 4f5dddd

Browse files
committed
build: add nix flake
1 parent f4266e2 commit 4f5dddd

File tree

2 files changed

+160
-0
lines changed

2 files changed

+160
-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: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
description = "jj-ryu - Stacked PRs CLI for Jujutsu";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
rust-overlay.url = "github:oxalica/rust-overlay";
7+
flake-utils.url = "github:numtide/flake-utils";
8+
};
9+
10+
outputs =
11+
{
12+
self,
13+
nixpkgs,
14+
rust-overlay,
15+
flake-utils,
16+
}:
17+
flake-utils.lib.eachDefaultSystem (
18+
system:
19+
let
20+
overlays = [ (import rust-overlay) ];
21+
pkgs = import nixpkgs { inherit system overlays; };
22+
lib = pkgs.lib;
23+
24+
rust = pkgs.rust-bin.stable."1.89.0".default;
25+
rustPlatform = pkgs.makeRustPlatform {
26+
cargo = rust;
27+
rustc = rust;
28+
};
29+
30+
ryu = rustPlatform.buildRustPackage {
31+
pname = "jj-ryu";
32+
version = "0.0.1-alpha.9";
33+
src = ./.;
34+
cargoLock = {
35+
lockFile = ./Cargo.lock;
36+
};
37+
nativeBuildInputs = [
38+
pkgs.pkg-config
39+
pkgs.jujutsu
40+
pkgs.git
41+
];
42+
buildInputs = lib.optionals pkgs.stdenv.isDarwin [ pkgs.libiconv ];
43+
doCheck = true;
44+
};
45+
in
46+
{
47+
packages = {
48+
default = ryu;
49+
ryu = ryu;
50+
};
51+
52+
apps.default = flake-utils.lib.mkApp { drv = ryu; };
53+
apps.ryu = flake-utils.lib.mkApp { drv = ryu; };
54+
55+
devShells.default = pkgs.mkShell {
56+
inputsFrom = [ ryu ];
57+
packages = [
58+
rust
59+
pkgs.pkg-config
60+
];
61+
};
62+
}
63+
);
64+
}

0 commit comments

Comments
 (0)