sonarr runs in a vm now

This commit is contained in:
Snorre 2025-03-04 15:24:46 +01:00
parent b78c6df390
commit 110864d9d0
3 changed files with 22 additions and 44 deletions

View file

@ -1,40 +0,0 @@
{
self,
nixpkgs,
...
}:
nixpkgs.lib.extend (
_final: prev: let
inherit (prev) mkIf;
in {
extensions = {
createVm = {
name,
system ? nixpkgs.system,
}: config: {microvm, ...}: {
imports = [microvm.host];
microvm.hypervisor = "cloud-hypervisor";
microvm.vms.${name} = {
pkgs = import nixpkgs {inherit system;};
microvm.shares = [
{
tag = "ro-store";
source = "/nix/store";
mountPoint = "/nix/.ro-store";
}
];
inherit config;
};
# Mount host /nix/store for drastically reduced image size and evaluation time
microvm.vms.${name}.config.shares = [
{
source = "/nix/store";
mountPoint = "/nix/.ro-store";
tag = "ro-store";
proto = "virtiofs";
}
];
};
};
}
)

View file

@ -55,7 +55,7 @@ in {
};
systemd.services.shoko-init = {
wantedeBy = ["multi-user.target"];
wantedBy = ["multi-user.target"];
# TODO: Check if shoko requires a db
# requires = optional haveLocalDB "postgresql.service";
# after = optional haveLocalDB "postgresql.service";

View file

@ -1,9 +1,14 @@
{...}: let
{lib, ...}: let
host = "127.0.0.1";
port = 8989;
in {
microvm.autostart = ["sonarr"];
microvm.vms."sonarr" = {
config.microvm.autostart = ["sonarr"];
config.system.activationScripts.makeSonarrDir = lib.stringAfter ["var"] ''
mkdir -p /var/lib/sonarr
'';
config.microvm.vms."sonarr" = {
config = {
system.stateVersion = "24.11";
microvm.shares = [
@ -18,6 +23,19 @@ in {
mountPoint = "/var/lib/sonarr";
}
];
microvm.interfaces = [
{
type = "tap";
# interface name on the host
id = "vm-sonarr";
# Ethernet address of the MicroVM's interface, not the host's
#
# Locally administered have one of 2/6/A/E in the second nibble.
mac = "02:00:00:00:00:01";
}
];
services.sonarr = {
enable = true;