This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| manuals:distributions:guix [2023/08/31 08:00] – remove --allow-downgrades Aither | manuals:distributions:guix [2026/08/19 14:43] (current) – Update Guix platform inheritance and deployment examples aither | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | < | ||
| + | |||
| + | < | ||
| + | source=" | ||
| + | test=" | ||
| + | /> | ||
| + | |||
| ====== GNU Guix System ====== | ====== GNU Guix System ====== | ||
| - | [[https:// | ||
| - | manager. It allows one to declaratively configure the system and its services, | ||
| - | a concept shared with [[manuals: | ||
| - | language, Guix is built with Guile Scheme. This page describes Guix specifics on vpsFree.cz' | ||
| - | VPS. | ||
| - | ===== Configuration ===== | + | [[https:// |
| - | The VPS is created from a template which contains a minimal | + | services, and packages are described declaratively |
| - | You can log in with a generated password or deploy your public key using vpsAdmin. | + | [[manuals: |
| - | The system | + | configuration changes and lets you return |
| - | VPS are containers, it is necessary | + | |
| - | option '' | + | |
| - | System configuration is stored in directory ''/ | + | ===== How the template works ===== |
| - | * '' | + | The vpsFree template |
| - | * '' | + | |
| - | < | + | * ''/ |
| - | # . /etc/profile | + | * ''/ |
| - | # guix pull | + | |
| - | # hash guix | + | '' |
| - | # guix system | + | module and inherits it. Keep the module lookup and inheritance: |
| + | base provides the container bootloader, file systems, kernel placeholder, | ||
| + | packages, services, and network integration. The current versions of both files | ||
| + | are available in the | ||
| + | [[https:// | ||
| + | |||
| + | The kernel is managed by vpsAdminOS. Do not add your own Linux kernel or a | ||
| + | bootloader intended for a physical machine to the configuration. | ||
| + | |||
| + | ===== Editing the configuration ===== | ||
| + | |||
| + | Start by editing ''/ | ||
| + | are visible there as defaults that you can change. You can also add fields such | ||
| + | as '' | ||
| + | lookup and '' | ||
| + | remain active. | ||
| + | |||
| + | When changing services, first derive and bind the service list outside the | ||
| + | '' | ||
| + | The deployment example below follows this pattern. Guix evaluates service | ||
| + | fields after loading the configuration, | ||
| + | from its temporary configuration module. | ||
| + | |||
| + | Activate the configuration as '' | ||
| + | |||
| + | < | ||
| + | #!/ | ||
| + | set -eo pipefail | ||
| + | |||
| + | # Use the Guix revision that built the active system generation. | ||
| + | export GUIX_PROFILE=/run/ | ||
| + | # shellcheck disable=SC1091 | ||
| + | . " | ||
| + | hash guix | ||
| + | |||
| + | test -r / | ||
| + | test -r / | ||
| + | test -r / | ||
| + | guix time-machine -C / | ||
| + | system reconfigure | ||
| </ | </ | ||
| - | ===== Known issues | + | '' |
| + | reconfiguration does not depend on later channel-history changes. The | ||
| + | '' | ||
| + | builds and immediately activates a new generation. Before logging out, verify | ||
| + | that SSH and the services you need are running. See the manuals for | ||
| + | [[https:// | ||
| + | and [[https:// | ||
| + | for details. | ||
| + | |||
| + | ===== Updating Guix ===== | ||
| + | |||
| + | The example above selects the Guix revision and channels that built the active | ||
| + | system generation. Reconfiguration therefore does not require '' | ||
| + | before every configuration change, keeping repeated deployments predictable. | ||
| + | |||
| + | When you intentionally update Guix, first record the current channels with | ||
| + | '' | ||
| + | by the command, and reconfigure again. Read the news before changing revisions, | ||
| + | and allow extra time, memory, and disk space for the build. The | ||
| + | [[https:// | ||
| + | explains channels and pinned revisions. | ||
| + | |||
| + | ===== Network and SSH ===== | ||
| + | |||
| + | Do not configure the primary network with '' | ||
| + | At every boot, vpsAdminOS creates ''/ | ||
| + | the '' | ||
| + | services on top of this layer. | ||
| + | |||
| + | For convenient first access, the default template permits SSH login as | ||
| + | '' | ||
| + | [[manuals: | ||
| + | |||
| + | ===== Deploying with guix deploy ===== | ||
| + | |||
| + | If you manage several Guix VPSes, you can keep their configurations on one | ||
| + | coordinator Guix system and deploy them with | ||
| + | [[https:// | ||
| + | The complete configuration below is a starting point for one VPS. You maintain | ||
| + | only '' | ||
| + | ''/ | ||
| + | |||
| + | The coordinator needs the SSH key ''/ | ||
| + | its public part to '' | ||
| + | key-only login first. Run '' | ||
| + | VPS and verify the resulting key fingerprint by following the | ||
| + | [[manuals: | ||
| + | beginning with '' | ||
| + | |||
| + | Save this configuration as ''/ | ||
| + | replace the target VPS address and host key: | ||
| + | |||
| + | <code scheme> | ||
| + | ;; Load the maintained vpsAdminOS container integration. | ||
| + | (add-to-load-path "/ | ||
| + | (use-modules (gnu) | ||
| + | (gnu machine) | ||
| + | (gnu machine ssh) | ||
| + | (gnu services base)) | ||
| + | (use-service-modules ssh) | ||
| + | |||
| + | (let* ((platform-system | ||
| + | (module-ref (resolve-interface ' | ||
| + | ' | ||
| + | ;; These files belong to the machine from which you run guix deploy. | ||
| + | | ||
| + | (local-file "/ | ||
| + | | ||
| + | (local-file "/ | ||
| + | ;; Build the service list before assigning the delayed services field. | ||
| + | | ||
| + | (cons | ||
| + | | ||
| + | | ||
| + | | ||
| + | (authorized-keys | ||
| + | (list controller-signing-key)))) | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | (inherit config) | ||
| + | (permit-root-login ' | ||
| + | (password-authentication? | ||
| + | (authorized-keys | ||
| + | | ||
| + | | ||
| + | (operating-system | ||
| + | (inherit platform-system) | ||
| + | (host-name " | ||
| + | (timezone " | ||
| + | (locale " | ||
| + | (services user-services))) | ||
| + | | ||
| + | (machine | ||
| + | (operating-system system) | ||
| + | (environment managed-host-environment-type) | ||
| + | (configuration | ||
| + | | ||
| + | ;; Replace the address and host key with those of your target VPS. | ||
| + | (host-name " | ||
| + | (system " | ||
| + | (user " | ||
| + | (identity "/ | ||
| + | (host-key " | ||
| + | (authorize? #t) | ||
| + | (allow-downgrades? | ||
| + | ;; vpsAdminOS supplies the kernel and exposes a dummy /dev/null root. | ||
| + | ;; Guix's bare-metal file-system/ | ||
| + | (safety-checks? | ||
| + | (list target-machine)) | ||
| + | </ | ||
| + | |||
| + | First load the configuration without deploying it with '' | ||
| + | / | ||
| + | / | ||
| + | '' | ||
| + | signing key on the target, and the declaration keeps it authorized in the new | ||
| + | generation. | ||
| + | |||
| + | The configuration deliberately allows only key-based '' | ||
| + | verifies the target host key. The container-specific '' | ||
| + | disables Guix checks for physical file systems and initrd modules: vpsAdminOS | ||
| + | supplies the kernel and its integration module exposes a dummy ''/ | ||
| + | root which current Guix cannot inspect. Downgrade protection stays enabled. | ||
| + | If deployment fails, fix its cause instead of enabling | ||
| + | '' | ||
| + | |||
| + | ===== Generations and recovery ===== | ||
| + | |||
| + | List generations with '' | ||
| + | before deleting older generations. The | ||
| + | [[https:// | ||
| + | describes rollback and generation management. | ||
| - | * halt (graceful shutdown) has been observed to sometimes hang, please report in case it's still a problem. | + | If a new configuration does not boot or you lose SSH access, follow |
| - | * cgroups v1 are not mounted. cgroups do not seem to be needed by the base system, contact us in case it's a problem for some service | + | [[manuals:vps: |
| + | [[manuals: | ||
| + | an older Guix generation. Fix the configuration and reconfigure again. | ||