updated nfs config

This commit is contained in:
Leyla Becker 2025-03-16 20:34:09 -05:00
parent de6a43a239
commit 7c0c94b47a
2 changed files with 23 additions and 14 deletions

View file

@ -15,7 +15,7 @@ in {
export_directory = lib.mkOption { export_directory = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = "what are exports going to be stored in"; description = "what are exports going to be stored in";
default = "/exports"; default = "/export";
}; };
directories = lib.mkOption { directories = lib.mkOption {
type = lib.types.listOf (lib.types.submodule ({config, ...}: { type = lib.types.listOf (lib.types.submodule ({config, ...}: {
@ -57,7 +57,7 @@ in {
# create any folders that we need to have for our exports # create any folders that we need to have for our exports
systemd.tmpfiles.rules = systemd.tmpfiles.rules =
[ [
"d ${config.host.network_storage.export_directory} 2775 root root -" "d ${config.host.network_storage.export_directory} 2775 nobody nogroup -"
] ]
++ ( ++ (
builtins.map ( builtins.map (
@ -77,14 +77,14 @@ in {
) )
); );
} }
(lib.mkIf config.host.impermanence.enable { # (lib.mkIf config.host.impermanence.enable {
environment.persistence."/persist/system/root" = { # environment.persistence."/persist/system/root" = {
enable = true; # enable = true;
hideMounts = true; # hideMounts = true;
directories = [ # directories = [
config.host.network_storage.export_directory # config.host.network_storage.export_directory
]; # ];
}; # };
}) # })
]); ]);
} }

View file

@ -56,11 +56,20 @@
++ ( ++ (
lib.lists.imap0 ( lib.lists.imap0 (
i: directory: let i: directory: let
option = fsid: "(rw,fsid=${toString fsid},nohide,insecure,no_subtree_check)"; createOptions = fsid: "(rw,fsid=${toString fsid},nohide,insecure,no_subtree_check)";
addresses = ["100.64.0.0/10" "192.168.0.0/24" "127.0.0.1"]; addresses = [
# loopback
"127.0.0.1"
"::1"
# local network
# "192.168.0.0/24"
# tailscale
"100.64.0.0/10"
"fd7a:115c:a1e0::/48"
];
options = lib.strings.concatStrings ( options = lib.strings.concatStrings (
lib.strings.intersperse " " ( lib.strings.intersperse " " (
lib.lists.imap0 (index: address: "${address}${option (1 + (i * (builtins.length addresses)) + index)}") addresses lib.lists.imap0 (index: address: "${address}${createOptions (1 + (i * (builtins.length addresses)) + index)}") addresses
) )
); );
in "${directory._directory} ${options}" in "${directory._directory} ${options}"