about summary refs log tree commit diff
path: root/modules/podman.nix
blob: 6c4b20a053409bb0667327a52d0ba030fe5afd10 (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
40
41
42
43
44
45
46
47
48
49
{
  config,
  inputs,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.nixfiles.modules.podman;
in
{
  options.nixfiles.modules.podman.enable = lib.mkEnableOption "Podman";

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

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

    nixfiles.modules.common.shell.aliases.p = "podman";

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

    virtualisation.podman = {
      enable = true;
      dockerCompat = false;
      dockerSocket.enable = false;
    };

    environment.systemPackages = [ pkgs.podman-compose ];

    my.extraGroups = [ "podman" ];

    hm.xdg.configFile."containers/registries.conf".source =
      pkgs.writers.writeTOML "containers-registries.toml"
        {
          registries.search.registries = [ "docker.io" ];
        };
  };
}

Consider giving Nix/NixOS a try! <3