about summary refs log tree commit diff
path: root/modules/docker.nix
blob: 330d417da8f3565232a87eb7b3cf54df892dad81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
  config,
  inputs,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.nixfiles.modules.docker;
in
{
  options.nixfiles.modules.docker.enable = lib.mkEnableOption "Docker";

  config = lib.mkIf cfg.enable {
    assertions = [
      {
        assertion = cfg.enable -> !config.nixfiles.modules.podman.enable;
        message = "Pick only one!";
      }
    ];

    ark.directories = [ "/var/lib/docker" ];

    nixfiles.modules.common.shell.aliases.d = "docker";

    secrets.containers-auth = {
      file = "${inputs.self}/secrets/containers-auth";
      path = "${config.my.home}/.docker/config.json";
      owner = lib.my.username;
      inherit (config.my) group;
    };

    virtualisation.docker.enable = true;

    environment.systemPackages = with pkgs; [ docker-compose ];

    my.extraGroups = [ "docker" ];
  };
}

Consider giving Nix/NixOS a try! <3