Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions hosts/servers/trenderhoof.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ ... }:

{
imports = [ ../../hardware/virtualized.nix ];

networking.hostName = "trenderhoof";

ocf.network = {
enable = true;
lastOctet = 77;
};

ocf.nfs = {
enable = true;
# https://github.com/ocf/puppet/blob/a081b2210691bd46d585accc8548c985188486a0/modules/ocf_filehost/manifests/init.pp#L10-L16
exports = [
{
directory = "/opt/homes";
hosts = [
"admin"
"www"
"ssh"
"apphost"
"adenine"
"guanine"
"cytosine"
"thymine"
"fluttershy"
"rainbowdash"
];
options = [
"rw"
"fsid=0"
"no_subtree_check"
"no_root_squash"
];
}
];
};

system.stateVersion = "25.11";
}
1 change: 1 addition & 0 deletions modules/ocf/managed-deployment.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ in
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMdAe7sPMxaidnqOah3UVrjt41KFHHOYleS1VWGH+ZUc" # storce
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAICW8L5pydSCGwBstSlXWNSQh//wmRB03RmAWaT3u7+8hAAAABHNzaDo=" # sbwilliams primary hardware token
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIIsQXwbC4lVR8qMbduDWHVNvjfqD1m8yYbjdEOGCNVNPAAAABHNzaDo=" # sbwilliams secondary hardware token
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF6TAvD4mDHB7BRgCgG50IOc0417lgpYxG8qZ2d7DesV" # dotlambda
];
};

Expand Down
59 changes: 59 additions & 0 deletions modules/ocf/nfs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{ config, lib, ... }:

let
inherit (lib)
concatMapStrings
concatMapStringsSep
concatStringsSep
mkEnableOption
mkIf
mkOption
types
;
cfg = config.ocf.nfs;
in
{
options.ocf.nfs = {
enable = mkEnableOption "NFS exports";
exports = mkOption {
type = types.listOf (
types.submodule {
options = {
directory = mkOption {
type = types.path;
};
hosts = mkOption {
description = "Hosts with which the export is shared";
example = [
"192.168.0.0/28"
"*.ocf.io"
];
type = with types; nonEmptyListOf str;
};
options = mkOption {
default = [ ];
description = "NFS options applied to all hosts";
example = [ "rw" ];
type = with types; listOf str;
};
};
}
);
};
};

config = mkIf cfg.enable {
services.nfs.server = {
enable = true;
# https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/5/html/deployment_guide/s1-nfs-server-config-exports
exports = lib.traceValSeq (
concatMapStrings (export: ''
${export.directory} \
${concatMapStringsSep " \\\n " (
host: "${host}(${concatStringsSep " " export.options})"
) export.hosts}
'') cfg.exports
);
};
};
}