add fileshare

This commit is contained in:
Kopatz
2024-06-01 23:55:36 +02:00
parent cc2aa2b6c3
commit 2843e736ba
11 changed files with 105 additions and 20 deletions

24
flake.lock generated
View File

@@ -634,11 +634,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1716987116, "lastModified": 1717248095,
"narHash": "sha256-uuEkErFVsFdg2K0cKbNQ9JlFSAm/xYqPr4rbPLI91Y8=", "narHash": "sha256-e8X2eWjAHJQT82AAN+mCI0B68cIDBJpqJ156+VRrFO0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "8251761f93d6f5b91cee45ac09edb6e382641009", "rev": "7b49d3967613d9aacac5b340ef158d493906ba79",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -779,11 +779,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1717191071, "lastModified": 1717269089,
"narHash": "sha256-wue0+NHKFhTiY7dTtP0jyNwVgUCMOBfcP7mSHVa6PMw=", "narHash": "sha256-PUxRImLJThMBjC8reFM/EXfLrv95miC7U8euZyDqSns=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "d15fade62b743839a20d927d3506d503858f49f0", "rev": "9a9d6c69d8be9c5fa66f0714de22564df72aaa96",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -794,11 +794,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1717242279, "lastModified": 1717271186,
"narHash": "sha256-ovx7RavkxxTXRokC5h1rmKtMZj8QautKLw9XhwGs8R4=", "narHash": "sha256-BEVwC1UI1Zh3b1jh43Fz9JGchxla98mkceDKs0TmZyk=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "5b704d93015b0e73a5d528fc97598b33e71cda69", "rev": "803e2370d6ca2a0a5f06a7a936bdf238d93a861a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -840,11 +840,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1717212835, "lastModified": 1717268716,
"narHash": "sha256-fSNsRokB3YaTmJOcSdDzKJOFWq/bQ/FCoMGpF12sF5c=", "narHash": "sha256-hKM/D6Ni3+Ihvmy8pF+rOFgIqhphOEHUWqxJd+5ZV6Y=",
"owner": "danth", "owner": "danth",
"repo": "stylix", "repo": "stylix",
"rev": "266db7f00cad4a465e0ce43d91798fda10716212", "rev": "3befd5d693a2669dc7d2086b57298838ff71f24b",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -35,7 +35,7 @@
}; };
outputs = { self, nur, nixpkgs, nixos-hardware, nixos-wsl, nixpkgs-unstable outputs = { self, nur, nixpkgs, nixos-hardware, nixos-wsl, nixpkgs-unstable
, agenix, home-manager, home-manager-unstable, nix-colors, nixos-cosmic , agenix, home-manager, home-manager-unstable, nix-colors, nixos-cosmic
, nixvim, stylix, disko, flake-utils }@inputs: , nixvim, stylix, disko, flake-utils, ... }@inputs:
let let
inherit (self) outputs; inherit (self) outputs;
system = "x86_64-linux"; system = "x86_64-linux";

View File

@@ -0,0 +1 @@
{ plugins.barbar = { enable = true; }; }

View File

@@ -1 +0,0 @@
{ plugins.bufferline = { enable = true; }; }

View File

@@ -99,7 +99,7 @@
options.desc = "Gitsigns reset current buffer"; options.desc = "Gitsigns reset current buffer";
} }
# Tabs # Tabs (barbar)
{ {
mode = "n"; mode = "n";
key = "<leader>tn"; key = "<leader>tn";
@@ -109,19 +109,19 @@
{ {
mode = "n"; mode = "n";
key = "<leader>td"; key = "<leader>td";
action = "<CMD>tabclose<CR>"; action = "<CMD>BufferClose<CR>";
options.desc = "Close tab"; options.desc = "Close tab";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>tt"; key = "<leader>tt";
action = "<CMD>tabnext<CR>"; action = "<CMD>BufferNext<CR>";
options.desc = "Go to the sub-sequent tab"; options.desc = "Go to the sub-sequent tab";
} }
{ {
mode = "n"; mode = "n";
key = "<leader>tp"; key = "<leader>tp";
action = "<CMD>tabprevious<CR>"; action = "<CMD>BufferPrevious<CR>";
options.desc = "Go to the previous tab"; options.desc = "Go to the previous tab";
} }

View File

@@ -10,7 +10,7 @@ let
./auto-pairs.nix ./auto-pairs.nix
./autosave.nix ./autosave.nix
./blankline.nix ./blankline.nix
./bufferline.nix ./barbar.nix
./cmp.nix ./cmp.nix
./fidget.nix ./fidget.nix
./refactoring.nix ./refactoring.nix

View File

@@ -11,6 +11,7 @@
./fileshelter.nix ./fileshelter.nix
./wireguard.nix ./wireguard.nix
./kop-monitor.nix ./kop-monitor.nix
./kop-fileshare.nix
./adam-site.nix ./adam-site.nix
]; ];
} }

View File

@@ -0,0 +1,62 @@
{ config, pkgs, lib, ... }:
with lib;
let cfg = config.custom.services.kop-fileshare;
in {
options = {
custom.services.kop-fileshare = {
enable = mkEnableOption "Enable the file upload server";
port = mkOption {
type = types.int;
default = 7777;
description = "Port for the file upload server";
};
dataDir = mkOption {
type = types.str;
default = "/var/lib/file-upload";
description = "Directory to store uploaded files";
};
};
};
config = mkIf cfg.enable {
users.users.kop-fileshare = {
home = cfg.dataDir;
createHome = true;
isSystemUser = true;
group = "kop-fileshare";
};
users.groups.kop-fileshare = {};
systemd.services.kop-fileshare = {
description = "File Upload Server";
wants = [ "network-online.target" ];
after = [ "network.target" "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${pkgs.kop-fileshare}/bin/kop-fileshare";
WorkingDirectory = cfg.dataDir;
User = "kop-fileshare";
Restart = "on-failure";
RestartSec = "5s";
PrivateMounts = mkDefault true;
PrivateTmp = mkDefault true;
PrivateUsers = mkDefault true;
ProtectClock = mkDefault true;
ProtectControlGroups = mkDefault true;
ProtectHome = mkDefault true;
ProtectHostname = mkDefault true;
ProtectKernelLogs = mkDefault true;
ProtectKernelModules = mkDefault true;
ProtectKernelTunables = mkDefault true;
ProtectSystem = mkDefault "strict";
# Needs network access
PrivateNetwork = mkDefault false;
};
environment = {
PORT = "${toString cfg.port}";
UPLOAD_PATH = "${toString cfg.dataDir}";
};
};
};
}

View File

@@ -4,5 +4,6 @@
kop-website = kop-website =
pkgs.callPackage ./website/default.nix { inherit kop-hub ente-frontend; }; pkgs.callPackage ./website/default.nix { inherit kop-hub ente-frontend; };
kop-monitor = pkgs.callPackage ./kop-monitor/default.nix { }; kop-monitor = pkgs.callPackage ./kop-monitor/default.nix { };
kop-fileshare = pkgs.callPackage ./kop-fileshare/default.nix { };
adam-site = pkgs.callPackage ./adam-site/default.nix { }; adam-site = pkgs.callPackage ./adam-site/default.nix { };
} }

View File

@@ -0,0 +1,18 @@
{ buildGoModule, stdenv, pkgs, lib, ... }:
buildGoModule rec {
pname = "kop-fileshare";
version = "0.0.1";
src = fetchGit {
url = "git@github.com:kropatz/kop-fileshare.git";
ref = "master";
rev = "3556ccab052233c0d5d70baa631ba8b56ee8ebdb";
};
vendorHash = "sha256-OQ6rNgOQHrrhE7DT+ulwpWJCDJ4DeJiDzriAu3mfS7I=";
meta = {
description = "Simple drag and drop file uploading/sharing website";
homepage = "https://github.com/Kropatz/kop-fileshare";
license = lib.licenses.gpl3;
};
}

View File

@@ -15,7 +15,10 @@
ld.enable = true; ld.enable = true;
settings.enable = true; settings.enable = true;
}; };
services = { adam-site.enable = true; }; services = {
#adam-site.enable = true;
kop-fileshare.enable = true;
};
graphical = { lxqt.enable = true; }; graphical = { lxqt.enable = true; };
}; };