rmfakecloud: run nixfmt

This commit is contained in:
Dominique Martinet 2024-11-18 21:51:18 +09:00
parent 807e9154dc
commit b15ed174fa
2 changed files with 47 additions and 18 deletions

View File

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
with lib;
@ -6,7 +11,8 @@ let
cfg = config.services.rmfakecloud;
serviceDataDir = "/var/lib/rmfakecloud";
in {
in
{
options = {
services.rmfakecloud = {
enable = mkEnableOption "rmfakecloud remarkable self-hosted cloud";
@ -36,7 +42,12 @@ in {
};
logLevel = mkOption {
type = types.enum [ "info" "debug" "warn" "error" ];
type = types.enum [
"info"
"debug"
"warn"
"error"
];
default = "info";
description = ''
Logging level.
@ -46,7 +57,9 @@ in {
extraSettings = mkOption {
type = with types; attrsOf str;
default = { };
example = { DATADIR = "/custom/path/for/rmfakecloud/data"; };
example = {
DATADIR = "/custom/path/for/rmfakecloud/data";
};
description = ''
Extra settings in the form of a set of key-value pairs.
For tokens and secrets, use `environmentFile` instead.
@ -106,11 +119,9 @@ in {
Type = "simple";
Restart = "always";
EnvironmentFile =
mkIf (cfg.environmentFile != null) cfg.environmentFile;
EnvironmentFile = mkIf (cfg.environmentFile != null) cfg.environmentFile;
AmbientCapabilities =
mkIf (cfg.port < 1024) [ "CAP_NET_BIND_SERVICE" ];
AmbientCapabilities = mkIf (cfg.port < 1024) [ "CAP_NET_BIND_SERVICE" ];
DynamicUser = true;
PrivateDevices = true;
@ -128,7 +139,10 @@ in {
ProtectProc = "invisible";
ProcSubset = "pid";
RemoveIPC = true;
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
];
RestrictNamespaces = true;
RestrictRealtime = true;
RestrictSUIDSGID = true;

View File

@ -1,4 +1,10 @@
{ lib, fetchFromGitHub, buildGoModule, callPackage, enableWebui ? true }:
{
lib,
fetchFromGitHub,
buildGoModule,
callPackage,
enableWebui ? true,
}:
buildGoModule rec {
pname = "rmfakecloud";
@ -15,22 +21,31 @@ buildGoModule rec {
ui = callPackage ./webui.nix { inherit version src; };
postPatch = if enableWebui then ''
mkdir -p ui/build
cp -r ${ui}/* ui/build
'' else ''
sed -i '/go:/d' ui/assets.go
'';
postPatch =
if enableWebui then
''
mkdir -p ui/build
cp -r ${ui}/* ui/build
''
else
''
sed -i '/go:/d' ui/assets.go
'';
ldflags = [
"-s" "-w" "-X main.version=v${version}"
"-s"
"-w"
"-X main.version=v${version}"
];
meta = with lib; {
description = "Host your own cloud for the Remarkable";
homepage = "https://ddvk.github.io/rmfakecloud/";
license = licenses.agpl3Only;
maintainers = with maintainers; [ pacien martinetd ];
maintainers = with maintainers; [
pacien
martinetd
];
mainProgram = "rmfakecloud";
};
}