clan-core/checks/flake-module.nix

80 lines
2.7 KiB
Nix
Raw Normal View History

2024-03-17 18:48:49 +00:00
{ self, ... }:
{
2023-08-26 22:18:17 +00:00
imports = [
./impure/flake-module.nix
2023-12-16 19:57:39 +00:00
./backups/flake-module.nix
2023-12-18 22:37:45 +00:00
./installation/flake-module.nix
2024-03-07 12:30:53 +00:00
./flash/flake-module.nix
2023-08-26 22:18:17 +00:00
];
2024-03-17 18:48:49 +00:00
perSystem =
{
pkgs,
lib,
self',
...
}:
{
checks =
2023-10-14 13:54:56 +00:00
let
2024-03-25 07:44:39 +00:00
# ensure all options can be rendered after importing clan into nixos
renderClanOptions =
let
docs = pkgs.nixosOptionsDoc {
options =
(pkgs.nixos {
imports = [ self.nixosModules.clanCore ];
clanCore.clanDir = ./.;
}).options;
2024-03-25 07:44:39 +00:00
warningsAreErrors = false;
};
in
docs.optionsJSON;
2023-10-14 13:54:56 +00:00
nixosTestArgs = {
# reference to nixpkgs for the current system
inherit pkgs;
# this gives us a reference to our flake but also all flake inputs
inherit self;
};
2024-03-17 18:48:49 +00:00
nixosTests = lib.optionalAttrs (pkgs.stdenv.isLinux) {
# import our test
secrets = import ./secrets nixosTestArgs;
container = import ./container nixosTestArgs;
deltachat = import ./deltachat nixosTestArgs;
2024-03-22 11:14:36 +00:00
matrix-synapse = import ./matrix-synapse nixosTestArgs;
2024-03-17 18:48:49 +00:00
zt-tcp-relay = import ./zt-tcp-relay nixosTestArgs;
borgbackup = import ./borgbackup nixosTestArgs;
syncthing = import ./syncthing nixosTestArgs;
2024-05-31 14:36:37 +00:00
postgresql = import ./postgresql nixosTestArgs;
2024-03-17 18:48:49 +00:00
wayland-proxy-virtwl = import ./wayland-proxy-virtwl nixosTestArgs;
};
flakeOutputs =
lib.mapAttrs' (
name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel
) self.nixosConfigurations
// lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages
// lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells
// lib.mapAttrs' (name: config: lib.nameValuePair "home-manager-${name}" config.activation-script) (
self'.legacyPackages.homeConfigurations or { }
);
2023-10-14 13:54:56 +00:00
in
{ inherit renderClanOptions; } // nixosTests // flakeOutputs;
2024-03-17 18:48:49 +00:00
legacyPackages = {
nixosTests =
let
nixosTestArgs = {
# reference to nixpkgs for the current system
inherit pkgs;
# this gives us a reference to our flake but also all flake inputs
inherit self;
};
in
lib.optionalAttrs (pkgs.stdenv.isLinux) {
# import our test
secrets = import ./secrets nixosTestArgs;
container = import ./container nixosTestArgs;
};
};
2023-10-14 13:54:56 +00:00
};
}