nixos/local-content-share: init module
This commit is contained in:
@@ -52,6 +52,8 @@
|
|||||||
|
|
||||||
- [boot.kernel.sysfs](options.html#opt-boot.kernel.sysfs) allows setting of sysfs attributes.
|
- [boot.kernel.sysfs](options.html#opt-boot.kernel.sysfs) allows setting of sysfs attributes.
|
||||||
|
|
||||||
|
- [local-content-share](https://github.com/Tanq16/local-content-share), a simple web-app for storing/sharing text snippets and files in your local network. Available as [services.local-content-share](#opt-services.local-content-share.enable).
|
||||||
|
|
||||||
- Docker now defaults to 28.x, because version 27.x stopped receiving security updates and bug fixes after [May 2, 2025](https://github.com/moby/moby/pull/49910).
|
- Docker now defaults to 28.x, because version 27.x stopped receiving security updates and bug fixes after [May 2, 2025](https://github.com/moby/moby/pull/49910).
|
||||||
|
|
||||||
- [Corteza](https://cortezaproject.org/), a low-code platform. Available as [services.corteza](#opt-services.corteza.enable).
|
- [Corteza](https://cortezaproject.org/), a low-code platform. Available as [services.corteza](#opt-services.corteza.enable).
|
||||||
|
|||||||
@@ -863,6 +863,7 @@
|
|||||||
./services/misc/lifecycled.nix
|
./services/misc/lifecycled.nix
|
||||||
./services/misc/litellm.nix
|
./services/misc/litellm.nix
|
||||||
./services/misc/llama-cpp.nix
|
./services/misc/llama-cpp.nix
|
||||||
|
./services/misc/local-content-share.nix
|
||||||
./services/misc/logkeys.nix
|
./services/misc/logkeys.nix
|
||||||
./services/misc/mame.nix
|
./services/misc/mame.nix
|
||||||
./services/misc/mbpfan.nix
|
./services/misc/mbpfan.nix
|
||||||
|
|||||||
63
nixos/modules/services/misc/local-content-share.nix
Normal file
63
nixos/modules/services/misc/local-content-share.nix
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.services.local-content-share;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.local-content-share = {
|
||||||
|
enable = lib.mkEnableOption "Local-Content-Share";
|
||||||
|
|
||||||
|
package = lib.mkPackageOption pkgs "local-content-share" { };
|
||||||
|
|
||||||
|
listenAddress = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "";
|
||||||
|
example = "127.0.0.1";
|
||||||
|
description = ''
|
||||||
|
Address on which the service will be available.
|
||||||
|
|
||||||
|
The service will listen on all interfaces if set to an empty string.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 8080;
|
||||||
|
description = "Port on which the service will be available";
|
||||||
|
};
|
||||||
|
|
||||||
|
openFirewall = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to automatically open the specified port in the firewall";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
systemd.services.local-content-share = {
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
DynamicUser = true;
|
||||||
|
User = "local-content-share";
|
||||||
|
StateDirectory = "local-content-share";
|
||||||
|
StateDirectoryMode = "0700";
|
||||||
|
WorkingDirectory = "/var/lib/local-content-share";
|
||||||
|
ExecStart = "${lib.getExe' cfg.package "local-content-share"} -listen=${cfg.listenAddress}:${toString cfg.port}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||||
|
allowedTCPPorts = [ cfg.port ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
meta.maintainers = with lib.maintainers; [ e-v-o-l-v-e ];
|
||||||
|
}
|
||||||
@@ -849,6 +849,7 @@ in
|
|||||||
litestream = runTest ./litestream.nix;
|
litestream = runTest ./litestream.nix;
|
||||||
lk-jwt-service = runTest ./matrix/lk-jwt-service.nix;
|
lk-jwt-service = runTest ./matrix/lk-jwt-service.nix;
|
||||||
lldap = runTest ./lldap.nix;
|
lldap = runTest ./lldap.nix;
|
||||||
|
local-content-share = runTest ./local-content-share.nix;
|
||||||
localsend = runTest ./localsend.nix;
|
localsend = runTest ./localsend.nix;
|
||||||
locate = runTest ./locate.nix;
|
locate = runTest ./locate.nix;
|
||||||
login = runTest ./login.nix;
|
login = runTest ./login.nix;
|
||||||
|
|||||||
25
nixos/tests/local-content-share.nix
Normal file
25
nixos/tests/local-content-share.nix
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{ pkgs, lib, ... }:
|
||||||
|
{
|
||||||
|
name = "local-content-share";
|
||||||
|
meta.maintainers = pkgs.local-content-share.meta.maintainers;
|
||||||
|
|
||||||
|
nodes.machine =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
services.local-content-share = {
|
||||||
|
enable = true;
|
||||||
|
port = 8081;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
testScript =
|
||||||
|
{ nodes, ... }:
|
||||||
|
let
|
||||||
|
cfg = nodes.machine.services.local-content-share;
|
||||||
|
in
|
||||||
|
''
|
||||||
|
machine.wait_for_unit("local-content-share.service")
|
||||||
|
machine.wait_for_open_port(${toString cfg.port})
|
||||||
|
machine.wait_until_succeeds("curl -sS -f http://127.0.0.1:${toString cfg.port}/", timeout=300)
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
lib,
|
lib,
|
||||||
buildGoModule,
|
buildGoModule,
|
||||||
fetchFromGitHub,
|
fetchFromGitHub,
|
||||||
|
nixosTests,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildGoModule (finalAttrs: {
|
buildGoModule (finalAttrs: {
|
||||||
@@ -20,6 +21,8 @@ buildGoModule (finalAttrs: {
|
|||||||
# no test file in upstream
|
# no test file in upstream
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
|
passthru.tests.nixos = nixosTests.local-content-share;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Storing/sharing text/files in your local network with no setup on client devices";
|
description = "Storing/sharing text/files in your local network with no setup on client devices";
|
||||||
homepage = "https://github.com/Tanq16/local-content-share";
|
homepage = "https://github.com/Tanq16/local-content-share";
|
||||||
|
|||||||
Reference in New Issue
Block a user