Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kcl: init at 0.8.5 #302285

Closed
wants to merge 1 commit into from
Closed

kcl: init at 0.8.5 #302285

wants to merge 1 commit into from

Conversation

Peefy
Copy link
Contributor

@Peefy Peefy commented Apr 7, 2024

Description of changes

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Copy link
Contributor

@msanft msanft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adjust commit & PR title according to the conventions

pname = "kcl";
version = "0.8.4";

src = if stdenv.isDarwin && stdenv.isAarch64 then fetchurl {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When having this many sources, it might be advisable to create a sources.json and then read the URL endings and hashes from there. For reference, see e.g. the tabnine package.

sha256 = "9a86ef943ca7df1a21801fb91be8092d04835d1d555c146da89c1149d33a4c42";
} else throw "Unsupported platform";

unpackPhase = "tar -xzf $src";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
unpackPhase = "tar -xzf $src";

Unpacking TAR files should happen by default: https://nixos.org/manual/nixpkgs/stable/#tar-files

Comment on lines +23 to +26
installPhase = ''
mkdir -p $out/bin
cp kcl $out/bin/
'';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
installPhase = ''
mkdir -p $out/bin
cp kcl $out/bin/
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp kcl $out/bin/
runHook postInstall
'';

@Peefy Peefy changed the title Create package.nix for KCL programming language kcl: init at 0.8.4 Apr 7, 2024
@mrene
Copy link
Contributor

mrene commented Apr 7, 2024

Since the source is available on github, why not build from source directly?

nix-init almost generates a working package by default

Generated package

{ lib
, buildGoModule
, fetchFromGitHub
}:

buildGoModule rec {
  pname = "kcl";
  version = "0.8.5";

  src = fetchFromGitHub {
    owner = "kcl-lang";
    repo = "cli";
    rev = "v${version}";
    hash = "sha256-ZjEMgQukhBGY3LWqsGmLj3lKfLtNNaQugQs0cSLMb80=";
  };

  vendorHash = "sha256-jmqKMB85HxAlwH7FVjHrLCZQYuAJrguRfzIz1yMypjw=";

  ldflags = [
    "-X=kcl-lang.io/cli/pkg/version.version=${version}"
  ];

  subPackages = [ "cmd/kcl" ];

  meta = with lib; {
    description = "The KCL Command Line Interface (CLI";
    homepage = "https://github.com/kcl-lang/cli";
    license = licenses.asl20;
    maintainers = with maintainers; [ ];
    mainProgram = "cli";
  };
}

@Peefy Peefy changed the title kcl: init at 0.8.4 kcl: init at 0.8.5 Apr 8, 2024
@Peefy Peefy closed this Apr 8, 2024
@Peefy
Copy link
Contributor Author

Peefy commented Apr 8, 2024

Thank you @msanft and @mrene I've opened another PR #302488 PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants