about summary refs log tree commit diff
path: root/modules/nixos/podman.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos/podman.nix')
-rw-r--r--modules/nixos/podman.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/nixos/podman.nix b/modules/nixos/podman.nix
new file mode 100644
index 0000000..1c5378b
--- /dev/null
+++ b/modules/nixos/podman.nix
@@ -0,0 +1,41 @@
+{
+  config,
+  lib,
+  inputs,
+  pkgs,
+  ...
+}:
+with lib; let
+  cfg = config.nixfiles.modules.podman;
+in {
+  options.nixfiles.modules.podman.enable = mkEnableOption "Podman";
+
+  config = mkIf cfg.enable {
+    assertions = [
+      {
+        assertion = !config.nixfiles.modules.docker.enable;
+        message = "Pick only one!";
+      }
+    ];
+
+    secrets.containers-auth = {
+      file = "${inputs.self}/secrets/containers-auth";
+      path = "${config.dirs.config}/containers/auth.json";
+      owner = my.username;
+      inherit (config.my) group;
+    };
+
+    virtualisation.podman.enable = true;
+
+    environment.systemPackages = with pkgs; [podman-compose];
+
+    my.extraGroups = ["podman"];
+
+    hm.programs.bash = {
+      shellAliases.p = "${pkgs.podman}/bin/podman";
+      initExtra = mkAfter ''
+        _complete_alias p __start_podman podman
+      '';
+    };
+  };
+}

Consider giving Nix/NixOS a try! <3