diff --git a/modules/containers/3x-ui.nix b/modules/containers/3x-ui.nix index 5a4067f..289ab39 100644 --- a/modules/containers/3x-ui.nix +++ b/modules/containers/3x-ui.nix @@ -1,31 +1,112 @@ -# Auto-generated using compose2nix v0.3.3-pre. { - pkgs, - lib, config, + lib, + pkgs, + xlib, ... }: - { - # Runtime - virtualisation.podman = { - enable = true; - autoPrune = { + virtualisation = { + podman = { enable = true; - flags = [ "--all" ]; + autoPrune = { + enable = true; + flags = [ "--all" ]; + }; + dockerCompat = true; }; - dockerCompat = true; + oci-containers = { + backend = "podman"; + containers."3xui_app" = { + image = "ghcr.io/mhsanaei/3x-ui:latest"; + environment = { + "XRAY_VMESS_AEAD_FORCED" = "false"; + "XUI_ENABLE_FAIL2BAN" = "true"; + "TZ" = "Europe/Moscow"; + }; + volumes = [ + "${xlib.dirs.services-mnt-folder}/containers/3x-ui/cert/:/root/cert:rw" + "${xlib.dirs.services-mnt-folder}/containers/3x-ui/db/:/etc/x-ui:rw" + ]; + log-driver = "journald"; + extraOptions = [ + "--network=host" + ]; + }; + }; + }; + + systemd = { + services = { + "podman-3xui_app" = { + serviceConfig = { + Restart = lib.mkOverride 90 "always"; + }; + partOf = [ + "podman-compose-3x-ui-root.target" + ]; + wantedBy = [ + "podman-compose-3x-ui-root.target" + ]; + }; + # Update + "podman-update-3xui_app" = { + path = [ + pkgs.podman + ]; + serviceConfig = { + Type = "oneshot"; + TimeoutSec = 300; + }; + script = '' + podman pull ghcr.io/mhsanaei/3x-ui:latest + systemctl restart podman-3xui_app.service + ''; + }; + # Builds + # "podman-build-3xui_app" = { + # path = [ + # pkgs.podman + # pkgs.git + # ]; + # serviceConfig = { + # Type = "oneshot"; + # TimeoutSec = 300; + # }; + # script = '' + # cd /mnt/containers/3x-ui + # podman build -t compose2nix/3xui_app -f ./Dockerfile . + # ''; + # }; + }; + # Root service + # When started, this will automatically create all resources and start + # the containers. When stopped, this will teardown all resources. + targets."podman-compose-3x-ui-root" = { + unitConfig = { + Description = "Root target generated by compose2nix."; + }; + wantedBy = [ "multi-user.target" ]; + }; + timers."podman-update-3xui_app" = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "weekly"; + Persistent = true; + }; + }; + # Folders + tmpfiles.rules = [ + "d /mnt 0755 root root -" + "d /mnt/containers 0755 root root -" + "d /mnt/services/containers 0755 root root -" + "d /mnt/services/containers/3x-ui 0755 root root -" + "d /mnt/services/containers/3x-ui/cert 0755 root root -" + "d /mnt/services/containers/3x-ui/db 0755 root root -" + ]; }; # Enable container name DNS for all Podman networks. - networking.firewall.interfaces = - let - matchAll = if !config.networking.nftables.enable then "podman+" else "podman*"; - in - { - "${matchAll}".allowedUDPPorts = [ 53 ]; - }; - networking.firewall = { allowedUDPPortRanges = [ { @@ -39,81 +120,12 @@ to = 15380; } ]; - allowedTCPPorts = [ - 8443 - 9443 - 13380 - ]; - allowedUDPPorts = [ - 8443 - 9443 - 13380 - ]; + interfaces = + let + matchAll = if !config.networking.nftables.enable then "podman+" else "podman*"; + in + { + "${matchAll}".allowedUDPPorts = [ 53 ]; + }; }; - virtualisation.oci-containers.backend = "podman"; - - # Containers - virtualisation.oci-containers.containers."3xui_app" = { - image = "ghcr.io/mhsanaei/3x-ui:latest"; - environment = { - "XRAY_VMESS_AEAD_FORCED" = "false"; - "XUI_ENABLE_FAIL2BAN" = "true"; - "TZ" = "Europe/Moscow"; - }; - volumes = [ - "/mnt/services/containers/3x-ui/cert/:/root/cert:rw" - "/mnt/services/containers/3x-ui/db/:/etc/x-ui:rw" - ]; - log-driver = "journald"; - extraOptions = [ - "--network=host" - ]; - }; - systemd.services."podman-3xui_app" = { - serviceConfig = { - Restart = lib.mkOverride 90 "always"; - }; - partOf = [ - "podman-compose-3x-ui-root.target" - ]; - wantedBy = [ - "podman-compose-3x-ui-root.target" - ]; - }; - - # Builds - # systemd.services."podman-build-3xui_app" = { - # path = [ - # pkgs.podman - # pkgs.git - # ]; - # serviceConfig = { - # Type = "oneshot"; - # TimeoutSec = 300; - # }; - # script = '' - # cd /mnt/containers/3x-ui - # podman build -t compose2nix/3xui_app -f ./Dockerfile . - # ''; - # }; - - # 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-3x-ui-root" = { - unitConfig = { - Description = "Root target generated by compose2nix."; - }; - wantedBy = [ "multi-user.target" ]; - }; - - # Folders - systemd.tmpfiles.rules = [ - "d /mnt 0755 root root -" - "d /mnt/containers 0755 root root -" - "d /mnt/services/containers 0755 root root -" - "d /mnt/services/containers/3x-ui 0755 root root -" - "d /mnt/services/containers/3x-ui/cert 0755 root root -" - "d /mnt/services/containers/3x-ui/db 0755 root root -" - ]; } diff --git a/modules/containers/openhands.nix b/modules/containers/openhands.nix index 31e9537..03fb7ca 100644 --- a/modules/containers/openhands.nix +++ b/modules/containers/openhands.nix @@ -85,21 +85,21 @@ }; # Builds - systemd.services."podman-build-openhands-app" = { - enable = false; - path = [ - pkgs.podman - pkgs.git - ]; - serviceConfig = { - Type = "oneshot"; - TimeoutSec = 300; - }; - script = '' - cd ${xlib.dirs.services-mnt-folder}/containers/openhands/source - podman build -t openhands:latest -f ./containers/app/Dockerfile . - ''; - }; + # systemd.services."podman-build-openhands-app" = { + # enable = false; + # path = [ + # pkgs.podman + # pkgs.git + # ]; + # serviceConfig = { + # Type = "oneshot"; + # TimeoutSec = 300; + # }; + # script = '' + # cd ${xlib.dirs.services-mnt-folder}/containers/openhands/source + # podman build -t openhands:latest -f ./containers/app/Dockerfile . + # ''; + # }; # Root service # When started, this will automatically create all resources and start diff --git a/modules/software/beets/default.nix b/modules/software/beets/default.nix index 37cbca9..4eb9a85 100644 --- a/modules/software/beets/default.nix +++ b/modules/software/beets/default.nix @@ -20,24 +20,24 @@ let # python3 = pkgs.python3.override { # packageOverrides = depsOverlay; # }; - beetsEnv = pkgs.python313.withPackages ( + beetsEnv = pkgs.python314.withPackages ( ps: with ps; [ - anyio # - lap # - llvmlite # - scipy # - requests-ratelimiter # - pyrate-limiter # - numpy # - numba # + anyio # N + lap # N + llvmlite # N + scipy # N + requests-ratelimiter # N + pyrate-limiter # N + numpy # N + numba # N et-xmlfile markdown-it-py mdurl openpyxl pygments rich - setuptools # - pysocks # + setuptools # N + pysocks # N beautifulsoup4 beetcamp beets