Skip to content

Commit

Permalink
reduce test vm footprint
Browse files Browse the repository at this point in the history
  • Loading branch information
ibizaman committed Mar 17, 2024
1 parent b9a7cf6 commit 0119ae7
Show file tree
Hide file tree
Showing 12 changed files with 88 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/services/nextcloud-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ in

environment.systemPackages = [
# Needed for a few apps. Would be nice to avoid having to put that in the environment and instead override https://github.com/NixOS/nixpkgs/blob/261abe8a44a7e8392598d038d2e01f7b33cf26d0/nixos/modules/services/web-apps/nextcloud.nix#L1035
pkgs.ffmpeg
pkgs.ffmpeg-headless

# Needed for the recognize app.
pkgs.nodejs
Expand Down
4 changes: 4 additions & 0 deletions test/vm/arr.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;
# TODO: Test login
commonTestScript = appname: { nodes, ... }:
let
Expand Down Expand Up @@ -58,6 +59,9 @@ let
../../modules/blocks/postgresql.nix
../../modules/blocks/nginx.nix
../../modules/services/arr.nix
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
];

shb.arr.${appname} = {
Expand Down
11 changes: 11 additions & 0 deletions test/vm/audiobookshelf.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;

# TODO: Test login
commonTestScript = { nodes, ... }:
let
Expand Down Expand Up @@ -43,6 +45,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down Expand Up @@ -71,6 +76,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down Expand Up @@ -120,6 +128,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down
5 changes: 5 additions & 0 deletions test/vm/authelia.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;

ldapAdminPassword = "ldapAdminPassword";
in
{
Expand All @@ -8,6 +10,9 @@ in

nodes.machine = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down
8 changes: 8 additions & 0 deletions test/vm/grocy.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;

# TODO: Test login
commonTestScript = { nodes, ... }:
let
Expand Down Expand Up @@ -43,6 +45,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down Expand Up @@ -70,6 +75,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down
14 changes: 14 additions & 0 deletions test/vm/jellyfin.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;

# TODO: Test login
commonTestScript = { nodes, ... }:
let
Expand Down Expand Up @@ -43,6 +45,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down Expand Up @@ -71,6 +76,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down Expand Up @@ -119,6 +127,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down Expand Up @@ -169,6 +180,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down
6 changes: 6 additions & 0 deletions test/vm/ldap.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;
in
{
auth = pkgs.nixosTest {
name = "ldap-auth";

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.ssl.enable = lib.mkEnableOption "ssl";
Expand Down
5 changes: 5 additions & 0 deletions test/vm/lib.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;

shblib = pkgs.callPackage ../../lib {};
in
{
Expand Down Expand Up @@ -45,6 +47,9 @@ in
nodes.machine = { config, pkgs, ... }:
{
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
libtest.config = lib.mkOption {
Expand Down
6 changes: 6 additions & 0 deletions test/vm/monitoring.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;
in
{
# This test, although simple, makes sure all provisioning went fine.
auth = pkgs.nixosTest {
name = "monitoring-basic";

nodes.machine = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.ssl.enable = lib.mkEnableOption "ssl";
Expand Down
7 changes: 7 additions & 0 deletions test/vm/nextcloud.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;
adminUser = "root";
adminPass = "rootpw";

Expand Down Expand Up @@ -129,6 +130,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down Expand Up @@ -169,6 +173,9 @@ in

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
{
options = {
shb.backup = lib.mkOption { type = lib.types.anything; };
Expand Down
15 changes: 15 additions & 0 deletions test/vm/postgresql.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;
in
{
peerWithoutUser = pkgs.nixosTest {
name = "postgresql-peerWithoutUser";

nodes.machine = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
../../modules/blocks/postgresql.nix
];

Expand Down Expand Up @@ -40,6 +46,9 @@

nodes.machine = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
../../modules/blocks/postgresql.nix
];

Expand Down Expand Up @@ -88,6 +97,9 @@

nodes.machine = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
../../modules/blocks/postgresql.nix
];

Expand Down Expand Up @@ -124,6 +136,9 @@

nodes.machine = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
../../modules/blocks/postgresql.nix
];

Expand Down
6 changes: 6 additions & 0 deletions test/vm/ssl.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{ pkgs, lib, ... }:
let
pkgs' = pkgs;
in
{
test = pkgs.nixosTest {
name = "ssl-test";

nodes.server = { config, pkgs, ... }: {
imports = [
(pkgs'.path + "/nixos/modules/profiles/minimal.nix")
(pkgs'.path + "/nixos/modules/profiles/headless.nix")
(pkgs'.path + "/nixos/modules/profiles/qemu-guest.nix")
../../modules/blocks/ssl.nix
];

Expand Down

0 comments on commit 0119ae7

Please sign in to comment.