See Setting up systemd, and *How to start a daemon properly in NixOS?* discourse , which refers to a tutorial, which covers the major points of NixOS configuration. nixos.wiki
We create a `systemd` service for `wiki`. In `/etc/nixos/`, we create a `wiki.nix` file:
``` {config, ...}: { systemd.services.wiki = { wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; description = "Federated Wiki (Node.js server version)"; serviceConfig = { Type = "simple"; User = "rgb"; ExecStart = "/nix/store/413cbs2w8m8bl01hkyjdrcgwsdb111cs-node_wiki-0.24.0/bin/wiki --security_type friends"; }; }; } ```
and we import this file into the `configuration.nix`: ``` […] { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix ./wiki.nix ]; […] ```
See NixOS Manual for the full list of valid attributes for `systemd.services.wiki`.
``` $ nixos-rebuild test ```
→ Overall exposure level for wiki.service: 9.2 UNSAFE 😨
Result of ``` $ systemd-analyze security wiki ```
# See also CGroup