Compare commits

...

10 commits

18 changed files with 134 additions and 88 deletions

View file

@ -703,16 +703,16 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1727672256,
"narHash": "sha256-9/79hjQc9+xyH+QxeMcRsA6hDyw6Z9Eo1/oxjvwirLk=",
"lastModified": 1732350895,
"narHash": "sha256-GcOQbOgmwlsRhpLGSwZJwLbo3pu9ochMETuRSS1xpz4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1719f27dd95fd4206afb9cec9f415b539978827e",
"rev": "0c582677378f2d9ffcb01490af2f2c678dcb29d3",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.05",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}

View file

@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
flake-parts.url = "github:hercules-ci/flake-parts";
git-hooks.url = "github:cachix/git-hooks.nix";

View file

@ -33,7 +33,7 @@
## FIXME: Remove direct root authentication once NixOps4 supports users with
## password-less sudo.
users.root.openssh.authorizedKeys.keys = [
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEElREJN0AC7lbp+5X204pQ5r030IbgCllsIxyU3iiKY"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJg5TlS1NGCRZwMjDgBkXeFUXqooqRlM8fJdBAQ4buPg"
];

View file

@ -17,11 +17,7 @@
};
nixpkgs = inputs.nixpkgs;
nixos.module = {
imports = [
./vm02116/configuration.nix
./vm02116/forgejo.nix
./vm02116/hardware-configuration.nix
];
imports = [ ./vm02116 ];
};
};
@ -35,11 +31,7 @@
};
nixpkgs = inputs.nixpkgs;
nixos.module = {
imports = [
./vm02179/configuration.nix
./vm02179/hardware-configuration.nix
./vm02179/gitea-runner.nix
];
imports = [ ./vm02179 ];
};
};
@ -53,11 +45,7 @@
};
nixpkgs = inputs.nixpkgs;
nixos.module = {
imports = [
./vm02186/procolix-configuration.nix
./vm02186/hardware-configuration.nix
./vm02186/gitea-runner.nix
];
imports = [ ./vm02186 ];
};
};
};
@ -79,10 +67,7 @@
};
nixpkgs = inputs.nixpkgs;
nixos.module = {
imports = [
./vm02187/configuration.nix
./vm02187/hardware-configuration.nix
];
imports = [ ./vm02187 ];
};
};
};

View file

@ -1,5 +1,8 @@
{
imports = [ ../common ];
imports = [
../common
./forgejo.nix
];
procolix.vm = {
name = "vm02116";
@ -12,4 +15,14 @@
## two options can safely be removed.
boot.initrd.availableKernelModules = [ "xen_blkfront" ];
services.xe-guest-utilities.enable = true;
fileSystems."/" = {
device = "/dev/disk/by-uuid/3802a66d-e31a-4650-86f3-b51b11918853";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/2CE2-1173";
fsType = "vfat";
};
}

View file

@ -5,6 +5,7 @@ in
{
services.forgejo = {
enable = true;
lfs.enable = true;
settings = {
service = {
DISABLE_REGISTRATION = true;

View file

@ -1,11 +0,0 @@
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/3802a66d-e31a-4650-86f3-b51b11918853";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/2CE2-1173";
fsType = "vfat";
};
}

View file

@ -1,9 +0,0 @@
{
imports = [ ../common ];
procolix.vm = {
name = "vm02179";
ip4 = "185.206.232.179";
ip6 = "2a00:51c0:12:1201::179";
};
}

View file

@ -1,4 +1,15 @@
{
imports = [
../common
./gitea-runner.nix
];
procolix.vm = {
name = "vm02179";
ip4 = "185.206.232.179";
ip6 = "2a00:51c0:12:1201::179";
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/119863f8-55cf-4e2f-ac17-27599a63f241";
fsType = "ext4";

View file

@ -1,4 +1,15 @@
{
imports = [
../common
./gitea-runner.nix
];
procolix.vm = {
name = "vm02186";
ip4 = "185.206.232.186";
ip6 = "2a00:51c0:12:1201::186";
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/833ac0f9-ad8c-45ae-a9bf-5844e378c44a";
fsType = "ext4";

View file

@ -1,9 +0,0 @@
{
imports = [ ../common ];
procolix.vm = {
name = "vm02186";
ip4 = "185.206.232.186";
ip6 = "2a00:51c0:12:1201::186";
};
}

View file

@ -1,4 +1,15 @@
{
imports = [
../common
./wiki.nix
];
procolix.vm = {
name = "vm02187";
ip4 = "185.206.232.187";
ip6 = "2a00:51c0:12:1201::187";
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/a46a9c46-e32b-4216-a4aa-8819b2cd0d49";
fsType = "ext4";

View file

@ -1,14 +1,6 @@
{ pkgs, ... }:
{
imports = [ ../common ];
procolix.vm = {
name = "vm02187";
ip4 = "185.206.232.187";
ip6 = "2a00:51c0:12:1201::187";
};
services.phpfpm.pools.mediawiki.phpOptions = ''
upload_max_filesize = 1024M;
post_max_size = 1024M;

View file

@ -30,6 +30,26 @@ Structured content is managed through Nix expressions, and copy is written in [C
- Edit any of the files, see [repository layout](#repository-layout) for guidance
# Testing
As a derivation, e.g. for CI:
```bash
nix-build -A tests
```
In the development shell:
```bash
run-tests
```
Running tests in a loop on source code changes:
```bash
test-loop
```
# Repository layout
- [content](./content)

View file

@ -14,16 +14,11 @@ let
in
new // { types = prev.recursiveUpdate prev.types new.types; };
lib'' = lib.extend lib';
# TODO: update when the PR to expose `pkgs.devmode` is merged
# https://github.com/NixOS/nixpkgs/pull/354556
devmode = pkgs.callPackage "${sources.devmode-reusable}/pkgs/by-name/de/devmode/package.nix" {
buildArgs = "${toString ./.} -A build --show-trace";
open = "/index.html";
};
in
rec {
lib = import ./lib.nix { inherit lib; };
result = lib''.evalModules {
lib = lib'';
result = lib.evalModules {
modules = [
./structure
./content
@ -38,11 +33,36 @@ rec {
inherit (result.config) build;
shell = pkgs.mkShellNoCC {
packages = with pkgs; [
cmark
npins
devmode
];
};
shell =
let
run-tests = pkgs.writeShellApplication {
name = "run-tests";
text = with pkgs; with lib; ''
${getExe nix-unit} ${toString ./tests.nix} "$@"
'';
};
test-loop = pkgs.writeShellApplication {
name = "test-loop";
text = with pkgs; with lib; ''
${getExe watchexec} -w ${toString ./.} -- ${getExe nix-unit} ${toString ./tests.nix}
'';
};
devmode = pkgs.devmode.override {
buildArgs = "${toString ./.} -A build --show-trace";
open = "/index.html";
};
in
pkgs.mkShellNoCC {
packages = [
pkgs.npins
run-tests
test-loop
devmode
];
};
tests = with pkgs; with lib; runCommand "run-tests" { } ''
touch $out
${getExe nix-unit} ${./tests.nix} "$@"
'';
}

View file

@ -104,7 +104,7 @@ rec {
path1 = subpath.components path1';
prefix1 = with lib; take (length path1 - 1) path1;
path2 = subpath.components path2';
prefix2 = with lib; take (length path1 - 1) path2;
prefix2 = with lib; take (length path2 - 1) path2;
commonPrefixLength = with lists;
findFirstIndex (i: i.fst != i.snd)

View file

@ -1,22 +1,22 @@
{
"pins": {
"devmode-reusable": {
"nix-unit": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "fricklerhandwerk",
"repo": "nixpkgs"
"owner": "nix-community",
"repo": "nix-unit"
},
"branch": "refactor-devmode",
"revision": "f0746a6690939987734d6519a2e3daf28ed36d87",
"url": "https://github.com/fricklerhandwerk/nixpkgs/archive/f0746a6690939987734d6519a2e3daf28ed36d87.tar.gz",
"hash": "011kg3c2mfy7y808llpmq3hf6vv6rlazx8m11w41pnym4kwr3ivz"
"branch": "main",
"revision": "2071bbb765681ac3d8194ec560c8b27ff2a3b541",
"url": "https://github.com/nix-community/nix-unit/archive/2071bbb765681ac3d8194ec560c8b27ff2a3b541.tar.gz",
"hash": "0blz1kcmn9vnr9q3iqp2mv13hv3pdccljmmc54f8j7ybf5v0wgmp"
},
"nixpkgs": {
"type": "Channel",
"name": "nixpkgs-unstable",
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.11pre691017.b69de56fac8c/nixexprs.tar.xz",
"hash": "0z32pj0lh5ng2a6cn0qfmka8cynnygckn5615mkaxq2aplkvgzx3"
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-25.05pre711046.8edf06bea5bc/nixexprs.tar.xz",
"hash": "1mwsn0rvfm603svrq3pca4c51zlix5gkyr4gl6pxhhq3q6xs5s8y"
}
},
"version": 3

11
website/tests.nix Normal file
View file

@ -0,0 +1,11 @@
# tests written for running with `nix-unit`
# https://github.com/nix-community/nix-unit
let
inherit (import ./. { }) lib;
in
{
test-relativePath = {
expr = with lib; relativePath "bar" "baz";
expected = "./baz";
};
}