tests/platforms: move out of flake wrappers module

These should be set up in a dedicated test file, owned by
`tests/default.nix`.

Also refactored to use `callTest`.
This commit is contained in:
Matt Sturgeon 2025-01-21 10:09:46 +00:00
parent 115994f18e
commit 77c78bd04e
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
7 changed files with 40 additions and 51 deletions

View file

@ -14,39 +14,6 @@
defaultSystem = system; defaultSystem = system;
}; };
}; };
checks =
{
home-manager-module =
(import ../tests/modules/hm.nix {
inherit pkgs;
inherit (inputs) home-manager;
nixvim = self;
}).activationPackage;
home-manager-extra-files-byte-compiling =
import ../tests/modules/hm-extra-files-byte-compiling.nix
{
inherit pkgs;
inherit (inputs) home-manager;
nixvim = self;
};
}
// pkgs.lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
nixos-module =
(import ../tests/modules/nixos.nix {
inherit system;
inherit (inputs) nixpkgs;
nixvim = self;
}).config.system.build.toplevel;
}
// pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin {
darwin-module =
(import ../tests/modules/darwin.nix {
inherit system;
inherit (inputs) nix-darwin;
nixvim = self;
}).system;
};
}; };
flake = { flake = {

View file

@ -52,6 +52,7 @@ in
# Individual tests can be run using: nix build .#docs.user-configs.tests.<test> # Individual tests can be run using: nix build .#docs.user-configs.tests.<test>
docs-user-configs = linkFarm "user-configs-tests" selfPackages.docs.user-configs.tests; docs-user-configs = linkFarm "user-configs-tests" selfPackages.docs.user-configs.tests;
} }
// callTests ./platforms { }
# Tests generated from ./test-sources # Tests generated from ./test-sources
# Grouped as a number of link-farms in the form { test-1, test-2, ... test-N } # Grouped as a number of link-farms in the form { test-1, test-2, ... test-N }
// callTests ./main.nix { } // callTests ./main.nix { }

View file

@ -1,9 +1,8 @@
{ {
nixvim, self,
system, system,
nix-darwin,
}: }:
nix-darwin.lib.darwinSystem { self.inputs.nix-darwin.lib.darwinSystem {
modules = [ modules = [
{ {
nixpkgs.hostPlatform = system; nixpkgs.hostPlatform = system;
@ -14,6 +13,6 @@ nix-darwin.lib.darwinSystem {
system.stateVersion = 5; system.stateVersion = 5;
} }
nixvim.nixDarwinModules.nixvim self.nixDarwinModules.nixvim
]; ];
} }

View file

@ -0,0 +1,21 @@
{
callTest,
lib,
stdenv,
}:
let
inherit (stdenv.hostPlatform)
isLinux
isDarwin
;
in
{
home-manager-module = (callTest ./hm.nix { }).activationPackage;
home-manager-extra-files-byte-compiling = callTest ./hm-extra-files-byte-compiling.nix { };
}
// lib.optionalAttrs isLinux {
nixos-module = (callTest ./nixos.nix { }).config.system.build.toplevel;
}
// lib.optionalAttrs isDarwin {
darwin-module = (callTest ./darwin.nix { }).system;
}

View file

@ -1,9 +1,12 @@
{ {
nixvim, self,
pkgs, pkgs,
home-manager,
}: }:
let let
inherit (self.inputs.home-manager.lib)
homeManagerConfiguration
;
config = { config = {
home = { home = {
username = "nixvim"; username = "nixvim";
@ -32,22 +35,22 @@ let
}; };
homeFilesByteCompilingEnabled = homeFilesByteCompilingEnabled =
(home-manager.lib.homeManagerConfiguration { (homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
nixvim.homeManagerModules.nixvim self.homeManagerModules.nixvim
config config
{ programs.nixvim.performance.byteCompileLua.configs = true; } { programs.nixvim.performance.byteCompileLua.configs = true; }
]; ];
}).config.home-files; }).config.home-files;
homeFilesByteCompilingDisabled = homeFilesByteCompilingDisabled =
(home-manager.lib.homeManagerConfiguration { (homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
nixvim.homeManagerModules.nixvim self.homeManagerModules.nixvim
config config
{ programs.nixvim.performance.byteCompileLua.configs = false; } { programs.nixvim.performance.byteCompileLua.configs = false; }
]; ];

View file

@ -1,9 +1,8 @@
{ {
nixvim, self,
pkgs, pkgs,
home-manager,
}: }:
home-manager.lib.homeManagerConfiguration { self.inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;
modules = [ modules = [
@ -19,6 +18,6 @@ home-manager.lib.homeManagerConfiguration {
programs.home-manager.enable = true; programs.home-manager.enable = true;
} }
nixvim.homeManagerModules.nixvim self.homeManagerModules.nixvim
]; ];
} }

View file

@ -1,9 +1,8 @@
{ {
nixvim, self,
nixpkgs,
system, system,
}: }:
nixpkgs.lib.nixosSystem { self.inputs.nixpkgs.lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [
@ -18,6 +17,6 @@ nixpkgs.lib.nixosSystem {
enable = true; enable = true;
}; };
} }
nixvim.nixosModules.nixvim self.nixosModules.nixvim
]; ];
} }