2024-10-01 13:07:09 +02:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
2024-11-07 17:10:05 +01:00
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
|
2024-10-01 13:07:09 +02:00
|
|
|
snf.url = "git+https://git.fediversity.eu/fediversity/simple-nixos-fediverse.git";
|
2024-10-01 13:56:15 +02:00
|
|
|
disko.url = "github:nix-community/disko";
|
2024-11-07 18:08:29 +01:00
|
|
|
|
|
|
|
nixops4.url = "github:nixops4/nixops4";
|
|
|
|
nixops4-nixos.url = "github:nixops4/nixops4/eval";
|
2024-10-01 13:07:09 +02:00
|
|
|
};
|
|
|
|
|
2024-11-08 16:15:39 +01:00
|
|
|
outputs =
|
|
|
|
inputs@{
|
|
|
|
self,
|
|
|
|
flake-parts,
|
|
|
|
nixpkgs,
|
|
|
|
snf,
|
|
|
|
...
|
|
|
|
}:
|
2024-11-07 17:10:05 +01:00
|
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
2024-10-01 13:07:09 +02:00
|
|
|
|
2024-11-08 16:15:39 +01:00
|
|
|
imports = [ inputs.nixops4-nixos.modules.flake.default ];
|
|
|
|
|
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"aarch64-linux"
|
|
|
|
"aarch64-darwin"
|
|
|
|
"x86_64-darwin"
|
2024-11-07 18:08:29 +01:00
|
|
|
];
|
2024-10-01 13:07:09 +02:00
|
|
|
|
2024-11-08 16:15:39 +01:00
|
|
|
perSystem =
|
|
|
|
{
|
|
|
|
config,
|
|
|
|
self',
|
|
|
|
inputs',
|
|
|
|
pkgs,
|
|
|
|
system,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
|
|
|
formatter = pkgs.nixfmt-rfc-style;
|
2024-10-01 13:56:15 +02:00
|
|
|
|
2024-11-08 16:15:39 +01:00
|
|
|
devShells.default = pkgs.mkShell { packages = [ inputs'.nixops4.packages.default ]; };
|
2024-11-07 17:10:05 +01:00
|
|
|
};
|
2024-10-01 13:07:09 +02:00
|
|
|
|
2024-11-08 16:15:39 +01:00
|
|
|
flake.allVmIds = [
|
|
|
|
"101"
|
|
|
|
"102"
|
|
|
|
"103"
|
|
|
|
"104"
|
|
|
|
"105"
|
|
|
|
"106"
|
|
|
|
"107"
|
|
|
|
"108"
|
|
|
|
"109"
|
|
|
|
"110"
|
|
|
|
];
|
2024-11-07 17:10:05 +01:00
|
|
|
|
|
|
|
flake.nixosConfigurations.provisioning =
|
|
|
|
let
|
|
|
|
inherit (builtins) map listToAttrs;
|
2024-11-08 16:15:39 +01:00
|
|
|
makeProvisioningConfiguration =
|
|
|
|
vmid:
|
|
|
|
nixpkgs.lib.nixosSystem {
|
|
|
|
modules = [
|
|
|
|
{ procolix.vmid = vmid; }
|
|
|
|
./procolixVm.nix
|
|
|
|
inputs.disko.nixosModules.default
|
|
|
|
];
|
|
|
|
};
|
2024-11-07 17:10:05 +01:00
|
|
|
in
|
2024-11-08 16:15:39 +01:00
|
|
|
listToAttrs (
|
|
|
|
map (vmid: {
|
|
|
|
name = "fedi${vmid}";
|
|
|
|
value = makeProvisioningConfiguration vmid;
|
|
|
|
}) self.allVmIds
|
|
|
|
);
|
2024-11-07 17:10:05 +01:00
|
|
|
|
|
|
|
flake.isoInstallers.provisioning =
|
2024-11-08 16:15:39 +01:00
|
|
|
let
|
|
|
|
inherit (builtins) mapAttrs;
|
|
|
|
in
|
|
|
|
mapAttrs (_: snf.mkInstaller nixpkgs) self.nixosConfigurations.provisioning;
|
2024-11-07 18:08:29 +01:00
|
|
|
|
2024-11-08 16:15:39 +01:00
|
|
|
nixops4Deployments.default =
|
|
|
|
{ providers, ... }:
|
2024-11-07 18:08:29 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
makeProcolixVmResource = vmid: vmconfig: {
|
|
|
|
type = providers.local.exec;
|
2024-11-08 16:15:39 +01:00
|
|
|
imports = [ inputs.nixops4-nixos.modules.nixops4Resource.nixos ];
|
2024-11-07 18:08:29 +01:00
|
|
|
ssh.opts = "";
|
|
|
|
ssh.host = "95.215.187.${vmid}";
|
|
|
|
ssh.hostPublicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOW+f+PUuOBVP4IongWpryzYiOwt19smufZksSwnSPyo";
|
|
|
|
|
|
|
|
nixpkgs = inputs.nixpkgs;
|
2024-11-08 16:15:39 +01:00
|
|
|
nixos.module =
|
|
|
|
{ pkgs, modulesPath, ... }:
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
vmconfig
|
|
|
|
{ procolix.vmid = vmid; }
|
|
|
|
./procolixVm.nix
|
|
|
|
inputs.snf.nixosModules.fediversity
|
|
|
|
inputs.disko.nixosModules.default
|
|
|
|
];
|
|
|
|
};
|
2024-11-07 18:08:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
2024-11-08 16:15:39 +01:00
|
|
|
{
|
|
|
|
providers.local = inputs.nixops4-nixos.modules.nixops4Provider.local;
|
2024-11-07 18:08:29 +01:00
|
|
|
|
2024-11-08 16:15:39 +01:00
|
|
|
resources = {
|
|
|
|
fedi101 = makeProcolixVmResource "101" {
|
|
|
|
fediversity = {
|
|
|
|
enable = true;
|
|
|
|
domain = "fediversity.niols.fr";
|
|
|
|
pixelfed.enable = true;
|
2024-11-07 18:08:29 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-11-08 16:15:39 +01:00
|
|
|
};
|
2024-10-01 13:07:09 +02:00
|
|
|
};
|
|
|
|
}
|