system/pkgs/shell/stow.nix

50 lines
1.7 KiB
Nix
Raw Normal View History

2024-10-14 17:28:31 -04:00
{ config, pkgs, lib, ... }:
let
# URL of your dotfiles repository
dotfilesRepo = "http://192.168.12.81/git/wayne/dotfiles";
# Path where the dotfiles repository will be cloned
dotfilesPath = "${config.home.homeDirectory}/.dotfiles";
# Path to the directory within the dotfiles repository that contains home directory dotfiles
homeStowPath = "${dotfilesPath}/home";
2024-11-01 12:04:24 -04:00
in
2024-10-14 17:28:31 -04:00
{
# Ensure that stow and git are installed
home.packages = with pkgs; [
stow
git
];
# Clone the dotfiles repository into the specified path
home.activation.cloneDotfiles = lib.mkAfter ''
echo "Running cloneDotfiles activation script"
echo "Dotfiles path: ${dotfilesPath}"
echo "Dotfiles repository: ${dotfilesRepo}"
export PATH=${pkgs.git}/bin:$PATH
if [ ! -d "${dotfilesPath}" ]; then
echo "Cloning dotfiles repository from ${dotfilesRepo} to ${dotfilesPath}"
git clone ${dotfilesRepo} ${dotfilesPath} || { echo "Failed to clone repository"; exit 1; }
else
echo "Dotfiles repository already exists at ${dotfilesPath}"
fi
'';
# Activation script to manage the symlinks for the home directory dotfiles using GNU Stow
home.activation.stowHome = lib.mkAfter ''
echo "Running stow to manage dotfiles"
export PATH=${pkgs.stow}/bin:$PATH
cd ${dotfilesPath}/home
2024-11-01 12:04:24 -04:00
# stow --adopt -t ${config.home.homeDirectory} bash bin config profile screen ssh tmux zsh # Specify the packages to stow
stow --adopt -t ${config.home.homeDirectory} bin config screen ssh tmux zsh # Specify the packages to stow
2024-10-14 17:28:31 -04:00
'';
# if [ ! -d "${dotfilesPath}" ]; then
# git clone ${dotfilesRepo} ${dotfilesPath}
# else
# echo "Updating dotfiles repository at ${dotfilesPath}"
# cd ${dotfilesPath} && git pull
# fi
}