falcon-nest/virtualization/portainer.nix
2026-06-21 01:36:08 -05:00

81 lines
2.6 KiB
Nix

{ pkgs, lib, config, ... }: {
users.users.portainer = {
autoSubUidGidRange = true;
isSystemUser = true;
group = "podman";
home = "/var/lib/portainer";
# linger = true;
createHome = true;
};
virtualisation.oci-containers.containers.portainer = {
autoStart = true;
image = "portainer/portainer-ce:lts";
#privileged = true;
volumes = [
#"/var/run/docker.sock:/var/run/docker.sock:rw"
"/run/podman/podman.sock:/var/run/docker.sock"
"portainer_portainer_data:/data:rw"
];
ports = [ "8000:8000" "9443:9443" "9000:9000" ];
log-driver = "journald";
# extraOptions =
# [ "--network-alias=portainer" "--network=portainer_default" ];
environment = {
PUID = "997";
PGID = "997";
TZ = "America/Chicago";
};
};
# systemd.services."podman-portainer" = {
# serviceConfig = { Restart = lib.mkOverride 90 "always"; };
# after = [
# "podman-network-portainer_default.service"
# "podman-volume-portainer_portainer_data.service"
# ];
# requires = [
# "podman-network-portainer_default.service"
# "podman-volume-portainer_portainer_data.service"
# ];
# partOf = [ "podman-compose-portainer-root.target" ];
# wantedBy = [ "podman-compose-portainer-root.target" ];
# };
# # Networks
# systemd.services."podman-network-portainer_default" = {
# path = [ pkgs.podman ];
# serviceConfig = {
# Type = "oneshot";
# RemainAfterExit = true;
# ExecStop = "podman network rm -f portainer_default";
# };
# script = ''
# podman network inspect portainer_default || podman network create portainer_default
# '';
# partOf = [ "podman-compose-portainer-root.target" ];
# wantedBy = [ "podman-compose-portainer-root.target" ];
# };
# # Volumes
# systemd.services."podman-volume-portainer_portainer_data" = {
# path = [ pkgs.podman ];
# serviceConfig = {
# Type = "oneshot";
# RemainAfterExit = true;
# };
# script = ''
# podman volume inspect portainer_portainer_data || podman volume create portainer_portainer_data
# '';
# partOf = [ "podman-compose-portainer-root.target" ];
# wantedBy = [ "podman-compose-portainer-root.target" ];
# };
# # Root service
# # When started, this will automatically create all resources and start
# # the containers. When stopped, this will teardown all resources.
# systemd.targets."podman-compose-portainer-root" = {
# unitConfig = { Description = "Root target generated by compose2nix."; };
# wantedBy = [ "multi-user.target" ];
# };
}