mirror of
https://github.com/bartvdbraak/dotfiles.git
synced 2025-06-29 12:49:10 +00:00
Restructure Configuration
This commit is contained in:
parent
af4429982d
commit
7fce1cec3f
73 changed files with 841 additions and 3504 deletions
23
nixos/symlink.sh
Normal file
23
nixos/symlink.sh
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
nixos_home="${1:-$(dirname "$(realpath "$0")")}"
|
||||
|
||||
# Check if the symlink exists and is valid
|
||||
if [ -L /etc/nixos ] && [ -e /etc/nixos ]; then
|
||||
echo "The symlink /etc/nixos already exists and is valid. Exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Copy hardware configuration
|
||||
cp /etc/nixos/hardware-configuration.nix "$nixos_home"
|
||||
echo "Copied generated hardware configuration into $nixos_home"
|
||||
|
||||
# Backup current /etc/nixos if it exists
|
||||
if [ -e /etc/nixos ]; then
|
||||
mv /etc/nixos /etc/nixos.bak
|
||||
echo "Created backup of current /etc/nixos"
|
||||
fi
|
||||
|
||||
# Create symlink
|
||||
ln -s "$nixos_home" /etc/nixos
|
||||
echo "Symlinked /etc/nixos to $nixos_home"
|
Loading…
Add table
Add a link
Reference in a new issue