nixos-mailserver/flake.nix

67 lines
1.6 KiB
Nix
Raw Normal View History

2020-12-15 16:01:40 +01:00
{
description = "A complete and Simple Nixos Mailserver";
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "flake:nixpkgs/nixos-unstable";
nixpkgs-21_05.url = "flake:nixpkgs/nixos-21.05";
blobs = {
url = "gitlab:simple-nixos-mailserver/blobs";
flake = false;
};
2020-12-15 16:01:40 +01:00
};
outputs = { self, utils, blobs, nixpkgs, nixpkgs-21_05 }: let
system = "x86_64-linux";
2020-12-15 16:01:40 +01:00
pkgs = nixpkgs.legacyPackages.${system};
# We want to test nixos-mailserver on several nixos releases
releases = [
{
name = "unstable";
pkgs = nixpkgs.legacyPackages.${system};
}
{
name = "21_05";
pkgs = nixpkgs-21_05.legacyPackages.${system};
}
];
testNames = [
"internal"
"external"
"clamav"
"multiple"
];
genTest = testName: release: {
"name"= "${testName}-${release.name}";
"value"= import (./tests/. + "/${testName}.nix") {
pkgs = release.pkgs;
inherit blobs;
};
};
# Generate an attribute set such as
# {
# external-unstable = <derivation>;
# external-21_05 = <derivation>;
# ...
# }
allTests = pkgs.lib.listToAttrs (
pkgs.lib.flatten (map (t: map (r: genTest t r) releases) testNames));
2020-12-15 16:01:40 +01:00
in {
nixosModules.mailserver = import ./.;
nixosModule = self.nixosModules.mailserver;
hydraJobs.${system} = allTests;
checks.${system} = allTests;
devShell.${system} = pkgs.mkShell {
2020-12-15 16:01:40 +01:00
buildInputs = with pkgs; [
(python3.withPackages (p: with p; [
sphinx
sphinx_rtd_theme
]))
jq
clamav
];
};
};
2020-12-15 16:01:40 +01:00
}