mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
Merge 2ef5a65b38
into 22a36aa709
This commit is contained in:
commit
49539939ae
4 changed files with 35 additions and 2 deletions
|
@ -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.'
|
||||
|
|
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…
Add table
Reference in a new issue