installer: remove
This commit is contained in:
parent
62f9402af0
commit
60ed03d0b1
4 changed files with 14 additions and 131 deletions
|
|
@ -1,109 +0,0 @@
|
|||
{ stdenv, nix, pkgs, nix-darwin }:
|
||||
|
||||
let
|
||||
nixPath = pkgs.lib.concatStringsSep ":" [
|
||||
"darwin=${nix-darwin}"
|
||||
"nixpkgs=${pkgs.path}"
|
||||
"$HOME/.nix-defexpr/channels"
|
||||
"/nix/var/nix/profiles/per-user/root/channels"
|
||||
"$NIX_PATH"
|
||||
];
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "darwin-installer";
|
||||
preferLocalBuild = true;
|
||||
|
||||
unpackPhase = ":";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
echo "$shellHook" > $out/bin/darwin-installer
|
||||
chmod +x $out/bin/darwin-installer
|
||||
'';
|
||||
|
||||
shellHook = ''
|
||||
#!${stdenv.shell}
|
||||
set -e
|
||||
|
||||
_PATH=$PATH
|
||||
export PATH=/nix/var/nix/profiles/default/bin:${nix}/bin:${pkgs.gnused}/bin:${pkgs.openssh}/bin:/usr/bin:/bin:/usr/sbin:/sbin
|
||||
|
||||
action=switch
|
||||
while [ "$#" -gt 0 ]; do
|
||||
i="$1"; shift 1
|
||||
case "$i" in
|
||||
--help)
|
||||
echo "darwin-installer: [--help] [--check]"
|
||||
exit
|
||||
;;
|
||||
--check)
|
||||
action=check
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo >&2
|
||||
echo >&2 "Installing nix-darwin..."
|
||||
echo >&2
|
||||
|
||||
export NIX_PATH=${nixPath}
|
||||
system=$(nix-build '<darwin>' -A system --no-out-link --show-trace)
|
||||
|
||||
export PATH=$system/sw/bin:$PATH
|
||||
darwin-rebuild "$action"
|
||||
|
||||
echo >&2
|
||||
echo >&2 " Installation complete."
|
||||
echo >&2 " See the README for more information: [0;34mhttps://github.com/LnL7/nix-darwin/blob/master/README.md[0m"
|
||||
echo >&2
|
||||
echo >&2 " Please log out and log in again to make sure nix-darwin is properly loaded."
|
||||
echo >&2
|
||||
exit
|
||||
'';
|
||||
|
||||
passthru.check = stdenv.mkDerivation {
|
||||
name = "run-darwin-test";
|
||||
shellHook = ''
|
||||
set -e
|
||||
echo >&2 "running installer tests..."
|
||||
echo >&2
|
||||
|
||||
echo >&2 "checking configuration.nix"
|
||||
test -f ~/.nixpkgs/darwin-configuration.nix
|
||||
test -w ~/.nixpkgs/darwin-configuration.nix
|
||||
echo >&2 "checking darwin channel"
|
||||
readlink ~/.nix-defexpr/channels/darwin
|
||||
test -e ~/.nix-defexpr/channels/darwin
|
||||
echo >&2 "checking /etc"
|
||||
readlink /etc/static
|
||||
test -e /etc/static
|
||||
echo >&2 "checking profile"
|
||||
cat /etc/profile
|
||||
(! grep nix-daemon.sh /etc/profile)
|
||||
echo >&2 "checking /run/current-system"
|
||||
readlink /run
|
||||
test -e /run
|
||||
readlink /run/current-system
|
||||
test -e /run/current-system
|
||||
echo >&2 "checking system profile"
|
||||
readlink /nix/var/nix/profiles/system
|
||||
test -e /nix/var/nix/profiles/system
|
||||
|
||||
echo >&2 "checking bash environment"
|
||||
env -i USER=john HOME=/Users/john bash -li -c 'echo $PATH'
|
||||
env -i USER=john HOME=/Users/john bash -li -c 'echo $PATH' | grep /Users/john/.nix-profile/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
|
||||
env -i USER=john HOME=/Users/john bash -li -c 'echo $NIX_PATH'
|
||||
env -i USER=john HOME=/Users/john bash -li -c 'echo $NIX_PATH' | grep darwin-config=/Users/john/.nixpkgs/darwin-configuration.nix:/nix/var/nix/profiles/per-user/root/channels
|
||||
|
||||
echo >&2 "checking zsh environment"
|
||||
env -i USER=john HOME=/Users/john zsh -l -c 'echo $PATH'
|
||||
env -i USER=john HOME=/Users/john zsh -l -c 'echo $PATH' | grep /Users/john/.nix-profile/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
|
||||
env -i USER=john HOME=/Users/john zsh -l -c 'echo $NIX_PATH'
|
||||
env -i USER=john HOME=/Users/john zsh -l -c 'echo $NIX_PATH' | grep darwin-config=/Users/john/.nixpkgs/darwin-configuration.nix:/nix/var/nix/profiles/per-user/root/channels
|
||||
|
||||
echo >&2 ok
|
||||
exit
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue