mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
Add hmInstall and nixOnDroidLinker in files
This commit is contained in:
parent
1b4c7758b2
commit
6e6e0cde72
3 changed files with 63 additions and 0 deletions
|
|
@ -21,6 +21,8 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
hmInstall = callPackage ./hm-install.nix { };
|
||||
|
||||
homeNixDefault = writeTextDir "etc/home.nix.default" (builtins.readFile ./raw/home.nix.default);
|
||||
|
||||
login = callPackage ./login.nix { };
|
||||
|
|
@ -33,6 +35,8 @@ in
|
|||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-on-droid.cachix.org-1:56snoMJTXmDRC1Ei24CmKoUqvHJ9XCp+nidK7qkMQrU=
|
||||
'';
|
||||
|
||||
nixOnDroidLinker = callPackage ./nix-on-droid-linker.nix { };
|
||||
|
||||
resolvConf = writeTextDir "etc/resolv.conf" ''
|
||||
nameserver 1.1.1.1
|
||||
nameserver 8.8.8.8
|
||||
|
|
|
|||
31
src/pkgs/files/hm-install.nix
Normal file
31
src/pkgs/files/hm-install.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||
|
||||
{ coreutils, instDir, nix, writeScriptBin }:
|
||||
|
||||
writeScriptBin "hm-install" ''
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
if [ -e $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh ]; then
|
||||
echo "You already have home-manager installed."
|
||||
fi
|
||||
|
||||
echo "Subscribing to home-manager channel..."
|
||||
${nix}/bin/nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager
|
||||
echo "Updating channels..."
|
||||
${nix}/bin/nix-channel --update
|
||||
|
||||
export NIX_PATH=$HOME/.nix-defexpr/channels''${NIX_PATH:+:}$NIX_PATH
|
||||
|
||||
if [ ! -e $HOME/.config/nixpkgs/home.nix ]; then
|
||||
echo "Creating an initial home-manager configuration in ~/.config/nixpkgs/home.nix ..."
|
||||
${coreutils}/bin/mkdir -p $HOME/.config/nixpkgs
|
||||
${coreutils}/bin/cp -n /etc/home.nix.default $HOME/.config/nixpkgs/home.nix
|
||||
fi
|
||||
|
||||
echo "Uninstalling basic-environment..."
|
||||
${nix}/bin/nix-env --uninstall basic-environment
|
||||
echo "Installing home-manager..."
|
||||
${nix}/bin/nix run nixpkgs.nix -c ${nix}/bin/nix-shell '<home-manager>' -A install
|
||||
''
|
||||
28
src/pkgs/files/nix-on-droid-linker.nix
Normal file
28
src/pkgs/files/nix-on-droid-linker.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# Licensed under GNU Lesser General Public License v3 or later, see COPYING.
|
||||
# Copyright (c) 2019 Alexander Sosedkin and other contributors, see AUTHORS.
|
||||
|
||||
{ coreutils, writeScriptBin }:
|
||||
|
||||
writeScriptBin "nix-on-droid-linker" ''
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
link() {
|
||||
local from="$1"
|
||||
local to="$2"
|
||||
|
||||
echo "Linking ~/.nix-profile/$from to /$to"
|
||||
${coreutils}/bin/mkdir -p $(dirname /$to)
|
||||
${coreutils}/bin/ln -snf $HOME/.nix-profile/$from /$to
|
||||
}
|
||||
|
||||
for i in login login-inner proot sh; do
|
||||
link bin/$i bin/$i
|
||||
done
|
||||
|
||||
for i in home.nix.default nix/nix.conf resolv.conf; do
|
||||
link etc/$i etc/$i
|
||||
done
|
||||
|
||||
link bin/env usr/bin/env
|
||||
''
|
||||
Loading…
Add table
Add a link
Reference in a new issue