Restructure flake.nix for a simpler config for building different images off the same NixOS config.
This commit is contained in:
@@ -17,64 +17,59 @@
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.podman.enable (
|
||||
lib.mkMerge [
|
||||
config = lib.mkIf config.me.podman.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertions = [
|
||||
assertion = !config.me.docker.enable;
|
||||
message = "podman conflicts with docker";
|
||||
}
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
dive
|
||||
podman-tui
|
||||
podman-compose
|
||||
];
|
||||
|
||||
# Write config files in /etc/containers
|
||||
virtualisation.containers.enable = true;
|
||||
# By default this includes "quay.io" which leads to prompting for which registry to download from.
|
||||
virtualisation.containers.registries.search = [ "docker.io" ];
|
||||
virtualisation = {
|
||||
podman = {
|
||||
enable = true;
|
||||
# Install docker shim
|
||||
dockerCompat = true;
|
||||
# Support name resolution in podman-compose.
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.variables = {
|
||||
# For compatibility with tools expecting a docker socket (like dive).
|
||||
DOCKER_HOST = "unix://$XDG_RUNTIME_DIR/podman/podman.sock";
|
||||
};
|
||||
|
||||
environment.persistence."/state" = lib.mkIf (config.me.mountPersistence) {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
{
|
||||
directory = "/var/lib/containers";
|
||||
user = "root";
|
||||
group = "root";
|
||||
mode = "0755";
|
||||
}
|
||||
];
|
||||
users.talexander = {
|
||||
directories = [
|
||||
{
|
||||
assertion = !config.me.docker.enable;
|
||||
message = "podman conflicts with docker";
|
||||
directory = ".local/share/containers";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
}
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
dive
|
||||
podman-tui
|
||||
podman-compose
|
||||
];
|
||||
|
||||
# Write config files in /etc/containers
|
||||
virtualisation.containers.enable = true;
|
||||
# By default this includes "quay.io" which leads to prompting for which registry to download from.
|
||||
virtualisation.containers.registries.search = [ "docker.io" ];
|
||||
virtualisation = {
|
||||
podman = {
|
||||
enable = true;
|
||||
# Install docker shim
|
||||
dockerCompat = true;
|
||||
# Support name resolution in podman-compose.
|
||||
defaultNetwork.settings.dns_enabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.variables = {
|
||||
# For compatibility with tools expecting a docker socket (like dive).
|
||||
DOCKER_HOST = "unix://$XDG_RUNTIME_DIR/podman/podman.sock";
|
||||
};
|
||||
|
||||
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
{
|
||||
directory = "/var/lib/containers";
|
||||
user = "root";
|
||||
group = "root";
|
||||
mode = "0755";
|
||||
}
|
||||
];
|
||||
users.talexander = {
|
||||
directories = [
|
||||
{
|
||||
directory = ".local/share/containers";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
]
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user