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

kryptor: .NET 6 -> 8 #363629

Merged
merged 6 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 30 additions & 8 deletions pkgs/by-name/kr/kryptor/deps.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 21 additions & 9 deletions pkgs/by-name/kr/kryptor/package.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{ lib
, buildDotnetModule
, fetchFromGitHub
, dotnetCorePackages
{
lib,
buildDotnetModule,
fetchFromGitHub,
dotnetCorePackages,
versionCheckHook,
}:

buildDotnetModule rec {
Expand All @@ -11,25 +13,35 @@ buildDotnetModule rec {
src = fetchFromGitHub {
owner = "samuel-lucas6";
repo = "Kryptor";
rev = "v${version}";
tag = "v${version}";
hash = "sha256-BxUmDzmfvRelQDHb5uLcQ2YPL7ClxZNFGm/gQoDK8t8=";
};

dotnet-sdk = dotnetCorePackages.sdk_6_0;
dotnet-sdk = dotnetCorePackages.sdk_8_0;
projectFile = "src/Kryptor.sln";
nugetDeps = ./deps.nix;

executables = ["kryptor"];
executables = [ "kryptor" ];

dotnetFlags = ["-p:IncludeNativeLibrariesForSelfExtract=true"];
dotnetFlags = [ "-p:TargetFramework=net8.0" ];

doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];

passthru = {
updateScript = ./update.sh;
};

meta = {
changelog = "https://github.com/samuel-lucas6/Kryptor/releases/tag/v${version}";
description = "Simple, modern, and secure encryption and signing tool that aims to be a better version of age and Minisign";
getchoo marked this conversation as resolved.
Show resolved Hide resolved
homepage = "https://github.com/samuel-lucas6/Kryptor";
license = lib.licenses.gpl3Only;
mainProgram = "kryptor";
maintainers = with lib.maintainers; [ arthsmn ];
maintainers = with lib.maintainers; [
arthsmn
gepbird
];
platforms = lib.platforms.all;
};
}
6 changes: 6 additions & 0 deletions pkgs/by-name/kr/kryptor/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env nix-shell
#!nix-shell --pure -i bash -p bash nix nix-update git cacert
set -euo pipefail

nix-update kryptor
Copy link
Contributor

Choose a reason for hiding this comment

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

If you like, you could use "$UPDATE_NIX_ATTR_PATH" here, and on the next line.

Some packages even do something like:

attr="${UPDATE_NIX_ATTR_PATH:-kryptor}"

to keep the script working when called directly.

It's only helpful if someone makes an overridden version of the package at another attribute path, so it's up to you whether you think it's worth it.

Copy link
Contributor Author

@gepbird gepbird Dec 10, 2024

Choose a reason for hiding this comment

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

I think it's cleaner as it is now, even if it won't work for overridden packages, thanks for the suggestion though.

Bit off topic but are there any plans for passthru.updateScript = nix-update-script { } supporting dotnet and updating deps.nix?
It works with for example pnpm packages, where it updates the hash inside pnpmDeps = pnpm.fetchDeps { hash = "..."; ... }

Also currently it's nice that each nuget package from deps.nix (and soon deps.json) is a seperate derivation and can be built independently, but regarding to #327064, what do you think about something like nugetDeps = dotnet_sdk.fetchNugetDeps { hash = "..."; ... };? A similar movement is also happening for rust packages.

Copy link
Contributor

Choose a reason for hiding this comment

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

what do you think about something like nugetDeps = dotnet_sdk.fetchNugetDeps { hash = "..."; ... };?

The problem is that restore isn't deterministic. There's no lock-file in most packages, and even if there was, the dotnet lockfile mechanism has some problems.

It's a good idea though. Maybe we'll get there eventually.

$(nix-build . -A kryptor.fetch-deps --no-out-link)
Loading