Extract shared nextcloud logic

This commit is contained in:
asonix 2023-01-24 22:55:24 -06:00
parent 1f7f05d1a0
commit 8fd4dac4a9

View file

@ -50,9 +50,8 @@
"@garage" "@garage"
"@garage-config" "@garage-config"
]; ];
in
{ sharedModule = { extraPackages ? [ ] }: {
modules.shared = { extraPackages ? [ ] }: {
services.openssh.settings.PasswordAuthentication = false; services.openssh.settings.PasswordAuthentication = false;
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default) # Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
@ -103,12 +102,11 @@
}; };
}; };
nixosConfigurations.nextcloud2 = makeNextcloudConfig = { hostName, volume }: nixpkgs.lib.nixosSystem {
nixpkgs.lib.nixosSystem {
system = "aarch64-linux"; system = "aarch64-linux";
modules = [ modules = [
image-builder.packages.aarch64-linux.modules.rockPro64v2 image-builder.packages.aarch64-linux.modules.rockPro64v2
(self.modules.shared (sharedModule
{ {
extraPackages = with pkgs; [ extraPackages = with pkgs; [
docker docker
@ -116,11 +114,46 @@
]; ];
}) })
{ {
networking.hostName = "nextcloud2"; networking.hostName = hostName;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
services.btrbk.instances.btrbk.settings.volume = { services.btrbk.instances.btrbk.settings.volume = volume;
}
];
};
deployer = { hostname, configuration }: {
hostname = hostname;
profiles.system = {
user = "root";
sshOpts = [
"-i"
"/home/asonix/.ssh/nix-installer"
];
path = deploy-rs.lib.aarch64-linux.activate.nixos configuration;
};
};
in
{
nixosConfigurations.nextcloud1 = makeNextcloudConfig {
hostName = "nextcloud1";
volume = {
# "ssh://192.168.20.28/btrfs/hdd" = btrbkSecondary {
# target-dir = "/btrfs/hdd/@snapshots";
# subvolumes = nextcloudSubvolumes;
# };
"/btrfs/hdd" = btrbkPrimary {
subvolumes = nextcloudSubvolumes;
};
};
};
nixosConfigurations.nextcloud2 =
makeNextcloudConfig {
hostName = "nextcloud2";
volume = {
"ssh://192.168.20.21/btrfs/hdd" = btrbkSecondary { "ssh://192.168.20.21/btrfs/hdd" = btrbkSecondary {
target-dir = "/btrfs/hdd/@snapshots"; target-dir = "/btrfs/hdd/@snapshots";
subvolumes = nextcloudSubvolumes; subvolumes = nextcloudSubvolumes;
@ -129,20 +162,11 @@
# subvolumes = nextcloudSubvolumes; # subvolumes = nextcloudSubvolumes;
# }; # };
}; };
}
];
}; };
deploy.nodes.nextcloud2 = { deploy.nodes.nextcloud2 = deployer {
hostname = "192.168.20.28"; hostname = "192.168.20.28";
profiles.system = { configuration = self.nixosConfigurations.nextcloud2;
user = "root";
sshOpts = [
"-i"
"/home/asonix/.ssh/nix-installer"
];
path = deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.nextcloud2;
};
}; };
}; };
} }