on master help sign in
j/flake.nix
62 lines 2.0 kB history raw
1{
2 description = "j — a functional-programming-centered CLI for Jujutsu repositories";
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 flake-utils.url = "github:numtide/flake-utils";
7 };
9 outputs = { self, nixpkgs, flake-utils }:
10 flake-utils.lib.eachDefaultSystem (system:
11 let
12 pkgs = import nixpkgs { inherit system; };
13 in
14 {
15 packages = {
16 j = pkgs.rustPlatform.buildRustPackage {
17 pname = "j";
18 version = "0.1.0";
19 src = ./.;
21 cargoLock = {
22 lockFile = ./Cargo.lock;
23 };
25 nativeBuildInputs = [ pkgs.makeWrapper ];
27 # The test suite shells out to git and expects a writable temp dir
28 # and network-free local remotes; it is not meant to run inside the
29 # Nix build sandbox.
30 doCheck = false;
32 # The reference config.j ships with the binary; `j` looks for it at
33 # <prefix>/share/j/config.j relative to its own executable.
34 postInstall = ''
35 install -Dm644 config.j $out/share/j/config.j
37 # difft is a runtime dependency (§7.10): make sure `j` always
38 # finds difftastic on PATH, without requiring it globally.
39 wrapProgram $out/bin/j \
40 --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.difftastic ]}
41 '';
43 meta = with pkgs.lib; {
44 description = "A functional-programming-centered CLI for Jujutsu repositories";
45 mainProgram = "j";
46 license = licenses.mit;
47 platforms = platforms.unix;
48 };
49 };
51 default = self.packages.${system}.j;
52 };
54 apps = {
55 j = {
56 type = "app";
57 program = "${self.packages.${system}.j}/bin/j";
58 };
59 default = self.apps.${system}.j;
60 };
61 });