/* * NixNG * Copyright (c) 2021 GPL Magic_RB * * This file is free software: you may copy, redistribute and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This file is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ { nglib, nixpkgs }: nglib.makeSystem { system = "x86_64-linux"; name = "nixng-reicio"; inherit nixpkgs; config = ({ pkgs, ... }: { dumb-init = { enable = true; type.services = { }; }; users.users."reicio" = { uid = 1002; home = "/var/empty"; group = "reicio"; description = "vmail user."; }; users.groups."reicio" = { gid = 1002; }; init.services.reicio = let reicio = with pkgs; rustPlatform.buildRustPackage { pname = "reicio-web"; version = "0.1.0"; src = fetchgit { url = "https://gitea.redalder.org/ThyW/reicio-web"; sha256 = "sha256-zAflDChM1szzESocMuzag+Umheku+AOeCb+4TYznJII="; }; cargoSha256 = "sha256-LmeJxYS11OEWEnw7YIOyR1vCqgXOCpnM28Yo+kPSxPg="; postInstall = '' mkdir -p $out/share/reicio cp -r quotes.json portraits templates $out/share/reicio cat < $out/share/reicio/Rocket.toml [global] address = "0.0.0.0" EOF ''; }; in { shutdownOnExit = true; enabled = true; script = pkgs.writeShellScript "reicio-run" '' export PATH=${with pkgs; lib.makeBinPath [ runit busybox reicio ]} cd ${pkgs.lib.trace reicio.outPath reicio}/share/reicio chpst -u reicio:reicio reicio-web ''; }; }); }