Extract shared nextcloud logic
This commit is contained in:
parent
1f7f05d1a0
commit
8fd4dac4a9
1 changed files with 56 additions and 32 deletions
88
flake.nix
88
flake.nix
|
@ -50,9 +50,8 @@
|
|||
"@garage"
|
||||
"@garage-config"
|
||||
];
|
||||
in
|
||||
{
|
||||
modules.shared = { extraPackages ? [ ] }: {
|
||||
|
||||
sharedModule = { extraPackages ? [ ] }: {
|
||||
services.openssh.settings.PasswordAuthentication = false;
|
||||
|
||||
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
|
||||
|
@ -103,46 +102,71 @@
|
|||
};
|
||||
};
|
||||
|
||||
nixosConfigurations.nextcloud2 =
|
||||
nixpkgs.lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
modules = [
|
||||
image-builder.packages.aarch64-linux.modules.rockPro64v2
|
||||
(self.modules.shared
|
||||
{
|
||||
extraPackages = with pkgs; [
|
||||
docker
|
||||
docker-compose
|
||||
];
|
||||
})
|
||||
makeNextcloudConfig = { hostName, volume }: nixpkgs.lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
modules = [
|
||||
image-builder.packages.aarch64-linux.modules.rockPro64v2
|
||||
(sharedModule
|
||||
{
|
||||
networking.hostName = "nextcloud2";
|
||||
extraPackages = with pkgs; [
|
||||
docker
|
||||
docker-compose
|
||||
];
|
||||
})
|
||||
{
|
||||
networking.hostName = hostName;
|
||||
|
||||
virtualisation.docker.enable = true;
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
services.btrbk.instances.btrbk.settings.volume = {
|
||||
"ssh://192.168.20.21/btrfs/hdd" = btrbkSecondary {
|
||||
target-dir = "/btrfs/hdd/@snapshots";
|
||||
subvolumes = nextcloudSubvolumes;
|
||||
};
|
||||
# "/btrfs/hdd" = btrbkPrimary {
|
||||
# subvolumes = nextcloudSubvolumes;
|
||||
# };
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
services.btrbk.instances.btrbk.settings.volume = volume;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
deploy.nodes.nextcloud2 = {
|
||||
hostname = "192.168.20.28";
|
||||
deployer = { hostname, configuration }: {
|
||||
hostname = hostname;
|
||||
profiles.system = {
|
||||
user = "root";
|
||||
sshOpts = [
|
||||
"-i"
|
||||
"/home/asonix/.ssh/nix-installer"
|
||||
];
|
||||
path = deploy-rs.lib.aarch64-linux.activate.nixos self.nixosConfigurations.nextcloud2;
|
||||
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 {
|
||||
target-dir = "/btrfs/hdd/@snapshots";
|
||||
subvolumes = nextcloudSubvolumes;
|
||||
};
|
||||
# "/btrfs/hdd" = btrbkPrimary {
|
||||
# subvolumes = nextcloudSubvolumes;
|
||||
# };
|
||||
};
|
||||
};
|
||||
|
||||
deploy.nodes.nextcloud2 = deployer {
|
||||
hostname = "192.168.20.28";
|
||||
configuration = self.nixosConfigurations.nextcloud2;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue