myNixOSConfig/services/containers.nix

50 lines
1.6 KiB
Nix
Raw Permalink Normal View History

2024-09-07 08:36:34 +02:00
{ lib, config, pkgs, ... }:
{
#import = [ ];
virtualisation = {
podman = {
enable = true;
# Create a `docker` alias for podman, to use it as a drop-in replacement
dockerCompat = true;
# Required for containers under podman-compose to be able to talk to each other.
defaultNetwork.settings.dns_enabled = true;
};
};
environment.etc."/containers/containers.conf".text = "";
/*
# PHPmyadmin
systemd.services.create-podman-network = with config.virtualisation.oci-containers; {
serviceConfig.Type = "oneshot";
wantedBy = [ "${backend}-phpmyadmin.service" ];
script = ''${pkgs.podman}/bin/podman network exists net_macvlan || \ ${pkgs.podman}/bin/podman network create --driver=macvlan --gateway=192.168.178.134.1 --subnet=192.168.178.134.0/24 -o parent=ens18 net_macvlan'';
};
containers = {
phpmyadmin = import ./container/phpmyadmin.nix;
};
# Create folders for the containers
system.activationScripts = {
script.text = ''
# phpMyAdmin
install -d -m 755 /home/dbuser/phpmyadmin -o root -g root
test -f /home/dbuser/phpmyadmin/config.user.inc.php || echo -e "<?php\n\n\$cfg['ShowPhpInfo'] = true; // Adds a link to phpinfo() on the home page\n\$cfg['SendErrorReports'] = 'never';" > /home/dbuser/phpmyadmin/config.user.inc.php
'';
};
*/
# podman as systemd service
/*
virtualisation.oci-containers.backend = "podman";
virtualisation.oci-containers.containers = {
container-name = {
image = "container-image";
autoStart = true;
ports = [ "127.0.0.1:1234:1234" ];
};
};
*/
services.flatpak.enable = true;
}