tvl-depot/users/glittershark/system/install
Vincent Ambo 81564185e9 Add 'users/glittershark/system/' from commit '3b174300ae60f63f50427cde3bfd680fd3043c3a'
git-subtree-dir: users/glittershark/system
git-subtree-mainline: 85d82a9dc2
git-subtree-split: 3b174300ae
2020-06-16 01:02:24 +01:00

35 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
set -eo pipefail
if [[ -f /etc/nixos/.system-installed ]]; then
echo "=== System config already installed, skipping"
else
echo "==> Installing system config"
[[ -d /etc/nixos ]] && sudo mv /etc/nixos{,.bak}
sudo mkdir -p /etc/nixos
sudo cp /etc/nixos.bak/hardware-configuration.nix /etc/nixos
sudo cp ./system/configuration.nix /etc/nixos/
sudo ln -s $(pwd)/system/{machines,modules,pkgs} /etc/nixos
sudo touch /etc/nixos/.system-installed
echo "==> System config installed, your old configuration is at /etc/nixos.bak"
fi
echo
if [[ -f ~/.config/nixpkgs/system-installed ]]; then
echo "=== home-manager config already installed, skipping"
else
echo "==> Installing home-manager config"
nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager
nix-channel --update
# nix-shell '<home-manager>' -A install
[[ -d ~/.config/nixpkgs ]] && mv ~/.config/{nixpkgs,nixpkgs.bak}
mkdir -p ~/.config/nixpkgs
ln -s $(pwd)/home/* ~/.config/nixpkgs
echo "==> home-manager config installed"
fi