Skip to content

matt1432/nixos-caddy-cloudflare

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Patched Caddy NixOS flake

Caddy's third-party plugins are installed by adding them as import in cmd/caddy/main.go and compiling caddy. This can be done either using the xcaddy utility as described here in the official docs or by creating a main.go file with the import and compiling with go build manually. This process is outlined in the upstream here. The xcaddy utility is not suited for deployment on NixOS where a sandboxed, reproducible build is required.

This flake compiles caddy from a custom main.go file as outlined above, currently only adding the cloudflare dns plugin. The caddy package of this flake's output will be caddy with that plugin baked in.

To modify/add plugins:

  1. Edit src/main.go as per the upstream docs
  2. Run go mod tidy
  3. If necessary, update the hash in flake.nix
  4. Run nix build

You should get a result with the compiled caddy. To verify that the plugins were correctly added use:

./result/bin/caddy list-modules

You should see the non-standard modules you added above this line at the end:

  Non-standard modules: n

Cachix

To make use of this repository's cachix binary cache, you can follow the instructions at this link, or add these to your nix configuration:

{
  nix.settings = {
    substituters = [
      "https://caddycf.cachix.org"
    ];

    trusted-public-keys = [
      "caddycf.cachix.org-1:6vbQaeiec/zKv9XfEwi9yWVCe7opbeJMu6w81UEXugY="
    ];
  };
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nix 88.2%
  • Shell 9.3%
  • Go 2.5%