fix: Git-annex fixes
This commit is contained in:
@@ -78,7 +78,8 @@ in {
|
||||
# The user that users log in as to access managed repos.
|
||||
users.groups.annex = {};
|
||||
users.users.annex = {
|
||||
isSystemUser = true;
|
||||
# Necessary to enable cloning over SSH.
|
||||
isNormalUser = true;
|
||||
group = "annex";
|
||||
home = "/var/sydnix/annex";
|
||||
createHome = true;
|
||||
@@ -92,9 +93,25 @@ in {
|
||||
name = ${cfg.user.name}
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[core]
|
||||
symlinks = true
|
||||
'';
|
||||
in ''
|
||||
ln -sf "${gitconfig-file}" ~/.gitconfig
|
||||
set -e
|
||||
|
||||
annexHome="${config.users.users.annex.home}"
|
||||
ln -sf "${gitconfig-file}" "$annexHome/.gitconfig"
|
||||
|
||||
# Symlink repos into annex's home for easy access. This is particularly nice for cloning:
|
||||
# git clone annex@deertopia.net:org
|
||||
# instead of
|
||||
# git clone annex@deertopia.net:/persist/deertopia.net/org
|
||||
# Less assumptions about the host's file system!
|
||||
${lib.strings.toShellVar "repos" (builtins.attrNames cfg.repos)}
|
||||
for repoPath in ''${!repos[@]}; do
|
||||
target="$annexHome/$(basename "$repoPath")"
|
||||
ln -sf "$repoPath" "$target"
|
||||
done
|
||||
'';
|
||||
|
||||
systemd.services =
|
||||
@@ -103,13 +120,18 @@ in {
|
||||
pkgs.writeScript "git-annex-init-if-necessary" ''
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
[ -e .git ] || git init
|
||||
[ -e .git/annex ] || git annex init
|
||||
|
||||
# Symlink repo into user `annex` for easy access.
|
||||
ln -sf "$(pwd)" "$HOME/"
|
||||
|
||||
${lib.strings.toShellVar "remotes" repo.remotes}
|
||||
for remoteName in ''${!remotes[@]}; do
|
||||
git remote get-url "$remoteName"
|
||||
if [ $? -eq 0 ]; then
|
||||
err=0
|
||||
git remote get-url "$remoteName" || err=$?
|
||||
if [ $err -eq 0 ]; then
|
||||
git remote set-url "$remoteName" "''${remotes["$remoteName"]}"
|
||||
else
|
||||
git remote add "$remoteName" "''${remotes["$remoteName"]}"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"100.95.131.43" = [ "whitepc" ];
|
||||
"192.168.68.66" = [ "guix-rebound" ];
|
||||
"192.168.68.79" = [ "deertopia" ];
|
||||
"192.168.68.55" = [ "fruitbook" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user