diff --git a/flake.lock b/flake.lock index b42f581..bc4fa4b 100644 --- a/flake.lock +++ b/flake.lock @@ -199,6 +199,27 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "lancache", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749398372, + "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "sidonia", @@ -220,7 +241,7 @@ "type": "github" } }, - "flake-parts_2": { + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "steam-servers", @@ -632,7 +653,7 @@ "hyprshell": { "inputs": { "crane": "crane", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "home-manager": "home-manager_2", "hyprland": [ "sidonia", @@ -808,6 +829,7 @@ "cache-domains": [ "lancache-domains" ], + "flake-parts": "flake-parts", "monolithic": [ "lancache-monolithic" ], @@ -816,15 +838,15 @@ ] }, "locked": { - "lastModified": 1748633413, - "narHash": "sha256-L6YxtHRHng07rWYtKQOoq2MeUkasdxmwn40o4wzu4tA=", - "owner": "Mop-u", + "lastModified": 1750198881, + "narHash": "sha256-5as6C7BSLNYxb4cwM0YtQ5KF0daUGQVY3LfqekeBYyo=", + "owner": "boffbowsh", "repo": "nix-lancache", - "rev": "8c2e08200b16cb0b7a5fefffc1adad80f70617c0", + "rev": "c55c577411da87274c7fa91051badc781a1f86e5", "type": "github" }, "original": { - "owner": "Mop-u", + "owner": "boffbowsh", "repo": "nix-lancache", "type": "github" } @@ -947,11 +969,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1770000653, - "narHash": "sha256-QO/twGynxjOSUDtxbqJLshc/Q5/wImLH5O6KV2p9eoE=", + "lastModified": 1770172907, + "narHash": "sha256-rqYl9B+4shcM5b6OYjT+qdsdQNJ7SY64/xcPIb96NzU=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "6a2ddb643aaf7949caa6158e718c5efc3dda7dc1", + "rev": "8958a5a4259e1aebf4916823bf463faaf2538566", "type": "github" }, "original": { @@ -1306,7 +1328,7 @@ "steam-servers": { "inputs": { "devshell": "devshell", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "flake-root": "flake-root", "nixpkgs": [ "nixpkgs" diff --git a/flake.nix b/flake.nix index efad80e..7e3061e 100644 --- a/flake.nix +++ b/flake.nix @@ -37,7 +37,7 @@ }; lancache = { - url = "github:Mop-u/nix-lancache"; + url = "github:boffbowsh/nix-lancache"; inputs.cache-domains.follows = "lancache-domains"; inputs.monolithic.follows = "lancache-monolithic"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/tsumugi/lancache.nix b/hosts/tsumugi/lancache.nix index a3fc299..2b610fa 100644 --- a/hosts/tsumugi/lancache.nix +++ b/hosts/tsumugi/lancache.nix @@ -6,40 +6,60 @@ ... }: let - enable = false; + enable = true; + nameservers = [ "10.0.4.1" ]; in { imports = [ inputs.lancache.nixosModules.dns inputs.lancache.nixosModules.cache ]; + networking = { inherit nameservers; }; services.lancache.dns = { inherit enable; - forwarders = [ - "10.0.4.1" - "fe80::e638:83ff:fe96:6a8b%enp6s0" - ]; + forwarders = nameservers; cacheIp = "10.0.4.2"; - #cacheIp6 = "fe80::e154:9dfe:dd4f:a1d5"; - cacheNetworks = [ - "10.0.4.0/24" - "fe80::/10" - "2001:bb6:9540:502::/64" - "127.0.0.0/24" - "::1/128" - ]; }; - services.lancache.cache = { inherit enable; - resolvers = [ "10.0.4.1" ]; + resolvers = nameservers; cacheDiskSize = "8000g"; cacheIndexSize = "2000m"; cacheDir = "/mnt/lancache/cache"; - #logDir = "/mnt/lancache/log"; # nginx doesn't like network drive for logging + nginxWorkerProcesses = 8; + cacheSliceSize = "4m"; }; services.resolved.extraConfig = '' DNSStubListener=no ''; - systemd.services.nginx.serviceConfig.LimitNOFILE = 65535; + systemd = { + tmpfiles.rules = [ + "d ${config.services.lancache.cache.logDir} - nginx nginx" + ]; + services.nginx.serviceConfig = { + LimitNOFILE = 65535; + ReadWritePaths = [ + config.services.lancache.cache.logDir + config.services.lancache.cache.cacheDir + ]; + }; + }; + services.nginx = { + proxyResolveWhileRunning = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + recommendedOptimisation = true; + recommendedGzipSettings = true; + recommendedBrotliSettings = true; + recommendedUwsgiSettings = true; + appendConfig = '' + worker_rlimit_nofile 65535; + ''; + appendHttpConfig = '' + access_log off; + proxy_buffer_size 64k; + proxy_buffers 8 64k; + proxy_busy_buffers_size 128k; + ''; + }; } diff --git a/hosts/tsumugi/networkMounts.nix b/hosts/tsumugi/networkMounts.nix index 22df85c..8cd1316 100644 --- a/hosts/tsumugi/networkMounts.nix +++ b/hosts/tsumugi/networkMounts.nix @@ -6,35 +6,18 @@ ... }: let - useNFS = true; hardMount = true; mntBenisuzume = name: { - fsType = if useNFS then "nfs" else "cifs"; - device = if useNFS then "10.0.4.3:/var/nfs/shared/${name}" else "//10.0.4.3/${name}"; - options = - ( - if useNFS then - [ - "nolock" - ] - else - [ "credentials=${config.sops.secrets."benisuzume/cifs".path}" ] - ) - ++ ( - if hardMount then - [ - "hard" - "intr" - ] - else - [ "soft" ] - ) - ++ [ - "intr" - "fsc" - "retry=infinity" - "timeo=60" - ]; + fsType = "nfs"; + device = "10.0.4.3:/var/nfs/shared/${name}"; + options = [ + "nolock" + "hard" + "async" + "fsc" + "noatime" + "nodiratime" + ]; }; in { @@ -45,8 +28,8 @@ in sops.secrets."benisuzume/cifs" = { }; fileSystems."/mnt/media" = mntBenisuzume "media"; - fileSystems."/mnt/lancache" = mntBenisuzume "lancache"; fileSystems."/mnt/gameservers" = mntBenisuzume "gameservers"; + fileSystems."/mnt/lancache" = mntBenisuzume "lancache"; services.cachefilesd = { enable = true;