NixOS - Cockpit Setup


Cockpit is a modern web-based graphical interface for servers. You can use it to administer servers and it has a built-in terminal. I use the NixOS package for example to view the system logs, network settings, services, system resources and CPU load without the need of the command line. Some things do not work out of the box with NixOS like the storage, applications and software sections but I don’t mind that because I use the configuration.nix to adjust things.

I have also added the Cockpit user interface for virtual machines and podman containers. I have been thinking (for a while) about replacing Proxmox with NixOS and virtual machines and podman containers are part of that.

Configuration

Open configuration.nix:

sudo nano /etc/nixos/configuration.nix

The first step is to add the Cockpit package to the system packages:

 environment.systemPackages = with pkgs; [
     cockpit # cockpit
  ];

In this case I am using the Cockpit package from the default channel. The unstable channel has a newer version, which you can also use.

Then add the Cockpit settings:

  # Cockpit
  services.cockpit = {
    enable = true;
    port = 9090;
    settings = {
      WebService = {
        AllowUnencrypted = true;
      };
    };
  };

Adjust the port of the web interface if necessary and save the changes to configuration.nix.

Now you can switch to the new configuration:

sudo nix-collect-garbage # optional: clean up
sudo nixos-rebuild switch

You can view my complete configuration.nix here.

Using Cockpit

Cockpit can be reached via the URL:

http://<IP>:9090/

For an explanation of how to access Cockpit with a local domain name (local reverse proxy), for example cockpit.home.arpa served over HTTPS, please see this note.


Read other notes

Comments

    No comments found for this note.

    Join the discussion for this note on this ticket. Comments appear on this page instantly.

    Tags


    Notes mentioning this note

    • NixOS - Cockpit Setup
      Cockpit is a modern web-based graphical interface for servers. You can use it to administer servers and it has a...

    Notes Graph