diff --git a/pkgs/by-name/sp/spade/package.nix b/pkgs/by-name/sp/spade/package.nix index 678bcfc7235d863..49b0443fbb4de2b 100644 --- a/pkgs/by-name/sp/spade/package.nix +++ b/pkgs/by-name/sp/spade/package.nix @@ -7,6 +7,7 @@ writeScript, git, python312, + swim, }: rustPlatform.buildRustPackage rec { @@ -44,6 +45,10 @@ rustPlatform.buildRustPackage rec { buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ python312 ]; env.NIX_CFLAGS_LINK = lib.optionalString stdenv.hostPlatform.isDarwin "-L${python312}/lib/python3.12/config-3.12-darwin -lpython3.12"; + passthru.tests = { + inherit swim; + }; + meta = with lib; { description = "Better hardware description language"; homepage = "https://gitlab.com/spade-lang/spade"; diff --git a/pkgs/by-name/sw/swim/package.nix b/pkgs/by-name/sw/swim/package.nix new file mode 100644 index 000000000000000..56e943da211d5ce --- /dev/null +++ b/pkgs/by-name/sw/swim/package.nix @@ -0,0 +1,72 @@ +{ + lib, + rustPlatform, + fetchFromGitLab, + pkg-config, + openssl, + spade, + stdenv, + darwin, + git, + _experimental-update-script-combinators, + nix-update-script, +}: + +rustPlatform.buildRustPackage rec { + pname = "swim"; + version = "0.10.0"; + + src = fetchFromGitLab { + owner = "spade-lang"; + repo = "swim"; + rev = "v${version}"; + hash = "sha256-Yuq1eYjxNnmrydzPyx+UWJJlZnC9sIEP3ZEleKmkzIM="; + }; + + cargoHash = "sha256-3WcMXvxlY0I7HnR+GTxHPAN+1HQsQLymjGFMM6q18xQ="; + + preConfigure = '' + # de-vendor spade git submodule + test "$version" = "${spade.version}" || { + >&2 echo ERROR: version mismatch between spade and swim! + false + } + ln -s ${spade.src} runt/spade + ''; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = + [ + openssl + ] + ++ lib.optionals stdenv.isDarwin [ + darwin.apple_sdk.frameworks.Security + darwin.apple_sdk.frameworks.SystemConfiguration + ]; + + nativeCheckInputs = [ git ]; + + checkFlags = [ + # tries to clone https://gitlab.com/spade-lang/swim-templates + "--skip=init::tests::git_init_then_swim_init_works" + "--skip=init::tests::init_board_correctly_sets_project_name" + "--skip=init::tests::init_board_creates_required_files" + "--skip=plugin::test::deny_changes_to_plugins::edits_are_denied" + "--skip=plugin::test::deny_changes_to_plugins::restores_work" + ]; + + passthru.updateScript = _experimental-update-script-combinators.sequence [ + (nix-update-script { extraArgs = [ "spade" "--commit" "--use-update-script" "--update-script-args" "--argstr skip-prompt true" ]; }) + (nix-update-script { extraArgs = [ "swim" ]; }) + ]; + + meta = { + description = "Build tool for spade"; + homepage = "https://gitlab.com/spade-lang/swim"; + changelog = "https://gitlab.com/spade-lang/swim/-/blob/${src.rev}/CHANGELOG.md"; + license = lib.licenses.eupl12; + maintainers = with lib.maintainers; [ pbsds ]; + mainProgram = "swim"; + }; +}