tests: update default arguments

The setup's tentative. Unfortunately, still requires the right
experimental features enabled.
This commit is contained in:
Gabriel Arazas 2024-07-23 21:43:21 +08:00
parent e9eae2f2eb
commit 5b7dae16d2
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
3 changed files with 32 additions and 4 deletions

View File

@ -1,8 +1,16 @@
{ pkgs ? import <nixpkgs> { } }:
let
flakeUtils = import ../lib/flake.nix;
flake = flakeUtils.importFlakeMetadata ../flake.lock;
in
{ pkgs ? import (flakeUtils.fetchTree flake "nixos-unstable") { } }:
let
utils = import ./utils.nix { inherit pkgs; };
in
{
lib = import ./lib { inherit pkgs; };
lib = import ./lib { inherit pkgs utils; };
modules = {
home-manager = import ./modules/home-manager { inherit pkgs; };
home-manager = import ./modules/home-manager { inherit pkgs utils; };
nixos = import ./modules/nixos { inherit pkgs utils; };
};
}

View File

@ -1,6 +1,6 @@
# For the environment-specific subset, we'll be simulating the configurations
# as a simple attribute set since that's what they are anyways.
{ pkgs ? import <nixpkgs> { } }:
{ pkgs ? import <nixpkgs> { }, utils ? import ../utils.nix { inherit pkgs; } }:
let
inherit (pkgs) lib;

20
tests/utils.nix Normal file
View File

@ -0,0 +1,20 @@
# A set of functions to facilitate testing in the project.
{ pkgs }:
let
nixpkgsPath = pkgs.path;
nixosLib = import "${nixpkgsPath}/nixos/lib" { };
in
rec {
# We're not using this to test the hosts configuration (that would be
# atrocious). We're only using this for NixOS modules.
nixosTest = test:
nixosLib.runTest {
imports = [ test ];
hostPkgs = pkgs;
specialArgs = {
foodogsquaredUtils = import ../lib/utils/nixos.nix { inherit pkgs; };
foodogsquaredModulesPath = builtins.toString ../modules/nixos;
};
};
}