push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
{
lib,
stdenv,
buildGoModule,
nodejs,
python3,
libtool,
cctools,
npmHooks,
fetchFromGitHub,
fetchNpmDeps,
testers,
mailpit,
nixosTests,
}:
let
source = import ./source.nix;
inherit (source)
version
vendorHash
;
src = fetchFromGitHub {
owner = "axllent";
repo = "mailpit";
rev = "v${version}";
hash = source.hash;
};
libtool' = if stdenv.hostPlatform.isDarwin then cctools else libtool;
# Separate derivation, because if we mix this in buildGoModule, the separate
# go-modules build inherits specific attributes and fails. Getting that to
# work is hackier than just splitting the build.
ui = stdenv.mkDerivation {
pname = "mailpit-ui";
inherit src version;
npmDeps = fetchNpmDeps {
inherit src;
hash = source.npmDepsHash;
};
nativeBuildInputs = [
nodejs
python3
libtool'
npmHooks.npmConfigHook
];
buildPhase = ''
npm run package
'';
installPhase = ''
mv server/ui/dist $out
'';
};
in
buildGoModule {
pname = "mailpit";
inherit src version vendorHash;
env.CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X github.com/axllent/mailpit/config.Version=${version}"
];
preBuild = ''
cp -r ${ui} server/ui/dist
'';
passthru.tests = {
inherit (nixosTests) mailpit;
version = testers.testVersion {
package = mailpit;
command = "mailpit version --no-release-check";
};
};
passthru.updateScript = {
supportedFeatures = [ "commit" ];
command = ./update.sh;
};
meta = with lib; {
description = "Email and SMTP testing tool with API for developers";
homepage = "https://github.com/axllent/mailpit";
changelog = "https://github.com/axllent/mailpit/releases/tag/v${version}";
maintainers = with maintainers; [ stephank ];
license = licenses.mit;
mainProgram = "mailpit";
};
}

View File

@@ -0,0 +1,6 @@
{
version = "1.27.9";
hash = "sha256-COPNi7AoHYyY8pfTSJYKxUG2Mh08czBjiD0VzLu0V6I=";
npmDepsHash = "sha256-QEjfCHqE8r41fgylNRY5Gk0tYQSYuFxHrHT6/7vtLxg=";
vendorHash = "sha256-Nmupbw8ouxsc7/CEAWz4Cj0cyEMP4WFPZ+P5ornf1AI=";
}

View File

@@ -0,0 +1,73 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p nix coreutils curl jq nix-prefetch-git prefetch-npm-deps
set -euo pipefail
OWNER=axllent
REPO=mailpit
TARGET_TAG="$(curl -L -s ${GITHUB_TOKEN:+-u ":${GITHUB_TOKEN}"} "https://api.github.com/repos/$OWNER/$REPO/releases/latest" | jq -r '.tag_name')"
TARGET_VERSION="$(echo "$TARGET_TAG" | sed -e 's/^v//')"
if [[ "$UPDATE_NIX_OLD_VERSION" == "$TARGET_VERSION" ]]; then
# mailpit is up-to-date
if [[ -n "$UPDATE_NIX_ATTR_PATH" ]]; then
echo "[{}]";
fi
exit 0
fi
extractVendorHash() {
original="${1?original hash missing}"
result="$(nix-build -A mailpit.goModules 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true)"
[ -z "$result" ] && { echo "$original"; } || { echo "$result"; }
}
TMP="$(mktemp -d)"
trap 'rm -rf "$TMP"' exit
NIXPKGS_MAILPIT_PATH=$(cd $(dirname ${BASH_SOURCE[0]}); pwd -P)/
SOURCE_NIX="$NIXPKGS_MAILPIT_PATH/source.nix"
PREFETCH_JSON=$TMP/prefetch.json
nix-prefetch-git --rev "$TARGET_TAG" --url "https://github.com/$OWNER/$REPO" > "$PREFETCH_JSON"
PREFETCH_HASH="$(jq '.hash' -r < "$PREFETCH_JSON")"
PREFETCH_PATH="$(jq '.path' -r < "$PREFETCH_JSON")"
NPM_DEPS_HASH="$(prefetch-npm-deps $PREFETCH_PATH/package-lock.json)"
FAKE_HASH="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
cat > $SOURCE_NIX <<-EOF
{
version = "$TARGET_VERSION";
hash = "$PREFETCH_HASH";
npmDepsHash = "$NPM_DEPS_HASH";
vendorHash = "$FAKE_HASH";
}
EOF
GO_HASH="$(nix-instantiate --eval -A mailpit.vendorHash | tr -d '"')"
VENDOR_HASH=$(extractVendorHash "$GO_HASH")
cat > $SOURCE_NIX <<-EOF
{
version = "$TARGET_VERSION";
hash = "$PREFETCH_HASH";
npmDepsHash = "$NPM_DEPS_HASH";
vendorHash = "$VENDOR_HASH";
}
EOF
if [[ -z "$UPDATE_NIX_ATTR_PATH" ]]; then
exit 0
fi
cat <<-EOF
[{
"attrPath": "$UPDATE_NIX_ATTR_PATH",
"oldVersion": "$UPDATE_NIX_OLD_VERSION",
"newVersion": "$TARGET_VERSION",
"files": ["$SOURCE_NIX"]
}]
EOF