clan-core/checks/flake-module.nix

50 lines
1.8 KiB
Nix
Raw Normal View History

{ self, ... }: {
2023-08-26 22:18:17 +00:00
imports = [
./impure/flake-module.nix
2023-08-26 22:18:17 +00:00
];
2023-08-24 12:38:24 +00:00
perSystem = { pkgs, lib, self', ... }: {
checks =
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;
};
2023-09-28 13:57:12 +00:00
nixosTests = lib.optionalAttrs (pkgs.stdenv.isLinux) {
# import our test
secrets = import ./secrets nixosTestArgs;
2023-10-14 13:54:56 +00:00
container = import ./container nixosTestArgs;
2023-11-03 09:26:11 +00:00
deltachat = import ./deltachat nixosTestArgs;
2023-11-14 11:58:15 +00:00
meshnamed = import ./meshnamed nixosTestArgs;
borgbackup = import ./borgbackup nixosTestArgs;
};
schemaTests = pkgs.callPackages ./schemas.nix {
inherit self;
};
2023-08-24 12:38:24 +00:00
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 { });
in
2023-08-24 12:38:24 +00:00
nixosTests // schemaTests // flakeOutputs;
2023-10-14 13:54:56 +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;
};
};
};
}