Move git-sync home config to shared module

This commit is contained in:
2026-04-26 20:55:15 -07:00
parent 9c2f244309
commit c3c0d54da4
3 changed files with 42 additions and 29 deletions

View File

@@ -85,8 +85,10 @@
enabledHomeUsers = [ enabledHomeUsers = [
activePrimaryUser activePrimaryUser
]; ];
sharedHomeModules = [./home/common.nix]; sharedHomeModules = [
ivanHomeModules = [./home/ivan.nix]; ./home/common.nix
./home/git-sync.nix
];
homeForUser = user: "/Users/${user}"; homeForUser = user: "/Users/${user}";
configuration = { configuration = {
pkgs, pkgs,
@@ -374,9 +376,7 @@
inherit inputs libDir; inherit inputs libDir;
}; };
sharedModules = sharedHomeModules; sharedModules = sharedHomeModules;
users = lib.genAttrs enabledHomeUsers (_: { users = lib.genAttrs enabledHomeUsers (_: {});
imports = ivanHomeModules;
});
}; };
}; };
in { in {

View File

@@ -0,0 +1,37 @@
{
config,
lib,
pkgs,
...
}: let
gitSyncPackage =
if pkgs ? "git-sync-rs"
then pkgs."git-sync-rs"
else pkgs.git-sync;
orgPath = "${config.home.homeDirectory}/org";
passwordStorePath = "${config.home.homeDirectory}/.password-store";
in {
services.git-sync = {
enable = true;
package = gitSyncPackage;
repositories = {
org = {
path = orgPath;
uri = "git@github.com:colonelpanic8/org.git";
interval = 180;
};
password-store = {
path = passwordStorePath;
uri = "git@github.com:colonelpanic8/.password-store.git";
};
};
};
# git-sync-rs does not infer the repository from launchd's WorkingDirectory.
launchd.agents = {
git-sync-org.config.ProgramArguments =
lib.mkForce ["${gitSyncPackage}/bin/git-sync" "-d" orgPath];
git-sync-password-store.config.ProgramArguments =
lib.mkForce ["${gitSyncPackage}/bin/git-sync" "-d" passwordStorePath];
};
}

View File

@@ -1,24 +0,0 @@
{
config,
pkgs,
...
}: {
services.git-sync = {
enable = true;
package =
if pkgs ? "git-sync-rs"
then pkgs."git-sync-rs"
else pkgs.git-sync;
repositories = {
org = {
path = "${config.home.homeDirectory}/org";
uri = "git@github.com:colonelpanic8/org.git";
interval = 180;
};
password-store = {
path = "${config.home.homeDirectory}/.password-store";
uri = "git@github.com:IvanMalison/.password-store.git";
};
};
};
}