Unverified Commit 9a4901a7 authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

listmonk: 3.0.0 -> 5.1.0 (#428070)

parents c0e1785c 77dec607
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -10,10 +10,6 @@ import ./make-test-python.nix (
        services.mailhog.enable = true;
        services.listmonk = {
          enable = true;
          settings = {
            admin_username = "listmonk";
            admin_password = "hunter2";
          };
          database = {
            createLocally = true;
            # https://github.com/knadh/listmonk/blob/174a48f252a146d7e69dab42724e3329dbe25ebe/internal/messenger/email/email.go#L18-L27
@@ -34,11 +30,10 @@ import ./make-test-python.nix (

      start_all()

      basic_auth = "listmonk:hunter2"
      def generate_listmonk_request(type, url, data=None):
         if data is None: data = {}
         json_data = json.dumps(data)
         return f'curl -u "{basic_auth}" -X {type} "http://localhost:9000/api/{url}" -H "Content-Type: application/json; charset=utf-8" --data-raw \'{json_data}\'''
         return f'curl -j -b cookies.txt -X {type} "http://localhost:9000/api/{url}" -H "Content-Type: application/json; charset=utf-8" --data-raw \'{json_data}\'''

      machine.wait_for_unit("mailhog.service")
      machine.wait_for_unit("postgresql.target")
@@ -47,6 +42,7 @@ import ./make-test-python.nix (
      machine.wait_for_open_port(8025)
      machine.wait_for_open_port(9000)
      machine.succeed("[[ -f /var/lib/listmonk/.db_settings_initialized ]]")
      machine.succeed('curl -c cookies.txt -X POST "http://localhost:9000/admin/login" --data email=listmonk@test.local --data username=listmonk --data password=hunter22 --data password2=hunter22')

      assert json.loads(machine.succeed(generate_listmonk_request("GET", 'health')))['data'], 'Health endpoint returned unexpected value'

+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ stdenv.mkDerivation (finalAttrs: {

  offlineCache = fetchYarnDeps {
    yarnLock = "${src}/frontend/yarn.lock";
    hash = "sha256-TdrglyRtb2Q8SFtoiCoDj/zBV2+7DwzIm/Fzlt0ZvSo=";
    hash = "sha256-pOBW3E3Nw+4IEwnNxNjZ+QfR7IF9Zk6MxnD8pFzssro=";
  };

  nativeBuildInputs = [
+24 −11
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  buildGoModule,
  fetchFromGitHub,
  callPackage,
  stuffbin,
  nixosTests,
  nix-update-script,
}:

buildGoModule rec {
buildGoModule (finalAttrs: {
  pname = "listmonk";
  version = "3.0.0";
  version = "5.1.0";

  src = fetchFromGitHub {
    owner = "knadh";
    repo = "listmonk";
    rev = "v${version}";
    hash = "sha256-eNX+2ens+mz2V8ZBHtFFHDVbi64AAiiREElMjh67Dd8=";
    rev = "v${finalAttrs.version}";
    hash = "sha256-rb0/T7I6yLGJBXikOHuXwDdW20nFXpssXfgViHSIIOU=";
  };

  vendorHash = "sha256-XAm2VfX1nHWTuAV2COEn8qrqPNv0xbaWgTYCpjrEfMw=";
  vendorHash = "sha256-bFUWjaaFHB2pnGHBsvUBS2icQkMrB/CfXFa+3vGFFvU=";

  nativeBuildInputs = [
    stuffbin
@@ -27,7 +29,8 @@ buildGoModule rec {
  ldflags = [
    "-s"
    "-w"
    "-X main.version=${version}"
    "-X main.versionString=${finalAttrs.version}"
    "-X \"main.buildString=v${finalAttrs.version} (${stdenv.hostPlatform.system})\""
  ];

  postInstall = ''
@@ -41,9 +44,10 @@ buildGoModule rec {
        "config.toml.sample"
        "schema.sql"
        "queries.sql"
        "permissions.json"
        "static/public:/public"
        "static/email-templates"
        "${passthru.frontend}:/admin"
        "${finalAttrs.passthru.frontend}:/admin"
        "i18n:/i18n"
      ];
    in
@@ -53,16 +57,25 @@ buildGoModule rec {
    '';

  passthru = {
    frontend = callPackage ./frontend.nix { inherit meta version src; };
    frontend = callPackage ./frontend.nix { inherit (finalAttrs) meta version src; };
    tests = { inherit (nixosTests) listmonk; };
    updateScript = nix-update-script {
      extraArgs = [
        "-s"
        "frontend"
      ];
    };
  };

  meta = {
    description = "High performance, self-hosted, newsletter and mailing list manager with a modern dashboard";
    mainProgram = "listmonk";
    homepage = "https://github.com/knadh/listmonk";
    changelog = "https://github.com/knadh/listmonk/releases/tag/v${version}";
    maintainers = with lib.maintainers; [ raitobezarius ];
    changelog = "https://github.com/knadh/listmonk/releases/tag/v${finalAttrs.version}";
    maintainers = with lib.maintainers; [
      raitobezarius
      hougo
    ];
    license = lib.licenses.agpl3Only;
  };
}
})
+0 −33
Original line number Diff line number Diff line
{
  lib,
  buildGoModule,
  fetchFromGitHub,
}:

buildGoModule rec {
  pname = "stuffbin";
  version = "1.1.0";

  vendorHash = null;

  src = fetchFromGitHub {
    owner = "knadh";
    repo = "stuffbin";
    rev = "v${version}";
    hash = "sha256-M72xNh7bKUMLzA+M8bJB++kJ5KCrkboQm1v8BasP3Yo=";
  };

  ldflags = [
    "-s"
    "-w"
    "-X main.version=${version}"
  ];

  meta = {
    description = "Compress and embed static files and assets into Go binaries and access them with a virtual file system in production";
    homepage = "https://github.com/knadh/stuffbin";
    changelog = "https://github.com/knadh/stuffbin/releases/tag/v${version}";
    maintainers = with lib.maintainers; [ raitobezarius ];
    license = lib.licenses.mit;
  };
}