From 7fecb860b9c7ad56e6c0f88ec9d337bb88ba183c Mon Sep 17 00:00:00 2001 From: Angelos Stylianidis Date: Mon, 28 Apr 2025 21:35:49 +0300 Subject: [PATCH] leo-lang: init at 3.2.0 --- .../0001-remove-update-subcommand.patch | 59 +++++++++++++++++++ pkgs/by-name/le/leo-lang/package.nix | 55 +++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100644 pkgs/by-name/le/leo-lang/0001-remove-update-subcommand.patch create mode 100644 pkgs/by-name/le/leo-lang/package.nix diff --git a/pkgs/by-name/le/leo-lang/0001-remove-update-subcommand.patch b/pkgs/by-name/le/leo-lang/0001-remove-update-subcommand.patch new file mode 100644 index 000000000000..bbccb5392c24 --- /dev/null +++ b/pkgs/by-name/le/leo-lang/0001-remove-update-subcommand.patch @@ -0,0 +1,59 @@ +diff --git i/errors/src/errors/cli/cli_errors.rs w/errors/src/errors/cli/cli_errors.rs +index 9e3995743b..89617d451d 100644 +--- i/errors/src/errors/cli/cli_errors.rs ++++ w/errors/src/errors/cli/cli_errors.rs +@@ -328,6 +328,13 @@ create_messages!( + help: None, + } + ++ @backtraced ++ nix_update_build_error { ++ args: (), ++ msg: format!("Self update is not supported on Nix."), ++ help: Some("Package must be updated via Nix".to_string()), ++ } ++ + @backtraced + custom { + args: (msg: impl Display), +diff --git i/leo/cli/commands/update.rs w/leo/cli/commands/update.rs +index 156e3ccce3..83dad3139b 100644 +--- i/leo/cli/commands/update.rs ++++ w/leo/cli/commands/update.rs +@@ -15,7 +15,6 @@ + // along with the Leo library. If not, see . + + use super::*; +-use crate::cli::helpers::updater::Updater; + + /// Update Leo to the latest version + #[derive(Debug, Parser)] +@@ -47,27 +46,6 @@ impl Command for LeoUpdate { + where + Self: Sized, + { +- match self.list { +- true => match Updater::show_available_releases() { +- Ok(output) => tracing::info!("{output}"), +- Err(error) => tracing::info!("Failed to list the available versions of Leo\n{error}\n"), +- }, +- false => { +- let result = Updater::update(!self.quiet, self.name); +- if !self.quiet { +- match result { +- Ok(status) => { +- if status.uptodate() { +- tracing::info!("\nLeo is already on the latest version") +- } else if status.updated() { +- tracing::info!("\nLeo has updated to version {}", status.version()) +- } +- } +- Err(e) => tracing::info!("\nFailed to update Leo to the latest version\n{e}\n"), +- } +- } +- } +- } +- Ok(()) ++ return Err(CliError::nix_update_build_error().into()); + } + } diff --git a/pkgs/by-name/le/leo-lang/package.nix b/pkgs/by-name/le/leo-lang/package.nix new file mode 100644 index 000000000000..a6e900ac47b4 --- /dev/null +++ b/pkgs/by-name/le/leo-lang/package.nix @@ -0,0 +1,55 @@ +{ + stdenv, + lib, + fetchFromGitHub, + rustPlatform, + pkg-config, + openssl, + nix-update-script, + curl, + versionCheckHook, +}: + +rustPlatform.buildRustPackage (finalAttrs: { + pname = "leo-lang"; + version = "3.4.0"; + + src = fetchFromGitHub { + owner = "ProvableHQ"; + repo = "leo"; + tag = "v${finalAttrs.version}"; + hash = "sha256-VDhD2devY2GPa2vGbZ0hSg1tIc6WJ5pgyDM6RsSb12U="; + fetchSubmodules = true; + }; + + patches = [ ./0001-remove-update-subcommand.patch ]; + + cargoHash = "sha256-PI2DviLVtlNFohRSOkGx7SQd2sh4jMKZKzw7RMKNw+o="; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ openssl ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ curl ]; + + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgram = "${placeholder "out"}/bin/leo"; + versionCheckProgramArg = "--version"; + doInstallCheck = true; + + passthru.updateScript = nix-update-script { }; + + checkFlags = [ + "--skip=cli::cli::tests::nested_local_dependency_run_test" + "--skip=cli::cli::tests::relaxed_shadowing_run_test" + "--skip=cli::cli::tests::relaxed_struct_shadowing_run_test" + ]; + + meta = { + description = "Functional, statically-typed programming language built for writing private applications"; + homepage = "https://github.com/ProvableHQ/leo"; + changelog = "https://github.com/ProvableHQ/leo/releases/tag/v${finalAttrs.version}"; + maintainers = with lib.maintainers; [ anstylian ]; + mainProgram = "leo"; + license = lib.licenses.gpl3Only; + platforms = lib.platforms.unix; + }; +})