Improve NFS handling

This commit is contained in:
Thomas Avé 2024-09-22 16:27:43 +02:00
parent a1f35cf72d
commit 016535a111
6 changed files with 95 additions and 44 deletions

View File

@ -99,11 +99,11 @@
]
},
"locked": {
"lastModified": 1726823634,
"narHash": "sha256-rU8Yy62KSLU8Q2J64F+50OJKORNdogxbXl2w4rFw13o=",
"lastModified": 1726985855,
"narHash": "sha256-NJPGK030Y3qETpWBhj9oobDQRbXdXOPxtu+YgGvZ84o=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "4803bf558bdf20cb067aceb8830b7ad70113f4e3",
"rev": "04213d1ce4221f5d9b40bcee30706ce9a91d148d",
"type": "github"
},
"original": {
@ -153,11 +153,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1726825661,
"narHash": "sha256-bnUrJnpDHtfnb6gJwJPBS74kVXnZrecpNbVlq75Oqeg=",
"lastModified": 1726995313,
"narHash": "sha256-HTbsXJDFugdQ794d1Bnh8eRSY7AlunIxd7jFW9kkKNM=",
"ref": "refs/heads/main",
"rev": "9e98fb0167f8bc6c5eb4510a65b42aaa3b743421",
"revCount": 5241,
"rev": "e5ff19ac0f2c8d53a0c847d06a17676e636d6447",
"revCount": 5247,
"submodules": true,
"type": "git",
"url": "https://github.com/hyprwm/Hyprland"
@ -236,11 +236,11 @@
]
},
"locked": {
"lastModified": 1724966483,
"narHash": "sha256-WXDgKIbzjYKczxSZOsJplCS1i1yrTUpsDPuJV/xpYLo=",
"lastModified": 1726874949,
"narHash": "sha256-PNnIpwGqpTvMU3N2r0wMQwK1E+t4Bb5fbJwblQvr+80=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "8976e3f6a5357da953a09511d0c7f6a890fb6ec2",
"rev": "d97af4f6bd068c03a518b597675e598f57ea2291",
"type": "github"
},
"original": {
@ -261,11 +261,11 @@
]
},
"locked": {
"lastModified": 1721324119,
"narHash": "sha256-SOOqIT27/X792+vsLSeFdrNTF+OSRp5qXv6Te+fb2Qg=",
"lastModified": 1726840673,
"narHash": "sha256-HIPEXyRRVZoqD6U+lFS1B0tsIU7p83FaB9m7KT/x6mQ=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "a048a6cb015340bd82f97c1f40a4b595ca85cc30",
"rev": "b68dab23fc922eae99306988133ee80a40b39ca5",
"type": "github"
},
"original": {
@ -323,11 +323,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1725983898,
"narHash": "sha256-4b3A9zPpxAxLnkF9MawJNHDtOOl6ruL0r6Og1TEDGCE=",
"lastModified": 1726755586,
"narHash": "sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK+Wk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1355a0cbfeac61d785b7183c0caaec1f97361b43",
"rev": "c04d5652cfa9742b1d519688f65d1bbccea9eb7e",
"type": "github"
},
"original": {
@ -339,11 +339,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1726463316,
"narHash": "sha256-gI9kkaH0ZjakJOKrdjaI/VbaMEo9qBbSUl93DnU7f4c=",
"lastModified": 1726755586,
"narHash": "sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK+Wk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "99dc8785f6a0adac95f5e2ab05cc2e1bf666d172",
"rev": "c04d5652cfa9742b1d519688f65d1bbccea9eb7e",
"type": "github"
},
"original": {
@ -355,11 +355,11 @@
},
"nur": {
"locked": {
"lastModified": 1726824598,
"narHash": "sha256-kFWCW7nD9RoUbrlNW1lE9ElmtSmWD/E9HMNJ7z3fJ8o=",
"lastModified": 1727011111,
"narHash": "sha256-2mgUfBkeAd7TL0Iphk2LcrSRrPQEaeAwO5KfpGVnpm4=",
"owner": "nix-community",
"repo": "NUR",
"rev": "cf86f6490757943388c0770c3a68845b172e8f76",
"rev": "dc07e8263258662a2ca0c66df18eabca98e82823",
"type": "github"
},
"original": {
@ -438,6 +438,14 @@
"hyprland",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
@ -448,11 +456,11 @@
]
},
"locked": {
"lastModified": 1726046979,
"narHash": "sha256-6SEsjurq9cdTkITA6d49ncAJe4O/8CgRG5/F//s6Xh8=",
"lastModified": 1726933538,
"narHash": "sha256-xTqnMoJsEojuvqJLuM+U7EZ7q71efaj3pbvjutq4TXc=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "e695669fd8e1d1be9eaae40f35e00f8bd8b64c18",
"rev": "4880c50146d0c2a3152d2b02f79253810c330c11",
"type": "github"
},
"original": {

View File

@ -1,10 +1,12 @@
{ pkgs, inputs, config, ... }:
{
let
serverIP = "10.0.0.1";
in {
imports = [
(import ../Common/default.nix { inherit inputs pkgs config; })
(import ../Common/nvidia.nix { inherit inputs pkgs config; })
(import ../Common/desktop.nix { inherit inputs pkgs config; })
(import ../Common/nfs.nix { inherit inputs pkgs config; })
(import ../Common/nfs.nix { inherit pkgs serverIP; })
];
hardware.graphics.extraPackages = [
pkgs.intel-compute-runtime
@ -29,7 +31,7 @@
address = [ "10.0.0.5/24" "2a02:a03f:83ad:2101::5/128" ];
privateKeyFile = "/home/user/.secrets/Wireguard/Aloria.key";
listenPort = 51820;
autostart = true;
autostart = false;
postUp = "resolvectl dns Tunnel 10.0.0.1; resolvectl domain Tunnel ~thomasave.be;";
dns = ["10.0.0.1"];
peers = [{
@ -43,7 +45,7 @@
address = [ "10.0.0.5/24" "2a02:a03f:83ad:2101::5/128" ];
privateKeyFile = "/home/user/.secrets/Wireguard/Aloria.key";
listenPort = 51820;
autostart = false;
autostart = true;
postUp = "resolvectl dns OPNsense 10.0.0.1; resolvectl domain OPNsense ~thomasave.be;";
dns = ["10.0.0.1"];
peers = [{
@ -54,7 +56,7 @@
}];
};
};
fileSystems."/home/server".device = pkgs.lib.mkForce "10.0.0.1:/home/server";
# fileSystems."/home/server".device = pkgs.lib.mkForce "10.0.0.1:/home/server";
services.upower.enable = true;
networking.wireless.iwd.enable = true;

View File

@ -10,6 +10,7 @@
boot.loader.timeout = 1;
boot.loader.efi.canTouchEfiVariables = true;
systemd.extraConfig = "DefaultTimeoutStopSec=10s";
systemd.services.systemd-user-sessions.enable = false;
boot.kernelPackages = pkgs.linuxPackages_latest;
services.thermald.enable = true;

View File

@ -1,24 +1,61 @@
{ ... }:
{
fileSystems."/home/server" = {
device = "192.168.1.2:/home/server";
{pkgs, serverIP, ...}:
let
sharePath = "/home/server";
mountPath = "/home/server";
common_options = [
"noauto"
"_netdev"
"x-systemd.automount"
"x-systemd.idle-timeout=600"
"x-systemd.device-timeout=2s"
"x-systemd.mount-timeout=2s"
"timeo=5"
"x-gvfs-hide"
"x-systemd.after=network-online.target"
"x-systemd.requires=network-online.target"
];
bind_options = [
"bind"
"x-systemd.after=${builtins.replaceStrings ["/"] ["-"] mountPath}.mount"
] ++ common_options;
in {
services.rpcbind.enable = true;
boot.supportedFilesystems = [ "nfs" ];
fileSystems.${mountPath} = {
device = "${serverIP}:${sharePath}";
fsType = "nfs";
options = [ "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" ];
options = [
"x-systemd.after=wg-quick-Tunnel.service"
"x-systemd.after=wg-quick-OPNsense.service"
] ++ common_options;
};
systemd.services."${builtins.replaceStrings ["/"] ["-"] mountPath}-unmount" = {
description = "Unmount NFS share before shutdown";
wantedBy = [ "shutdown.target" ];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "/bin/true";
ExecStop = "${pkgs.util-linux}/bin/umount -f -l ${mountPath}";
TimeoutStopSec = "10s";
};
};
fileSystems."/home/user/Workspace" = {
device = "/home/server/Workspace";
options = [ "bind" "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" "x-gvfs-hide"];
options = bind_options;
};
fileSystems."/home/user/Documents" = {
device = "/home/server/Storage/Thomas/Documents";
options = [ "bind" "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" "x-gvfs-hide"];
options = bind_options;
};
fileSystems."/home/user/Pictures" = {
device = "/home/server/Storage/Thomas/Pictures";
options = [ "bind" "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" "x-gvfs-hide"];
options = bind_options;
};
fileSystems."/home/user/Videos" = {
device = "/home/server/Storage/Thomas/Videos";
options = [ "bind" "x-systemd.automount" "x-systemd.mount-timeout=1" "_netdev" "noauto" "timeo=1" "x-gvfs-hide"];
options = bind_options;
};
}

View File

@ -1,10 +1,11 @@
{ inputs, config, pkgs, ... }:
{
let
serverIP = "192.168.1.2";
in {
imports = [
(import ../Common/default.nix { inherit inputs pkgs; })
(import ../Common/desktop.nix { inherit inputs pkgs config; })
(import ../Common/nfs.nix { inherit inputs pkgs config; })
(import ../Common/nfs.nix { inherit pkgs serverIP; })
];
# AMD CPU

View File

@ -1,8 +1,10 @@
{ inputs, config, pkgs, ... }:
{
let
serverIP = "192.168.1.2";
in {
imports = [
(import ../Common/default.nix { inherit inputs config pkgs; })
(import ../Common/nfs.nix { inherit inputs pkgs config; })
(import ../Common/nfs.nix { inherit pkgs serverIP; })
];
services.ollama = {