1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00
home-manager/home-manager/install.nix
Robert Helgesson c8cb60b8a1
home-manager: add init command to main tool
The init command is essentially the old install script but integrated
into the home-manager tool. This simplifies things slightly since we
can use the existing code infrastructure.

The init command is Nix flake aware in the sense that, if we detect
that the user's Nix setup supports flakes, then we also create an
initial `flake.nix` file.

Finally, we update the installation instructions for the Nix flakes
standalone setup to use the new init command.

Zsh completion update provided by Anund <anundm@gmail.com>.
2023-03-15 22:47:04 +01:00

20 lines
534 B
Nix

{ home-manager, runCommand }:
let
hmBashLibInit = ''
export TEXTDOMAIN=home-manager
export TEXTDOMAINDIR=${home-manager}/share/locale
source ${home-manager}/share/bash/home-manager.sh
'';
in runCommand "home-manager-install" {
propagatedBuildInputs = [ home-manager ];
preferLocalBuild = true;
shellHookOnly = true;
shellHook = "exec ${home-manager}/bin/home-manager init --switch --no-flake";
} ''
${hmBashLibInit}
_iError 'This derivation is not buildable, please run it using nix-shell.'
exit 1
''