1
0
Fork 0
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:
nikhil 2024-12-11 22:27:44 +05:30
parent 9479cb5611
commit 2ef5a65b38
3 changed files with 31 additions and 0 deletions

View 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
'';
};
}

View file

@ -0,0 +1,6 @@
{ hmInstall ? (import <home-manager> { }).install }:
hmInstall.override {
shellHook = ''
exec home-manager init --switch --no-flake -b backup
'';
}

View file

@ -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()
'';
}