From 83722310d5ff9285af09f86179c49febaed4e900 Mon Sep 17 00:00:00 2001 From: Quinn Unger Date: Mon, 2 Dec 2024 17:39:37 +0000 Subject: [PATCH] add lancache --- config/target/tsumugi/lancache.nix | 29 +++++ config/target/tsumugi/networkMounts.nix | 10 +- flake.lock | 134 ++++++++++++++++++++---- flake.nix | 21 +++- lib/setTarget.nix | 2 + secrets/secrets.yaml | 4 +- 6 files changed, 167 insertions(+), 33 deletions(-) create mode 100644 config/target/tsumugi/lancache.nix diff --git a/config/target/tsumugi/lancache.nix b/config/target/tsumugi/lancache.nix new file mode 100644 index 0000000..0d8e308 --- /dev/null +++ b/config/target/tsumugi/lancache.nix @@ -0,0 +1,29 @@ +{ inputs, config, pkgs, lib, target, ... }: +{ + lancache.dns = { + enable = true; + forwarders = [ "10.0.4.1" ]; + cacheIp = "10.0.4.2"; + #cacheIp6 = "fe80::e154:9dfe:dd4f:a1d5"; + cacheNetworks = [ + "10.0.4.0/24" + "fe80::/10" + "2001:bb6:9533:4002::/64" + "127.0.0.0/24" + "::1/128" + ]; + }; + + lancache.cache = { + enable = true; + resolvers = [ "10.0.4.1" ]; + cacheDiskSize = "8000g"; + cacheIndexSize = "2000m"; + nginxWorkerProcesses = "4"; + cacheDir = "/mnt/lancache"; + }; + services.resolved.extraConfig = '' + DNSStubListener=no + ''; + systemd.services.nginx.serviceConfig.LimitNOFILE = 65535; +} diff --git a/config/target/tsumugi/networkMounts.nix b/config/target/tsumugi/networkMounts.nix index 636cbe9..3947853 100644 --- a/config/target/tsumugi/networkMounts.nix +++ b/config/target/tsumugi/networkMounts.nix @@ -1,8 +1,7 @@ -{ inputs, config, pkgs, lib, target, ... }: -{ - fileSystems."/mnt/media" = { +{ inputs, config, pkgs, lib, target, ... }: let + mntBenisuzume = name: { fsType = "nfs"; - device = "10.0.4.3:/var/nfs/shared/media"; + device = "10.0.4.3:/var/nfs/shared/${name}"; options = [ "nfsvers=3" "hard" @@ -10,4 +9,7 @@ "nolock" ]; }; +in { + fileSystems."/mnt/media" = mntBenisuzume "media"; + fileSystems."/mnt/lancache" = mntBenisuzume "lancache"; } \ No newline at end of file diff --git a/flake.lock b/flake.lock index 8d3e9d2..96a0721 100644 --- a/flake.lock +++ b/flake.lock @@ -152,11 +152,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1730504689, - "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", "type": "github" }, "original": { @@ -293,11 +293,11 @@ ] }, "locked": { - "lastModified": 1733133928, - "narHash": "sha256-gU40r9AfpIr4eq+0noM8yH1Hxf+EA3dqfIpFtQl8Y1E=", + "lastModified": 1733389730, + "narHash": "sha256-KZMu4ddMll5khS0rYkJsVD0hVqjMNHlhTM3PCQar0Ag=", "owner": "nix-community", "repo": "home-manager", - "rev": "873e39d5f4437d2f3ab06881fea8e63e45e1d011", + "rev": "65912bc6841cf420eb8c0a20e03df7cbbff5963f", "type": "github" }, "original": { @@ -335,10 +335,40 @@ "type": "github" } }, + "hyprgraphics": { + "inputs": { + "hyprutils": [ + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1733248371, + "narHash": "sha256-FFLJzFTyNhS7tBEEECx0B8Ye/bpmxhFVEKlECgMLc6c=", + "owner": "hyprwm", + "repo": "hyprgraphics", + "rev": "cc95e5babc6065bc3ab4cd195429a9900836ef13", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprgraphics", + "type": "github" + } + }, "hyprland": { "inputs": { "aquamarine": "aquamarine", "hyprcursor": "hyprcursor", + "hyprgraphics": "hyprgraphics", "hyprland-protocols": "hyprland-protocols", "hyprlang": "hyprlang", "hyprutils": "hyprutils", @@ -349,11 +379,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1733073275, - "narHash": "sha256-U6uCJ9EwwAXhezn6sRymF8RGeiad3aw0STIT8c9zgSY=", + "lastModified": 1733369810, + "narHash": "sha256-B+C6wTFfYKiKY/p6xWC2w9xErpG0WpBxKJ8Tj5kxQl0=", "ref": "refs/heads/main", - "rev": "6d7544458d0fafcae410c1978a0cabce2fb4a346", - "revCount": 5507, + "rev": "ceef4fb3a5efe1617790f56e2701846a21c2533d", + "revCount": 5515, "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" @@ -507,6 +537,61 @@ "type": "github" } }, + "lancache": { + "inputs": { + "cache-domains": [ + "lancache-domains" + ], + "monolithic": [ + "lancache-monolithic" + ] + }, + "locked": { + "lastModified": 1733252407, + "narHash": "sha256-AtAk2sAwNsYx52U0inQWUkq0Ml/6gH6jLMsQghgwLzk=", + "owner": "Mop-u", + "repo": "nix-lancache", + "rev": "a4ebafef806d791bb56ccb1c0bc435e7ac618541", + "type": "github" + }, + "original": { + "owner": "Mop-u", + "repo": "nix-lancache", + "type": "github" + } + }, + "lancache-domains": { + "flake": false, + "locked": { + "lastModified": 1729844030, + "narHash": "sha256-MRyIz1l23B/ibVc1sPi6BwtB0imi47z1gqQxm5PM60Q=", + "owner": "uklans", + "repo": "cache-domains", + "rev": "67594ce10c85250bf5e3cc3c6f4a0abb90abd25c", + "type": "github" + }, + "original": { + "owner": "uklans", + "repo": "cache-domains", + "type": "github" + } + }, + "lancache-monolithic": { + "flake": false, + "locked": { + "lastModified": 1733016816, + "narHash": "sha256-KYy0s5pDTeYTjmwOKvnZlwTkTF/djBhUFsa4j7eZwEE=", + "owner": "lancachenet", + "repo": "monolithic", + "rev": "d72fa02f7883201e8307f6bcc4221f7748dede04", + "type": "github" + }, + "original": { + "owner": "lancachenet", + "repo": "monolithic", + "type": "github" + } + }, "libtsm": { "flake": false, "locked": { @@ -590,11 +675,11 @@ ] }, "locked": { - "lastModified": 1733104667, - "narHash": "sha256-77V9I6NiwUaDswdsc5TilIREd7OFs8UAVQ3+++cIPN0=", + "lastModified": 1733363776, + "narHash": "sha256-3EZvm60PErALa91el3zRl+cJCuHmJfqiBzK+EEPnf84=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "5747ec35c936d9d9f58c281111f5ab7115fe13cc", + "rev": "46d4b9024ccd2b36012ba074b330fd955a22295b", "type": "github" }, "original": { @@ -621,14 +706,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1730504152, - "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", + "lastModified": 1733096140, + "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" } }, "nixpkgs-lib_2": { @@ -680,11 +765,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1733015953, - "narHash": "sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE+crk=", + "lastModified": 1733212471, + "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff", + "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", "type": "github" }, "original": { @@ -801,6 +886,9 @@ "hyprland": "hyprland", "hyprswitch": "hyprswitch", "kmscon": "kmscon", + "lancache": "lancache", + "lancache-domains": "lancache-domains", + "lancache-monolithic": "lancache-monolithic", "libtsm": "libtsm", "magnetic-catppuccin-gtk": "magnetic-catppuccin-gtk", "naturaldocs": "naturaldocs", @@ -884,11 +972,11 @@ "stextLSP": { "flake": false, "locked": { - "lastModified": 1731834823, - "narHash": "sha256-wfvnQrJ88z6cIzrBxwFH+ourKkEYs5khdTg56rWrRtA=", + "lastModified": 1733334852, + "narHash": "sha256-tVG5Qlvtfyh+GKvXusIO0ysCjSSo9Udp+3Ej1qR1cDA=", "owner": "sublimelsp", "repo": "LSP", - "rev": "9be040dfc9d6bad3a7d4bb7c41f94f74ac4f0003", + "rev": "8b7afad0527400e113dd6cd0f1f63175bcc599c7", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 3d66c93..0ed0eea 100644 --- a/flake.nix +++ b/flake.nix @@ -13,8 +13,11 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nix-colors.url = "github:misterio77/nix-colors"; + aagl.url = "github:ezKEa/aagl-gtk-on-nix"; + sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -24,7 +27,6 @@ url = "https://github.com/hyprwm/Hyprland"; type = "git"; submodules = true; - #inputs.nixpkgs.follows = "nixpkgs"; }; waybar = { @@ -42,10 +44,21 @@ catppuccin = { url = "github:catppuccin/nix"; }; - aagl = { - url = "github:ezKEa/aagl-gtk-on-nix"; - #inputs.nixpkgs.follows = "nixpkgs"; + + lancache-domains = { + url = "github:uklans/cache-domains"; + flake = false; + }; + lancache-monolithic = { + url = "github:lancachenet/monolithic"; + flake = false; + }; + lancache = { + url = "github:Mop-u/nix-lancache"; + inputs.cache-domains.follows = "lancache-domains"; + inputs.monolithic.follows = "lancache-monolithic"; }; + nonfree-fonts = { url = "github:Mop-u/nonfree-fonts"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/lib/setTarget.nix b/lib/setTarget.nix index 5aa898e..efc5dbe 100644 --- a/lib/setTarget.nix +++ b/lib/setTarget.nix @@ -86,6 +86,8 @@ rec { modules = [ inputs.catppuccin.nixosModules.catppuccin inputs.home-manager.nixosModules.home-manager + inputs.lancache.nixosModules.dns + inputs.lancache.nixosModules.cache inputs.aagl.nixosModules.default inputs.sops-nix.nixosModules.sops inputs.nix-minecraft.nixosModules.minecraft-servers diff --git a/secrets/secrets.yaml b/secrets/secrets.yaml index ddff71e..5104539 100644 --- a/secrets/secrets.yaml +++ b/secrets/secrets.yaml @@ -41,8 +41,8 @@ sops: SDVCSndPQ0E1OXdTVUdpRGYrcUFqYk0KFTvgLXik0lc81p/7tIiwoCqSuYukEXj7 yaxdNHxFhFK3QK6WOCMDjUmEM0G5knDnHfjcGZgAUtzU+chLTmUYhg== -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-12-02T13:20:58Z" - mac: ENC[AES256_GCM,data:sCKU17BbXhL9vJXDxoBMK4iNu7pPq1yk91UVQKInnhPXCdzjtK5Cqf+66OvlHjFCkZMDsJgFOduLtfFfHE1dVQzdP6yaqrKnCrWwFiB7xzOsxG7gKZAGb1wYQkz2LcOMfAllyuaUWVaGDoKsHzuLbyBEF4HR1hFW8MD3T4iZ4hQ=,iv:E4gFrOyzJvJPRwO+DN0TSYfhVblniC25TQXo9Tx0h6Y=,tag:MkrcjMbf0RxdgYrFahvDLg==,type:str] + lastmodified: "2024-12-03T09:48:59Z" + mac: ENC[AES256_GCM,data:rEDDBOEXEuIboyAwHewbDBvUIT8zoyE1uI2/3cCgiUQTRo5Sy+ZBLPDnWWPqZR1LV4S+lg5DORWLD4jb3xAWl6UFT7AaJjDgXQqHT3jkdMLWCAot1VRboLN6z/yK8jJRR+OYOynZHHji3mvwQJLxN809YPmfhHRIc49vNPhY2gc=,iv:Cdh4W76+sVS6pZDuI6oHsSLEmmsDkatPoyhDPpfND+c=,tag:fPRCe9Acpj97np3YrbDRdg==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.9.1 -- knotmirror 0.0.1