nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 75 lines 2.4 kB view raw
1{ 2 lib, 3 stdenv, 4 rustPlatform, 5 fetchFromGitHub, 6 versionCheckHook, 7 nix-update-script, 8 icu, 9}: 10rustPlatform.buildRustPackage (finalAttrs: { 11 pname = "msedit"; 12 version = "1.2.1"; 13 14 src = fetchFromGitHub { 15 owner = "microsoft"; 16 repo = "edit"; 17 tag = "v${finalAttrs.version}"; 18 hash = "sha256-Sb73awgdajBKKW0QIpmKF6g9mIIS/1f0a6D/jQulnUM="; 19 }; 20 21 cargoHash = "sha256-U8U70nzTmpY6r8J661EJ4CGjx6vWrGovu5m25dvz5sY="; 22 23 # Requires nightly features 24 env = { 25 RUSTC_BOOTSTRAP = 1; 26 # Without -headerpad, the following error occurs on x86_64-darwin 27 # error: install_name_tool: changing install names or rpaths can't be redone for: ... because larger updated load commands do not fit (the program must be relinked, and you may need to use -headerpad or -headerpad_max_install_names) 28 NIX_LDFLAGS = toString ( 29 lib.optionals (with stdenv.hostPlatform; isDarwin && isx86_64) [ 30 "-headerpad_max_install_names" 31 ] 32 ); 33 }; 34 35 buildInputs = [ 36 icu 37 ]; 38 39 # https://github.com/microsoft/edit/blob/f8bea2be191d00baa2a4551817541ea3f8c5b03e/src/icu.rs#L834 40 # Required for Ctrl+F searching to work 41 postFixup = 42 let 43 rpathAppend = lib.makeLibraryPath [ icu ]; 44 in 45 lib.optionalString stdenv.hostPlatform.isElf '' 46 patchelf $out/bin/edit \ 47 --add-rpath ${rpathAppend} 48 '' 49 + lib.optionalString stdenv.hostPlatform.isDarwin '' 50 ${stdenv.cc.targetPrefix}install_name_tool -add_rpath ${rpathAppend} $out/bin/edit 51 ''; 52 53 # Disabled for now, microsoft/edit#194 54 doInstallCheck = false; 55 nativeInstallCheckInputs = [ versionCheckHook ]; 56 versionCheckProgram = "${placeholder "out"}/bin/edit"; 57 58 passthru.updateScript = nix-update-script { }; 59 60 meta = { 61 description = "Simple editor for simple needs"; 62 longDescription = '' 63 This editor pays homage to the classic MS-DOS Editor, 64 but with a modern interface and input controls similar to VS Code. 65 The goal is to provide an accessible editor that even users largely 66 unfamiliar with terminals can easily use. 67 ''; 68 mainProgram = "edit"; 69 homepage = "https://github.com/microsoft/edit"; 70 changelog = "https://github.com/microsoft/edit/releases/tag/v${finalAttrs.version}"; 71 license = lib.licenses.mit; 72 maintainers = with lib.maintainers; [ RossSmyth ]; 73 platforms = lib.platforms.all; 74 }; 75})