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-11-30 22:14:01 +01:00
|
|
|
nmdsrc = {
|
|
|
|
url = "git+https://git.sr.ht/~rycee/nmd";
|
|
|
|
flake = false;
|
|
|
|
};
|
2023-06-23 06:22:34 +02:00
|
|
|
};
|
|
|
|
|
2023-11-30 22:14:01 +01:00
|
|
|
outputs = { nixpkgs, nix-flake-tests, flake-utils, nmdsrc, ... }: flake-utils.lib.eachDefaultSystem (system:
|
2023-11-05 04:30:17 +01:00
|
|
|
let
|
2024-05-27 08:08:29 +02:00
|
|
|
originPkgs = nixpkgs.legacyPackages.${system};
|
2023-12-04 09:33:16 +01:00
|
|
|
patches = [
|
2024-05-27 08:08:29 +02:00
|
|
|
(originPkgs.fetchpatch {
|
|
|
|
url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/315018.patch";
|
|
|
|
hash = "sha256-8jcGyO/d+htfv/ZajxXh89S3OiDZAr7/fsWC1JpGczM=";
|
|
|
|
})
|
2024-06-10 08:30:14 +02:00
|
|
|
(originPkgs.fetchpatch {
|
|
|
|
url = "https://github.com/NixOS/nixpkgs/pull/317107.patch";
|
2024-06-10 09:25:44 +02:00
|
|
|
hash = "sha256-6SfqnPLPxJHckXNU03HA0X03u9Ynn3baQ2HHMq5FkIc=";
|
2024-06-10 08:30:14 +02:00
|
|
|
})
|
2023-12-04 09:33:16 +01:00
|
|
|
];
|
|
|
|
patchedNixpkgs = originPkgs.applyPatches {
|
|
|
|
name = "nixpkgs-patched";
|
|
|
|
src = nixpkgs;
|
2024-05-27 08:08:29 +02:00
|
|
|
inherit patches;
|
2023-11-30 19:38:35 +01:00
|
|
|
};
|
|
|
|
|
2023-12-04 09:33:16 +01:00
|
|
|
pkgs = import patchedNixpkgs {
|
|
|
|
inherit system;
|
|
|
|
};
|
2023-11-30 22:14:01 +01:00
|
|
|
|
2023-11-30 19:38:35 +01:00
|
|
|
allModules = [
|
|
|
|
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
|
2024-03-04 02:25:26 +01:00
|
|
|
modules/services/audiobookshelf.nix
|
2023-11-30 19:38:35 +01:00
|
|
|
modules/services/deluge.nix
|
2024-03-04 02:25:26 +01:00
|
|
|
modules/services/grocy.nix
|
2023-11-30 19:38:35 +01:00
|
|
|
modules/services/hledger.nix
|
|
|
|
modules/services/home-assistant.nix
|
|
|
|
modules/services/jellyfin.nix
|
|
|
|
modules/services/nextcloud-server.nix
|
|
|
|
modules/services/vaultwarden.nix
|
|
|
|
];
|
2024-04-15 00:21:20 +02:00
|
|
|
|
|
|
|
# Only used for documentation.
|
|
|
|
contractDummyModules = [
|
|
|
|
modules/contracts/ssl/dummyModule.nix
|
|
|
|
];
|
2023-11-05 04:30:17 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
nixosModules.default = { config, ... }: {
|
2023-11-30 19:38:35 +01:00
|
|
|
imports = allModules;
|
2023-11-05 04:30:17 +01:00
|
|
|
};
|
2023-06-23 06:22:34 +02:00
|
|
|
|
2023-12-04 09:33:16 +01:00
|
|
|
packages.manualHtml = pkgs.callPackage ./docs {
|
2024-04-15 00:21:20 +02:00
|
|
|
inherit nmdsrc;
|
|
|
|
allModules = allModules ++ contractDummyModules;
|
2023-12-04 09:33:16 +01:00
|
|
|
release = "0.0.1";
|
|
|
|
};
|
2023-11-30 19:38:35 +01:00
|
|
|
|
2024-01-12 08:22:46 +01:00
|
|
|
lib.contracts = pkgs.callPackage ./modules/contracts {};
|
|
|
|
|
2023-11-22 07:18:48 +01:00
|
|
|
checks =
|
|
|
|
let
|
|
|
|
importFiles = files:
|
2023-12-08 19:37:57 +01:00
|
|
|
map (m: pkgs.callPackage m {}) 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;
|
|
|
|
}
|
|
|
|
);
|
2024-05-27 08:08:29 +02:00
|
|
|
|
|
|
|
shblib = pkgs.callPackage ./lib {};
|
2023-11-23 10:03:33 +01:00
|
|
|
in (rec {
|
2023-11-22 07:18:48 +01:00
|
|
|
all = mergeTests [
|
|
|
|
modules
|
|
|
|
];
|
|
|
|
|
2024-05-27 08:08:29 +02:00
|
|
|
modules = shblib.check {
|
2023-11-22 07:18:48 +01:00
|
|
|
inherit pkgs;
|
|
|
|
tests =
|
|
|
|
mergeTests (importFiles [
|
|
|
|
./test/modules/arr.nix
|
|
|
|
./test/modules/davfs.nix
|
2024-03-01 00:34:53 +01:00
|
|
|
./test/modules/lib.nix
|
2023-12-01 07:49:34 +01:00
|
|
|
./test/modules/nginx.nix
|
2023-11-22 07:18:48 +01:00
|
|
|
./test/modules/postgresql.nix
|
|
|
|
]);
|
|
|
|
};
|
2024-03-01 00:34:53 +01:00
|
|
|
|
|
|
|
lib = nix-flake-tests.lib.check {
|
|
|
|
inherit pkgs;
|
|
|
|
tests = pkgs.callPackage ./test/modules/lib.nix {};
|
|
|
|
};
|
2023-11-23 10:03:33 +01:00
|
|
|
}
|
2024-03-13 06:40:32 +01:00
|
|
|
// (vm_test "arr" ./test/vm/arr.nix)
|
2024-03-04 02:01:00 +01:00
|
|
|
// (vm_test "audiobookshelf" ./test/vm/audiobookshelf.nix)
|
2023-12-11 06:56:31 +01:00
|
|
|
// (vm_test "authelia" ./test/vm/authelia.nix)
|
2024-06-10 08:29:40 +02:00
|
|
|
// (vm_test "deluge" ./test/vm/deluge.nix)
|
2024-03-04 02:25:26 +01:00
|
|
|
// (vm_test "grocy" ./test/vm/grocy.nix)
|
2024-05-25 02:56:36 +02:00
|
|
|
// (vm_test "home-assistant" ./test/vm/home-assistant.nix)
|
2024-03-03 07:58:36 +01:00
|
|
|
// (vm_test "jellyfin" ./test/vm/jellyfin.nix)
|
2023-12-01 07:08:38 +01:00
|
|
|
// (vm_test "ldap" ./test/vm/ldap.nix)
|
2024-03-01 00:34:53 +01:00
|
|
|
// (vm_test "lib" ./test/vm/lib.nix)
|
2023-11-26 18:56:08 +01:00
|
|
|
// (vm_test "monitoring" ./test/vm/monitoring.nix)
|
2023-12-30 18:51:55 +01:00
|
|
|
// (vm_test "nextcloud" ./test/vm/nextcloud.nix)
|
2024-03-04 02:25:26 +01:00
|
|
|
// (vm_test "postgresql" ./test/vm/postgresql.nix)
|
2024-01-12 08:22:46 +01:00
|
|
|
// (vm_test "ssl" ./test/vm/ssl.nix)
|
2024-05-25 00:02:38 +02:00
|
|
|
// (vm_test "vaultwarden" ./test/vm/vaultwarden.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
|
|
|
}
|