smtp4dev: use finalAttrs pattern, fix updateScript, adopt (#411238)

This commit is contained in:
Felix Bargfeldt 2025-05-30 07:22:03 +02:00 committed by GitHub
commit fa1c082c37
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 19 deletions

View file

@ -7,27 +7,20 @@
npmHooks,
fetchNpmDeps,
dotnetCorePackages,
nix-update-script,
}:
let
buildDotnetModule (finalAttrs: {
pname = "smtp4dev";
version = "3.8.6";
src = fetchFromGitHub {
owner = "rnwood";
repo = "smtp4dev";
tag = version;
tag = finalAttrs.version;
hash = "sha256-k4nerh4cVVcFQF7a4Wvcfhefa3SstEOASk+0soN0n9k=";
};
npmRoot = "Rnwood.Smtp4dev/ClientApp";
patches = [ ./smtp4dev-npm-packages.patch ];
in
buildDotnetModule {
inherit
version
src
npmRoot
patches
;
pname = "smtp4dev";
nativeBuildInputs = [
nodejs
@ -36,10 +29,12 @@ buildDotnetModule {
stdenv.cc # c compiler is needed for compiling npm-deps
];
npmRoot = "Rnwood.Smtp4dev/ClientApp";
npmDeps = fetchNpmDeps {
inherit src patches;
inherit (finalAttrs) src patches;
hash = "sha256-Uj0EnnsA+QHq5KHF2B93OG8rwxYrV6sEgMTbd43ttCA=";
postPatch = "cd ${npmRoot}";
postPatch = "cd ${finalAttrs.npmRoot}";
};
dotnet-sdk = dotnetCorePackages.sdk_8_0;
@ -52,9 +47,7 @@ buildDotnetModule {
mv $out/bin/Rnwood.Smtp4dev $out/bin/smtp4dev
'';
passthru.updateScript = nix-update-script {
extraArgs = [ "--version-regex=^(\\d+\\.\\d+\\.\\d+)$" ];
};
passthru.updateScript = ./update.sh;
meta = {
description = "Fake smtp email server for development and testing";
@ -64,7 +57,8 @@ buildDotnetModule {
maintainers = with lib.maintainers; [
rucadi
jchw
defelo
];
platforms = lib.platforms.unix;
};
}
})

View file

@ -0,0 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq nix-update
version=$(curl ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} -sfL "https://api.github.com/repos/rnwood/smtp4dev/releases/latest" | jq -r .tag_name)
nix-update --version="$version" smtp4dev