0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

Merge pull request #5326 from prikhi/refactor-psd-config

profile-sync-daemon: refactor nixos module
This commit is contained in:
wmertens 2014-12-14 19:38:31 +01:00
commit d3d38c38c5

View file

@ -6,18 +6,20 @@ let
cfg = config.services.psd; cfg = config.services.psd;
configFile = '' configFile = ''
${if cfg.users != [ ] then '' ${optionalString (cfg.users != [ ]) ''
USERS="${concatStringsSep " " cfg.users}" USERS="${concatStringsSep " " cfg.users}"
'' else ""} ''}
${if cfg.browsers != [ ] then '' ${optionalString (cfg.browsers != [ ]) ''
BROWSERS="${concatStringsSep " " cfg.browsers}" BROWSERS="${concatStringsSep " " cfg.browsers}"
'' else ""} ''}
${optionalString (cfg.volatile != "") "VOLATILE=${cfg.volatile}"} ${optionalString (cfg.volatile != "") "VOLATILE=${cfg.volatile}"}
${optionalString (cfg.daemonFile != "") "DAEMON_FILE=${cfg.daemonFile}"} ${optionalString (cfg.daemonFile != "") "DAEMON_FILE=${cfg.daemonFile}"}
''; '';
in { in {
options.services.psd = with types; { options.services.psd = with types; {
enable = mkOption { enable = mkOption {
type = bool; type = bool;
@ -84,7 +86,6 @@ in {
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd = { systemd = {
services = { services = {
psd = { psd = {
@ -103,7 +104,6 @@ in {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = "yes"; RemainAfterExit = "yes";
ExecStart = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon sync"; ExecStart = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon sync";
ExecStop = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon unsync"; ExecStop = "${pkgs.profile-sync-daemon}/bin/profile-sync-daemon unsync";
}; };
}; };
@ -124,7 +124,7 @@ in {
}; };
timers.psd-resync = { timers.psd-resync = {
description = "Timer for profile sync daemon - 1 Hour"; description = "Timer for profile sync daemon - ${cfg.resyncTimer}";
partOf = [ "psd-resync.service" "psd.service" ]; partOf = [ "psd-resync.service" "psd.service" ];
timerConfig = { timerConfig = {