a37b5c9c61
This avoids the uncontrollable nature of fetching the tarball as part of the evaluation. Instead the user can decide when to update and also perform rollbacks, if necessary.
56 lines
1.2 KiB
Nix
56 lines
1.2 KiB
Nix
{ home-manager, pkgs }:
|
|
|
|
pkgs.runCommand
|
|
"home-manager-install"
|
|
{
|
|
propagatedBuildInputs = [ home-manager ];
|
|
preferLocalBuild = true;
|
|
allowSubstitutes = false;
|
|
shellHook = ''
|
|
confFile="''${XDG_CONFIG_HOME:-$HOME/.config}/nixpkgs/home.nix"
|
|
|
|
if [[ ! -e $confFile ]]; then
|
|
echo
|
|
echo "Creating initial Home Manager configuration..."
|
|
|
|
mkdir -p "$(dirname "$confFile")"
|
|
cat > $confFile <<EOF
|
|
{ config, pkgs, ... }:
|
|
|
|
{
|
|
# Let Home Manager install and manage itself.
|
|
programs.home-manager.enable = true;
|
|
}
|
|
EOF
|
|
fi
|
|
|
|
echo
|
|
echo "Creating initial Home Manager generation..."
|
|
echo
|
|
|
|
if home-manager switch; then
|
|
cat <<EOF
|
|
|
|
All done! The home-manager tool should now be installed and you
|
|
can edit
|
|
|
|
$confFile
|
|
|
|
to configure Home Manager. Run 'man home-configuration.nix' to
|
|
see all available options.
|
|
EOF
|
|
exit 0
|
|
else
|
|
cat <<EOF
|
|
|
|
Uh oh, the installation failed! Please create an issue at
|
|
|
|
https://github.com/rycee/home-manager/issues
|
|
|
|
if the error seems to be the fault of Home Manager.
|
|
EOF
|
|
exit 1
|
|
fi
|
|
'';
|
|
}
|
|
""
|