Initial commit

This commit is contained in:
Shawn Borton 2026-06-21 01:36:08 -05:00
commit a4db9c8516
36 changed files with 15659 additions and 0 deletions

View file

@ -0,0 +1,77 @@
# Auto-generated using compose2nix v0.3.2-pre.
# nix run github:aksiksi/compose2nix -- -project=portainer -output=/home/shawnb/.dotfiles/virtualization/portainer-composer.nix
{ pkgs, lib, config, ... }:
{
# Create portainer user and add to docker group
users.users.portainer = {
isSystemUser = true;
group = "podman";
home = "/var/lib/portainer";
createHome = true;
};
# Containers
virtualisation.oci-containers.containers."portainer" = {
podman.user = "portainer";
image = "portainer/portainer-ce:lts";
volumes = [
"/var/run/docker.sock:/var/run/docker.sock:rw"
"portainer_portainer_data:/data:rw"
];
ports = [ "8000:8000/tcp" "9443:9443/tcp" "9000:9000/tcp" ];
log-driver = "journald";
extraOptions =
[ "--network-alias=portainer" "--network=portainer_default" ];
};
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" ];
};
}