fleek
fleek copied to clipboard
Help on programs/services needed (example: syncthing service)
Hi there.,
Using fleek to add packages has worked without a hitch so far, so really cool and happy to have this tool. However, I'm struggling with programs/services. The fleek documentation is really sparse here.
Case in point: Trying to add syncthing, which needs to run as a service, and there is an entry in the home-manager documentation relating to syncthing as well, so I assume it needs to be added as a program.
Tried using the command line:
❯ fleek add --program syncthing
# fleek | vv0.8.5
## Usage
> Add a new package or program to your configuration
fleek add [package] [package] ...
## Description
Add a new package or program to your configuration.
Use the `--program` flag to specify a program which can also be configured by nix.
## Flags
-a, --apply | apply configuration after adding
-h, --help | help for add
-q, --quiet | suppress logs
-v, --verbose | show more detailed output
ERROR unknown flag: --program
That did not work as you can see. Also tried the syntax below, but same result.
fleek add syncthing --program
Trawling through the fleek directory looking for clues, I found these two files:
~/.local/share/fleek/programs.nix
~/.local/share/fleek/user.nix
The comments in these files suggest that programs and their configs respectively should be listed in these two files before adding them to .
I added programs.syncthing.enable = true;
to programs.nix and services.syncthing.enable = true;
to user.nix. Then added syncthing to the list of programs in the fleek.yml
file and applied the config. It ran without errors, but syncthing was not installed.
A bit of help here would be appreciated. :-)
Thanks!
this is a bug in fleek. I temporarily removed the concept of programs from the add/remove commands because of confusion about what they are and how to use them. Will fix.
Thanks for your reply. Looking forward to the fix. Cheers!
Here's an example config for syncthing: https://github.com/bketelsen/fleek/blob/main/user.nix note that you don't need to add it to both programs & services. Just services is fine.
Thanks for that. Will give it a try. Just so I understand, how minimal or extensive should this config be? Will Fleek now go out and create a systemd service without further config for example, or should that be set up in the user.nix file as well? I've been looking at this example, which is really extensive, and also contains the tray service config and explicit systemd service configs. Don't know what Fleek handles automagically, so just wondering how much config should be added here.
I'm not sure if you figured out your last question or not, so just in case and for future readers:
The example you referenced is actually home manager's implementation of services.syncthing
. That particular file tells home manager (one of the background Nix processes fleek uses) what to set up when you enable the service in your config. To enable and use it you should only need to enter this into your user.nix:
services.syncthing.enable = true;
If you want to use the tray icon (which I haven't had luck getting to work in NixOS even -- probably an ID10T error...), you would set it like this:
services.syncthing.enable = true;
services.syncthing.tray.enable = true;
Please note that services don't always automatically start as soon as you install them. You can either restart or manually tell systemd to start them: systemctl --user start syncthing
. After the initial reboot/start, however, they should start automatically for you with each reboot.
Thank you @ironman820, that's really useful info!
You are welcome @thinkbig1979. I wanted to add that I figured out my tray issues while poking around the home manager GitHub.
They posted a workaround. If you want to use the tray notifier, along with the tray configuration I mentioned previously, you can enter this into your user.nix:
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = [ "graphical-session-pre.target" ];
};
};