from my phone so i cant see the changes lol
This commit is contained in:
61
modules/containers/silverbullet/container.nix
Normal file
61
modules/containers/silverbullet/container.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{moduleWithSystem, ...}: {
|
||||
flake.nixosModules.containerSilverbullet = moduleWithSystem ({pkgs, ...}: {config, ...}: {
|
||||
virtualisation.oci-containers.containers."silverbullet-silverbullet" = {
|
||||
image = "ghcr.io/silverbulletmd/silverbullet:v2";
|
||||
environmentFiles = [config.sops.templates."silverbullet.env".path];
|
||||
volumes = [
|
||||
"/mnt/storage/Notes:/space:rw"
|
||||
];
|
||||
ports = [
|
||||
"9003:3000/tcp"
|
||||
];
|
||||
log-driver = "journald";
|
||||
extraOptions = [
|
||||
"--network-alias=silverbullet"
|
||||
"--network=silverbullet_default"
|
||||
];
|
||||
};
|
||||
systemd.services."podman-silverbullet-silverbullet" = {
|
||||
serviceConfig = {
|
||||
Restart = pkgs.lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [
|
||||
"podman-network-silverbullet_default.service"
|
||||
];
|
||||
requires = [
|
||||
"podman-network-silverbullet_default.service"
|
||||
];
|
||||
partOf = [
|
||||
"podman-compose-silverbullet-root.target"
|
||||
];
|
||||
wantedBy = [
|
||||
"podman-compose-silverbullet-root.target"
|
||||
];
|
||||
};
|
||||
|
||||
# Networks
|
||||
systemd.services."podman-network-silverbullet_default" = {
|
||||
path = [pkgs.podman];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "podman network rm -f silverbullet_default";
|
||||
};
|
||||
script = ''
|
||||
podman network inspect silverbullet_default || podman network create silverbullet_default
|
||||
'';
|
||||
partOf = ["podman-compose-silverbullet-root.target"];
|
||||
wantedBy = ["podman-compose-silverbullet-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-silverbullet-root" = {
|
||||
unitConfig = {
|
||||
Description = "Root target generated by compose2nix.";
|
||||
};
|
||||
wantedBy = ["multi-user.target"];
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user