graysky2 / profile-sync-daemon

Symlinks and syncs browser profile dirs to RAM thus reducing HDD/SDD calls and speeding-up browsers.
https://wiki.archlinux.org/index.php/Profile-sync-daemon
Other
910 stars 88 forks source link

Add Documentation for NixOS #96

Closed prikhi closed 9 years ago

prikhi commented 9 years ago

I packaged psd for NixOS: https://github.com/NixOS/nixpkgs/pull/5316

Instead of installing profile-sync-daemon and configuring /etc/psd.conf, users just modify their system's configuration.nix file to enable and configure the psd service:

{ # ...
  services.psd = {
    enable = true;
    users = [ "user42" "other_user" ];
    browsers = [ "firefox" "chromium" ];
    resyncTimer = "30m";
  };
}

Then rebuild the system with nixos-rebuild switch, and everything else will be automatically installed and setup.

v5.53 is currently available in the nixos-unstable channel and 5.54 will be coming to trunk(nixpkgs/master) soon.

graysky2 commented 9 years ago

Merged, thank you for the interest.

graysky2 commented 9 years ago

...do you want to have your installer system modify the man page? Particularly, the SETUP section? I would think you can just replace the instructions therein with the short description you authored in the INSTALL doc, no?

prikhi commented 9 years ago

Hey, sorry for the delay, my internet's been out.

It'd be great, but I wouldn't view it as necessary. It's the same general steps to use any service provided by NixOS, and all options are documented in the manual.

My main holdup is that I don't know exactly how to do this. Is it Makefile related or something I'd add in on the NixOS side? If you are willing to throw me some links or show me the starting line, I could take it on.

graysky2 commented 9 years ago

No problem. I am glad to write up a NixOS specific manpage for you. I can add a switch to Makefile that will be specific to NixOS. As I consider the text, tell me: how have you modified the script itself (/usr/bin/psd) to use configuration.nix rather than /etc/psd.conf? I ask because as you see starting on line 28 of the script, when running, the config file is redefined to snapshot it to prevent the user from modifying it while psd is active which will cause problems. Do you have a similar mechanism to prevent users from changing the services.psd... section of configuration.nix? Also, does NixOS ship 3.18.x yet? If so, how are you handling the overlayfs option?

prikhi commented 9 years ago

Awesome, thanks a lot :)

Instead of modifying the script to use configuration.nix, NixOS instead uses configuration.nix to create an /etc/psd.conf for the user: https://github.com/NixOS/nixpkgs/pull/5316/files#diff-05aa267605fc5d99a85ce1953bb50912R8 https://github.com/NixOS/nixpkgs/pull/5316/files#diff-05aa267605fc5d99a85ce1953bb50912R136

So when config options change, the /etc/psd.conf is regenerated but the backup on the tmpfs is fine.

One thing I forgot but will include in the next version bump is to make sure the service is automatically restarted whenever configuration options are changed. But the current need to manually restart can be excluded from the manpage, as nixos unstable moves fast.

graysky2 commented 9 years ago

OK, that is cool. In effect it is no different from the user manually modifying the file so no need for me do change that wording. I will not mention the 2nd point in the manpage per your request. Give me a few hours... have to take care of some holiday BS now.

graysky2 commented 9 years ago

Also, do users still need to be "tracking nixos-unstable?"

prikhi commented 9 years ago

Yes, but 14.12 should be released soon & it will no longer be the case.

I will open a new PR to remove that bit when that's released stable.

graysky2 commented 9 years ago

OK. I will update the man page I am drafting then as well so users will have the updated info. Also, what is the correct variable in services.psd to enable the overlayfs option? I am assuming you just took my var name? Is this right:

use_overlayfs = true; # set to true to enable overlayfs or set to false to use the default sync mode
prikhi commented 9 years ago

useOverlayFS = true; since nix prefers camelCase. The default is false, I will switch it when NixOS switches to kernel >=3.18

On Mon, Dec 22, 2014 at 4:24 PM, graysky notifications@github.com wrote:

OK. I will update the man page I am drafting then as well so users will have the updated info. Also, what is the correct variable in services.psd to enable the overlayfs option? I am assuming you just took my var name? Is this right:

use_overlayfs = true; # set to true to enable overlayfs or set to false to use the default sync mode

— Reply to this email directly or view it on GitHub https://github.com/graysky2/profile-sync-daemon/pull/96#issuecomment-67891652 .

graysky2 commented 9 years ago

OK... please see my unstable branch (https://github.com/graysky2/profile-sync-daemon/commit/05fef23bfe7dd6cd2a55a586500819d6a988cb95)

Basically you just set the NIXOS_MAN = 1 in the makefile and then build.

1) Does it work for you? 2) Do you like the text?

graysky2 commented 9 years ago

I just saw that 14.12 is live. Is it safe to update the docs and the readme? ...to remove the 'you need to be tracking the unstable channel.'

prikhi commented 9 years ago

Sorry I was mistaken, the psd service didn't make it into 14.12. Not sure when the next release will be(most people run unstable) so I would remove the 14.12 part and leave the nixos-unstable bit.

graysky2 commented 9 years ago

OK... I will make that edit tomorrow.

graysky2 commented 9 years ago

OK, I just released 5.60.1 with this modification, https://github.com/graysky2/profile-sync-daemon/commit/386733fb8f7699e004c981d18e039503cbeed1df

prikhi commented 9 years ago

Beautiful, thanks. I will let you know when I know when the next release is.

graysky2 commented 9 years ago

Perfect