mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-31 04:04:32 +00:00
auto-upgrade: unbreak on unattended, loginctl enable-linger systems
Fixes https://github.com/nix-community/home-manager/issues/3127
This commit is contained in:
parent
1efd250317
commit
a71ccc546d
1 changed files with 11 additions and 8 deletions
|
@ -8,6 +8,16 @@ let
|
||||||
path = config.programs.home-manager.path;
|
path = config.programs.home-manager.path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
autoUpgradeApp = pkgs.writeShellApplication {
|
||||||
|
name = "home-manager-auto-upgrade";
|
||||||
|
text = ''
|
||||||
|
echo "Update Nix's channels"
|
||||||
|
nix-channel --update
|
||||||
|
echo "Upgrade Home Manager"
|
||||||
|
home-manager switch
|
||||||
|
'';
|
||||||
|
runtimeInputs = with pkgs; [ homeManagerPackage nix ];
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
meta.maintainers = [ lib.hm.maintainers.pinage404 ];
|
meta.maintainers = [ lib.hm.maintainers.pinage404 ];
|
||||||
|
|
||||||
|
@ -52,14 +62,7 @@ in {
|
||||||
|
|
||||||
services.home-manager-auto-upgrade = {
|
services.home-manager-auto-upgrade = {
|
||||||
Unit.Description = "Home Manager upgrade";
|
Unit.Description = "Home Manager upgrade";
|
||||||
|
Service.ExecStart = "${autoUpgradeApp}/bin/home-manager-auto-upgrade";
|
||||||
Service.ExecStart = toString
|
|
||||||
(pkgs.writeShellScript "home-manager-auto-upgrade" ''
|
|
||||||
echo "Update Nix's channels"
|
|
||||||
${pkgs.nix}/bin/nix-channel --update
|
|
||||||
echo "Upgrade Home Manager"
|
|
||||||
${homeManagerPackage}/bin/home-manager switch
|
|
||||||
'');
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue