Compare commits

..

No commits in common. "e4f9e94269dfdf192ab97016f7997033f7dab205" and "ed5cbe1a050e6ef6bfbf023b0ce3ea5358bffe6e" have entirely different histories.

3 changed files with 21 additions and 53 deletions

6
flake.lock generated
View file

@ -182,11 +182,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1732303962, "lastModified": 1731235328,
"narHash": "sha256-5Umjb5AdtxV5jSJd5jxoCckh5mlg+FBQDsyAilu637g=", "narHash": "sha256-NjavpgE9/bMe/ABvZpyHIUeYF1mqR5lhaep3wB79ucs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "8cf9cb2ee78aa129e5b8220135a511a2be254c0c", "rev": "60bb110917844d354f3c18e05450606a435d2d10",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -143,7 +143,6 @@
publicShare = null; # Disable the public folder publicShare = null; # Disable the public folder
}; };
}; };
systemd.user.startServices = true;
}; };
}; };

View file

@ -1,54 +1,23 @@
{config, ...}: { {config, ...}: {
services.syncthing = { services.syncthing = {
# enable = true; enable = true;
# user = "toast"; user = "toast";
# group = "users"; group = "users";
# dataDir = config.users.users.toast.home; dataDir = config.users.users.toast.home;
settings.folders."passwords".path = "~/Documents/Passwords"; settings.folders."passwords".path = "~/Documents/Passwords";
}; };
age.secrets = { # Allow regular users to stop syncthing
syncthingCert = { # https://stackoverflow.com/questions/61480914/using-policykit-to-allow-non-root-users-to-start-and-stop-a-service
owner = "toast"; security.polkit.extraConfig = ''
group = "users"; polkit.addRule(function(action, subject) {
}; if (
syncthingKey = { action.id == "org.freedesktop.systemd1.manage-units" &&
owner = "toast"; action.lookup("unit") == "syncthing.service" &&
group = "users"; subject.user == "${config.services.syncthing.user}"
}; )
}; {
home-manager.users.toast = { return polkit.Result.YES;
osConfig, }
lib, })
... '';
}: let
systemConfig = osConfig.services.syncthing;
missingOptions = [
"all_proxy"
"configDir"
"dataDir"
"databaseDir"
"declarative"
"devices"
"folders"
"extraFlags"
"user"
"group"
"systemService"
"openDefaultPorts"
"options"
"relay"
"useInotify"
];
removeMissingOptions = rawOptions: (
# lib.attrsets.filterAttrs (n: v: n == "all_proxy") rawOptions
builtins.removeAttrs rawOptions missingOptions
);
in {
services.syncthing = removeMissingOptions systemConfig // {
enable = true;
# Renamed options
allProxy = systemConfig.all_proxy;
extraOptions = systemConfig.extraFlags;
};
};
} }