Compare commits

..

60 commits

Author SHA1 Message Date
e790a4450f
add tls 2025-07-17 19:11:11 +02:00
dabeae4695
remove 'attic use' lines in favor of substituter 2025-07-17 19:11:11 +02:00
4495da07ba
use cache for all steps 2025-07-17 19:10:26 +02:00
4ae4190415
make cache public 2025-07-17 19:09:11 +02:00
d9a20a1fa2
add caching workflow 2025-07-17 19:08:45 +02:00
550f5cb584
rm attic config from runner as it's really the containers that need it 2025-07-17 19:08:45 +02:00
a435b5447a
expose attic-client in CI container 2025-07-17 19:08:45 +02:00
5d11766c2d
manually use cache in ci 2025-07-17 19:08:45 +02:00
8278f6781a
factor out user 2025-07-17 19:07:36 +02:00
5ccffb0621
have attic know it doesn't do https, for now 2025-07-17 19:07:36 +02:00
7655f6a38e
for now set substituters to use http as well 2025-07-17 19:07:36 +02:00
fe789c1819
expose 8080 in nftables, pending proper TLS/reverse-proxy/port (?) 2025-07-17 19:07:36 +02:00
0a615fa961
expose port 9000 following documentation 2025-07-17 19:07:36 +02:00
aa0ead9c7c
pull attic-client into shell as CI is missing <nixpkgs> for nix-shell 2025-07-17 19:07:17 +02:00
8fab923899
collapse caching ci test, given it seems to not carry over variables between steps 2025-07-17 19:07:04 +02:00
7eeeee4543
test attic cache from ci 2025-07-17 19:04:16 +02:00
a5ec137b4f
allow consuming attic cache from ci runner 2025-07-17 19:03:33 +02:00
16e1f9a6a3
enquote attic env values for use in source attic.env 2025-07-17 19:03:33 +02:00
2cee7b315b
add generator dependency 2025-07-17 19:03:33 +02:00
50f3d01aec
moar extraDependencies 2025-07-17 19:03:33 +02:00
45e97e8339
[wip] handling env file (still fails)
rm unused dep nix-templating

fix imports
2025-07-17 19:03:33 +02:00
ebd79d2d5e
use templating fork 2025-07-17 19:03:33 +02:00
3622dc817a
add tests, fix some things
upgrade memory to resolve oom
2025-07-17 19:03:33 +02:00
5cf5a121e4
move from dev to operator
revert

add qemu import
2025-07-17 19:03:33 +02:00
b6eebd577f
WIP: add attic cache, see #92
flesh out attic

TODO keys nginx-port testing

fix key

fix key
2025-07-17 19:03:33 +02:00
5140fe5935
actually pass a priority level fitting my description 2025-07-17 19:03:33 +02:00
761d74a109
use defaultOverridePriority over mkDefault to fix acme error without cashing with settings from tests 2025-07-17 19:03:33 +02:00
8ff5b87d00
use mkDefault to prevent acme clash in tests 2025-07-17 19:03:33 +02:00
b9d406f437
increase numInstances to 5 2025-07-17 19:03:33 +02:00
6755385536
Revert "switch to podman"
This reverts commit 60e7b841a9.
2025-07-17 19:03:33 +02:00
96e2f4ac5d
runs-on: nix 2025-07-17 19:03:33 +02:00
ac68a23805
switch to podman 2025-07-17 19:03:33 +02:00
d0aaf18a70
increase numInstances to 3 2025-07-17 19:03:33 +02:00
1b03238b06
add note on podman attempt 2025-07-17 19:03:33 +02:00
2cef9589db
reconciliate old/new runners 2025-07-17 19:03:33 +02:00
14a5e057b9
explicitly use custom container in CI 2025-07-17 19:03:33 +02:00
f11f28eda8
explicitly allow running command to manually generating tokens from forgejo machine
additionally serves to document the needed command, for future
automation.
2025-07-17 19:03:33 +02:00
fabb42e05d
set up ci container from clan
credit:
https://discourse.nixos.org/t/gitea-nix-actions-runner-setup/35279
2025-07-17 19:03:33 +02:00
0b809bf866
try and recreate the container from icewind
see:
https://icewind.nl/entry/gitea-actions-nix/#using-nix-to-build-our-nix-image

> Error: crun: cannot find `` in $PATH: No such file or directory: OCI
runtime attempted to invoke a command that was not found
2025-07-17 19:03:33 +02:00
cf35f423e1
runs-on: docker 2025-07-17 19:03:33 +02:00
224cbedc1e
rm runner file 2025-07-17 19:03:33 +02:00
953bbc7349
explicitly specify container image 2025-07-17 19:03:33 +02:00
3a4d0679d5
add label for new runner 2025-07-17 19:03:33 +02:00
a528c4e148
try out existing nix container made for gitea actions 2025-07-17 19:03:33 +02:00
8e02684bf8
Switch all CI jobs to nixos label 2025-07-17 19:03:33 +02:00
765183cd0d fix typo in users (#475)
Reviewed-on: Fediversity/Fediversity#475
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-17 19:02:14 +02:00
6cf1d87f0b get parity in authorized keys between procolix and root for nixops4 ssh to non-VMs (#474)
Reviewed-on: Fediversity/Fediversity#474
Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-17 18:59:31 +02:00
8253288f8a remove pixelfed from CI until fixed (#472)
this test is still borked as per #33.
the intent would be to get this test on a feature branch pertaining to that issue - the point being we should be able to rely on CI's boolean result for detecting (newly induced) regressions.

Reviewed-on: Fediversity/Fediversity#472
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-17 15:25:17 +02:00
67f50f08de enable continuous deployment (#471)
closes #177

Reviewed-on: Fediversity/Fediversity#471
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-17 10:01:51 +02:00
5402178e7b reinstate import statement for panel module, fixes error deploying fedi201 (#468)
resolves error on CI run https://git.fediversity.eu/Fediversity/Fediversity/actions/runs/1026:

```
123456       error: attempt to call something which is not a function but a path: /nix/store/93yyf22vw60l1j3l6h02c99p93lp55q5-source/panel
       at /nix/store/93yyf22vw60l1j3l6h02c99p93lp55q5-source/machines/dev/fedi201/fedipanel.nix:13:6:
           12|   imports = [
           13|     (../../../panel { }).module
             |      ^
           14|     "${sources.home-manager}/nixos"```
```

Reviewed-on: Fediversity/Fediversity#468
2025-07-16 20:51:23 +02:00
e627815399 pass SHELL env var in CD (#466)
see #177

Reviewed-on: Fediversity/Fediversity#466
2025-07-16 18:18:16 +02:00
354dba260a verbose CD (#465)
debugging effort part of #177

Reviewed-on: Fediversity/Fediversity#465
2025-07-16 14:14:06 +02:00
b791bd515d pass sources via specialArgs (#464)
this gets rid of ugly in-place imports and upward paths

Reviewed-on: Fediversity/Fediversity#464
Reviewed-by: kiara Grouwstra <kiara@procolix.eu>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-committed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2025-07-16 10:53:36 +02:00
f2017aaeb4 CD: lump SSH commands into a single shell invocation (#462)
Reviewed-on: Fediversity/Fediversity#462
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-15 13:00:47 +02:00
980a994f83 run ssh commands thru the shell (which has openssh) (#461)
Reviewed-on: Fediversity/Fediversity#461
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-15 12:26:16 +02:00
b9b13df04e allow SSH access from continuous deployment (#460)
Reviewed-on: Fediversity/Fediversity#460
Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-15 11:56:22 +02:00
159e4107b8 fix Pixelfed test eval failure (#458)
Reviewed-on: Fediversity/Fediversity#458
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-15 10:38:10 +02:00
86305a6a2e fix link; readability 2025-07-15 09:04:56 +02:00
e62f14d9be expose panel tests in flake 2025-07-15 08:54:48 +02:00
82f83eea0d fix mastodon test (#457)
closes #34.

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Reviewed-on: Fediversity/Fediversity#457
Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Kiara Grouwstra <kiara@procolix.eu>
Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
2025-07-15 08:54:20 +02:00
16 changed files with 102 additions and 59 deletions

View file

@ -4,7 +4,7 @@ on:
workflow_dispatch: # allows manual triggering workflow_dispatch: # allows manual triggering
push: push:
branches: branches:
# - main - main
jobs: jobs:
deploy: deploy:
@ -13,7 +13,7 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up SSH key to access age secrets - name: Set up SSH key for age secrets and SSH
run: | run: |
env env
mkdir -p ~/.ssh mkdir -p ~/.ssh
@ -21,4 +21,4 @@ jobs:
chmod 600 ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519
- name: Deploy - name: Deploy
run: nix-shell --run 'nixops4 apply default' run: nix-shell --run 'eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_ed25519 && SHELL=$(which bash) nixops4 apply -v default'

View file

@ -21,11 +21,17 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: nix-shell --run 'nix-unit ./deployment/data-model-test.nix' - run: nix-shell --run 'nix-unit ./deployment/data-model-test.nix'
check-mastodon:
runs-on: native
steps:
- uses: actions/checkout@v4
- run: nix build .#checks.x86_64-linux.test-mastodon-service -L
check-peertube: check-peertube:
runs-on: nix runs-on: nix
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: nix-build services -A tests.peertube - run: nix build .#checks.x86_64-linux.test-peertube-service -L
check-panel: check-panel:
runs-on: nix runs-on: nix

View file

@ -12,6 +12,7 @@ let
inherit (pkgs) lib; inherit (pkgs) lib;
inherit (import sources.flake-inputs) import-flake; inherit (import sources.flake-inputs) import-flake;
inherit ((import-flake { src = ./.; }).inputs) nixops4; inherit ((import-flake { src = ./.; }).inputs) nixops4;
panel = import ./panel { inherit sources system; };
pre-commit-check = pre-commit-check =
(import "${git-hooks}/nix" { (import "${git-hooks}/nix" {
inherit nixpkgs system; inherit nixpkgs system;
@ -73,6 +74,7 @@ in
tests = { tests = {
inherit pre-commit-check; inherit pre-commit-check;
panel = panel.tests;
}; };
# re-export inputs so they can be overridden granularly # re-export inputs so they can be overridden granularly

View file

@ -17,15 +17,20 @@
./infra/flake-part.nix ./infra/flake-part.nix
./keys/flake-part.nix ./keys/flake-part.nix
./secrets/flake-part.nix ./secrets/flake-part.nix
./services/tests/flake-part.nix
]; ];
perSystem = perSystem =
{ {
pkgs, pkgs,
lib, lib,
system,
... ...
}: }:
{ {
checks = {
panel = (import ./. { inherit sources system; }).tests.panel.basic;
};
formatter = pkgs.nixfmt-rfc-style; formatter = pkgs.nixfmt-rfc-style;
pre-commit.settings.hooks = pre-commit.settings.hooks =

View file

@ -1,14 +1,13 @@
# Infra # Infra
This directory contains the definition of [the VMs](machines.md) that host our This directory contains the definition of [the VMs](../machines/machines.md) that host our
infrastructure. infrastructure.
## Provisioning VMs with an initial configuration ## Provisioning VMs with an initial configuration
NOTE[Niols]: This is very manual and clunky. Two things will happen. In the near > NOTE[Niols]: This is still very manual and clunky. Two things will happen:
future, I will improve the provisioning script to make this a bit less clunky. > 1. In the near future, I will improve the provisioning script to make this a bit less clunky.
In the far future, NixOps4 will be able to communicate with Proxmox directly and > 2. In the far future, NixOps4 will be able to communicate with Proxmox directly and everything will become much cleaner.
everything will become much cleaner.
1. Choose names for your VMs. It is recommended to choose `fediXXX`, with `XXX` 1. Choose names for your VMs. It is recommended to choose `fediXXX`, with `XXX`
above 100. For instance, `fedi117`. above 100. For instance, `fedi117`.
@ -25,8 +24,7 @@ everything will become much cleaner.
Those files need to exist during provisioning, but their content matters only Those files need to exist during provisioning, but their content matters only
when updating the machines' configuration. when updating the machines' configuration.
FIXME: Remove this step by making the provisioning script not fail with the > FIXME: Remove this step by making the provisioning script not fail with the public key does not exist yet.
public key does not exist yet.
3. Run the provisioning script: 3. Run the provisioning script:
``` ```
@ -44,7 +42,7 @@ everything will become much cleaner.
ssh fedi117.abundos.eu 'sudo cat /etc/ssh/ssh_host_ed25519_key.pub' > keys/systems/fedi117.pub ssh fedi117.abundos.eu 'sudo cat /etc/ssh/ssh_host_ed25519_key.pub' > keys/systems/fedi117.pub
``` ```
FIXME: Make the provisioning script do that for us. > FIXME: Make the provisioning script do that for us.
7. Regenerate the list of machines: 7. Regenerate the list of machines:
``` ```
@ -56,7 +54,7 @@ everything will become much cleaner.
just enough for it to boot and be reachable. Go on to the next section to just enough for it to boot and be reachable. Go on to the next section to
update the machine and put an actual configuration. update the machine and put an actual configuration.
FIXME: Figure out why the full configuration isn't on the machine at this > FIXME: Figure out why the full configuration isn't on the machine at this
point and fix it. point and fix it.
## Updating existing VM configurations ## Updating existing VM configurations

View file

@ -1,7 +1,13 @@
{
config,
...
}:
{ {
_class = "nixos"; _class = "nixos";
users.users = { users.users = {
root.openssh.authorizedKeys.keys = config.users.users.procolix.openssh.authorizedKeys.keys;
procolix = { procolix = {
isNormalUser = true; isNormalUser = true;
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];

View file

@ -1,15 +1,4 @@
let { sources, ... }:
# pulling this in manually over from module args resolves an infinite recursion.
# FIXME: instead untangle `//infra/flake-part.nix` and make it stop passing wild functions.
# move moving towards a portable-services-like pattern where some things are submodules.
# Right now those wild functions are for parameterising a bunch of things,
# and the modular way to do that would be options --
# obviously you can't use those for `imports`,
# so one way to decouple fixpoints is to isolate them into submodules.
# Therefore one approach would be to try to go down the call graph,
# and see where what's currently a function could be a `submodule` field of something else.
sources = import ../../npins;
in
{ {
_class = "nixos"; _class = "nixos";

View file

@ -60,6 +60,8 @@ in
users.users.root.openssh.authorizedKeys.keys = attrValues keys.contributors ++ [ users.users.root.openssh.authorizedKeys.keys = attrValues keys.contributors ++ [
# allow our panel vm access to the test machines # allow our panel vm access to the test machines
keys.panel keys.panel
# allow continuous deployment access
keys.cd
]; ];
}; };

View file

@ -27,7 +27,6 @@ let
_module.args = { _module.args = {
inherit inherit
inputs inputs
sources
keys keys
secrets secrets
; ;
@ -37,6 +36,10 @@ let
./common/proxmox-qemu-vm.nix ./common/proxmox-qemu-vm.nix
]; ];
nixos.specialArgs = {
inherit sources;
};
imports = imports =
[ [
./common/resource.nix ./common/resource.nix
@ -66,6 +69,21 @@ 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;
};
});
};
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;
@ -78,6 +96,7 @@ let
]; ];
}); });
}; };
};
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 =

View file

@ -1,17 +1,17 @@
{ {
config, config,
sources,
... ...
}: }:
let let
name = "panel"; name = "panel";
sources = import ../../../npins;
in in
{ {
_class = "nixos"; _class = "nixos";
imports = [ imports = [
(import ../../../panel { }).module (import ../../../panel { }).module
(import "${sources.home-manager}/nixos") "${sources.home-manager}/nixos"
]; ];
security.acme = { security.acme = {

View file

@ -45,7 +45,7 @@ in
''; '';
}; };
module = import ./nix/configuration.nix; module = ./nix/configuration.nix;
tests = pkgs.callPackage ./nix/tests.nix { }; tests = pkgs.callPackage ./nix/tests.nix { };
# re-export inputs so they can be overridden granularly # re-export inputs so they can be overridden granularly

View file

@ -1,13 +0,0 @@
{
system ? builtins.currentSystem,
sources ? import ../npins,
pkgs ? import sources.nixpkgs { inherit system; },
...
}:
{
tests = {
mastodon = pkgs.nixosTest ./tests/mastodon.nix;
pixelfed-garage = pkgs.nixosTest ./tests/pixelfed-garage.nix;
peertube = pkgs.nixosTest ./tests/peertube.nix;
};
}

View file

@ -50,7 +50,7 @@ in
displayName = mkOption { displayName = mkOption {
type = types.str; type = types.str;
description = "Name of the initial user, for humans"; description = "Name of the initial user, for humans";
default = config.fediversity.temp.initialUser.name; default = config.fediversity.temp.initialUser.username;
}; };
email = mkOption { email = mkOption {
type = types.str; type = types.str;

View file

@ -0,0 +1,14 @@
{ ... }:
{
_class = "flake";
perSystem =
{ pkgs, ... }:
{
checks = {
test-mastodon-service = pkgs.testers.runNixOSTest ./mastodon.nix;
test-pixelfed-garage-service = pkgs.testers.runNixOSTest ./pixelfed-garage.nix;
test-peertube-service = pkgs.testers.runNixOSTest ./peertube.nix;
};
};
}

View file

@ -6,7 +6,7 @@
{ pkgs, ... }: { pkgs, ... }:
let let
lib = pkgs.lib; inherit (pkgs) lib writeText;
## FIXME: this binding was not used, but maybe we want a side-effect or something? ## FIXME: this binding was not used, but maybe we want a side-effect or something?
# rebuildableTest = import ./rebuildableTest.nix pkgs; # rebuildableTest = import ./rebuildableTest.nix pkgs;
@ -69,9 +69,17 @@ in
expect expect
]; ];
environment.variables = { environment.variables = {
AWS_ACCESS_KEY_ID = config.fediversity.garage.ensureKeys.mastodon.id; AWS_ACCESS_KEY_ID = "$(cat ${config.fediversity.mastodon.s3AccessKeyFile})";
AWS_SECRET_ACCESS_KEY = config.fediversity.garage.ensureKeys.mastodon.secret; AWS_SECRET_ACCESS_KEY = "$(cat ${config.fediversity.mastodon.s3SecretKeyFile})";
}; };
services.mastodon.extraEnvFiles = [
# generate as: cd ${pkgs.mastodon}; IGNORE_ALREADY_SET_SECRETS=true RAILS_ENV=development ${pkgs.mastodon}/bin/rails db:encryption:init
(writeText "rest" ''
ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=naGoEzeyjUmwIlmgZZmGQDWJrlWud5eX
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=A0tE1VJ7S3cjaOQ58mNkhrVFY7o5NKDB
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY=tGHhd5Os7hLxa8QTzWwjyVLrvsj5VsCw
'')
];
}; };
}; };

View file

@ -113,6 +113,7 @@ let
${seleniumQuit}''; ${seleniumQuit}'';
dummyFile = pkgs.writeText "dummy" "dummy";
in in
{ {
name = "test-pixelfed-garage"; name = "test-pixelfed-garage";
@ -161,8 +162,8 @@ in
]; ];
environment.variables = { environment.variables = {
POST_MEDIA = ./fediversity.png; POST_MEDIA = ./fediversity.png;
AWS_ACCESS_KEY_ID = config.fediversity.garage.ensureKeys.pixelfed.id; AWS_ACCESS_KEY_ID = "$(cat ${config.fediversity.pixelfed.s3AccessKeyFile})";
AWS_SECRET_ACCESS_KEY = config.fediversity.garage.ensureKeys.pixelfed.secret; AWS_SECRET_ACCESS_KEY = "$(cat ${config.fediversity.pixelfed.s3SecretKeyFile})";
## without this we get frivolous errors in the logs ## without this we get frivolous errors in the logs
MC_REGION = "garage"; MC_REGION = "garage";
}; };
@ -170,6 +171,12 @@ in
users.users.selenium = { users.users.selenium = {
isNormalUser = true; isNormalUser = true;
}; };
fediversity.temp.initialUser = {
username = "dummy";
displayName = "dummy";
email = "dummy";
passwordFile = dummyFile;
};
}; };
}; };