1"use strict";(self.webpackChunkwoodpecker=self.webpackChunkwoodpecker||[]).push([["3145"],{67515(e,n,t){t.r(n),t.d(n,{metadata:()=>i,default:()=>p,frontMatter:()=>r,contentTitle:()=>a,toc:()=>l,assets:()=>d});var i=JSON.parse('{"id":"administration/deployment-methods/nixos","title":"NixOS","description":"Note that this module is not maintained by the Woodpecker developers.","source":"@site/versioned_docs/version-2.8/30-administration/05-deployment-methods/40-nixos.md","sourceDirName":"30-administration/05-deployment-methods","slug":"/administration/deployment-methods/nixos","permalink":"/docs/2.8/administration/deployment-methods/nixos","draft":false,"unlisted":false,"editUrl":"https://github.com/woodpecker-ci/woodpecker/edit/main/docs/versioned_docs/version-2.8/30-administration/05-deployment-methods/40-nixos.md","tags":[],"version":"2.8","sidebarPosition":40,"frontMatter":{},"sidebar":"tutorialSidebar","previous":{"title":"Third-party installation methods","permalink":"/docs/2.8/administration/deployment-methods/third-party"},"next":{"title":"Databases","permalink":"/docs/2.8/administration/database"}}'),o=t(94686),s=t(23191);let r={},a="NixOS",d={},l=[{value:"General Configuration",id:"general-configuration",level:2},{value:"Tips and tricks",id:"tips-and-tricks",level:2}];function c(e){let n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",header:"header",p:"p",pre:"pre",...(0,s.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(n.header,{children:(0,o.jsx)(n.h1,{id:"nixos",children:"NixOS"})}),"\n",(0,o.jsx)(n.admonition,{type:"info",children:(0,o.jsxs)(n.p,{children:["Note that this module is not maintained by the Woodpecker developers.\nIf you experience issues please open a bug report in the ",(0,o.jsx)(n.a,{href:"https://github.com/NixOS/nixpkgs/issues/new/choose",children:"nixpkgs repo"})," where the module is maintained."]})}),"\n",(0,o.jsx)(n.p,{children:"The NixOS install is in theory quite similar to the binary install and supports multiple backends.\nIn practice, the settings are specified declaratively in the NixOS configuration and no manual steps need to be taken."}),"\n",(0,o.jsx)(n.h2,{id:"general-configuration",children:"General Configuration"}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.code,{className:"language-nix",children:'{ config\n, ...\n}:\nlet\n domain = "woodpecker.example.org";\nin\n{\n # This automatically sets up certificates via let\'s encrypt\n security.acme.defaults.email = "[email protected]";\n security.acme.acceptTerms = true;\n security.acme.certs."${domain}" = { };\n\n # Setting up a nginx proxy that handles tls for us\n networking.firewall.allowedTCPPorts = [ 80 443 ];\n services.nginx = {\n enable = true;\n recommendedTlsSettings = true;\n recommendedOptimisation = true;\n recommendedProxySettings = true;\n virtualHosts."${domain}" = {\n enableACME = true;\n forceSSL = true;\n locations."/" = {\n proxyPass = "http://localhost:3007";\n };\n };\n };\n\n services.woodpecker-server = {\n enable = true;\n environment = {\n WOODPECKER_HOST = "https://${domain}";\n WOODPECKER_SERVER_ADDR = ":3007";\n WOODPECKER_OPEN = "true";\n };\n # You can pass a file with env vars to the system it could look like:\n # WOODPECKER_AGENT_SECRET=XXXXXXXXXXXXXXXXXXXXXX\n environmentFile = "/path/to/my/secrets/file";\n };\n\n # This sets up a woodpecker agent\n services.woodpecker-agents.agents."docker" = {\n enable = true;\n # We need this to talk to the podman socket\n extraGroups = [ "podman" ];\n environment = {\n WOODPECKER_SERVER = "localhost:9000";\n WOODPECKER_MAX_WORKFLOWS = "4";\n DOCKER_HOST = "unix:///run/podman/podman.sock";\n WOODPECKER_BACKEND = "docker";\n };\n # Same as with woodpecker-server\n environmentFile = [ "/var/lib/secrets/woodpecker.env" ];\n };\n\n # Here we setup podman and enable dns\n virtualisation.podman = {\n enable = true;\n defaultNetwork.settings = {\n dns_enabled = true;\n };\n };\n # This is needed for podman to be able to talk over dns\n networking.firewall.interfaces."podman0" = {\n allowedUDPPorts = [ 53 ];\n allowedTCPPorts = [ 53 ];\n };\n}\n'})}),"\n",(0,o.jsxs)(n.p,{children:["All configuration options can be found via ",(0,o.jsx)(n.a,{href:"https://search.nixos.org/options?channel=unstable&size=200&sort=relevance&query=woodpecker",children:"NixOS Search"})]}),"\n",(0,o.jsx)(n.h2,{id:"tips-and-tricks",children:"Tips and tricks"}),"\n",(0,o.jsxs)(n.p,{children:["There are some resources on how to utilize Woodpecker more effectively with NixOS on the ",(0,o.jsx)(n.a,{href:"/docs/2.8/awesome",children:"Awesome Woodpecker"})," page, like using the runners nix-store in the pipeline."]})]})}function p(e={}){let{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,o.jsx)(n,{...e,children:(0,o.jsx)(c,{...e})}):c(e)}},23191(e,n,t){t.d(n,{R:()=>r,x:()=>a});var i=t(92990);let o={},s=i.createContext(o);function r(e){let n=i.useContext(s);return i.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:r(e.components),i.createElement(s.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.