Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 78 lines 2.1 kB view raw
1{ 2 lib, 3 rustPlatform, 4 fetchFromGitLab, 5 stdenv, 6 _experimental-update-script-combinators, 7 nix-update-script, 8 nix-update, 9 writeScript, 10 git, 11 pkg-config, 12 openssl, 13 python312, 14 swim, 15}: 16 17rustPlatform.buildRustPackage rec { 18 pname = "spade"; 19 version = "0.13.0"; 20 21 src = fetchFromGitLab { 22 owner = "spade-lang"; 23 repo = "spade"; 24 rev = "v${version}"; 25 hash = "sha256-eWeEbwIm+PC0XHmvV3xZqUIcA01arnalbGFtPTUP9tg="; 26 # only needed for vatch, which contains test data 27 fetchSubmodules = true; 28 }; 29 30 cargoHash = "sha256-YMUeHr9eUOYIcO7PbaFgZa0Ib10GMF+jT10ZCSG7PNo="; 31 32 # TODO: somehow respect https://nixos.org/manual/nixpkgs/stable/#var-passthru-updateScript-commit 33 passthru.updateScript = _experimental-update-script-combinators.sequence [ 34 # rust + gitlab + fetchgit is a rare combo 35 (writeScript "update-spade" '' 36 VERSION="$( 37 ${lib.getExe git} ls-remote --tags --sort -version:refname ${lib.escapeShellArg src.gitRepoUrl} \ 38 | cut -f2 | grep ^refs/tags/v | cut -d/ -f3- | cut -c2- \ 39 | sort --version-sort --reverse | head -n1 40 )" 41 exec ${lib.getExe nix-update} spade --version "$VERSION" "$@" --commit 42 '') 43 (nix-update-script { 44 extraArgs = [ 45 "swim" 46 "--commit" 47 ]; 48 }) 49 ]; 50 51 nativeBuildInputs = [ 52 pkg-config 53 ]; 54 55 buildInputs = [ 56 openssl 57 ] 58 ++ lib.optionals stdenv.hostPlatform.isDarwin [ python312 ]; 59 env.NIX_CFLAGS_LINK = lib.optionalString stdenv.hostPlatform.isDarwin "-L${python312}/lib/python3.12/config-3.12-darwin -lpython3.12"; 60 61 passthru.tests = { 62 inherit swim; 63 }; 64 65 meta = with lib; { 66 description = "Better hardware description language"; 67 homepage = "https://gitlab.com/spade-lang/spade"; 68 changelog = "https://gitlab.com/spade-lang/spade/-/blob/${src.rev}/CHANGELOG.md"; 69 # compiler is eupl12, spade-lang stdlib is both asl20 and mit 70 license = with licenses; [ 71 eupl12 72 asl20 73 mit 74 ]; 75 maintainers = with maintainers; [ pbsds ]; 76 mainProgram = "spade"; 77 }; 78}