Compare commits

..

55 commits

Author SHA1 Message Date
97f4e28c18
rm explicit dns 2025-08-04 14:28:13 +02:00
6a2fc2cfb6
rm agent exec 2025-08-04 14:25:17 +02:00
cdf1da55bc
rm /home 2025-08-04 14:13:27 +02:00
1988b763a0
disables nftables for woodpecker, just like for forgejo-ci
Some checks failed
ci/woodpecker/manual/check-mastodon Pipeline is pending
ci/woodpecker/manual/check-panel Pipeline is pending
ci/woodpecker/manual/check-peertube Pipeline is pending
ci/woodpecker/manual/check-pre-commit Pipeline is pending
ci/woodpecker/manual/update Pipeline is pending
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
2025-08-04 14:04:49 +02:00
a32babf80c
rm debugging pipelines
Some checks failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/update Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
2025-08-04 12:52:40 +02:00
18ca0ca042
explicitly specify flakes as nixos/nix image is missing this 2025-08-04 12:52:20 +02:00
4b564d7bc9
Revert "temp rm non-working pipelines"
Some checks failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline was successful
ci/woodpecker/manual/check-data-model Pipeline was successful
ci/woodpecker/manual/update Pipeline was successful
ci/woodpecker/manual/check-panel Pipeline failed
This reverts commit 101717899e.
2025-08-04 12:46:40 +02:00
e6c35dc29a
disable firewall nftables
Some checks failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
2025-08-04 12:45:08 +02:00
db9783adac
return to dig 2025-08-04 12:44:52 +02:00
603eb57d13
try alpine for git
Some checks failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
2025-08-04 12:28:17 +02:00
989dbcfa5e
try verbose clone 2025-08-04 12:25:58 +02:00
b30ff44e9f
coreutils
Some checks failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
2025-08-04 12:22:42 +02:00
3c47703dfe
nixos sh
Some checks failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
2025-08-04 12:16:09 +02:00
f87a0a5448
sudo ping 2025-08-04 12:14:10 +02:00
1b2d3092e4
replaces images
Some checks failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
2025-08-04 12:12:52 +02:00
101717899e
temp rm non-working pipelines 2025-08-04 12:12:48 +02:00
d4c5fa5c9c
apt-get update
Some checks failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
2025-08-04 11:46:44 +02:00
a8ca5674e0
proper package
Some checks failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
2025-08-04 11:45:50 +02:00
8f330c03e4
no sudo
Some checks failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
2025-08-04 11:41:05 +02:00
c36e8561c6
install ping
Some checks failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
2025-08-04 11:39:31 +02:00
e8923bb97b
install git 2025-08-04 11:38:55 +02:00
d6ad6ced66
ubuntu vs nixos
Some checks failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-dns-ubuntu Pipeline failed
ci/woodpecker/manual/check-dns-nixos Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
2025-08-04 11:36:46 +02:00
1686a87905
install first
Some checks failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-dns Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
2025-08-04 11:31:28 +02:00
4c50e501d1
mv skip_clone
Some checks failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-dns Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
2025-08-04 11:24:56 +02:00
abbeb3e7c1
debug by dns job
Some checks failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-dns Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
2025-08-04 11:22:25 +02:00
4d4e343803
plug hole in firewall 2025-08-04 10:34:50 +02:00
1b0115c891
add agent groups
Some checks failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-dns Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/update Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
2025-08-04 10:13:44 +02:00
2c7ed7afba
woodpecker: add packages needed for network
https://github.com/NixOS/nixpkgs/pull/73971#issuecomment-790421418
2025-08-04 09:47:37 +02:00
c6e93e8817
test dns from a non-nix container
Some checks failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-dns Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
2025-08-04 09:28:49 +02:00
6fc1dc7b8a
make things conditional 2025-07-27 10:43:25 +02:00
6c105468d5
make secrets conditional 2025-07-27 10:38:40 +02:00
f9a055e33f
disable exec agent 2025-07-27 10:30:23 +02:00
fc465b3beb
make service group setting conditional 2025-07-27 10:29:14 +02:00
9b6b1c6e9f
container dns 2025-07-27 10:25:42 +02:00
25041f55f7
set service groups 2025-07-27 10:25:24 +02:00
965e71ddb8
add packages used for debugging 2025-07-27 10:24:27 +02:00
81e5586f4d
set just group for system users 2025-07-27 10:24:09 +02:00
91e3df8e18
image: bash (local back-end) -> nixos/nix (docker back-end)
Some checks failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
2025-07-26 18:05:43 +02:00
738d6c5d92
wrap faulty statement
Some checks failed
ci/woodpecker/manual/check-data-model Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline failed
ci/woodpecker/manual/check-pre-commit Pipeline failed
ci/woodpecker/manual/update Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-panel Pipeline failed
2025-07-26 17:52:19 +02:00
9951ea0418
debug harder
Some checks failed
ci/woodpecker/manual/check-panel Pipeline is pending
ci/woodpecker/manual/check-peertube Pipeline is pending
ci/woodpecker/manual/check-pre-commit Pipeline is pending
ci/woodpecker/manual/update Pipeline is pending
ci/woodpecker/manual/check-deployment-cli Pipeline is running
ci/woodpecker/manual/check-deployment-basic Pipeline is running
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline is running
ci/woodpecker/manual/check-data-model Pipeline was successful
ci/woodpecker/manual/check-mastodon Pipeline failed
2025-07-26 17:19:08 +02:00
e4ab638976
continue debugging
Some checks failed
ci/woodpecker/manual/check-deployment-cli Pipeline is running
ci/woodpecker/manual/check-deployment-basic Pipeline is running
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline was successful
ci/woodpecker/manual/check-panel Pipeline is running
ci/woodpecker/manual/check-peertube Pipeline is running
ci/woodpecker/manual/check-pre-commit Pipeline was successful
ci/woodpecker/manual/check-mastodon Pipeline is running
ci/woodpecker/manual/update Pipeline was successful
ci/woodpecker/manual/check-deployment-panel Pipeline is running
2025-07-26 16:59:23 +02:00
71e6dd83df
even more debugging
Some checks failed
ci/woodpecker/manual/check-panel Pipeline is pending
ci/woodpecker/manual/check-peertube Pipeline is pending
ci/woodpecker/manual/check-pre-commit Pipeline is pending
ci/woodpecker/manual/update Pipeline is pending
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline was successful
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
2025-07-26 16:56:16 +02:00
f24376d685
add more debug prints to CD
Some checks failed
ci/woodpecker/manual/check-panel Pipeline is pending
ci/woodpecker/manual/check-peertube Pipeline is pending
ci/woodpecker/manual/check-pre-commit Pipeline is pending
ci/woodpecker/manual/update Pipeline is pending
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline is running
ci/woodpecker/manual/check-data-model Pipeline was successful
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
2025-07-26 16:49:25 +02:00
a8797bc1b4
add debugging lines to CD pipeline to debug error Could not open a connection to your authentication agent
Some checks failed
ci/woodpecker/manual/check-pre-commit Pipeline is pending
ci/woodpecker/manual/update Pipeline is pending
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline is running
ci/woodpecker/manual/check-data-model Pipeline was successful
ci/woodpecker/manual/check-deployment-cli Pipeline is running
ci/woodpecker/manual/check-deployment-panel Pipeline is running
ci/woodpecker/manual/check-mastodon Pipeline is running
ci/woodpecker/manual/check-panel Pipeline is running
ci/woodpecker/manual/check-peertube Pipeline is running
2025-07-26 16:23:04 +02:00
4df2ba9be7
split CI jobs
Some checks failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/check-data-model Pipeline was successful
ci/woodpecker/manual/check-mastodon Pipeline failed
ci/woodpecker/manual/check-deployment-cli Pipeline failed
ci/woodpecker/manual/check-deployment-basic Pipeline failed
ci/woodpecker/manual/check-deployment-panel Pipeline failed
ci/woodpecker/manual/check-peertube Pipeline is running
ci/woodpecker/manual/check-panel Pipeline is running
ci/woodpecker/manual/check-pre-commit Pipeline was successful
ci/woodpecker/manual/update Pipeline was successful
2025-07-26 16:12:46 +02:00
e123a9210f
hard-code forgejo IP to prevent clone step issues in CI using woodpecker's local back-end 2025-07-26 16:11:27 +02:00
c3df3e43b6
update: bash
Some checks failed
ci/woodpecker/manual/cd Pipeline failed
ci/woodpecker/manual/update Pipeline was successful
ci/woodpecker/manual/ci Pipeline failed
2025-07-26 14:26:32 +02:00
95e5a292d7
allow manual 2025-07-26 14:23:39 +02:00
1e011d5cd8
set image: bash to initally test local woodpecker back-end 2025-07-26 14:13:34 +02:00
8fd67f0f57
simplify secrets 2025-07-26 14:07:46 +02:00
ebe70b34cf
none like _file somehow? 2025-07-25 23:46:25 +02:00
42e158664d
configure user 2025-07-25 23:45:53 +02:00
cfe7a9b2d2
un-template 2025-07-25 22:15:11 +02:00
335e4273d7
fix container agent 2025-07-25 22:15:01 +02:00
d833de6f2a
add woodpecker CI
add woodpecker

status: agents error `agent could not auth: individual agent not found
by token: sql: no rows in result set`
2025-07-25 17:46:40 +02:00
25 changed files with 176 additions and 194 deletions

View file

@ -1,30 +0,0 @@
when:
- event: manual
- event: push
branch: main
## NOTE: NixOps4 does not provide a good “dry run” mode, so we instead check
## proxies for resources, namely whether their `.#vmOptions.<machine>` and
## `.#nixosConfigurations.<machine>` outputs evaluate and build correctly, and
## whether we can dry run `infra/proxmox-*.sh` on them. This will not catch
## everything, and in particular not issues in how NixOps4 wires up the
## resources, but that is still something.
steps:
- name: check-resources
image: nixos/nix
commands:
- run: |
set -euC
echo ==================== [ VM Options ] ====================
machines=$(nix eval --impure --raw --expr 'with builtins; toString (attrNames (getFlake (toString ./.)).vmOptions)')
for machine in $machines; do
echo ~~~~~~~~~~~~~~~~~~~~~: $machine :~~~~~~~~~~~~~~~~~~~~~
nix build --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.vmOptions-$machine
done
echo
echo ==================== [ NixOS Configurations ] ====================
machines=$(nix eval --impure --raw --expr 'with builtins; toString (attrNames (getFlake (toString ./.)).nixosConfigurations)')
for machine in $machines; do
echo ~~~~~~~~~~~~~~~~~~~~~: $machine :~~~~~~~~~~~~~~~~~~~~~
nix build --extra-experimental-features 'nix-command flakes' .#checks.x86_64-linux.nixosConfigurations-$machine
done

View file

@ -48,8 +48,7 @@ in
extraTestScript = mkOption { }; extraTestScript = mkOption { };
sourceFileset = mkOption { sourceFileset = mkOption {
## FIXME: grab `lib.types.fileset` from NixOS, once upstreaming PR ## REVIEW: Upstream to nixpkgs?
## https://github.com/NixOS/nixpkgs/pull/428293 lands.
type = types.mkOptionType { type = types.mkOptionType {
name = "fileset"; name = "fileset";
description = "fileset"; description = "fileset";

View file

@ -20,13 +20,16 @@ in
''; '';
}; };
isFediversityVm = mkOption { proxmox = mkOption {
type = types.bool; type = types.nullOr (
types.enum [
"procolix"
"fediversity"
]
);
description = '' description = ''
Whether the machine is a Fediversity VM or not. This is used to The Proxmox instance. This is used for provisioning only and should be
determine whether the machine should be provisioned via Proxmox or not. set to `null` if the machine is not a VM.
Machines that are _not_ Fediversity VM could be physical machines, or
VMs that live outside Fediversity, eg. on Procolix's Proxmox.
''; '';
}; };

View file

@ -1,14 +1,10 @@
{ ... }: { sources, ... }:
{ {
_class = "nixos"; _class = "nixos";
## FIXME: It would be nice, but the following leads to infinite recursion imports = [
## in the way we currently plug `sources` in. "${sources.nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
## ];
# imports = [
# "${sources.nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
# ];
boot = { boot = {
initrd = { initrd = {

View file

@ -2,6 +2,7 @@
inputs, inputs,
lib, lib,
config, config,
sources,
keys, keys,
secrets, secrets,
... ...
@ -32,9 +33,12 @@ in
## should go into the `./nixos` subdirectory. ## should go into the `./nixos` subdirectory.
nixos.module = { nixos.module = {
imports = [ imports = [
"${sources.agenix}/modules/age.nix"
"${sources.disko}/module.nix"
"${sources.vars}/options.nix"
"${sources.vars}/backends/on-machine.nix"
./options.nix ./options.nix
./nixos ./nixos
./proxmox-qemu-vm.nix
]; ];
## Inject the shared options from the resource's `config` into the NixOS ## Inject the shared options from the resource's `config` into the NixOS

View file

@ -14,40 +14,49 @@ let
mkOption mkOption
evalModules evalModules
filterAttrs filterAttrs
mapAttrs'
deepSeq
; ;
inherit (lib.attrsets) genAttrs; inherit (lib.attrsets) genAttrs;
commonResourceModule = { ## Given a machine's name and whether it is a test VM, make a resource module,
# TODO(@fricklerhandwerk): this is terrible but IMO we should just ditch ## except for its missing provider. (Depending on the use of that resource, we
# flake-parts and have our own data model for how the project is organised ## will provide a different one.)
# internally makeResourceModule =
_module.args = { { vmName, isTestVm }:
{
nixos.module.imports = [
./common/proxmox-qemu-vm.nix
];
nixos.specialArgs = {
inherit inherit
sources
inputs inputs
keys keys
secrets secrets
sources
; ;
}; };
## FIXME: It would be preferrable to have those `sources`-related imports in imports =
## the modules that use them. However, doing so triggers infinite recursions [
## because of the way we propagate `sources`. `sources` must be propagated by
## means of `specialArgs`, but this requires a bigger change.
nixos.module.imports = [
"${sources.nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
"${sources.agenix}/modules/age.nix"
"${sources.disko}/module.nix"
"${sources.home-manager}/nixos"
"${sources.vars}/options.nix"
"${sources.vars}/backends/on-machine.nix"
];
imports = [
./common/resource.nix ./common/resource.nix
]
++ (
if isTestVm then
[
../machines/operator/${vmName}
{
nixos.module.users.users.root.openssh.authorizedKeys.keys = [
# allow our panel vm access to the test machines
keys.panel
]; ];
}
]
else
[
../machines/dev/${vmName}
]
);
fediversityVm.name = vmName;
}; };
## Given a list of machine names, make a deployment with those machines' ## Given a list of machine names, make a deployment with those machines'
@ -56,16 +65,40 @@ let
vmNames: vmNames:
{ providers, ... }: { providers, ... }:
{ {
# XXX: this type merge is for adding `specialArgs` to resource modules
options.resources = mkOption {
type =
with lib.types;
lazyAttrsOf (submoduleWith {
class = "nixops4Resource";
modules = [ ];
# TODO(@fricklerhandwerk): we may want to pass through all of `specialArgs`
# once we're sure it's sane. leaving it here for better control during refactoring.
specialArgs = {
inherit
sources
inputs
keys
secrets
;
};
});
};
config = {
providers.local = inputs.nixops4.modules.nixops4Provider.local; providers.local = inputs.nixops4.modules.nixops4Provider.local;
resources = genAttrs vmNames (vmName: { resources = genAttrs vmNames (vmName: {
type = providers.local.exec; type = providers.local.exec;
imports = [ imports = [
inputs.nixops4-nixos.modules.nixops4Resource.nixos inputs.nixops4-nixos.modules.nixops4Resource.nixos
commonResourceModule (makeResourceModule {
../machines/dev/${vmName} inherit vmName;
isTestVm = false;
})
]; ];
}); });
}; };
};
makeDeployment' = vmName: makeDeployment [ vmName ]; makeDeployment' = vmName: makeDeployment [ vmName ];
## Given an attrset of test configurations (key = test machine name, value = ## Given an attrset of test configurations (key = test machine name, value =
@ -79,29 +112,21 @@ let
fediversity = import ../services/fediversity; fediversity = import ../services/fediversity;
} }
{ {
garageConfigurationResource = { garageConfigurationResource = makeResourceModule {
imports = [ vmName = "test01";
commonResourceModule isTestVm = true;
../machines/operator/test01
];
}; };
mastodonConfigurationResource = { mastodonConfigurationResource = makeResourceModule {
imports = [ vmName = "test06"; # somehow `test02` has a problem - use test06 instead
commonResourceModule isTestVm = true;
../machines/operator/test06 # somehow `test02` has a problem - use test06 instead
];
}; };
peertubeConfigurationResource = { peertubeConfigurationResource = makeResourceModule {
imports = [ vmName = "test05";
commonResourceModule isTestVm = true;
../machines/operator/test05
];
}; };
pixelfedConfigurationResource = { pixelfedConfigurationResource = makeResourceModule {
imports = [ vmName = "test04";
commonResourceModule isTestVm = true;
../machines/operator/test04
];
}; };
}; };
@ -114,63 +139,54 @@ let
## this is only needed to expose NixOS configurations for provisioning ## this is only needed to expose NixOS configurations for provisioning
## purposes, and eventually all of this should be handled by NixOps4. ## purposes, and eventually all of this should be handled by NixOps4.
options = { options = {
nixos.module = mkOption { type = lib.types.deferredModule; }; # NOTE: not just `nixos` otherwise merging will go wrong nixos.module = mkOption { }; # NOTE: not just `nixos` otherwise merging will go wrong
nixpkgs = mkOption { }; nixpkgs = mkOption { };
ssh = mkOption { }; ssh = mkOption { };
}; };
}; };
makeResourceConfig = makeResourceConfig =
{ vmName, isTestVm }: vm:
(evalModules { (evalModules {
modules = [ modules = [
nixops4ResourceNixosMockOptions nixops4ResourceNixosMockOptions
commonResourceModule (makeResourceModule vm)
(if isTestVm then ../machines/operator/${vmName} else ../machines/dev/${vmName})
]; ];
}).config; }).config;
## Given a VM name, make a NixOS configuration for this machine. ## Given a VM name, make a NixOS configuration for this machine.
makeConfiguration = makeConfiguration =
isTestVm: vmName: isTestVm: vmName:
import "${sources.nixpkgs}/nixos" { let
configuration = (makeResourceConfig { inherit vmName isTestVm; }).nixos.module; inherit (sources) nixpkgs;
system = "x86_64-linux"; in
import "${nixpkgs}/nixos" {
modules = [
(makeResourceConfig { inherit vmName isTestVm; }).nixos.module
];
}; };
makeVmOptions = makeVmOptions = isTestVm: vmName: {
isTestVm: vmName: inherit ((makeResourceConfig { inherit vmName isTestVm; }).fediversityVm)
let proxmox
config = (makeResourceConfig { inherit vmName isTestVm; }).fediversityVm;
in
if config.isFediversityVm then
{
inherit (config)
vmId vmId
description description
sockets sockets
cores cores
memory memory
diskSize diskSize
hostPublicKey hostPublicKey
unsafeHostPrivateKey unsafeHostPrivateKey
; ;
} };
else
null;
listSubdirectories = path: attrNames (filterAttrs (_: type: type == "directory") (readDir path)); listSubdirectories = path: attrNames (filterAttrs (_: type: type == "directory") (readDir path));
machines = listSubdirectories ../machines/dev; machines = listSubdirectories ../machines/dev;
testMachines = listSubdirectories ../machines/operator; testMachines = listSubdirectories ../machines/operator;
nixosConfigurations =
genAttrs machines (makeConfiguration false)
// genAttrs testMachines (makeConfiguration true);
vmOptions =
filterAttrs (_: value: value != null) # Filter out non-Fediversity VMs
(genAttrs machines (makeVmOptions false) // genAttrs testMachines (makeVmOptions true));
in in
{ {
_class = "flake"; _class = "flake";
@ -194,23 +210,10 @@ in
) )
); );
}; };
flake = { inherit nixosConfigurations vmOptions; }; flake.nixosConfigurations =
genAttrs machines (makeConfiguration false)
perSystem = // genAttrs testMachines (makeConfiguration true);
{ pkgs, ... }: flake.vmOptions =
{ genAttrs machines (makeVmOptions false)
checks = // genAttrs testMachines (makeVmOptions true);
mapAttrs' (name: nixosConfiguration: {
name = "nixosConfigurations-${name}";
value = nixosConfiguration.config.system.build.toplevel;
}) nixosConfigurations
// mapAttrs' (name: vmOptions: {
name = "vmOptions-${name}";
## Check that VM options builds/evaluates correctly. `deepSeq e1
## e2` evaluates `e1` strictly in depth before returning `e2`. We
## use this trick because checks need to be derivations, which VM
## options are not.
value = deepSeq vmOptions pkgs.hello;
}) vmOptions;
};
} }

View file

@ -179,9 +179,15 @@ grab_vm_options () {
--log-format raw --quiet --log-format raw --quiet
) )
proxmox=$(echo "$options" | jq -r .proxmox)
vm_id=$(echo "$options" | jq -r .vmId) vm_id=$(echo "$options" | jq -r .vmId)
description=$(echo "$options" | jq -r .description) description=$(echo "$options" | jq -r .description)
if [ "$proxmox" != fediversity ]; then
die "I do not know how to provision things that are not Fediversity VMs,
but I got proxmox = '%s' for VM %s." "$proxmox" "$vm_name"
fi
sockets=$(echo "$options" | jq -r .sockets) sockets=$(echo "$options" | jq -r .sockets)
cores=$(echo "$options" | jq -r .cores) cores=$(echo "$options" | jq -r .cores)
memory=$(echo "$options" | jq -r .memory) memory=$(echo "$options" | jq -r .memory)

View file

@ -167,10 +167,16 @@ grab_vm_options () {
--log-format raw --quiet --log-format raw --quiet
) )
proxmox=$(echo "$options" | jq -r .proxmox)
vm_id=$(echo "$options" | jq -r .vmId) vm_id=$(echo "$options" | jq -r .vmId)
printf 'done grabing VM options for VM %s. Got id: %d.\n' \ if [ "$proxmox" != fediversity ]; then
"$vm_name" "$vm_id" die "I do not know how to remove things that are not Fediversity VMs,
but I got proxmox = '%s' for VM %s." "$proxmox" "$vm_name"
fi
printf 'done grabing VM options for VM %s. Found VM %d on %s Proxmox.\n' \
"$vm_name" "$vm_id" "$proxmox"
fi fi
} }

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "fedi200";
isFediversityVm = true;
vmId = 200; vmId = 200;
proxmox = "fediversity";
description = "Testing machine for Hans"; description = "Testing machine for Hans";
domain = "abundos.eu"; domain = "abundos.eu";
@ -17,4 +16,10 @@
gateway = "2a00:51c0:13:1305::1"; gateway = "2a00:51c0:13:1305::1";
}; };
}; };
nixos.module = {
imports = [
../../../infra/common/proxmox-qemu-vm.nix
];
};
} }

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "fedi201";
isFediversityVm = true;
vmId = 201; vmId = 201;
proxmox = "fediversity";
description = "FediPanel"; description = "FediPanel";
domain = "abundos.eu"; domain = "abundos.eu";
@ -20,6 +19,7 @@
nixos.module = { nixos.module = {
imports = [ imports = [
../../../infra/common/proxmox-qemu-vm.nix
./fedipanel.nix ./fedipanel.nix
]; ];
}; };

View file

@ -1,5 +1,6 @@
{ {
config, config,
sources,
... ...
}: }:
let let
@ -10,6 +11,7 @@ in
imports = [ imports = [
(import ../../../panel { }).module (import ../../../panel { }).module
"${sources.home-manager}/nixos"
]; ];
security.acme = { security.acme = {

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "fedi203";
isFediversityVm = true;
vmId = 203; vmId = 203;
proxmox = "fediversity";
description = "woodpecker"; description = "woodpecker";
domain = "abundos.eu"; domain = "abundos.eu";
@ -20,6 +19,7 @@
nixos.module = { nixos.module = {
imports = [ imports = [
../../../infra/common/proxmox-qemu-vm.nix
./woodpecker.nix ./woodpecker.nix
]; ];
}; };

View file

@ -20,9 +20,7 @@ in
ssh.host = mkForce "forgejo-ci"; ssh.host = mkForce "forgejo-ci";
fediversityVm = { fediversityVm = {
name = "forgejo-ci";
domain = "procolix.com"; domain = "procolix.com";
isFediversityVm = false;
ipv4 = { ipv4 = {
interface = "enp1s0f0"; interface = "enp1s0f0";

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "vm02116";
isFediversityVm = false;
vmId = 2116; vmId = 2116;
proxmox = "procolix";
description = "Forgejo"; description = "Forgejo";
ipv4.address = "185.206.232.34"; ipv4.address = "185.206.232.34";
@ -15,6 +14,7 @@
{ lib, ... }: { lib, ... }:
{ {
imports = [ imports = [
../../../infra/common/proxmox-qemu-vm.nix
./forgejo.nix ./forgejo.nix
]; ];

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "vm02187";
isFediversityVm = false;
vmId = 2187; vmId = 2187;
proxmox = "procolix";
description = "Wiki"; description = "Wiki";
ipv4.address = "185.206.232.187"; ipv4.address = "185.206.232.187";
@ -15,6 +14,7 @@
{ lib, ... }: { lib, ... }:
{ {
imports = [ imports = [
../../../infra/common/proxmox-qemu-vm.nix
./wiki.nix ./wiki.nix
]; ];

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test01";
isFediversityVm = true;
vmId = 7001; vmId = 7001;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test02";
isFediversityVm = true;
vmId = 7002; vmId = 7002;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test03";
isFediversityVm = true;
vmId = 7003; vmId = 7003;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test04";
isFediversityVm = true;
vmId = 7004; vmId = 7004;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test05";
isFediversityVm = true;
vmId = 7005; vmId = 7005;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test06";
isFediversityVm = true;
vmId = 7006; vmId = 7006;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test11";
isFediversityVm = true;
vmId = 7011; vmId = 7011;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test12";
isFediversityVm = true;
vmId = 7012; vmId = 7012;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test13";
isFediversityVm = true;
vmId = 7013; vmId = 7013;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;

View file

@ -2,9 +2,8 @@
_class = "nixops4Resource"; _class = "nixops4Resource";
fediversityVm = { fediversityVm = {
name = "test14";
isFediversityVm = true;
vmId = 7014; vmId = 7014;
proxmox = "fediversity";
hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub; hostPublicKey = builtins.readFile ./ssh_host_ed25519_key.pub;
unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key; unsafeHostPrivateKey = builtins.readFile ./ssh_host_ed25519_key;