2023-06-23 06:22:34 +02:00
|
|
|
{
|
|
|
|
description = "SelfHostBlocks module";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
|
|
sops-nix.url = "github:Mic92/sops-nix";
|
2023-11-05 04:30:17 +01:00
|
|
|
nix-flake-tests.url = "github:antifuchs/nix-flake-tests";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
2023-06-23 06:22:34 +02:00
|
|
|
};
|
|
|
|
|
2023-11-23 10:03:33 +01:00
|
|
|
outputs = { nixpkgs, nix-flake-tests, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
|
2023-11-05 04:30:17 +01:00
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
nixosModules.default = { config, ... }: {
|
|
|
|
imports = [
|
2023-11-21 07:20:19 +01:00
|
|
|
modules/blocks/authelia.nix
|
|
|
|
modules/blocks/backup.nix
|
|
|
|
modules/blocks/davfs.nix
|
|
|
|
modules/blocks/ldap.nix
|
|
|
|
modules/blocks/monitoring.nix
|
|
|
|
modules/blocks/nginx.nix
|
|
|
|
modules/blocks/postgresql.nix
|
|
|
|
modules/blocks/ssl.nix
|
|
|
|
modules/blocks/tinyproxy.nix
|
|
|
|
modules/blocks/vpn.nix
|
|
|
|
|
|
|
|
modules/services/arr.nix
|
|
|
|
modules/services/deluge.nix
|
|
|
|
modules/services/hledger.nix
|
|
|
|
modules/services/home-assistant.nix
|
|
|
|
modules/services/jellyfin.nix
|
|
|
|
modules/services/nextcloud-server.nix
|
|
|
|
modules/services/vaultwarden.nix
|
2023-11-05 04:30:17 +01:00
|
|
|
];
|
|
|
|
};
|
2023-06-23 06:22:34 +02:00
|
|
|
|
2023-11-22 07:18:48 +01:00
|
|
|
checks =
|
|
|
|
let
|
|
|
|
importFiles = files:
|
|
|
|
map (m: import m {
|
|
|
|
inherit pkgs;
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
}) files;
|
2023-11-08 05:26:34 +01:00
|
|
|
|
2023-11-22 07:18:48 +01:00
|
|
|
mergeTests = pkgs.lib.lists.foldl pkgs.lib.trivial.mergeAttrs {};
|
2023-11-23 10:03:33 +01:00
|
|
|
|
|
|
|
flattenAttrs = root: attrset: pkgs.lib.attrsets.foldlAttrs (acc: name: value: acc // {
|
|
|
|
"${root}_${name}" = value;
|
|
|
|
}) {} attrset;
|
2023-11-26 18:56:08 +01:00
|
|
|
|
|
|
|
vm_test = name: path: flattenAttrs "vm_${name}" (
|
|
|
|
import path {
|
|
|
|
inherit pkgs;
|
|
|
|
inherit (pkgs) lib;
|
|
|
|
}
|
|
|
|
);
|
2023-11-23 10:03:33 +01:00
|
|
|
in (rec {
|
2023-11-22 07:18:48 +01:00
|
|
|
all = mergeTests [
|
|
|
|
modules
|
|
|
|
];
|
|
|
|
|
|
|
|
modules = nix-flake-tests.lib.check {
|
|
|
|
inherit pkgs;
|
|
|
|
tests =
|
|
|
|
mergeTests (importFiles [
|
|
|
|
./test/modules/arr.nix
|
|
|
|
./test/modules/davfs.nix
|
|
|
|
./test/modules/postgresql.nix
|
|
|
|
]);
|
|
|
|
};
|
2023-11-23 10:03:33 +01:00
|
|
|
}
|
2023-11-26 18:56:08 +01:00
|
|
|
// (vm_test "postgresql" ./test/vm/postgresql.nix)
|
|
|
|
// (vm_test "monitoring" ./test/vm/monitoring.nix)
|
2023-11-23 10:03:33 +01:00
|
|
|
);
|
2023-11-05 04:30:17 +01:00
|
|
|
}
|
|
|
|
);
|
2023-06-23 06:22:34 +02:00
|
|
|
}
|