caddy soluzione 2. overlay senza nixpkgs custom
This commit is contained in:
parent
1903e0a6e1
commit
6602567bf9
6 changed files with 80 additions and 59 deletions
19
flake.lock
generated
19
flake.lock
generated
|
|
@ -241,22 +241,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-caddy": {
|
||||
"locked": {
|
||||
"lastModified": 1699107987,
|
||||
"narHash": "sha256-nWXETr4Oqy/vOfzgWyMY04qzEN2iREFJc5ycQ3XNu0A=",
|
||||
"owner": "jpds",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a33b02fa9d664f31dadc8a874eb1a5dbaa9f4ecf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "jpds",
|
||||
"ref": "caddy-external-plugins",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
|
|
@ -264,8 +248,7 @@
|
|||
"home-manager": "home-manager_2",
|
||||
"lix-module": "lix-module",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-caddy": "nixpkgs-caddy"
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"stable": {
|
||||
|
|
|
|||
21
flake.nix
21
flake.nix
|
|
@ -33,26 +33,23 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# Used for caddy plugins
|
||||
nixpkgs-caddy.url = "github:jpds/nixpkgs/caddy-external-plugins";
|
||||
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, nixpkgs
|
||||
, nixos-hardware
|
||||
, lix-module
|
||||
, agenix
|
||||
, colmena
|
||||
, home-manager
|
||||
, ...
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixos-hardware,
|
||||
lix-module,
|
||||
agenix,
|
||||
colmena,
|
||||
home-manager,
|
||||
...
|
||||
}@inputs:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
lib = nixpkgs.lib;
|
||||
caddyWithPlugins = pkgs.callPackage ./packages/caddy-pkg.nix { };
|
||||
in
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
{ nixpkgs
|
||||
, nixos-hardware
|
||||
, agenix
|
||||
, home-manager
|
||||
, lix-module
|
||||
, nixpkgs-caddy
|
||||
, ...
|
||||
{
|
||||
nixpkgs,
|
||||
nixos-hardware,
|
||||
agenix,
|
||||
home-manager,
|
||||
lix-module,
|
||||
...
|
||||
}:
|
||||
let
|
||||
agenixOverlay = final: prev: { agenix = agenix.packages.${prev.system}.default; };
|
||||
|
||||
customOverlays = import ../overlay;
|
||||
|
||||
pkgs =
|
||||
system:
|
||||
import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ agenixOverlay ];
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
pkgs-caddy =
|
||||
system:
|
||||
import nixpkgs-caddy {
|
||||
inherit system;
|
||||
overlays = [
|
||||
agenixOverlay
|
||||
customOverlays
|
||||
];
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
|
||||
|
|
@ -48,9 +46,7 @@ in
|
|||
home-manager.nixosModules.home-manager
|
||||
agenix.nixosModules.default
|
||||
];
|
||||
specialArgs = {
|
||||
# inherit nixvim nix-index-database;
|
||||
};
|
||||
# specialArgs = { };
|
||||
};
|
||||
|
||||
arr = nixpkgs.lib.nixosSystem {
|
||||
|
|
@ -61,9 +57,7 @@ in
|
|||
./arr
|
||||
agenix.nixosModules.default
|
||||
];
|
||||
specialArgs = {
|
||||
# inherit nixvim nix-index-database;
|
||||
};
|
||||
# specialArgs = { };
|
||||
};
|
||||
|
||||
metrics = nixpkgs.lib.nixosSystem {
|
||||
|
|
@ -74,9 +68,7 @@ in
|
|||
./metrics
|
||||
agenix.nixosModules.default
|
||||
];
|
||||
specialArgs = {
|
||||
pkgs-caddy = pkgs-caddy "x86_64-linux";
|
||||
};
|
||||
# specialArgs = { };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
, pkgs-caddy
|
||||
, ...
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
|
|
|
|||
48
overlay/caddy-custom.nix
Normal file
48
overlay/caddy-custom.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
caddy.override {
|
||||
buildGoModule = args: buildGoModule (args // {
|
||||
src = stdenv.mkDerivation rec {
|
||||
pname = "caddy-using-xcaddy-${xcaddy.version}";
|
||||
inherit (caddy) version;
|
||||
|
||||
dontUnpack = true;
|
||||
dontFixup = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cacert
|
||||
go
|
||||
];
|
||||
|
||||
plugins = [
|
||||
# https://github.com/caddy-dns/cloudflare
|
||||
"github.com/caddy-dns/cloudflare@89f16b99c18ef49c8bb470a82f895bce01cbaece"
|
||||
];
|
||||
|
||||
configurePhase = ''
|
||||
export GOCACHE=$TMPDIR/go-cache
|
||||
export GOPATH="$TMPDIR/go"
|
||||
export XCADDY_SKIP_BUILD=1
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
${xcaddy}/bin/xcaddy build "${caddy.src.rev}" ${lib.concatMapStringsSep " " (plugin: "--with ${plugin}") plugins}
|
||||
cd buildenv*
|
||||
go mod vendor
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -r --reflink=auto . $out
|
||||
'';
|
||||
|
||||
outputHash = "sha256-lyhEIOgGkR31bt9YV+W854TBZw419G8uuTtBSsFcgCA=";
|
||||
outputHashMode = "recursive";
|
||||
};
|
||||
|
||||
subPackages = [ "." ];
|
||||
ldflags = [ "-s" "-w" ]; ## don't include version info twice
|
||||
vendorHash = null;
|
||||
});
|
||||
}
|
||||
1
overlay/default.nix
Normal file
1
overlay/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
_: prev: { caddy-custom = prev.callPackage ./caddy-custom.nix { }; }
|
||||
Loading…
Add table
Add a link
Reference in a new issue