forked from nico/dots
nix: automatically pull dotfiles and apply them on boot
This commit is contained in:
parent
5e97f82df0
commit
0fdd56c432
2 changed files with 36 additions and 0 deletions
|
|
@ -19,6 +19,7 @@
|
||||||
./modules/firefox.nix
|
./modules/firefox.nix
|
||||||
./modules/games.nix
|
./modules/games.nix
|
||||||
./modules/boot.nix
|
./modules/boot.nix
|
||||||
|
./modules/stow.nix
|
||||||
|
|
||||||
./hosts/pluto/conf.nix
|
./hosts/pluto/conf.nix
|
||||||
./hosts/pluto/hardware-configuration.nix
|
./hosts/pluto/hardware-configuration.nix
|
||||||
|
|
|
||||||
35
nix/modules/stow.nix
Normal file
35
nix/modules/stow.nix
Normal 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!"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue