# modules/hosts/laptop/docker.nix # # Rootless Docker for the `dock` CLI (~/.local/bin/dock). The daemon runs as a # systemd USER service (`systemctl --user … docker`), never as root, so nobody # is added to the `docker` group and the rootful daemon stays off. # # - virtualisation.docker.rootless: dockerd-rootless as the user unit # `docker.service`, WantedBy default.target (starts on login) # - setSocketVariable: /etc/profile exports # DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock (new logins only) # - pkgs.docker already ships the compose and buildx CLI plugins # (composeSupport/buildxSupport default to true), so `docker compose` and # `docker buildx` work with nothing extra; docker-compose is added only for # the standalone `docker-compose` spelling some scripts still call. # # newuidmap/newgidmap come from the NixOS shadow wrappers, and the user's # /etc/subuid + /etc/subgid ranges from isNormalUser's autoSubUidGidRange. { ... }: { flake.nixosModules.laptop-docker = { pkgs, ... }: { virtualisation.docker.rootless = { enable = true; setSocketVariable = true; }; environment.systemPackages = [ pkgs.docker-compose ]; } ; }