How to start using Nix(OS)

France! I guess you are from Germany?

yes, in the north/west on the northsea at the river ems…

Question about Teamviewer. Irt needs to activate the daemon. But i need Teamviewer only once a month.

services.teamviewer.enable

On Debian i could enable and disable a daemon by hand only when i need it. What about Nixos?

The option you show is doing a few things (you can check here):

  • it installs teamviewer
  • it creates a systemd service teamviewerd
    In particular, you can use systemctl status teamviewerd.service to check the status of the daemon, or sudo systemctl {start/stop} teamviewerd to start/stop it as usual:
╰─❯ systemctl status teamviewerd.service                                                                                                                                                                       ─╯
● teamviewerd.service - TeamViewer remote control daemon
     Loaded: loaded (/etc/systemd/system/teamviewerd.service; enabled; preset: enabled)
     Active: active (running) since Sun 2024-01-07 11:34:53 CET; 4 days ago
    Process: 2999 ExecStartPre=/nix/store/s6js9pa8s9absvqzri0lbximxmdki4md-unit-script-teamviewerd-pre-start/bin/teamviewerd-pre-start (code=exited, status=0/SUCCESS)
   Main PID: 3001 (.teamviewerd-wr)
         IP: 0B in, 0B out
         IO: 16.0K read, 1.3M written
      Tasks: 21 (limit: 18952)
     Memory: 3.5M
        CPU: 4min 19.938s
     CGroup: /system.slice/teamviewerd.service
             └─3001 /nix/store/vsvdbxwhb7an69r3h0sw8rr609ws3ywv-teamviewer-15.35.7/bin/teamviewerd -f

janv. 07 11:34:53 bestos systemd[1]: Starting TeamViewer remote control daemon...
janv. 07 11:34:53 bestos systemd[1]: Started TeamViewer remote control daemon.


╭─    ~ ······································································································································································· 4 ✘  5s   15:25:56  ─╮
╰─❯ sudo systemctl stop teamviewerd.service                                                                                                                                                                    ─╯
[sudo] Mot de passe de leo : 

╭─    ~ ········································································································································································· ✔  5s   15:26:03  ─╮
╰─❯ systemctl status teamviewerd.service                                                                                                                                                                       ─╯
○ teamviewerd.service - TeamViewer remote control daemon
     Loaded: loaded (/etc/systemd/system/teamviewerd.service; enabled; preset: enabled)
     Active: inactive (dead) since Thu 2024-01-11 15:26:03 CET; 2s ago
   Duration: 4d 3h 51min 9.926s
    Process: 2999 ExecStartPre=/nix/store/s6js9pa8s9absvqzri0lbximxmdki4md-unit-script-teamviewerd-pre-start/bin/teamviewerd-pre-start (code=exited, status=0/SUCCESS)
    Process: 3001 ExecStart=/nix/store/vsvdbxwhb7an69r3h0sw8rr609ws3ywv-teamviewer-15.35.7/bin/teamviewerd -f (code=exited, status=0/SUCCESS)
   Main PID: 3001 (code=exited, status=0/SUCCESS)
         IP: 0B in, 0B out
         IO: 16.0K read, 1.3M written
        CPU: 4min 20.151s

janv. 07 11:34:53 bestos systemd[1]: Starting TeamViewer remote control daemon...
janv. 07 11:34:53 bestos systemd[1]: Started TeamViewer remote control daemon.
janv. 11 15:26:03 bestos systemd[1]: Stopping TeamViewer remote control daemon...
janv. 11 15:26:03 bestos systemd[1]: teamviewerd.service: Deactivated successfully.
janv. 11 15:26:03 bestos systemd[1]: Stopped TeamViewer remote control daemon.
janv. 11 15:26:03 bestos systemd[1]: teamviewerd.service: Consumed 4min 20.151s CPU time, read 16.0K from disk, written 1.3M to disk, no IP traffic.

╭─    ~ ·············································································································································································· 3 ✘  15:26:06  ─╮
╰─❯ sudo systemctl start teamviewerd.service                                                                                                                                                                   ─╯

╭─    ~ ················································································································································································ ✔  15:26:11  ─╮
╰─❯ systemctl status teamviewerd.service                                                                                                                                                                       ─╯
● teamviewerd.service - TeamViewer remote control daemon
     Loaded: loaded (/etc/systemd/system/teamviewerd.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-01-11 15:26:11 CET; 2s ago
    Process: 2395199 ExecStartPre=/nix/store/s6js9pa8s9absvqzri0lbximxmdki4md-unit-script-teamviewerd-pre-start/bin/teamviewerd-pre-start (code=exited, status=0/SUCCESS)
   Main PID: 2395202 (.teamviewerd-wr)
         IP: 0B in, 0B out
         IO: 0B read, 0B written
      Tasks: 21 (limit: 18952)
     Memory: 8.1M
        CPU: 174ms
     CGroup: /system.slice/teamviewerd.service
             └─2395202 /nix/store/vsvdbxwhb7an69r3h0sw8rr609ws3ywv-teamviewer-15.35.7/bin/teamviewerd -f

janv. 11 15:26:11 bestos systemd[1]: Starting TeamViewer remote control daemon...
janv. 11 15:26:11 bestos systemd[1]: Started TeamViewer remote control daemon.

You can also just set services.teamviewer.enable = false; when you don’t need teamviewer, and services.teamviewer.enable = true; when you need it, especially if you use teamviewer very rarely it makes sense.

But that needs a reboot then.? Or when it is set to false, i can enable it only for that session with?

You mean for services.teamviewer.enable = true; ? No, you should not need any reboot: when you set services.teamviewer.enable = true; NixOs is clever enough to start/stop/restart the good services. If you set services.teamviewer.enable = false;, it will completely uninstall teamviewer, so sudo systemctl start teamviewerd.service will not work. You can however disable the daemon if you don’t want it to start by default, I guess:

systemd.services.teamviewerd.wantedBy = lib.mkForce [ ];

should work based on this answer Disable a systemd service while having it in NixOS's conf - #3 by jtojnar

1 Like

OK, just a moment, i will try it out

OK, without reboot it won’t work. Can later try after reboot…

[wolf@daw:~]$ sudo systemctl start teamviewerd
Failed to start teamviewerd.service: Unit teamviewerd.service has a bad unit file setting.
See system logs and ‘systemctl status teamviewerd.service’ for details.
[wolf@daw:~]$ sudo systemctl status teamviewerd
○ teamviewerd.service
Loaded: bad-setting (Reason: Unit teamviewerd.service has a bad unit file setting.)
Active: inactive (dead)
Jan 11 15:53:11 daw systemd[1]: teamviewerd.service: Service has no ExecStart=, ExecStop=, or SuccessAction=.>
Jan 11 15:53:22 daw systemd[1]: teamviewerd.service: Service has no ExecStart=, ExecStop=, or SuccessAction=.>
Jan 11 15:53:33 daw systemd[1]: teamviewerd.service: Service has no ExecStart=, ExecStop=, or SuccessAction=.>
lines 1-7/7 (END)

used this line…

You put both:

    services.teamviewer.enable = true;
    systemd.services.teamviewerd.wantedBy = lib.mkForce [ ];

?

No, the last line.

And a reboot doen’t help

Oh, you need both: the first line just tells “please install teamviewer and create a new service called teamviewerd”, the second line just says “in the teamviewerd service, remove the line wantedBy, i.e. do not start it automatically”.

Works like a charm… Very nice…

And now i can stop the daemon with systemctl. after closing the app.

1 Like

Programstarter does not work.
Screenshot_20240113_180743
But i can start it via terminal…

On other distro there is a ./application dir filled with .dektop files. The rustdesk application has no starter, but can also started via terminal…

Oh, it is a bug of the derivation, here

The ${placeholder "out"}/bin should be removed to keep the path relative, as advised here What is the recommended use of makeDesktopItem? How to setup the icon correctly? - #6 by zarel as it allows better theming, wrappers by users etc. Right now, the issue is that makeDesktopItem will create first a different derivation, as seen in your screenshot, that contains wnly the desktop file, so the placeholder will point to this nearly empty directory.

I don’t have a computer with me right now, but it can be a nice simple first pull request for you if you want to get involved in nixpkgs. If not, just create a new issue in github with the maintainers of the package (cf names at the end of the above link) and me in mention, explaining what I just explained above.

And right now, you can temporarily fix your issue by using overrideAttrs, like replace anydesk.in your configuration with something like

(anydesk.overrideAttrs (finalAttrs: previousAttrs: {
  desktopItems = [
    (makeDesktopItem {
      name = "AnyDesk";
      exec = "anydesk %u";
      icon = "anydesk";
      desktopName = "AnyDesk";
      genericName = description;
      categories = [ "Network" ];
      startupNotify = false;
    })
  ];
});
)

(I can’t test but should work)

Hi, tomorrow i can look at it. Today i’m on tour for radio production. 1st time live transmitting with nixos. ~10000 listener via FM transmitter…


Oh good luck, seems very impressive. What kind of software/hardware are you using?

Oh, that’s very simple. Some 48V powered condenser microphones, a mixer with usb audio interface and the software “butt” to stream the audio to an icecast server, the studio is playing out the stream to put it on the air.

Yes, now i have a case by not running software…

[wolf@schwoon-desktop:~/APP]$ ./MQTT-Explorer-0.4.0-beta1.AppImage
Could not start dynamically linked executable: ./MQTT-Explorer-0.4.0-beta1.AppImage
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
Frequently Asked Questions — nix.dev documentation

First i search for it in the nix packages…

For App images, you can sometimes use appimage-run ./yourimage.AppImage, but sometimes it fails without obvious error message if a lib is missing. Enabling:

programs.nix-ld.enable = true;

will save you quite some headacke, especially if you develop/use nodejs applications that love to include pre-build binaries. Of course, you can also package the application yourself and submit it in nixpkgs, either from source (for Electron app it might be less obvious than for usual apps), or directly by wrapping the app image, apparently someone already tried to do that here for your program mqtt-explorer.nix · GitHub.

OK, before i’m trying this i check the package “mqttui”. And i found the real-vnc-viewer, that i sometimes use for local vnc server.

But the possibility to run AppImage application is maybe useful and good to know the workaround.

Sometimes it is not so bad, when often used programs are not available without trouble… My solar inverters mqtt data… :slight_smile: Show with mqttui