This commit is contained in:
commit
95a533c876
451 changed files with 18255 additions and 0 deletions
28
tests/build/hm-hyprland/default.nix
Normal file
28
tests/build/hm-hyprland/default.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.synix.homeModules.common
|
||||
inputs.synix.homeModules.hyprland
|
||||
inputs.synix.homeModules.nixvim
|
||||
inputs.synix.homeModules.stylix
|
||||
];
|
||||
|
||||
home.username = "test-user";
|
||||
|
||||
programs.nixvim.enable = true;
|
||||
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
autostart = true;
|
||||
};
|
||||
|
||||
stylix.enable = true;
|
||||
|
||||
home.stateVersion = "25.11";
|
||||
}
|
||||
7
tests/build/nixos-hyprland/boot.nix
Normal file
7
tests/build/nixos-hyprland/boot.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
boot.loader.systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 10;
|
||||
};
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
}
|
||||
20
tests/build/nixos-hyprland/default.nix
Normal file
20
tests/build/nixos-hyprland/default.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./boot.nix
|
||||
./hardware.nix
|
||||
./networking.nix
|
||||
./users.nix
|
||||
|
||||
inputs.synix.nixosModules.common
|
||||
inputs.synix.nixosModules.device.laptop
|
||||
inputs.synix.nixosModules.hyprland
|
||||
];
|
||||
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
48
tests/build/nixos-hyprland/hardware.nix
Normal file
48
tests/build/nixos-hyprland/hardware.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"ahci"
|
||||
"nvme"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
"sr_mod"
|
||||
"usb_storage"
|
||||
"virtio_pci"
|
||||
"virtio_scsi"
|
||||
"xhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/ROOT";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-label/BOOT";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"fmask=0022"
|
||||
"dmask=0022"
|
||||
];
|
||||
};
|
||||
|
||||
swapDevices = [ { device = "/dev/disk/by-label/SWAP"; } ];
|
||||
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
4
tests/build/nixos-hyprland/networking.nix
Normal file
4
tests/build/nixos-hyprland/networking.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
networking.hostName = "test-host";
|
||||
networking.domain = "test-host.local";
|
||||
}
|
||||
13
tests/build/nixos-hyprland/users.nix
Normal file
13
tests/build/nixos-hyprland/users.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.synix.nixosModules.normalUsers
|
||||
];
|
||||
|
||||
normalUsers.test-user = {
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
];
|
||||
};
|
||||
}
|
||||
7
tests/build/nixos-server/boot.nix
Normal file
7
tests/build/nixos-server/boot.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
boot.loader.systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 10;
|
||||
};
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
}
|
||||
20
tests/build/nixos-server/default.nix
Normal file
20
tests/build/nixos-server/default.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./boot.nix
|
||||
./hardware.nix
|
||||
./networking.nix
|
||||
./services
|
||||
./users.nix
|
||||
|
||||
inputs.synix.nixosModules.common
|
||||
inputs.synix.nixosModules.device.server
|
||||
];
|
||||
|
||||
system.stateVersion = "25.11";
|
||||
}
|
||||
48
tests/build/nixos-server/hardware.nix
Normal file
48
tests/build/nixos-server/hardware.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"ahci"
|
||||
"nvme"
|
||||
"sd_mod"
|
||||
"sdhci_pci"
|
||||
"sr_mod"
|
||||
"usb_storage"
|
||||
"virtio_pci"
|
||||
"virtio_scsi"
|
||||
"xhci_pci"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/ROOT";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" = {
|
||||
device = "/dev/disk/by-label/BOOT";
|
||||
fsType = "vfat";
|
||||
options = [
|
||||
"fmask=0022"
|
||||
"dmask=0022"
|
||||
];
|
||||
};
|
||||
|
||||
swapDevices = [ { device = "/dev/disk/by-label/SWAP"; } ];
|
||||
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
4
tests/build/nixos-server/networking.nix
Normal file
4
tests/build/nixos-server/networking.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
networking.hostName = "test-host";
|
||||
networking.domain = "test-host.local";
|
||||
}
|
||||
6
tests/build/nixos-server/services/default.nix
Normal file
6
tests/build/nixos-server/services/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./nginx.nix
|
||||
./openssh.nix
|
||||
];
|
||||
}
|
||||
14
tests/build/nixos-server/services/nginx.nix
Normal file
14
tests/build/nixos-server/services/nginx.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ inputs.synix.nixosModules.nginx ];
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
forceSSL = true;
|
||||
openFirewall = true;
|
||||
};
|
||||
}
|
||||
12
tests/build/nixos-server/services/openssh.nix
Normal file
12
tests/build/nixos-server/services/openssh.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.synix.nixosModules.openssh
|
||||
];
|
||||
|
||||
services.openssh.enable = true;
|
||||
}
|
||||
13
tests/build/nixos-server/users.nix
Normal file
13
tests/build/nixos-server/users.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.synix.nixosModules.normalUsers
|
||||
];
|
||||
|
||||
normalUsers.test-user = {
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
];
|
||||
};
|
||||
}
|
||||
95
tests/run/synapse.nix
Normal file
95
tests/run/synapse.nix
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
name = "synapse-test";
|
||||
|
||||
nodes.machine =
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.matrix-synapse;
|
||||
|
||||
keyFile = pkgs.writeText "livekit.key" "API Secret: secret";
|
||||
in
|
||||
{
|
||||
# fake sops module
|
||||
options.sops = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = { };
|
||||
};
|
||||
|
||||
imports = [
|
||||
../../modules/nixos/matrix-synapse
|
||||
../../modules/nixos/coturn
|
||||
../../modules/nixos/maubot
|
||||
];
|
||||
|
||||
config = {
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
coturn.enable = true;
|
||||
settings = {
|
||||
registration_shared_secret = "secret";
|
||||
turn_shared_secret = "turn-secret";
|
||||
};
|
||||
};
|
||||
|
||||
services.coturn = {
|
||||
enable = true;
|
||||
no-tls = true;
|
||||
static-auth-secret = "turn-secret";
|
||||
};
|
||||
|
||||
services.maubot = {
|
||||
enable = true;
|
||||
extraConfigFile = builtins.toString (
|
||||
pkgs.writeText "maubot-extra" ''
|
||||
homeservers:
|
||||
${cfg.settings.server_name}:
|
||||
url: http://127.0.0.1:${builtins.toString cfg.port}
|
||||
secret: ${cfg.settings.registration_shared_secret}
|
||||
admins:
|
||||
alice: password
|
||||
''
|
||||
);
|
||||
};
|
||||
|
||||
services.livekit.keyFile = keyFile;
|
||||
services.lk-jwt-service.keyFile = keyFile;
|
||||
|
||||
services.nginx.enable = true;
|
||||
networking.domain = "example.com";
|
||||
networking.firewall.enable = false; # simplify networking for test
|
||||
|
||||
# Override SSL/ACME requirements for test
|
||||
services.nginx.virtualHosts."example.com".forceSSL = lib.mkForce false;
|
||||
services.nginx.virtualHosts."example.com".enableACME = lib.mkForce false;
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
machine.wait_for_unit("default.target")
|
||||
|
||||
machine.wait_for_unit("matrix-synapse.service")
|
||||
machine.wait_for_open_port(8008)
|
||||
|
||||
machine.wait_for_unit("livekit.service")
|
||||
machine.wait_for_open_port(7880)
|
||||
|
||||
machine.wait_for_unit("lk-jwt-service.service")
|
||||
machine.wait_for_open_port(8080)
|
||||
|
||||
machine.wait_for_unit("coturn.service")
|
||||
machine.wait_for_open_port(3478)
|
||||
|
||||
machine.wait_for_unit("maubot.service")
|
||||
machine.wait_for_open_port(29316)
|
||||
|
||||
machine.succeed("curl -f http://localhost:8008/_matrix/client/versions")
|
||||
# machine.succeed("curl -f http://localhost:29316/_matrix/maubot/v1/logs") # TODO: add auth
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue