main
1# Adapted from upstream nix/package.nix: builtins.fetchGit is forbidden by the
2# restrict-eval CI check, hence cargoHash; the binary is GPL-3.0-only, hence gpl3Only.
3{
4 lib,
5 rustPlatform,
6 fetchFromGitHub,
7 stdenv,
8 nix-update-script,
9}:
10rustPlatform.buildRustPackage (finalAttrs: {
11 pname = "flyline";
12 version = "1.10.0";
13
14 src = fetchFromGitHub {
15 owner = "HalFrgrd";
16 repo = "flyline";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-nOCawyqUdOkxaqFS11Tp9IaOm7hevWhnLjpxsr5YWCo=";
19 };
20
21 cargoHash = "sha256-4ifX9N1OnIxwNRy4rWBZSqE0460G/dx+N8N4ZHInBpk=";
22
23 patches = [./no-delete-line.patch];
24 doCheck = false;
25
26 # macOS-only: fix Mach-O reproducibility leaks and re-add -undefined
27 # dynamic_lookup, which exporting RUSTFLAGS would otherwise drop.
28 preConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
29 export RUSTFLAGS="--remap-path-prefix=$NIX_BUILD_TOP=/build -C link-arg=-undefined -C link-arg=dynamic_lookup -C link-arg=-Wl,-install_name,@rpath/libflyline.dylib -C link-arg=-Wl,-reproducible''${RUSTFLAGS:+ $RUSTFLAGS}"
30 '';
31
32 passthru.updateScript = nix-update-script {};
33
34 meta = {
35 description = "Bash plugin to replace readline for a modern line editing experience";
36 homepage = "https://github.com/HalFrgrd/flyline";
37 license = lib.licenses.gpl3Only;
38 platforms = lib.platforms.unix;
39 };
40})