Files
archived-hipudding-teslamate/nix/flake-modules/checks.nix
scottbot95 dffdea99ef refactor: Cleanup nix code (#4265)
* refactor: Extract package creation to separate flake-module

* refactor: move module.nix to nix folder

* refactor: extract checks into their own flake module

* refactor: extract devShell into its own flake module

* refactor: Extract nix dev dependencies to a separate partition

* fix: spelling error

* fix: Checks break on darwin

Looks like `mkIf` doesn't work properly with flake-parts/perSystem

* fix: Remove partitions to make `devenv up` work

RIP partitions :(

* style: linter findings

---------

Co-authored-by: Jakob Lichterfeld <jakob-lichterfeld@gmx.de>
2024-10-21 15:40:49 +02:00

49 lines
1.2 KiB
Nix

{ self, inputs, ... }:
{
perSystem =
{ self'
, pkgs
, lib
, ...
}:
let
inherit (inputs) nixpkgs;
moduleTest =
(nixpkgs.lib.nixos.runTest {
hostPkgs = pkgs;
defaults.documentation.enable = false;
imports = [
{
name = "teslamate";
nodes.server = {
imports = [ self.nixosModules.default ];
virtualisation.cores = 4;
virtualisation.memorySize = 2048;
services.teslamate = {
enable = true;
secretsFile = builtins.toFile "teslamate.env" ''
ENCRYPTION_KEY=123456789
DATABASE_PASS=123456789
RELEASE_COOKIE=123456789
'';
postgres.enable_server = true;
grafana.enable = true;
};
};
testScript = ''
server.wait_for_open_port(4000)
'';
}
];
}).config.result;
in
{
checks =
if pkgs.stdenv.isLinux then {
default = moduleTest;
} else { };
};
}