mirror of
https://codeberg.org/icewind/shelve.git
synced 2026-06-03 20:14:08 +02:00
fmt
This commit is contained in:
parent
39d60199fb
commit
d3d50bfb2c
6 changed files with 56 additions and 51 deletions
19
README.md
19
README.md
|
|
@ -4,22 +4,27 @@ Quick and easy file hosting
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
Shelve is intended to be an easy way to share files with a friend, just drag in
|
||||||
|
a file and copy the link.
|
||||||
|
|
||||||
## Tokens
|
## 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
|
## License
|
||||||
|
|
||||||
Licensed under either of
|
Licensed under either of
|
||||||
|
|
||||||
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
|
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
|
https://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
- MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
||||||
|
https://opensource.org/licenses/MIT)
|
||||||
|
|
||||||
at your option.
|
at your option.
|
||||||
|
|
||||||
### Contribution
|
### Contribution
|
||||||
|
|
||||||
Unless you explicitly state otherwise, any contribution intentionally
|
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||||
submitted for inclusion in the work by you, as defined in the Apache-2.0
|
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
|
||||||
license, shall be dual licensed as above, without any additional terms or
|
dual licensed as above, without any additional terms or conditions.
|
||||||
conditions.
|
|
||||||
|
|
|
||||||
10
docker.nix
10
docker.nix
|
|
@ -1,6 +1,6 @@
|
||||||
{ dockerTools
|
{
|
||||||
, shelve
|
dockerTools,
|
||||||
,
|
shelve,
|
||||||
}:
|
}:
|
||||||
dockerTools.buildLayeredImage {
|
dockerTools.buildLayeredImage {
|
||||||
name = "icewind1991/shelve";
|
name = "icewind1991/shelve";
|
||||||
|
|
@ -11,9 +11,9 @@ dockerTools.buildLayeredImage {
|
||||||
dockerTools.caCertificates
|
dockerTools.caCertificates
|
||||||
];
|
];
|
||||||
config = {
|
config = {
|
||||||
Cmd = [ "shelve" ];
|
Cmd = ["shelve"];
|
||||||
ExposedPorts = {
|
ExposedPorts = {
|
||||||
"80/tcp" = { };
|
"80/tcp" = {};
|
||||||
};
|
};
|
||||||
Env = [
|
Env = [
|
||||||
"ROCKET_ADDRESS=0.0.0.0"
|
"ROCKET_ADDRESS=0.0.0.0"
|
||||||
|
|
|
||||||
19
flake.nix
19
flake.nix
|
|
@ -10,20 +10,21 @@
|
||||||
inputs.flakelight.follows = "flakelight";
|
inputs.flakelight.follows = "flakelight";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
outputs = { mill-scale, ... }: mill-scale ./. {
|
outputs = {mill-scale, ...}:
|
||||||
|
mill-scale ./. {
|
||||||
extraPaths = [
|
extraPaths = [
|
||||||
./templates
|
./templates
|
||||||
];
|
];
|
||||||
nixosModules = { outputs, ... }: {
|
nixosModules = {outputs, ...}: {
|
||||||
default =
|
default = {
|
||||||
{ pkgs
|
pkgs,
|
||||||
, config
|
config,
|
||||||
, lib
|
lib,
|
||||||
, ...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [ ./nix/module.nix ];
|
imports = [./nix/module.nix];
|
||||||
config = lib.mkIf config.services.shelve.enable {
|
config = lib.mkIf config.services.shelve.enable {
|
||||||
nixpkgs.overlays = [ outputs.overlays.default ];
|
nixpkgs.overlays = [outputs.overlays.default];
|
||||||
services.shelve.package = lib.mkDefault pkgs.shelve;
|
services.shelve.package = lib.mkDefault pkgs.shelve;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
{ config
|
{
|
||||||
, lib
|
config,
|
||||||
, pkgs
|
lib,
|
||||||
, ...
|
pkgs,
|
||||||
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.services.shelve;
|
cfg = config.services.shelve;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.services.shelve = {
|
options.services.shelve = {
|
||||||
enable = mkEnableOption "Enables the shelve service";
|
enable = mkEnableOption "Enables the shelve service";
|
||||||
|
|
||||||
|
|
@ -24,8 +24,8 @@ in
|
||||||
|
|
||||||
tokens = mkOption {
|
tokens = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [ ];
|
default = [];
|
||||||
example = [ "foo" "bar" ];
|
example = ["foo" "bar"];
|
||||||
description = "upload tokens";
|
description = "upload tokens";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -51,14 +51,14 @@ in
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
networking.firewall.allowedTCPPorts = lib.optional cfg.openPort cfg.port;
|
networking.firewall.allowedTCPPorts = lib.optional cfg.openPort cfg.port;
|
||||||
|
|
||||||
users.groups.shelve = { };
|
users.groups.shelve = {};
|
||||||
users.users.shelve = {
|
users.users.shelve = {
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
group = "shelve";
|
group = "shelve";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.shelve = {
|
systemd.services.shelve = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = ["multi-user.target"];
|
||||||
environment = {
|
environment = {
|
||||||
ROCKET_PORT = toString cfg.port;
|
ROCKET_PORT = toString cfg.port;
|
||||||
ROCKET_ADDRESS = cfg.bindAddress;
|
ROCKET_ADDRESS = cfg.bindAddress;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
final: prev: {
|
final: prev: {
|
||||||
shelve = final.callPackage ./package.nix { };
|
shelve = final.callPackage ./package.nix {};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
{ stdenv
|
{
|
||||||
, rustPlatform
|
stdenv,
|
||||||
, lib
|
rustPlatform,
|
||||||
,
|
lib,
|
||||||
}:
|
}: let
|
||||||
let
|
|
||||||
inherit (lib.sources) sourceByRegex;
|
inherit (lib.sources) sourceByRegex;
|
||||||
inherit (builtins) fromTOML readFile;
|
inherit (builtins) fromTOML readFile;
|
||||||
src = sourceByRegex ../. [ "Cargo.*" "(src|templates)(/.*)?" ];
|
src = sourceByRegex ../. ["Cargo.*" "(src|templates)(/.*)?"];
|
||||||
cargoPackage = (fromTOML (readFile ../Cargo.toml)).package;
|
cargoPackage = (fromTOML (readFile ../Cargo.toml)).package;
|
||||||
in
|
in
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage rec {
|
||||||
pname = cargoPackage.name;
|
pname = cargoPackage.name;
|
||||||
inherit (cargoPackage) version;
|
inherit (cargoPackage) version;
|
||||||
|
|
||||||
|
|
@ -18,4 +17,4 @@ rustPlatform.buildRustPackage rec {
|
||||||
cargoLock = {
|
cargoLock = {
|
||||||
lockFile = ../Cargo.lock;
|
lockFile = ../Cargo.lock;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue