nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 77 lines 1.6 kB view raw
1{ 2 lib, 3 rustPlatform, 4 fetchFromGitHub, 5 cmake, 6 installShellFiles, 7 pkg-config, 8 zstd, 9 stdenv, 10 darwin, 11 gitMinimal, 12}: 13 14let 15 inherit (darwin) libresolv; 16in 17rustPlatform.buildRustPackage rec { 18 pname = "onefetch"; 19 version = "2.26.1"; 20 21 src = fetchFromGitHub { 22 owner = "o2sh"; 23 repo = "onefetch"; 24 rev = version; 25 hash = "sha256-JT7iQRKOK/2Zh/IDMv1FM1szITeBaaMy+WuXHjpPkfY="; 26 }; 27 28 cargoHash = "sha256-VBbiOA/+SPcIvmhNQ71gUBOIWEWV1A86rljBfdAfhZM="; 29 30 cargoPatches = [ 31 # enable pkg-config feature of zstd 32 ./zstd-pkg-config.patch 33 ]; 34 35 nativeBuildInputs = [ 36 cmake 37 installShellFiles 38 pkg-config 39 ]; 40 41 buildInputs = [ 42 zstd 43 ] 44 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 45 libresolv 46 ]; 47 48 nativeCheckInputs = [ 49 gitMinimal 50 ]; 51 52 preCheck = '' 53 git init 54 git config user.name nixbld 55 git config user.email nixbld@example.com 56 git add . 57 git commit -m test 58 ''; 59 60 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 61 installShellCompletion --cmd onefetch \ 62 --bash <($out/bin/onefetch --generate bash) \ 63 --fish <($out/bin/onefetch --generate fish) \ 64 --zsh <($out/bin/onefetch --generate zsh) 65 ''; 66 67 meta = { 68 description = "Git repository summary on your terminal"; 69 homepage = "https://github.com/o2sh/onefetch"; 70 changelog = "https://github.com/o2sh/onefetch/blob/v${version}/CHANGELOG.md"; 71 license = lib.licenses.mit; 72 maintainers = with lib.maintainers; [ 73 kloenk 74 ]; 75 mainProgram = "onefetch"; 76 }; 77}