mirror of
https://github.com/nix-community/home-manager
synced 2024-08-28 23:16:30 +02:00
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>.
21 lines
534 B
Nix
21 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
|
|
''
|