i take back what i said, it should be relevant now, though
Some checks failed
/ nix fmt (push) Has been cancelled
Some checks failed
/ nix fmt (push) Has been cancelled
This commit is contained in:
parent
321f72f070
commit
abd6c558a2
43 changed files with 929 additions and 978 deletions
|
@ -8,8 +8,7 @@
|
|||
caddy,
|
||||
testers,
|
||||
stdenv,
|
||||
}:
|
||||
let
|
||||
}: let
|
||||
attrsToModule = map (plugin: plugin.repo);
|
||||
attrsToVersionedModule = map (
|
||||
{
|
||||
|
@ -17,7 +16,7 @@ let
|
|||
version,
|
||||
...
|
||||
}:
|
||||
lib.escapeShellArg "${repo}@${version}"
|
||||
lib.escapeShellArg "${repo}@${version}"
|
||||
);
|
||||
|
||||
pname = "caddy";
|
||||
|
@ -37,7 +36,7 @@ let
|
|||
hash = "sha256-CBfyqtWp3gYsYwaIxbfXO3AYaBiM7LutLC7uZgYXfkQ=";
|
||||
};
|
||||
|
||||
subPackages = [ "cmd/caddy" ];
|
||||
subPackages = ["cmd/caddy"];
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
|
@ -46,7 +45,7 @@ let
|
|||
];
|
||||
|
||||
# matches upstream since v2.8.0
|
||||
tags = [ "nobadger" ];
|
||||
tags = ["nobadger"];
|
||||
|
||||
nativeBuildInputs = [
|
||||
gnused
|
||||
|
@ -87,72 +86,71 @@ let
|
|||
];
|
||||
};
|
||||
in
|
||||
buildGoModule {
|
||||
inherit
|
||||
pname
|
||||
version
|
||||
src
|
||||
subPackages
|
||||
ldflags
|
||||
tags
|
||||
nativeBuildInputs
|
||||
postInstall
|
||||
meta
|
||||
;
|
||||
buildGoModule {
|
||||
inherit
|
||||
pname
|
||||
version
|
||||
src
|
||||
subPackages
|
||||
ldflags
|
||||
tags
|
||||
nativeBuildInputs
|
||||
postInstall
|
||||
meta
|
||||
;
|
||||
|
||||
vendorHash = "sha256-1Api8bBZJ1/oYk4ZGIiwWCSraLzK9L+hsKXkFtk6iVM=";
|
||||
vendorHash = "sha256-1Api8bBZJ1/oYk4ZGIiwWCSraLzK9L+hsKXkFtk6iVM=";
|
||||
|
||||
passthru = {
|
||||
withPlugins =
|
||||
{
|
||||
passthru = {
|
||||
withPlugins = {
|
||||
caddyModules,
|
||||
vendorHash ? lib.fakeHash,
|
||||
}:
|
||||
buildGoModule {
|
||||
pname = "${caddy.pname}-with-plugins";
|
||||
buildGoModule {
|
||||
pname = "${caddy.pname}-with-plugins";
|
||||
|
||||
inherit
|
||||
version
|
||||
src
|
||||
subPackages
|
||||
ldflags
|
||||
tags
|
||||
nativeBuildInputs
|
||||
postInstall
|
||||
meta
|
||||
;
|
||||
inherit
|
||||
version
|
||||
src
|
||||
subPackages
|
||||
ldflags
|
||||
tags
|
||||
nativeBuildInputs
|
||||
postInstall
|
||||
meta
|
||||
;
|
||||
|
||||
modBuildPhase = ''
|
||||
for module in ${toString (attrsToModule caddyModules)}; do
|
||||
sed -i "/standard/a _ \"$module\"" ./cmd/caddy/main.go
|
||||
done
|
||||
for plugin in ${toString (attrsToVersionedModule caddyModules)}; do
|
||||
go get $plugin
|
||||
done
|
||||
go mod vendor
|
||||
'';
|
||||
modBuildPhase = ''
|
||||
for module in ${toString (attrsToModule caddyModules)}; do
|
||||
sed -i "/standard/a _ \"$module\"" ./cmd/caddy/main.go
|
||||
done
|
||||
for plugin in ${toString (attrsToVersionedModule caddyModules)}; do
|
||||
go get $plugin
|
||||
done
|
||||
go mod vendor
|
||||
'';
|
||||
|
||||
modInstallPhase = ''
|
||||
mv -t vendor go.mod go.sum
|
||||
cp -r vendor "$out"
|
||||
'';
|
||||
modInstallPhase = ''
|
||||
mv -t vendor go.mod go.sum
|
||||
cp -r vendor "$out"
|
||||
'';
|
||||
|
||||
preBuild = ''
|
||||
chmod -R u+w vendor
|
||||
[ -f vendor/go.mod ] && mv -t . vendor/go.{mod,sum}
|
||||
for module in ${toString (attrsToModule caddyModules)}; do
|
||||
sed -i "/standard/a _ \"$module\"" ./cmd/caddy/main.go
|
||||
done
|
||||
'';
|
||||
preBuild = ''
|
||||
chmod -R u+w vendor
|
||||
[ -f vendor/go.mod ] && mv -t . vendor/go.{mod,sum}
|
||||
for module in ${toString (attrsToModule caddyModules)}; do
|
||||
sed -i "/standard/a _ \"$module\"" ./cmd/caddy/main.go
|
||||
done
|
||||
'';
|
||||
|
||||
inherit vendorHash;
|
||||
};
|
||||
tests = {
|
||||
inherit (nixosTests) caddy;
|
||||
version = testers.testVersion {
|
||||
command = "${caddy}/bin/caddy version";
|
||||
package = caddy;
|
||||
inherit vendorHash;
|
||||
};
|
||||
tests = {
|
||||
inherit (nixosTests) caddy;
|
||||
version = testers.testVersion {
|
||||
command = "${caddy}/bin/caddy version";
|
||||
package = caddy;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue