fix: Git-annex fixes

This commit is contained in:
Madeleine Sydney
2025-01-24 18:09:37 -07:00
parent 83a37f2288
commit 3616248c20
8 changed files with 50 additions and 13 deletions

8
flake.lock generated
View File

@@ -385,13 +385,13 @@
"nixpkgs": "nixpkgs_7"
},
"locked": {
"lastModified": 1736880634,
"narHash": "sha256-uFPSHfiWP3tGACvTjrGvWaR6m9w2O2D74yK2GujTFfw=",
"path": "/persist/dots/scripts/sydnix",
"lastModified": 1737768735,
"narHash": "sha256-/jvbkavgRukfbtKA4nKcsZbsqfcGcZxYbG7HN8vFFeE=",
"path": "/persist/dots/scripts/sydnix-cli",
"type": "path"
},
"original": {
"path": "/persist/dots/scripts/sydnix",
"path": "/persist/dots/scripts/sydnix-cli",
"type": "path"
}
},

View File

@@ -16,7 +16,7 @@
sops-nix.url = "github:Mic92/sops-nix";
sydnix-cli.url = "path:///persist/dots/scripts/sydnix";
sydnix-cli.url = "path:///persist/dots/scripts/sydnix-cli";
};
outputs = { nixpkgs, ... }@inputs:

View File

@@ -1,4 +1,4 @@
{ config, pkgs, lib, disko, /* sydnix-cli, */ ... }:
{ config, pkgs, lib, disko, sydnix-cli, ... }:
{
imports = [
./hardware-configuration.nix
@@ -40,12 +40,17 @@
enable = true;
user.name = "annex";
user.email = "annex@deertopia.net";
keyFiles = [ ../../public-keys/crumb-at-guix-rebound.pub ];
keyFiles = [
../../public-keys/crumb-at-guix-rebound.pub
../../public-keys/crumble-at-fruitbook.pub
../../public-keys/lain-at-deertopia.pub
];
repos = {
"/persist/deertopia.net/dav/org" = {
managed = true;
remotes = {
"guix-rebound" = "crumb@guix-rebound:/tmp/org";
"guix-rebound" = "crumb@guix-rebound:org";
# "fruitbook" = "crumble@fruitbook:org";
};
};
};
@@ -93,7 +98,7 @@
neovim
git
sshfs
# sydnix-cli.packages.x86_64-linux.default
sydnix-cli.packages.x86_64-linux.default
];
services.openssh = {

View File

@@ -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"]}"

View File

@@ -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" ];
};
};
}

View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFP/OfX8RIifDj2GHziEPIQGkviWIDH0LjVQWwIRzQsv crumb@duck.com

View File

@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKOl+/eFzGrNtp4zKCmDiO4kGhDcb2cwl/Grh8VBYBT3 lain@deertopia

View File

@@ -9,6 +9,7 @@
openssh.authorizedKeys.keyFiles = [
../../public-keys/crumb-at-guix-rebound.pub
../../public-keys/crumble-at-fruitbook.pub
];
};
@@ -17,6 +18,12 @@
];
sydnix = {
impermanence = {
enable = true;
directories = [
".ssh"
];
};
};
# Don't touch!