Skip to content

Commit

Permalink
refactor(tests): call from flake.nix (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo authored Nov 28, 2024
1 parent 2e2bdec commit becc648
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 42 deletions.
19 changes: 14 additions & 5 deletions dev/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,20 @@

checks = forAllSystems (
system:
import ../tests rec {
inherit home-manager home-manager-stable;
inherit (nixpkgs) lib;
nixpkgs = nixpkgsFor.${system}.unstable;
nixpkgs-stable = nixpkgsFor.${system}.stable;
let
pkgs = nixpkgsFor.${system};
inherit (pkgs.unstable) lib;

callUnstable = lib.flip pkgs.unstable.callPackage { inherit home-manager; };
callStable = lib.flip pkgs.stable.callPackage { home-manager = home-manager-stable; };
in
lib.optionalAttrs pkgs.unstable.stdenv.hostPlatform.isDarwin {
darwin-test-unstable = callUnstable ../tests/darwin.nix;
darwin-test-stable = callStable ../tests/darwin.nix;
}
// lib.optionalAttrs pkgs.unstable.stdenv.hostPlatform.isLinux {
nixos-test-unstable = callUnstable ../tests/nixos.nix;
nixos-test-stable = callStable ../tests/nixos.nix;
}
);

Expand Down
42 changes: 22 additions & 20 deletions tests/darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
pkgs,
home-manager,
}:

(home-manager.lib.homeManagerConfiguration {
inherit pkgs;

modules = [
./home.nix

Expand All @@ -13,35 +15,35 @@
homeDirectory = "/Users/test";
};

i18n.inputMethod.enabled = lib.mkForce null;
i18n.inputMethod.enabled = lib.mkVMOverride null;

programs = {
cava.enable = lib.mkForce false; # NOTE: this may actually work on darwin, but the package is currently not supported
foot.enable = lib.mkForce false;
fuzzel.enable = lib.mkForce false;
hyprlock.enable = lib.mkForce false;
imv.enable = lib.mkForce false;
mpv.enable = lib.mkForce false; # NOTE: same as cava, but `mpv` fails to build currently
obs-studio.enable = lib.mkForce false;
rio.enable = lib.mkForce false; # marked as broken
rofi.enable = lib.mkForce false;
spotify-player.enable = lib.mkForce false; # NOTE: same as mpv
swaylock.enable = lib.mkForce false;
tofi.enable = lib.mkForce false;
waybar.enable = lib.mkForce false;
cava.enable = lib.mkVMOverride false; # NOTE: this may actually work on darwin, but the package is currently not supported
foot.enable = lib.mkVMOverride false;
fuzzel.enable = lib.mkVMOverride false;
hyprlock.enable = lib.mkVMOverride false;
imv.enable = lib.mkVMOverride false;
mpv.enable = lib.mkVMOverride false; # NOTE: same as cava, but `mpv` fails to build currently
obs-studio.enable = lib.mkVMOverride false;
rio.enable = lib.mkVMOverride false; # marked as broken
rofi.enable = lib.mkVMOverride false;
spotify-player.enable = lib.mkVMOverride false; # NOTE: same as mpv
swaylock.enable = lib.mkVMOverride false;
tofi.enable = lib.mkVMOverride false;
waybar.enable = lib.mkVMOverride false;
};

qt.enable = lib.mkForce false; # NOTE: same as cava
qt.enable = lib.mkVMOverride false; # NOTE: same as cava

services = {
dunst.enable = lib.mkForce false;
mako.enable = lib.mkForce false;
polybar.enable = lib.mkForce false;
dunst.enable = lib.mkVMOverride false;
mako.enable = lib.mkVMOverride false;
polybar.enable = lib.mkVMOverride false;
};

wayland.windowManager = {
hyprland.enable = lib.mkForce false;
sway.enable = lib.mkForce false;
hyprland.enable = lib.mkVMOverride false;
sway.enable = lib.mkVMOverride false;
};
}
];
Expand Down
17 changes: 0 additions & 17 deletions tests/default.nix

This file was deleted.

1 change: 1 addition & 0 deletions tests/nixos.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ testers, home-manager }:

testers.runNixOSTest {
name = "module-test";

Expand Down

0 comments on commit becc648

Please sign in to comment.