Unverified Commit 7c52e7a0 authored by Yifei Sun's avatar Yifei Sun
Browse files

caddy: 2.8.4 -> 2.9.0

parent 07fd500b
Loading
Loading
Loading
Loading
+46 −35
Original line number Diff line number Diff line
{ lib
, buildGoModule
, callPackage
, fetchFromGitHub
, nixosTests
, caddy
, testers
, installShellFiles
, stdenv
{
  lib,
  buildGoModule,
  callPackage,
  fetchFromGitHub,
  nixosTests,
  caddy,
  testers,
  installShellFiles,
  stdenv,
}:
let
  version = "2.8.4";
  version = "2.9.0";
  dist = fetchFromGitHub {
    owner = "caddyserver";
    repo = "dist";
    rev = "v${version}";
    hash = "sha256-O4s7PhSUTXoNEIi+zYASx8AgClMC5rs7se863G6w+l0=";
    tag = "v${version}";
    hash = "sha256-3QcpmPUhZZ8oN/CUbCh/A1D0B59o1RxWPyMbA/WoRcU=";
  };
in
buildGoModule {
@@ -24,11 +25,11 @@ buildGoModule {
  src = fetchFromGitHub {
    owner = "caddyserver";
    repo = "caddy";
    rev = "v${version}";
    hash = "sha256-CBfyqtWp3gYsYwaIxbfXO3AYaBiM7LutLC7uZgYXfkQ=";
    tag = "v${version}";
    hash = "sha256-ea1Cch0LOGVGO9CVvS61EHVwJule4HZRizpQYP1QA2w=";
  };

  vendorHash = "sha256-1Api8bBZJ1/oYk4ZGIiwWCSraLzK9L+hsKXkFtk6iVM=";
  vendorHash = "sha256-HEQCNOv4vO5QsbmoT0acRoaJ4sB0dzF1zcR38778nBI=";

  subPackages = [ "cmd/caddy" ];

@@ -39,18 +40,24 @@ buildGoModule {
  ];

  # matches upstream since v2.8.0
  tags = [ "nobadger" ];
  tags = [
    "nobadger"
    "nomysql"
    "nopgx"
  ];

  nativeBuildInputs = [ installShellFiles ];

  postInstall = ''
  postInstall =
    ''
      install -Dm644 ${dist}/init/caddy.service ${dist}/init/caddy-api.service -t $out/lib/systemd/system

      substituteInPlace $out/lib/systemd/system/caddy.service \
        --replace-fail "/usr/bin/caddy" "$out/bin/caddy"
      substituteInPlace $out/lib/systemd/system/caddy-api.service \
        --replace-fail "/usr/bin/caddy" "$out/bin/caddy"
  '' + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    ''
    + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
      # Generating man pages and completions fail on cross-compilation
      # https://github.com/NixOS/nixpkgs/issues/308283

@@ -74,11 +81,15 @@ buildGoModule {
    withPlugins = callPackage ./plugins.nix { inherit caddy; };
  };

  meta = with lib; {
  meta = {
    homepage = "https://caddyserver.com";
    description = "Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS";
    license = licenses.asl20;
    license = lib.licenses.asl20;
    mainProgram = "caddy";
    maintainers = with maintainers; [ Br1ght0ne techknowlogick ];
    maintainers = with lib.maintainers; [
      Br1ght0ne
      stepbrobd
      techknowlogick
    ];
  };
}