1
0
Fork 0
mirror of https://codeberg.org/icewind/shelve.git synced 2026-06-03 20:14:08 +02:00
This commit is contained in:
Robin Appelman 2025-06-02 21:00:23 +02:00
commit d3d50bfb2c
6 changed files with 56 additions and 51 deletions

View file

@ -4,22 +4,27 @@ Quick and easy file hosting
![Shelve UI](screenshots/shelve.png)
Shelve is intended to be an easy way to share files with a friend, just drag in
a file and copy the link.
## Tokens
Upload tokens are configured by setting the `TOKENS` environment variable to a comma separated list.
Upload tokens are configured by setting the `TOKENS` environment variable to a
comma separated list.
## License
Licensed under either of
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
https://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or
https://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.

View file

@ -1,6 +1,6 @@
{ dockerTools
, shelve
,
{
dockerTools,
shelve,
}:
dockerTools.buildLayeredImage {
name = "icewind1991/shelve";
@ -11,9 +11,9 @@ dockerTools.buildLayeredImage {
dockerTools.caCertificates
];
config = {
Cmd = [ "shelve" ];
Cmd = ["shelve"];
ExposedPorts = {
"80/tcp" = { };
"80/tcp" = {};
};
Env = [
"ROCKET_ADDRESS=0.0.0.0"

View file

@ -10,23 +10,24 @@
inputs.flakelight.follows = "flakelight";
};
};
outputs = { mill-scale, ... }: mill-scale ./. {
extraPaths = [
./templates
];
nixosModules = { outputs, ... }: {
default =
{ pkgs
, config
, lib
, ...
outputs = {mill-scale, ...}:
mill-scale ./. {
extraPaths = [
./templates
];
nixosModules = {outputs, ...}: {
default = {
pkgs,
config,
lib,
...
}: {
imports = [ ./nix/module.nix ];
imports = [./nix/module.nix];
config = lib.mkIf config.services.shelve.enable {
nixpkgs.overlays = [ outputs.overlays.default ];
nixpkgs.overlays = [outputs.overlays.default];
services.shelve.package = lib.mkDefault pkgs.shelve;
};
};
};
};
};
}

View file

@ -1,12 +1,12 @@
{ config
, lib
, pkgs
, ...
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.services.shelve;
in
{
in {
options.services.shelve = {
enable = mkEnableOption "Enables the shelve service";
@ -24,8 +24,8 @@ in
tokens = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "foo" "bar" ];
default = [];
example = ["foo" "bar"];
description = "upload tokens";
};
@ -51,14 +51,14 @@ in
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = lib.optional cfg.openPort cfg.port;
users.groups.shelve = { };
users.groups.shelve = {};
users.users.shelve = {
isSystemUser = true;
group = "shelve";
};
systemd.services.shelve = {
wantedBy = [ "multi-user.target" ];
wantedBy = ["multi-user.target"];
environment = {
ROCKET_PORT = toString cfg.port;
ROCKET_ADDRESS = cfg.bindAddress;

View file

@ -1,3 +1,3 @@
final: prev: {
shelve = final.callPackage ./package.nix { };
shelve = final.callPackage ./package.nix {};
}

View file

@ -1,21 +1,20 @@
{ stdenv
, rustPlatform
, lib
,
}:
let
{
stdenv,
rustPlatform,
lib,
}: let
inherit (lib.sources) sourceByRegex;
inherit (builtins) fromTOML readFile;
src = sourceByRegex ../. [ "Cargo.*" "(src|templates)(/.*)?" ];
src = sourceByRegex ../. ["Cargo.*" "(src|templates)(/.*)?"];
cargoPackage = (fromTOML (readFile ../Cargo.toml)).package;
in
rustPlatform.buildRustPackage rec {
pname = cargoPackage.name;
inherit (cargoPackage) version;
rustPlatform.buildRustPackage rec {
pname = cargoPackage.name;
inherit (cargoPackage) version;
inherit src;
inherit src;
cargoLock = {
lockFile = ../Cargo.lock;
};
}
cargoLock = {
lockFile = ../Cargo.lock;
};
}