nix-config/home/pass-store.nix

38 lines
1.2 KiB
Nix

{ config, pkgs, ... }:
{
# Setup git remotes for pass store
# This file manages the git remote configuration for ~/.password-store
# (pass itself is configured in home/pass.nix)
home.activation.passStoreRemotes = {
data = ''
set -e
if [ ! -d "$HOME/.password-store" ]; then
mkdir -p "$HOME/.password-store"
fi
cd "$HOME/.password-store"
# Init git if needed
if [ ! -d ".git" ]; then
${pkgs.git}/bin/git init -q
fi
# Add origin (forgejo) if not present
if ! ${pkgs.git}/bin/git remote get-url origin >/dev/null 2>&1; then
${pkgs.git}/bin/git remote add origin "ssh://git@git.iscg.dev:2222/mikl/password-store.git"
fi
# Add github remote if not present
if ! ${pkgs.git}/bin/git remote get-url github >/dev/null 2>&1; then
${pkgs.git}/bin/git remote add github "git@github.com:isogonalconjugate/password-store.git"
fi
# Add git.sol.moe remote if not present
if ! ${pkgs.git}/bin/git remote get-url "git.sol.moe" >/dev/null 2>&1; then
${pkgs.git}/bin/git remote add "git.sol.moe" "git@git.sol.moe:mikl/password-store.git"
fi
'';
};
}