1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00
This commit is contained in:
nikhil-057 2025-03-19 07:43:18 +02:00 committed by GitHub
commit 49539939ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 2 deletions

View file

@ -1,4 +1,6 @@
{ home-manager, runCommand }:
{ home-manager, runCommand
, shellHook ? "exec ${home-manager}/bin/home-manager init --switch --no-flake"
}:
let
@ -12,7 +14,7 @@ in runCommand "home-manager-install" {
propagatedBuildInputs = [ home-manager ];
preferLocalBuild = true;
shellHookOnly = true;
shellHook = "exec ${home-manager}/bin/home-manager init --switch --no-flake";
inherit shellHook;
} ''
${hmBashLibInit}
_iError 'This derivation is not buildable, please run it using nix-shell.'

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