chore: reorganise nix files into base dir

This commit is contained in:
Nico 2025-05-03 16:15:57 +10:00
parent 0fdd56c432
commit 104a0ccd4a
13 changed files with 2 additions and 2 deletions

35
modules/stow.nix Normal file
View file

@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
{
systemd.user.services.stowinit = {
enable = true;
after = [ "network.target" ];
wantedBy = [ "default.target" ];
description = "apply stow configurations and pull dotfiles.";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
script = ''
export installdir="$HOME/dots"
export repo="https://codeberg.org/nico/dots"
if [ ! -d "$installdir" ]; then
echo "cloning repo"
${pkgs.git}/bin/git clone $repo $installdir
else
echo "pulling latest dotfiles"
pushd $installdir
${pkgs.git}/bin/git pull $repo # works if repo is cloned using ssh
popd
fi
${pkgs.stow}/bin/stow --target=$HOME --dir=$installdir stow
echo "stowed configuration!"
'';
};
}