mirror of
https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git
synced 2024-12-26 15:06:14 +01:00
a0f9688a31
We also move tests to Flakes. This would allow users to submit PRs with a fork of nixpkgs when they want to test nixpkgs PRs against SNM.
66 lines
1.6 KiB
Nix
66 lines
1.6 KiB
Nix
{
|
|
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;
|
|
};
|
|
};
|
|
|
|
outputs = { self, utils, blobs, nixpkgs, nixpkgs-21_05 }: let
|
|
system = "x86_64-linux";
|
|
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));
|
|
|
|
in {
|
|
nixosModules.mailserver = import ./.;
|
|
nixosModule = self.nixosModules.mailserver;
|
|
hydraJobs.${system} = allTests;
|
|
checks.${system} = allTests;
|
|
devShell.${system} = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
(python3.withPackages (p: with p; [
|
|
sphinx
|
|
sphinx_rtd_theme
|
|
]))
|
|
jq
|
|
clamav
|
|
];
|
|
};
|
|
};
|
|
}
|