-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working example with blueprint specific nixos module
- Loading branch information
Showing
6 changed files
with
58 additions
and
59 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# handled by injectPublisherArgs | ||
{ | ||
flake, | ||
|
||
# throws an error; there might be a bug with this | ||
# perSystem, | ||
... | ||
}: | ||
|
||
# this is the module that in the real scenario lives outside of the `runTest` caller code | ||
{ | ||
config, | ||
pkgs, | ||
lib, | ||
... | ||
}: | ||
|
||
{ | ||
imports = [ flake.inputs.extra-container.nixosModules.default ]; | ||
config = | ||
|
||
# (mysteriously) broken: | ||
# pkgs.lib.mkIf true { | ||
|
||
# works: | ||
lib.mkIf true { | ||
environment.systemPackages = [ | ||
# perSystem.self.packages.hello | ||
flake.packages.${pkgs.stdenv.system}.hello | ||
]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,30 @@ | ||
{ pkgs, flake, ... }: | ||
{ | ||
pkgs, | ||
flake, | ||
system, | ||
... | ||
}: | ||
|
||
let | ||
lib = pkgs.lib; | ||
nixos = import (lib.path.append pkgs.path "nixos/lib") { inherit lib; }; | ||
in | ||
nixos.runTest ( | ||
/* | ||
TODO: what are these arguments? if i put pkgs in here i'm getting: | ||
error: infinite recursion encountered | ||
at /nix/store/cb1gs888vfqxawvc65q1dk6jzbayh3wz-source/lib/modules.nix:1016:24: | ||
1015| { _type = "override"; | ||
1016| inherit priority content; | ||
| ^ | ||
1017| }; | ||
*/ | ||
{ ... }: | ||
pkgs.testers.runNixOSTest ( | ||
{ lib, ... }: | ||
{ | ||
name = "nixos-test"; | ||
|
||
defaults._module.args = { | ||
inherit flake; | ||
}; | ||
|
||
nodes.machine = | ||
{ ... }: | ||
{ pkgs, ... }: | ||
{ | ||
imports = [ | ||
( | ||
# this is the module that in the real scenario lives outside of the `runTest` caller code | ||
{ config, pkgs, lib, flake, ... }: | ||
|
||
{ | ||
imports = [ | ||
flake.inputs.extra-container.nixosModules.default | ||
]; | ||
config = | ||
# mysteriously broken: | ||
# pkgs.lib.mkIf true { }; | ||
imports = [ flake.nixosModules.unrepro ]; | ||
|
||
# works: | ||
lib.mkIf true { }; | ||
} | ||
) | ||
environment.systemPackages = [ | ||
(pkgs.writeShellScriptBin "hello2" '' | ||
exec ${lib.getExe flake.packages.${system}.hello} | ||
'') | ||
]; | ||
}; | ||
|
||
testScript = _: ''''; | ||
hostPkgs = pkgs; | ||
testScript = _: '' | ||
machine.succeed("hello") | ||
machine.succeed("hello2") | ||
''; | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ pkgs, ... }: pkgs.hello |