pocket accept cors

This commit is contained in:
BOTAlex 2025-10-04 02:23:05 +02:00
parent e70aee4ab6
commit 134fe2e279
10 changed files with 320 additions and 219 deletions

38
modules/buildCache.nix Normal file
View file

@ -0,0 +1,38 @@
{ pkgs, ... }: {
services.harmonia = {
enable = true;
signKeyPaths = [ "/var/lib/secrets/harmonia.secret" ];
settings = {
bind = "0.0.0.0:5444";
workers = 4;
};
};
imports = [ ./../networking/networkSetup.nix ];
services.caddy = {
enable = true;
virtualHosts."cache.deprived.dev" = {
extraConfig = ''
reverse_proxy localhost:5444
header {
# Cache control for nix store paths
Cache-Control "public, max-age=31536000, immutable"
# CORS headers if needed
Access-Control-Allow-Origin "*"
Access-Control-Allow-Methods "GET, HEAD, OPTIONS"
}
# Optional: Enable compression
encode gzip
# Optional: Logging
log {
output file /var/log/caddy/cache.log
}
'';
};
};
}

View file

@ -0,0 +1,25 @@
{ lib, pkgs, rustPlatform }:
rustPlatform.buildRustPackage rec {
pname = "shreddit";
version = "1.1.1"; # pick the crate version you want
src = pkgs.fetchCrate {
inherit pname version;
sha256 =
"sha256-ERcQZ7LLR9kfI1WMCr70EopmuPmK4Y7eXnhM7djvEI4="; # fill after first build
};
cargoHash =
"sha256-9s6wmB4YqKmyHKDS2b5keEYFDBerpdQxtNY1wVqGDxg="; # fill after first build
nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = [ pkgs.openssl ];
meta = with lib; {
description = "Shreddit CLI (Rust crate)";
license = licenses.mit; # adjust if needed
mainProgram = "shreddit";
};
}

View file

@ -1,9 +1,4 @@
{
config,
lib,
pkgs,
...
}:
{ config, lib, pkgs, ... }:
with lib;
let
@ -56,8 +51,7 @@ let
"NIX_LD_LIBRARY_PATH=${config.home.profileDirectory}/lib/nvim-depends/lib"
"PKG_CONFIG_PATH=${config.home.profileDirectory}/lib/nvim-depends/pkgconfig"
];
in
{
in {
home.packages = with pkgs; [
patchelf
nvim-depends-include
@ -65,11 +59,9 @@ in
nvim-depends-pkgconfig
ripgrep
];
home.extraOutputsToInstall = ["nvim-depends"];
home.shellAliases.nvim =
(concatStringsSep " " buildEnv)
+ " SQLITE_CLIB_PATH=${pkgs.sqlite.out}/lib/libsqlite3.so "
+ "nvim";
home.extraOutputsToInstall = [ "nvim-depends" ];
home.shellAliases.nvim = (concatStringsSep " " buildEnv)
+ " SQLITE_CLIB_PATH=${pkgs.sqlite.out}/lib/libsqlite3.so " + "nvim";
programs.neovim = {
enable = true;
@ -97,12 +89,12 @@ in
extraLuaPackages = ls: with ls; [ luarocks ];
};
# Screw declarative here
xdg.configFile."nvim".source = builtins.fetchGit {
url = "https://github.com/MagicBOTAlex/NVimConfigs";
ref = "master"; # change if the default branch is different
# submodules = true; # uncomment if needed
};
# # Screw declarative here
# xdg.configFile."nvim".source = builtins.fetchGit {
# url = "https://github.com/MagicBOTAlex/NVimConfigs";
# ref = "master"; # change if the default branch is different
# # submodules = true; # uncomment if needed
# };
# xdg.configFile."nvim".source = pkgs.fetchFromGitHub {
# owner = "MagicBOTAlex";