mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
install: add integration test with preexisting dotfile
This commit is contained in:
parent
9479cb5611
commit
2ef5a65b38
3 changed files with 31 additions and 0 deletions
15
tests/integration/standalone/alice-home-dotprofile.nix
Normal file
15
tests/integration/standalone/alice-home-dotprofile.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.username = "alice";
|
||||
home.homeDirectory = "/home/alice";
|
||||
home.stateVersion = "24.11";
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
# Write .profile
|
||||
home.file = {
|
||||
".profile".text = ''
|
||||
echo sourcing dotprofile
|
||||
'';
|
||||
};
|
||||
}
|
6
tests/integration/standalone/override-install.nix
Normal file
6
tests/integration/standalone/override-install.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ hmInstall ? (import <home-manager> { }).install }:
|
||||
hmInstall.override {
|
||||
shellHook = ''
|
||||
exec home-manager init --switch --no-flake -b backup
|
||||
'';
|
||||
}
|
|
@ -122,6 +122,16 @@
|
|||
machine.succeed("test ! -e /home/alice/.local/state/home-manager")
|
||||
machine.succeed("test ! -e /home/alice/.local/state/nix/profiles/home-manager")
|
||||
|
||||
with subtest("Home Manager Installation with preexisting dotfile"):
|
||||
succeed_as_alice("touch /home/alice/.profile")
|
||||
|
||||
succeed_as_alice("cp ${
|
||||
./alice-home-dotprofile.nix
|
||||
} /home/alice/.config/home-manager/home.nix")
|
||||
|
||||
succeed_as_alice("nix-shell ${./override-install.nix}")
|
||||
succeed_as_alice("test -e /home/alice/.profile.backup")
|
||||
|
||||
logout_alice()
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue