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,46 +102,71 @@
}; };
}; };
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 (sharedModule
(self.modules.shared
{
extraPackages = with pkgs; [
docker
docker-compose
];
})
{ {
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 = { services.btrbk.instances.btrbk.settings.volume = 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, configuration }: {
hostname = "192.168.20.28"; hostname = hostname;
profiles.system = { profiles.system = {
user = "root"; user = "root";
sshOpts = [ sshOpts = [
"-i" "-i"
"/home/asonix/.ssh/nix-installer" "/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;
};
}; };
} }