Unverified Commit c585cf68 authored by Arne Keller's avatar Arne Keller Committed by GitHub
Browse files

leo-lang: init at 3.4.0 (#378105)

parents 5f045c63 7fecb860
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1903,6 +1903,12 @@
    matrix = "@schuelermine:matrix.org";
    keys = [ { fingerprint = "CDBF ECA8 36FE E340 1CEB  58FF BA34 EE1A BA3A 0955"; } ];
  }; # currently on hiatus, please do not ping until this notice is removed (or if it’s been like two years)
  anstylian = {
    email = "agathangelos.stylianidis@gmail.com";
    github = "anstylian";
    githubId = 11269403;
    name = "Angelos Stylinidis";
  };
  anthonyroussel = {
    email = "anthony@roussel.dev";
    github = "anthonyroussel";
+59 −0
Original line number Diff line number Diff line
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 <https://www.gnu.org/licenses/>.
 
 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());
     }
 }
+55 −0
Original line number Diff line number Diff line
{
  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;
  };
})