mirror of
https://github.com/RGBCube/hjem
synced 2025-10-17 07:02:25 +00:00
wip
This commit is contained in:
parent
627b34efad
commit
70711dab01
3 changed files with 88 additions and 5 deletions
6
flake.lock
generated
6
flake.lock
generated
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1757487488,
|
"lastModified": 1758277210,
|
||||||
"narHash": "sha256-zwE/e7CuPJUWKdvvTCB7iunV4E/+G0lKfv4kk/5Izdg=",
|
"narHash": "sha256-iCGWf/LTy+aY0zFu8q12lK8KuZp7yvdhStehhyX1v8w=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ab0f3607a6c7486ea22229b92ed2d355f1482ee0",
|
"rev": "8eaee110344796db060382e15d3af0a9fc396e0e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
# Hjem Integration Tests
|
# Hjem Integration Tests
|
||||||
hjem-basic = import ./tests/basic.nix checkArgs;
|
hjem-basic = import ./tests/basic.nix checkArgs;
|
||||||
hjem-special-args = import ./tests/special-args.nix checkArgs;
|
hjem-special-args = import ./tests/special-args.nix checkArgs;
|
||||||
hjem-linker = import ./tests/linker.nix checkArgs;
|
hjem-linker = import ./tests/linker.nix {inherit inputs;} checkArgs;
|
||||||
hjem-xdg = import ./tests/xdg.nix checkArgs;
|
hjem-xdg = import ./tests/xdg.nix checkArgs;
|
||||||
hjem-xdg-linker = import ./tests/xdg-linker.nix checkArgs;
|
hjem-xdg-linker = import ./tests/xdg-linker.nix checkArgs;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
{inputs}:
|
||||||
|
|
||||||
let
|
let
|
||||||
userHome = "/home/alice";
|
userHome = "/home/alice";
|
||||||
in
|
in
|
||||||
|
@ -10,7 +12,19 @@ in
|
||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [self.nixosModules.hjem];
|
imports = [
|
||||||
|
(inputs.nixpkgs + /nixos/modules/testing/test-instrumentation.nix)
|
||||||
|
(inputs.nixpkgs + /nixos/modules/profiles/base.nix)
|
||||||
|
self.nixosModules.hjem
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
device = "/dev/vda";
|
||||||
|
forceInstall = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.git ];
|
||||||
|
|
||||||
system.switch.enable = true;
|
system.switch.enable = true;
|
||||||
|
|
||||||
|
@ -42,13 +56,69 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# needed to rebuild the system
|
||||||
|
system.includeBuildDependencies = true;
|
||||||
|
system.extraDependencies = [pkgs.grub2];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = {nodes, ...}: let
|
testScript = {nodes, ...}: let
|
||||||
baseSystem = nodes.node1.system.build.toplevel;
|
baseSystem = nodes.node1.system.build.toplevel;
|
||||||
specialisations = "${baseSystem}/specialisation";
|
specialisations = "${baseSystem}/specialisation";
|
||||||
|
pkgs = nodes.node1.nixpkgs.pkgs;
|
||||||
|
|
||||||
|
configFile =
|
||||||
|
pkgs.writeText "configuration.nix" # nix
|
||||||
|
''
|
||||||
|
{ lib, pkgs, ... }: {
|
||||||
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
<nixpkgs/nixos/modules/testing/test-instrumentation.nix>
|
||||||
|
<nixpkgs/nixos/modules/profiles/base.nix>
|
||||||
|
|
||||||
|
${inputs.self}/modules/nixos
|
||||||
|
];
|
||||||
|
|
||||||
|
_module.args.hjem-lib = import ${inputs.self}/lib.nix { inherit lib pkgs; };
|
||||||
|
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
device = "/dev/vda";
|
||||||
|
forceInstall = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
documentation.enable = false;
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.git ];
|
||||||
|
|
||||||
|
system.switch.enable = true;
|
||||||
|
|
||||||
|
users.groups.alice = {};
|
||||||
|
users.users.alice = {
|
||||||
|
isNormalUser = true;
|
||||||
|
home = ${userHome};
|
||||||
|
password = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
hjem = {
|
||||||
|
linker = ${inputs.smfh.packages.${pkgs.system}.default};
|
||||||
|
users = {
|
||||||
|
alice = {
|
||||||
|
enable = true;
|
||||||
|
files.".config/bar" = {
|
||||||
|
text = "Hello again!!";
|
||||||
|
clobber = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
|
||||||
in ''
|
in ''
|
||||||
|
node1.start(allow_reboot=True)
|
||||||
node1.succeed("loginctl enable-linger alice")
|
node1.succeed("loginctl enable-linger alice")
|
||||||
|
|
||||||
with subtest("Activation service runs correctly"):
|
with subtest("Activation service runs correctly"):
|
||||||
|
@ -69,5 +139,18 @@ in
|
||||||
node1.succeed("${specialisations}/fileGetsOverwritten/bin/switch-to-configuration test")
|
node1.succeed("${specialisations}/fileGetsOverwritten/bin/switch-to-configuration test")
|
||||||
node1.succeed("test -L ${userHome}/.config/foo")
|
node1.succeed("test -L ${userHome}/.config/foo")
|
||||||
node1.succeed("grep \"Hello new world!\" ${userHome}/.config/foo")
|
node1.succeed("grep \"Hello new world!\" ${userHome}/.config/foo")
|
||||||
|
|
||||||
|
with subtest("nixos-rebuild boot"):
|
||||||
|
node1.fail("test -L ${userHome}/.config/bar")
|
||||||
|
|
||||||
|
node1.succeed("nixos-generate-config")
|
||||||
|
node1.copy_from_host(
|
||||||
|
"${configFile}",
|
||||||
|
"/etc/nixos/configuration.nix",
|
||||||
|
)
|
||||||
|
node1.succeed("nixos-rebuild boot -I nixpkgs=${pkgs.path} -I nixos-config=/etc/nixos/configuration.nix >&2")
|
||||||
|
node1.reboot()
|
||||||
|
|
||||||
|
node1.succeed("test -L ${userHome}/.config/bar")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue