mod: only define checks for x86_64-linux
This commit is contained in:
parent
c333122720
commit
d28c8d7b6a
1 changed files with 141 additions and 125 deletions
266
flake.nix
266
flake.nix
|
|
@ -20,11 +20,10 @@
|
||||||
nmdsrc,
|
nmdsrc,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (
|
let
|
||||||
system:
|
shbPatches =
|
||||||
let
|
system:
|
||||||
originPkgs = nixpkgs.legacyPackages.${system};
|
nixpkgs.legacyPackages.${system}.lib.optionals (system == "x86_64-linux") [
|
||||||
shbPatches = originPkgs.lib.optionals (system == "x86_64-linux") [
|
|
||||||
# Get rid of lldap patches when https://github.com/NixOS/nixpkgs/pull/425923 is merged.
|
# Get rid of lldap patches when https://github.com/NixOS/nixpkgs/pull/425923 is merged.
|
||||||
./patches/lldap.patch
|
./patches/lldap.patch
|
||||||
./patches/0001-nixos-borgbackup-add-option-to-override-state-direct.patch
|
./patches/0001-nixos-borgbackup-add-option-to-override-state-direct.patch
|
||||||
|
|
@ -35,33 +34,42 @@
|
||||||
# hash = "sha256-hoLrqV7XtR1hP/m0rV9hjYUBtrSjay0qcPUYlKKuVWk=";
|
# hash = "sha256-hoLrqV7XtR1hP/m0rV9hjYUBtrSjay0qcPUYlKKuVWk=";
|
||||||
# })
|
# })
|
||||||
];
|
];
|
||||||
patchNixpkgs =
|
|
||||||
{
|
patchNixpkgs =
|
||||||
nixpkgs,
|
{
|
||||||
patches,
|
nixpkgs,
|
||||||
system,
|
patches,
|
||||||
}:
|
system,
|
||||||
nixpkgs.legacyPackages.${system}.applyPatches {
|
}:
|
||||||
name = "nixpkgs-patched";
|
nixpkgs.legacyPackages.${system}.applyPatches {
|
||||||
src = nixpkgs;
|
name = "nixpkgs-patched";
|
||||||
inherit patches;
|
src = nixpkgs;
|
||||||
|
inherit patches;
|
||||||
|
};
|
||||||
|
patchedNixpkgs =
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
patched = patchNixpkgs {
|
||||||
|
nixpkgs = inputs.nixpkgs;
|
||||||
|
patches = shbPatches system;
|
||||||
|
inherit system;
|
||||||
};
|
};
|
||||||
patchedNixpkgs =
|
in
|
||||||
let
|
patched
|
||||||
patched = patchNixpkgs {
|
// {
|
||||||
nixpkgs = inputs.nixpkgs;
|
nixosSystem = args: import "${patched}/nixos/lib/eval-config.nix" args;
|
||||||
patches = shbPatches;
|
};
|
||||||
inherit system;
|
pkgs' =
|
||||||
};
|
system:
|
||||||
in
|
import (patchedNixpkgs system) {
|
||||||
patched
|
|
||||||
// {
|
|
||||||
nixosSystem = args: import "${patched}/nixos/lib/eval-config.nix" args;
|
|
||||||
};
|
|
||||||
pkgs = import patchedNixpkgs {
|
|
||||||
inherit system;
|
inherit system;
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
flake-utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = pkgs' system;
|
||||||
|
|
||||||
# The contract dummies are used to show options for contracts.
|
# The contract dummies are used to show options for contracts.
|
||||||
contractDummyModules = [
|
contractDummyModules = [
|
||||||
|
|
@ -239,105 +247,11 @@
|
||||||
contracts = pkgs.callPackage ./modules/contracts {
|
contracts = pkgs.callPackage ./modules/contracts {
|
||||||
shb = self.lib.${system};
|
shb = self.lib.${system};
|
||||||
};
|
};
|
||||||
patches = shbPatches;
|
patches = shbPatches system;
|
||||||
inherit patchNixpkgs patchedNixpkgs;
|
inherit patchNixpkgs;
|
||||||
|
patchedNixpkgs = patchedNixpkgs system;
|
||||||
};
|
};
|
||||||
|
|
||||||
checks =
|
|
||||||
let
|
|
||||||
inherit (pkgs.lib)
|
|
||||||
foldl
|
|
||||||
foldlAttrs
|
|
||||||
mergeAttrs
|
|
||||||
optionalAttrs
|
|
||||||
;
|
|
||||||
|
|
||||||
importFiles =
|
|
||||||
files:
|
|
||||||
map (
|
|
||||||
m:
|
|
||||||
pkgs.callPackage m {
|
|
||||||
shb = self.lib.${system};
|
|
||||||
}
|
|
||||||
) files;
|
|
||||||
|
|
||||||
mergeTests = foldl mergeAttrs { };
|
|
||||||
|
|
||||||
flattenAttrs =
|
|
||||||
root: attrset:
|
|
||||||
foldlAttrs (
|
|
||||||
acc: name: value:
|
|
||||||
acc
|
|
||||||
// {
|
|
||||||
"${root}_${name}" = value;
|
|
||||||
}
|
|
||||||
) { } attrset;
|
|
||||||
|
|
||||||
vm_test =
|
|
||||||
name: path:
|
|
||||||
flattenAttrs "vm_${name}" (
|
|
||||||
removeAttrs
|
|
||||||
(pkgs.callPackage path {
|
|
||||||
shb = self.lib.${system};
|
|
||||||
})
|
|
||||||
[
|
|
||||||
"override"
|
|
||||||
"overrideDerivation"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
in
|
|
||||||
(optionalAttrs (system == "x86_64-linux") (
|
|
||||||
{
|
|
||||||
modules = self.lib.${system}.check {
|
|
||||||
inherit pkgs;
|
|
||||||
tests = mergeTests (importFiles [
|
|
||||||
./test/modules/davfs.nix
|
|
||||||
# TODO: Make this not use IFD
|
|
||||||
./test/modules/lib.nix
|
|
||||||
]);
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: Make this not use IFD
|
|
||||||
lib = nix-flake-tests.lib.check {
|
|
||||||
inherit pkgs;
|
|
||||||
tests = pkgs.callPackage ./test/modules/lib.nix {
|
|
||||||
shb = self.lib.${system};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// (vm_test "arr" ./test/services/arr.nix)
|
|
||||||
// (vm_test "audiobookshelf" ./test/services/audiobookshelf.nix)
|
|
||||||
// (vm_test "deluge" ./test/services/deluge.nix)
|
|
||||||
// (vm_test "firefly-iii" ./test/services/firefly-iii.nix)
|
|
||||||
// (vm_test "forgejo" ./test/services/forgejo.nix)
|
|
||||||
// (vm_test "grocy" ./test/services/grocy.nix)
|
|
||||||
// (vm_test "hledger" ./test/services/hledger.nix)
|
|
||||||
// (vm_test "immich" ./test/services/immich.nix)
|
|
||||||
// (vm_test "homeassistant" ./test/services/home-assistant.nix)
|
|
||||||
// (vm_test "homepage" ./test/services/homepage.nix)
|
|
||||||
// (vm_test "jellyfin" ./test/services/jellyfin.nix)
|
|
||||||
// (vm_test "karakeep" ./test/services/karakeep.nix)
|
|
||||||
// (vm_test "nextcloud" ./test/services/nextcloud.nix)
|
|
||||||
// (vm_test "open-webui" ./test/services/open-webui.nix)
|
|
||||||
// (vm_test "paperless" ./test/services/paperless.nix)
|
|
||||||
// (vm_test "pinchflat" ./test/services/pinchflat.nix)
|
|
||||||
// (vm_test "vaultwarden" ./test/services/vaultwarden.nix)
|
|
||||||
|
|
||||||
// (vm_test "authelia" ./test/blocks/authelia.nix)
|
|
||||||
// (vm_test "borgbackup" ./test/blocks/borgbackup.nix)
|
|
||||||
// (vm_test "lldap" ./test/blocks/lldap.nix)
|
|
||||||
// (vm_test "lib" ./test/blocks/lib.nix)
|
|
||||||
// (vm_test "mitmdump" ./test/blocks/mitmdump.nix)
|
|
||||||
// (vm_test "monitoring" ./test/blocks/monitoring.nix)
|
|
||||||
// (vm_test "postgresql" ./test/blocks/postgresql.nix)
|
|
||||||
// (vm_test "restic" ./test/blocks/restic.nix)
|
|
||||||
// (vm_test "ssl" ./test/blocks/ssl.nix)
|
|
||||||
|
|
||||||
// (vm_test "contracts-backup" ./test/contracts/backup.nix)
|
|
||||||
// (vm_test "contracts-databasebackup" ./test/contracts/databasebackup.nix)
|
|
||||||
// (vm_test "contracts-secret" ./test/contracts/secret.nix)
|
|
||||||
));
|
|
||||||
|
|
||||||
# To see the traces, run:
|
# To see the traces, run:
|
||||||
# nix run .#playwright -- show-trace $(nix eval .#checks.x86_64-linux.vm_grocy_basic --raw)/trace/0.zip
|
# nix run .#playwright -- show-trace $(nix eval .#checks.x86_64-linux.vm_grocy_basic --raw)/trace/0.zip
|
||||||
packages.playwright = pkgs.callPackage (
|
packages.playwright = pkgs.callPackage (
|
||||||
|
|
@ -393,6 +307,108 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
// flake-utils.lib.eachSystem [ "x86_64-linux" ] (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = pkgs' system;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
checks =
|
||||||
|
let
|
||||||
|
inherit (pkgs.lib)
|
||||||
|
foldl
|
||||||
|
foldlAttrs
|
||||||
|
mergeAttrs
|
||||||
|
;
|
||||||
|
|
||||||
|
importFiles =
|
||||||
|
files:
|
||||||
|
map (
|
||||||
|
m:
|
||||||
|
pkgs.callPackage m {
|
||||||
|
shb = self.lib.${system};
|
||||||
|
}
|
||||||
|
) files;
|
||||||
|
|
||||||
|
mergeTests = foldl mergeAttrs { };
|
||||||
|
|
||||||
|
flattenAttrs =
|
||||||
|
root: attrset:
|
||||||
|
foldlAttrs (
|
||||||
|
acc: name: value:
|
||||||
|
acc
|
||||||
|
// {
|
||||||
|
"${root}_${name}" = value;
|
||||||
|
}
|
||||||
|
) { } attrset;
|
||||||
|
|
||||||
|
vm_test =
|
||||||
|
name: path:
|
||||||
|
flattenAttrs "vm_${name}" (
|
||||||
|
removeAttrs
|
||||||
|
(pkgs.callPackage path {
|
||||||
|
shb = self.lib.${system};
|
||||||
|
})
|
||||||
|
[
|
||||||
|
"override"
|
||||||
|
"overrideDerivation"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
in
|
||||||
|
(
|
||||||
|
{
|
||||||
|
modules = self.lib.${system}.check {
|
||||||
|
inherit pkgs;
|
||||||
|
tests = mergeTests (importFiles [
|
||||||
|
./test/modules/davfs.nix
|
||||||
|
# TODO: Make this not use IFD
|
||||||
|
./test/modules/lib.nix
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Make this not use IFD
|
||||||
|
lib = nix-flake-tests.lib.check {
|
||||||
|
inherit pkgs;
|
||||||
|
tests = pkgs.callPackage ./test/modules/lib.nix {
|
||||||
|
shb = self.lib.${system};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// (vm_test "arr" ./test/services/arr.nix)
|
||||||
|
// (vm_test "audiobookshelf" ./test/services/audiobookshelf.nix)
|
||||||
|
// (vm_test "deluge" ./test/services/deluge.nix)
|
||||||
|
// (vm_test "firefly-iii" ./test/services/firefly-iii.nix)
|
||||||
|
// (vm_test "forgejo" ./test/services/forgejo.nix)
|
||||||
|
// (vm_test "grocy" ./test/services/grocy.nix)
|
||||||
|
// (vm_test "hledger" ./test/services/hledger.nix)
|
||||||
|
// (vm_test "immich" ./test/services/immich.nix)
|
||||||
|
// (vm_test "homeassistant" ./test/services/home-assistant.nix)
|
||||||
|
// (vm_test "homepage" ./test/services/homepage.nix)
|
||||||
|
// (vm_test "jellyfin" ./test/services/jellyfin.nix)
|
||||||
|
// (vm_test "karakeep" ./test/services/karakeep.nix)
|
||||||
|
// (vm_test "nextcloud" ./test/services/nextcloud.nix)
|
||||||
|
// (vm_test "open-webui" ./test/services/open-webui.nix)
|
||||||
|
// (vm_test "paperless" ./test/services/paperless.nix)
|
||||||
|
// (vm_test "pinchflat" ./test/services/pinchflat.nix)
|
||||||
|
// (vm_test "vaultwarden" ./test/services/vaultwarden.nix)
|
||||||
|
|
||||||
|
// (vm_test "authelia" ./test/blocks/authelia.nix)
|
||||||
|
// (vm_test "borgbackup" ./test/blocks/borgbackup.nix)
|
||||||
|
// (vm_test "lldap" ./test/blocks/lldap.nix)
|
||||||
|
// (vm_test "lib" ./test/blocks/lib.nix)
|
||||||
|
// (vm_test "mitmdump" ./test/blocks/mitmdump.nix)
|
||||||
|
// (vm_test "monitoring" ./test/blocks/monitoring.nix)
|
||||||
|
// (vm_test "postgresql" ./test/blocks/postgresql.nix)
|
||||||
|
// (vm_test "restic" ./test/blocks/restic.nix)
|
||||||
|
// (vm_test "ssl" ./test/blocks/ssl.nix)
|
||||||
|
|
||||||
|
// (vm_test "contracts-backup" ./test/contracts/backup.nix)
|
||||||
|
// (vm_test "contracts-databasebackup" ./test/contracts/databasebackup.nix)
|
||||||
|
// (vm_test "contracts-secret" ./test/contracts/secret.nix)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
// {
|
// {
|
||||||
herculesCI.ciSystems = [ "x86_64-linux" ];
|
herculesCI.ciSystems = [ "x86_64-linux" ];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue