Compare commits

..

No commits in common. "4199d6cbb146ad02b05482505bfa9bec236b1b92" and "cc131ff00bb023e810bcdcace7863170a2108020" have entirely different histories.

11 changed files with 20 additions and 125 deletions

View file

@ -43,9 +43,6 @@
node2 = kclib.mkHost {
name = "node2";
};
node-nfs = kclib.mkHost {
name = "node-nfs";
};
};
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;
devShells.x86_64-linux.default =

View file

@ -1,5 +1,4 @@
{
pkgs,
...
}:
{
@ -33,9 +32,5 @@
services.qemuGuest.enable = true;
environment.systemPackages = [
pkgs.nfs-utils
];
system.stateVersion = "24.11";
}

View file

@ -1,24 +0,0 @@
{ ... }:
{
kropcloud =
let
serverIp = "192.168.1.180";
in
{
drives.hasSecondDrive = true;
services = {
nfs = {
enable = true;
exportDirectory = "/mnt/nas";
clusterWildcard = "192.168.1.0/24";
};
};
networking = {
ipv4 = {
address = serverIp;
prefixLength = 24;
defaultGateway = "192.168.1.1";
};
};
};
}

View file

@ -9,11 +9,6 @@ in
{
options.kropcloud.drives = {
hasSecondDrive = lib.mkEnableOption "Whence this VM has second drive";
secondDriveMountpoint = lib.mkOption {
type = lib.types.str;
default = "/mnt/nas";
description = "The mountpoint for the second drive";
};
};
config = {
disko.devices = {
@ -50,22 +45,6 @@ in
};
};
};
secondary = lib.mkIf cfg.hasSecondDrive {
type = "disk";
device = "/dev/sdb";
content = {
type = "gpt";
partitions = {
data = {
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/mnt/nas";
};
};
};
};
};
};
};
};

View file

@ -52,40 +52,25 @@ in
services.avahi = {
enable = true;
openFirewall = true;
};
networking = {
nftables.enable = true;
firewall = {
checkReversePath = "loose";
allowedUDPPorts =
[ ]
++ lib.optionals kc_cfg.services.k3s.enable [
8472
]
++ lib.optionals kc_cfg.services.nfs.enable [
4000
4001
4002
2049
111
];
allowedTCPPorts =
[ ]
++ lib.optionals kc_cfg.services.k3s.enable [
2379
2380
6443
10250
]
++ lib.optionals kc_cfg.services.nfs.enable [
4000
4001
4002
2049
111
];
allowedUDPPorts = []
++ lib.optionals kc_cfg.services.k3s.enable
[
8472
];
allowedTCPPorts = []
++ lib.optionals kc_cfg.services.k3s.enable
[
2379
2380
6443
10250
];
};
interfaces = {
ens18 = {

View file

@ -5,6 +5,5 @@
./tailscale
./hydra
./k3s
./nfs
];
}

View file

@ -44,7 +44,10 @@ in
"--disable local-storage"
]
++ (
if (!cfg.isMaster && cfg.master != null) then [ "--server https://${cfg.master}:6443" ] else [ ]
if (!cfg.isMaster && cfg.master != null) then
[ "--server https://${cfg.master}:6443" ]
else
[ ]
)
);
clusterInit = cfg.isMaster;

View file

@ -1,35 +0,0 @@
{
config,
lib,
...
}:
let
cfg = config.kropcloud.services.nfs;
kc_cfg = config.kropcloud;
in
{
options.kropcloud.services.nfs = {
enable = lib.mkEnableOption "Whence to enable nfs service.";
exportDirectory = lib.mkOption {
type = lib.types.str;
default = "/mnt/nas";
description = "The directory to export.";
};
clusterWildcard = lib.mkOption {
type = lib.types.str;
default = "*";
description = "The wildcard to use for cluster.";
};
};
config = lib.mkIf cfg.enable {
services.nfs.server = {
enable = true;
exports = ''
${cfg.exportDirectory} ${cfg.clusterWildcard}(rw,sync,no_wdelay,no_root_squash,insecure)
'';
statdPort = 4000;
lockdPort = 4001;
mountdPort = 4002;
};
};
}

Binary file not shown.

View file

@ -7,8 +7,7 @@
"test-server": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID4ioqiTzYe6Y6H0YfFkWyDBbCB25wYs3gKNZIufE/Sn",
"node0": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIITESdAzft5+WqMWM2A9Tix8BDWGnVv3z0IF8mqXwWA0",
"node1": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMxhznyKJwumO3jzm9kjH+lZJln7fypT8YKAdLNhVspU",
"node2": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOkaqX7Omdrfa4Ot3J+k6EBUkPWp/frEYIFzS1OLc3tw",
"node-nfs": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKv1xIg3+faoigxh6S9hUJMIPe2KP6Qb3PQtvFynkrtI"
"node2": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOkaqX7Omdrfa4Ot3J+k6EBUkPWp/frEYIFzS1OLc3tw"
},
"secrets": {
"mypassword.age": [
@ -17,17 +16,14 @@
"servers:test-server",
"servers:node0",
"servers:node1",
"servers:node2",
"servers:node-nfs",
"servers:node-nfs"
"servers:node2"
],
"k3stoken.age": [
"hosts:wenar-nix",
"hosts:lenar",
"servers:node0",
"servers:node1",
"servers:node2",
"servers:node-nfs"
"servers:node2"
]
}
}

Binary file not shown.