mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-28 11:06:15 +01:00
ca34d4229c
Signed-off-by: main <magic_rb@redalder.org>
78 lines
2.4 KiB
Nix
78 lines
2.4 KiB
Nix
/*
|
|
* NixNG
|
|
* Copyright (c) 2021 GPL Magic_RB <magic_rb@redalder.org>
|
|
*
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
{ 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 <<EOF > $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
|
|
'';
|
|
};
|
|
});
|
|
}
|