diff --git a/flake.lock b/flake.lock index 5539f53..d8e28b4 100644 --- a/flake.lock +++ b/flake.lock @@ -263,6 +263,22 @@ "type": "github" } }, + "flake-compat_6": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -402,6 +418,42 @@ "type": "github" } }, + "flake-utils_4": { + "inputs": { + "systems": "systems_8" + }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { + "inputs": { + "systems": "systems_9" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "fromYaml": { "flake": false, "locked": { @@ -554,6 +606,28 @@ "type": "github" } }, + "gitignore_4": { + "inputs": { + "nixpkgs": [ + "upfast", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703887061, + "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "gnome-shell": { "flake": false, "locked": { @@ -571,6 +645,31 @@ "type": "github" } }, + "gomod2nix": { + "inputs": { + "flake-utils": [ + "upfast", + "flake-utils" + ], + "nixpkgs": [ + "upfast", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1705314449, + "narHash": "sha256-yfQQ67dLejP0FLK76LKHbkzcQqNIrux6MFe32MMFGNQ=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "30e3c3a9ec4ac8453282ca7f67fca9e1da12c3e6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, "hercules-ci-effects": { "inputs": { "flake-parts": "flake-parts_2", @@ -926,6 +1025,54 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1704874635, + "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_10": { + "locked": { + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_11": { + "locked": { + "lastModified": 1704842529, + "narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1740547748, @@ -1154,6 +1301,28 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_6", + "flake-utils": "flake-utils_5", + "gitignore": "gitignore_4", + "nixpkgs": "nixpkgs_11", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1708018599, + "narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", @@ -1170,7 +1339,8 @@ "nix-on-droid": "nix-on-droid", "nixpkgs": "nixpkgs_8", "nvf": "nvf", - "stylix": "stylix" + "stylix": "stylix", + "upfast": "upfast" } }, "rust-overlay": { @@ -1371,6 +1541,36 @@ "type": "github" } }, + "systems_8": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_9": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tinted-foot": { "flake": false, "locked": { @@ -1496,6 +1696,27 @@ "type": "github" } }, + "upfast": { + "inputs": { + "flake-utils": "flake-utils_4", + "gomod2nix": "gomod2nix", + "nixpkgs": "nixpkgs_10", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1710684364, + "narHash": "sha256-4nlNw3sIUmnDYg9fBNwR93UsJz4uFB7yovN6udmFlAI=", + "ref": "refs/heads/main", + "rev": "37f1c553b419cfb2d69e12ffd66f501b34805170", + "revCount": 106, + "type": "git", + "url": "https://git.cronyakatsuki.xyz/crony/UpFast" + }, + "original": { + "type": "git", + "url": "https://git.cronyakatsuki.xyz/crony/UpFast" + } + }, "utils": { "inputs": { "systems": "systems_2" diff --git a/flake.nix b/flake.nix index 5afee07..55eff64 100644 --- a/flake.nix +++ b/flake.nix @@ -73,6 +73,9 @@ # secrets management agenix.url = "github:ryantm/agenix"; + + # My selfhosted service, inspired by 0x0.st + upfast.url = "git+https://git.cronyakatsuki.xyz/crony/UpFast"; }; outputs = { @@ -211,6 +214,7 @@ }; odin = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; system = "aarch64-linux"; modules = [ disko.nixosModules.disko diff --git a/modules/servers/odin/default.nix b/modules/servers/odin/default.nix index 07ea4d9..deccde3 100644 --- a/modules/servers/odin/default.nix +++ b/modules/servers/odin/default.nix @@ -4,5 +4,6 @@ ./searx.nix ./syncyomi.nix ./wallabag.nix + ./upfast.nix ]; } diff --git a/modules/servers/odin/upfast.nix b/modules/servers/odin/upfast.nix new file mode 100644 index 0000000..772489f --- /dev/null +++ b/modules/servers/odin/upfast.nix @@ -0,0 +1,57 @@ +{inputs, ...}: { + fileSystems."/var/lib/upfast" = { + device = "/root/10gb"; + fsType = "ext4"; + options = [ + "loop" + "rw" + "usrquota" + "grpquota" + ]; + }; + + users = { + users.upfast = { + isSystemUser = true; + home = "/var/lib/upfast"; + group = "upfast"; + }; + groups.upfast = {}; + }; + + systemd.services.upfast = { + enable = true; + description = "SelfHosted file upload and share service like 0x0.st"; + serviceConfig = { + Type = "simple"; + User = "upfast"; + Group = "upfast"; + WorkingDirectory = "/var/lib/upfast"; + Restart = "on-failure"; + }; + + script = "${inputs.upfast.packages.aarch64-linux.default}/bin/upfast -p 8383 -d https://upfast.cronyakatsuki.xyz"; + + after = ["var-lib-upfast.mount"]; + bindsTo = ["var-lib-upfast.mount"]; + + wantedBy = ["multi-user.target"]; + }; + + services.traefik.dynamicConfigOptions.http = { + services.upfast.loadBalancer.servers = [ + { + url = "http://localhost:8383"; + } + ]; + + routers.upfast = { + rule = "Host(`upfast.cronyakatsuki.xyz`)"; + tls = { + certResolver = "porkbun"; + }; + service = "upfast"; + entrypoints = "websecure"; + }; + }; +}