diff --git a/flakes/common/nix_modules/essentials/default.nix b/flakes/common/nix_modules/essentials/default.nix index 7bc19c55..12dcbf01 100644 --- a/flakes/common/nix_modules/essentials/default.nix +++ b/flakes/common/nix_modules/essentials/default.nix @@ -30,6 +30,7 @@ with lib; killall speedtest-cli parted + fio ]; environment.shellAliases = { @@ -55,6 +56,8 @@ with lib; # ripgrep rg = "rg --no-ignore"; rgf = "rg --files --glob '!/nix/store/**' 2>/dev/null | rg"; + + speedtest_internet = "speedtest-cli"; }; environment.shellInit = lib.concatStringsSep "\n\n" [ diff --git a/flakes/common/nix_modules/essentials/unix_utils.func.sh b/flakes/common/nix_modules/essentials/unix_utils.func.sh index 3120f6d2..a6c4907f 100644 --- a/flakes/common/nix_modules/essentials/unix_utils.func.sh +++ b/flakes/common/nix_modules/essentials/unix_utils.func.sh @@ -50,16 +50,77 @@ mail_clear() { speedtest_fs () { dir=$(pwd) - drive=$(df -h ${dir} | awk 'NR==2 {print $1}') - echo Testing read speeds on drive ${drive} - sudo hdparm -Tt ${drive} - test_file=$(date +%u%m%d) - test_file="${dir}/speedtest_fs_${test_file}" + drive=$(df -h "${dir}" | awk 'NR==2 {print $1}') + echo "Testing filesystem on: ${dir}" + echo "Underlying device: ${drive}" echo - echo Testing write speeds into test file: ${test_file} - dd if=/dev/zero of=${test_file} bs=8k count=10k; rm -f ${test_file} -} -speedtest_internet () { - speedtest-cli + test_file="${dir}/speedtest_fs_$(date +%u%m%d).fio" + file_size=1G # size of the test file + runtime=5 # seconds per test + + cleanup() { + if [ -n "${test_file:-}" ] && [ -f "${test_file}" ]; then + echo + echo "Cleaning up test file: ${test_file}" + rm -f "${test_file}" + fi + } + + # Ensure cleanup on normal exit, Ctrl+C, etc. + trap cleanup EXIT INT TERM + + echo "Creating test file (${file_size}) at: ${test_file}" + fio --name=precreate \ + --filename="${test_file}" \ + --rw=write \ + --bs=1M \ + --size="${file_size}" \ + --iodepth=16 \ + --direct=1 \ + --numjobs=1 \ + --group_reporting >/dev/null 2>&1 + + echo + echo "=== Sequential write test (${runtime}s) ===" + fio --name=seqwrite \ + --filename="${test_file}" \ + --rw=write \ + --bs=1M \ + --size="${file_size}" \ + --iodepth=16 \ + --direct=1 \ + --numjobs=1 \ + --time_based \ + --runtime="${runtime}" \ + --group_reporting + + echo + echo "=== Sequential read test (${runtime}s) ===" + fio --name=seqread \ + --filename="${test_file}" \ + --rw=read \ + --bs=1M \ + --size="${file_size}" \ + --iodepth=16 \ + --direct=1 \ + --numjobs=1 \ + --time_based \ + --runtime="${runtime}" \ + --group_reporting + + echo + echo "=== Random read/write test (${runtime}s, 70% reads, 4k blocks) ===" + fio --name=randrw \ + --filename="${test_file}" \ + --rw=randrw \ + --rwmixread=70 \ + --bs=4k \ + --size="${file_size}" \ + --iodepth=32 \ + --direct=1 \ + --numjobs=4 \ + --time_based \ + --runtime="${runtime}" \ + --group_reporting } diff --git a/flakes/opencode/flake.lock b/flakes/opencode/flake.lock index 35b16e4d..c41ca50b 100644 --- a/flakes/opencode/flake.lock +++ b/flakes/opencode/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1766125104, - "narHash": "sha256-l/YGrEpLromL4viUo5GmFH3K5M1j0Mb9O+LiaeCPWEM=", + "lastModified": 1766870016, + "narHash": "sha256-fHmxAesa6XNqnIkcS6+nIHuEmgd/iZSP/VXxweiEuQw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7d853e518814cca2a657b72eeba67ae20ebf7059", + "rev": "5c2bc52fb9f8c264ed6c93bd20afa2ff5e763dce", "type": "github" }, "original": { @@ -21,11 +21,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1766426038, - "narHash": "sha256-3TxsJjL5M83q9nOa4ls6rWfbECYUE6llzBAgqCYQml8=", + "lastModified": 1767028968, + "narHash": "sha256-Z6Jk9Ee3+KHaQf7V/zbHHgotZ0gQA5Mtqpzs8PAQmBY=", "owner": "sst", "repo": "opencode", - "rev": "6baee0791f48bcf32eef1e199d0cadca57772b9b", + "rev": "b7ce46f7a12e68283d6588c33aaf972426ddd65e", "type": "github" }, "original": { diff --git a/hosts/h002/flake.lock b/hosts/h002/flake.lock index c90d1881..ce89d194 100644 --- a/hosts/h002/flake.lock +++ b/hosts/h002/flake.lock @@ -64,11 +64,11 @@ "common": { "locked": { "dir": "flakes/common", - "lastModified": 1766101431, - "narHash": "sha256-96UMxqqZjI9L9SEBwL3yxbJBH5NC9Gq+kgAS4GQaWqE=", + "lastModified": 1767040959, + "narHash": "sha256-YZyIBq1N0iRMN+R/LGNLmmkSmimer6MMysP032xC3C8=", "ref": "refs/heads/master", - "rev": "a5fa2f1e63efc1111940bf2c636e4043381886cd", - "revCount": 959, + "rev": "d4f62bef186fd1a16510854754f5b328c3e4cab8", + "revCount": 993, "type": "git", "url": "https://git.joshuabell.xyz/ringofstorms/dotfiles" }, diff --git a/hosts/h002/flake.nix b/hosts/h002/flake.nix index 39db9da3..75620a84 100644 --- a/hosts/h002/flake.nix +++ b/hosts/h002/flake.nix @@ -66,7 +66,7 @@ token = "11714da6-fd2e-436a-8b83-e0e07ba33a95"; }; services.beszel.agent.environment = { - EXTRA_FILESYSTEMS = "sdb__Data"; + EXTRA_FILESYSTEMS = "/data__Data"; }; }) diff --git a/hosts/h002/hardware-configuration.nix b/hosts/h002/hardware-configuration.nix index cb8dfd17..3bf05b3f 100644 --- a/hosts/h002/hardware-configuration.nix +++ b/hosts/h002/hardware-configuration.nix @@ -46,9 +46,10 @@ fsType = "bcachefs"; options = [ "defaults" - "compression=zstd" - "fsck" - "fix_errors" + # "fsck" + # "fix_errors" + "x-systemd.device-timeout=600s" + "nofail" ]; }; diff --git a/hosts/h002/nfs-data.nix b/hosts/h002/nfs-data.nix index f796c878..79eac45b 100644 --- a/hosts/h002/nfs-data.nix +++ b/hosts/h002/nfs-data.nix @@ -1,13 +1,46 @@ -{ pkgs, ... }: { - services.nfs.server = { - enable = true; - exports = '' - /data 100.64.0.0/10(rw,sync,no_subtree_check,fsid=0,crossmnt) - ''; - }; + pkgs, + config, + lib, + ... +}: +lib.mkMerge [ + ({ + services.nfs.server = { + enable = true; + exports = '' + /data 100.64.0.0/10(rw,sync,no_subtree_check,fsid=0,crossmnt) + /data 10.12.14.0/10(rw,sync,no_subtree_check,fsid=0,crossmnt) + ''; + }; - environment.systemPackages = [ - pkgs.nfs-utils - ]; -} + environment.systemPackages = [ + pkgs.nfs-utils + ]; + }) + # Open ports and expose so local network works + (lib.mkIf config.networking.firewall.enable { + services.rpcbind.enable = true; + services.nfs.server.lockdPort = 32803; + services.nfs.server.mountdPort = 892; + services.nfs.server.statdPort = 662; + + networking.firewall = { + allowedTCPPorts = [ + 2049 + 111 + 892 + 32803 + 662 + ]; + allowedUDPPorts = [ + 2049 + 111 + 892 + 32803 + 662 + ]; + }; + + }) +] diff --git a/hosts/h003/mods/networking.nix b/hosts/h003/mods/networking.nix index 2e6c8fa7..cd97830b 100644 --- a/hosts/h003/mods/networking.nix +++ b/hosts/h003/mods/networking.nix @@ -197,7 +197,7 @@ # Static DHCP reservations dhcp-host = [ "00:be:43:b9:f4:e0,H001,10.12.14.10" - "54:04:a6:32:d1:71,H002,10.12.14.10" + "54:04:a6:32:d1:71,H002,10.12.14.183" "c8:c9:a3:2b:7b:19,PRUSA-MK4,10.12.14.21" "24:e8:53:73:a3:c6,LGWEBOSTV,10.12.14.30" "2c:cf:67:6a:45:47,HOMEASSISTANT,10.12.14.22" diff --git a/hosts/lio/flake.lock b/hosts/lio/flake.lock index 04973b85..d812b6bd 100644 --- a/hosts/lio/flake.lock +++ b/hosts/lio/flake.lock @@ -64,11 +64,11 @@ "common": { "locked": { "dir": "flakes/common", - "lastModified": 1766961967, - "narHash": "sha256-ccLRTjpQ3tqvNMMhCn02+WS74KE0i8bYLI/Jh4GdoiQ=", + "lastModified": 1767040810, + "narHash": "sha256-7ylVqMemlv1lAT05ymJIrQRhDxwC84ncDheJWbdMkGw=", "ref": "refs/heads/master", - "rev": "6b023457ec9053e748bc49ac3e28ea82e2f998d4", - "revCount": 975, + "rev": "677c5a2c4eb222cca9b740f10463c638fca3ada6", + "revCount": 992, "type": "git", "url": "https://git.joshuabell.xyz/ringofstorms/dotfiles" }, @@ -321,11 +321,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1766125104, - "narHash": "sha256-l/YGrEpLromL4viUo5GmFH3K5M1j0Mb9O+LiaeCPWEM=", + "lastModified": 1766870016, + "narHash": "sha256-fHmxAesa6XNqnIkcS6+nIHuEmgd/iZSP/VXxweiEuQw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7d853e518814cca2a657b72eeba67ae20ebf7059", + "rev": "5c2bc52fb9f8c264ed6c93bd20afa2ff5e763dce", "type": "github" }, "original": { @@ -1237,11 +1237,11 @@ }, "locked": { "dir": "flakes/opencode", - "lastModified": 1766961967, - "narHash": "sha256-ccLRTjpQ3tqvNMMhCn02+WS74KE0i8bYLI/Jh4GdoiQ=", + "lastModified": 1767029710, + "narHash": "sha256-MqilsCw9R5Rnq6qFBVctn/WtYO6vA8Rlt14tgKiIC/s=", "ref": "refs/heads/master", - "rev": "6b023457ec9053e748bc49ac3e28ea82e2f998d4", - "revCount": 975, + "rev": "3f8232e8f98713bc74c8f4ace0694cdc19ae2d3d", + "revCount": 988, "type": "git", "url": "https://git.joshuabell.xyz/ringofstorms/dotfiles" }, @@ -1256,11 +1256,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1766426038, - "narHash": "sha256-3TxsJjL5M83q9nOa4ls6rWfbECYUE6llzBAgqCYQml8=", + "lastModified": 1767028968, + "narHash": "sha256-Z6Jk9Ee3+KHaQf7V/zbHHgotZ0gQA5Mtqpzs8PAQmBY=", "owner": "sst", "repo": "opencode", - "rev": "6baee0791f48bcf32eef1e199d0cadca57772b9b", + "rev": "b7ce46f7a12e68283d6588c33aaf972426ddd65e", "type": "github" }, "original": { diff --git a/hosts/lio/flake.nix b/hosts/lio/flake.nix index 7b1be4d7..6b439c84 100644 --- a/hosts/lio/flake.nix +++ b/hosts/lio/flake.nix @@ -185,6 +185,7 @@ vlang ttyd pavucontrol + nfs-utils ]; services.flatpak.packages = [