1

Compare commits

...

11 Commits

16 changed files with 377 additions and 19 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ config/neovim/store
home/modules/ags/config/types home/modules/ags/config/types
home/modules/ags/config/tsconfig.json home/modules/ags/config/tsconfig.json
system/modules/agenix/secrets.nix system/modules/agenix/secrets.nix
config/neovim/nvim_bundle

View File

@ -68,7 +68,7 @@ rec {
# bintools = pkgs.bintools.bintools; # Unwrapped bintools # bintools = pkgs.bintools.bintools; # Unwrapped bintools
# libc = pkgs.glibc; # libc = pkgs.glibc;
# }; # };
# gcc = pkgs.hiPrio (pkgs.wrapCCWith { # gcc = lib.hiPrio (pkgs.wrapCCWith {
# cc = pkgs.gcc.cc; # Unwrapped gcc # cc = pkgs.gcc.cc; # Unwrapped gcc
# libc = pkgs.glibc; # libc = pkgs.glibc;
# bintools = bintools; # bintools = bintools;
@ -84,7 +84,7 @@ rec {
# bintools = pkgs.bintools.bintools; # Unwrapped bintools # bintools = pkgs.bintools.bintools; # Unwrapped bintools
# libc = pkgs.glibc_multi; # libc = pkgs.glibc_multi;
# }; # };
# gcc_multilib = pkgs.hiPrio (pkgs.wrapCCWith { # gcc_multilib = lib.hiPrio (pkgs.wrapCCWith {
# cc = pkgs.gcc.cc; # Unwrapped gcc # cc = pkgs.gcc.cc; # Unwrapped gcc
# libc = pkgs.glibc_multi; # libc = pkgs.glibc_multi;
# bintools = bintools_multilib; # bintools = bintools_multilib;

View File

@ -210,6 +210,10 @@ Convert line endings to dos format
unix2dos <file> unix2dos <file>
$ file: eza -1 $ file: eza -1
% tiddl
Download stuff from tidal
tiddl download --track-quality max --path ~/Downloads/Beet/Albums --videos none url "<url>"
; =========================== ; ===========================
; SECRETS ; SECRETS
; =========================== ; ===========================

204
config/neovim/bundle.py Normal file
View File

@ -0,0 +1,204 @@
#!/usr/bin/env python3
import argparse
import os
import re
import shutil
import subprocess
from typing import cast
from urllib.request import urlretrieve
INIT_LUA: str = "/home/christoph/.config/nvim/init.lua"
def patch_paths(text: str, mappings: dict[str, str]) -> str:
"""Patches /nix/store paths in init.lua"""
patched = text
for old, new in mappings.items():
print(f"Patching init.lua: {old} -> {new}")
patched = patched.replace(old, new)
return patched
def patch_various(text: str) -> str:
"""Patches various incompatibilities with NixVim init.lua"""
# Install lazy
print("Patching init.lua: Bootstrap lazy.nvim")
patched = (
"""-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
"""
+ text
)
# print("Patching init.lua: Disabling vim.loader")
# patched = patched.replace("vim.loader.enable(true)", "vim.loader.enable(false)")
return patched
def copy_plugins(text: str, path: str) -> dict[str, str]:
"""Copies NeoVim plugins from the Nix Store"""
os.makedirs(path, exist_ok=True)
plugins_path: str = re.findall(r"\"(/nix/store/.*-lazy-plugins)\"", text)[0]
print(f"Copying: {plugins_path} -> {path}/plugins")
_ = shutil.copytree(plugins_path, f"{path}/plugins")
treesitter_path: str = re.findall(
r"\"(/nix/store/.*-vimplugin-nvim-treesitter.*)\"", text
)[0]
print(f"Copying: {treesitter_path} -> {path}/treesitter")
_ = shutil.copytree(treesitter_path, f"{path}/treesitter")
parsers_path: str = re.findall(r"\"(/nix/store/.*-treesitter-parsers)\"", text)[0]
print(f"Copying: {parsers_path} -> {path}/parsers")
_ = shutil.copytree(parsers_path, f"{path}/parsers")
return {
plugins_path: "./plugins",
treesitter_path: "./treesitter",
parsers_path: "./parsers",
}
def write_file(text: str, path: str) -> None:
"""Write text to a file"""
with open(path, "w") as file:
_ = file.write(text)
# TODO: Could add etc. nvim/lsp/formatter/linter binaries here
# TODO: Needs "install recipe", as in most cases the download will be an archive
DOWNLOADS: list[tuple[str, str]] = [
# (
# "https://github.com/neovim/neovim/releases/download/v0.11.6/nvim-linux-x86_64.tar.gz",
# "nvim",
# ),
]
def download_binaries(path: str, urls: list[tuple[str, str]]) -> None:
"""Download required binaries"""
os.makedirs(f"{path}/bin", exist_ok=True)
def download(url: str, path: str) -> None:
"""Download from URL"""
print(f"Downloading: {url}")
_ = urlretrieve(url, path)
for url, name in urls:
download(url, f"{path}/bin/{name}")
def build_nvim(path: str) -> None:
"""Builds a static nvim binary against musl"""
# TODO: Build etc. is working, but on the target system there are
# lua-ffi errors from noice.nvim with the static binary.
# This does not happen with nvim from system package repository.
def run(command: list[str]) -> None:
"""Run a subprocess"""
print(f"Running: {' '.join(command)}")
_ = subprocess.run(command)
os.makedirs(f"{path}/nvim-build", exist_ok=True)
with open(f"{path}/nvim-build/build-nvim.sh", "w") as file:
_ = file.write(
"\n".join(
[
"#!/bin/sh",
"git clone https://github.com/neovim/neovim",
"cd neovim",
"git checkout stable",
'make -j$(nproc) CMAKE_BUILD_TYPE=Release CMAKE_EXTRA_FLAGS="-DSTATIC_BUILD=1"',
"make CMAKE_INSTALL_PREFIX=/workdir/install install",
]
)
)
run(
[
"docker",
"run",
"--rm",
"-it",
"-v",
f"{os.path.abspath(path)}/nvim-build:/workdir",
"-w",
"/workdir",
"alpine:3.23.3",
"/bin/sh",
"-c",
"apk add build-base cmake coreutils curl gettext-tiny-dev git && chmod +x ./build-nvim.sh && ./build-nvim.sh",
]
)
_ = shutil.copytree(f"{path}/nvim-build/install/bin", f"{path}/bin")
_ = shutil.copytree(f"{path}/nvim-build/install/lib", f"{path}/lib")
_ = shutil.copytree(f"{path}/nvim-build/install/share", f"{path}/share")
_ = shutil.rmtree(f"{path}/nvim-build")
def bundle() -> None:
"""Creates a standalone NeoVim bundle from the NixVim configuration"""
parser = argparse.ArgumentParser()
_ = parser.add_argument(
"--config",
type=str,
default=INIT_LUA,
help="init.lua or other config file",
)
_ = parser.add_argument(
"--out",
type=str,
default="./nvim_bundle",
help="destination folder",
)
args = parser.parse_args()
args.config = cast(str, args.config)
args.out = cast(str, args.out)
with open(args.config, "r") as file:
patched_init_lua: str = file.read()
path_mappings = copy_plugins(patched_init_lua, args.out)
patched_init_lua = patch_paths(patched_init_lua, path_mappings)
patched_init_lua = patch_various(patched_init_lua)
write_file(patched_init_lua, f"{args.out}/init.lua")
# build_nvim(args.out)
# download_binaries(args.out, DOWNLOADS)
if __name__ == "__main__":
bundle()

6
config/neovim/info.md Normal file
View File

@ -0,0 +1,6 @@
# NeoVim Portable
## Requirements
- Base packages: `sudo apt install neovim git direnv ripgrep curl fzf`
- Link or copy the generated `nvim_bundle` to `~/.config/nvim` on the target machine

View File

@ -9,4 +9,5 @@
msty = pkgs.callPackage ./msty {}; msty = pkgs.callPackage ./msty {};
unityhub = pkgs.callPackage ./unityhub {}; unityhub = pkgs.callPackage ./unityhub {};
tidal-dl-ng = pkgs.callPackage ./tidal-dl-ng {}; tidal-dl-ng = pkgs.callPackage ./tidal-dl-ng {};
tiddl = pkgs.callPackage ./tiddl {};
} }

View File

@ -50,8 +50,8 @@
# }); # });
tidalDlNg = pythonPkgs.buildPythonApplication rec { tidalDlNg = pythonPkgs.buildPythonApplication rec {
pname = "tidal_dl_ng"; pname = "tidal_dl_ng_for_dj";
version = "0.33.0"; version = "0.33.2";
format = "pyproject"; format = "pyproject";
# The official repo was deleted # The official repo was deleted
@ -62,24 +62,20 @@
# sha256 = "sha256-PUT0anx1yivgXwW21jah7Rv1/BabOT+KPoW446NFNyg="; # sha256 = "sha256-PUT0anx1yivgXwW21jah7Rv1/BabOT+KPoW446NFNyg=";
# }; # };
# Alternative repo # Package now also deleted from PyPi
# src = pkgs.fetchFromGitHub { # src = pythonPkgs.fetchPypi {
# owner = "rodvicj"; # inherit pname version;
# repo = "tidal_dl_ng-Project"; # sha256 = "sha256-rOMyxnT7uVnMbn678DFtqAu4+Uc5VFGcqGI0jxplnpc=";
# rev = "4573142c76ef045ebf8e80c34657dd2bec96f17d";
# sha256 = "sha256-3sO2qj8V4KXOWK7vQsFAOYeTZo2rsc/M36SwRnC0oVg=";
# }; # };
# Package is still on PyPi # TODO: Borked
# "For DJ"-Fork
src = pythonPkgs.fetchPypi { src = pythonPkgs.fetchPypi {
inherit pname version; inherit pname version;
sha256 = "sha256-rOMyxnT7uVnMbn678DFtqAu4+Uc5VFGcqGI0jxplnpc="; sha256 = "sha256-605cgBqZV6L7sxWtEa4Ki+9hBqX4m3Rk+X5oY5bv/FQ=";
}; };
doCheck = false;
dontCheckRuntimeDeps = true; dontCheckRuntimeDeps = true;
catchConflicts = false;
strictDeps = false;
nativeBuildInputs = with pythonPkgs; [poetry-core setuptools]; nativeBuildInputs = with pythonPkgs; [poetry-core setuptools];
@ -132,7 +128,7 @@
tidal-dl-ng-gui-desktopfile = pkgs.stdenv.mkDerivation { tidal-dl-ng-gui-desktopfile = pkgs.stdenv.mkDerivation {
pname = "tdng"; pname = "tdng";
version = "0.31.3"; version = "0.33.2";
dontUnpack = true; dontUnpack = true;
nativeBuildInputs = [pkgs.makeWrapper]; nativeBuildInputs = [pkgs.makeWrapper];

View File

@ -0,0 +1,60 @@
{
lib,
stdenv,
pkgs,
}: let
pythonPkgs = pkgs.python314Packages.overrideScope (self: super: {
typer = super.typer.overridePythonAttrs (old: {
version = "0.20.1";
src = pkgs.fetchPypi {
pname = "typer";
version = "0.20.0";
sha256 = "sha256-Gq9klAMXk+SHb7C6z6apErVRz0PB5jyADfixqGZyDDc=";
};
});
aiofiles = super.aiofiles.overridePythonAttrs (old: {
version = "25.1.0";
src = pkgs.fetchFromGitHub {
owner = "Tinche";
repo = "aiofiles";
tag = "v25.1.0";
hash = "sha256-NBmzoUb2una3+eWqR1HraVPibaRb9I51aYwskrjxskQ=";
};
# Build system changed in this version
build-system = with pythonPkgs; [
hatchling
hatch-vcs
];
});
});
in
pythonPkgs.buildPythonApplication rec {
pname = "tiddl";
version = "3.2.0";
format = "pyproject";
src = pythonPkgs.fetchPypi {
inherit pname version;
sha256 = "sha256-uLkGyIScYPqFgQdPAOYJDJG0jp+nDAwIl2kFkaJZFco=";
};
dontCheckRuntimeDeps = true;
build-system = with pythonPkgs; [
poetry-core
setuptools
];
propagatedBuildInputs = with pythonPkgs; [
# Nixpkgs
aiofiles
aiohttp
m3u8
mutagen
pydantic
requests
requests-cache
typer
];
}

View File

@ -478,6 +478,7 @@ in
systemctl-tui systemctl-tui
restic # Backups restic # Backups
gnumake gnumake
just
# Hardware/Software info # Hardware/Software info
pciutils # lspci pciutils # lspci
@ -499,7 +500,7 @@ in
imagemagick # Convert image (magic) imagemagick # Convert image (magic)
mp3val # Validate mp3 files mp3val # Validate mp3 files
flac # Validate flac files flac # Validate flac files
spotdl # spotdl
# Document utils # Document utils
poppler-utils # pdfunite poppler-utils # pdfunite

View File

@ -133,6 +133,7 @@
godot_4 godot_4
(obs-studio.override {cudaSupport = true;}) (obs-studio.override {cudaSupport = true;})
kdePackages.kdenlive kdePackages.kdenlive
# davinci-resolve
krita krita
makemkv makemkv
lrcget lrcget
@ -141,7 +142,8 @@
jellyfin-desktop jellyfin-desktop
jellyfin-mpv-shim jellyfin-mpv-shim
# tidal-hifi # tidal-hifi
tidal-dl-ng # TODO: Borked # tidal-dl-ng # TODO: Borked
tiddl
picard picard
handbrake handbrake
teamspeak6-client teamspeak6-client

View File

@ -69,6 +69,7 @@ in [
(mkBm "Rust" "https://doc.rust-lang.org/stable/book/ch03-00-common-programming-concepts.html") (mkBm "Rust" "https://doc.rust-lang.org/stable/book/ch03-00-common-programming-concepts.html")
(mkBm "RustOS" "https://os.phil-opp.com/") (mkBm "RustOS" "https://os.phil-opp.com/")
(mkBm "Interpreters" "https://craftinginterpreters.com/contents.html") (mkBm "Interpreters" "https://craftinginterpreters.com/contents.html")
(mkBm "Godbolt" "https://godbolt.org")
]; ];
} }
{ {

View File

@ -50,6 +50,7 @@ in {
typescript typescript
vscode-langservers-extracted # includes nodejs vscode-langservers-extracted # includes nodejs
autotools-language-server autotools-language-server
just-lsp
# Linters # Linters
checkstyle # java checkstyle # java
@ -74,6 +75,8 @@ in {
rustfmt rustfmt
stylua stylua
typstyle typstyle
mbake
just-formatter
]) ])
[ [
@ -513,8 +516,10 @@ in {
html = ["prettierd" "prettier"]; html = ["prettierd" "prettier"];
java = ["google-java-format"]; java = ["google-java-format"];
javascript = ["prettierd" "prettier"]; javascript = ["prettierd" "prettier"];
just = ["just"];
latex = ["tex-fmt"]; latex = ["tex-fmt"];
lua = ["stylua"]; lua = ["stylua"];
make = ["bake"];
markdown = ["prettierd" "prettier"]; markdown = ["prettierd" "prettier"];
nix = ["alejandra"]; nix = ["alejandra"];
python = ["black"]; python = ["black"];
@ -878,6 +883,7 @@ in {
{name = "cmake";} {name = "cmake";}
{name = "cssls";} {name = "cssls";}
{name = "html";} # vscode-langservers-extracted {name = "html";} # vscode-langservers-extracted
{name = "just-lsp";} # TODO: Doesn't autostart?
{name = "lua_ls";} {name = "lua_ls";}
{ {
name = "ltex"; name = "ltex";
@ -1987,6 +1993,39 @@ in {
''; '';
}; };
visual-whitespace = rec {
name = "visual-whitespace";
pkg = pkgs.vimPlugins.visual-whitespace-nvim;
event = ["ModeChanged *:[vV\22]"];
config = mkDefaultConfig name;
opts = {
enabled = true;
highlight = {
link = "Visual";
default = true;
};
match_types = {
space = true;
tab = true;
nbsp = true;
lead = false;
trail = false;
};
list_chars = {
space = "·";
tab = "";
nbsp = "";
lead = "";
trail = "";
};
fileformat_chars = {
unix = "";
mac = "";
dos = "";
};
};
};
# wakatime = { # wakatime = {
# name = "wakatime"; # name = "wakatime";
# pkg = pkgs.vimPlugins.vim-wakatime; # pkg = pkgs.vimPlugins.vim-wakatime;
@ -2168,6 +2207,7 @@ in {
typst-preview # Typst support typst-preview # Typst support
ufo # Code folding ufo # Code folding
vimtex # LaTeX support vimtex # LaTeX support
visual-whitespace
# wakatime # Time tracking # wakatime # Time tracking
web-devicons # Icons for many plugins web-devicons # Icons for many plugins
which-key # Live keybinding help which-key # Live keybinding help

View File

@ -28,6 +28,7 @@
../services/gitea.nix ../services/gitea.nix
../services/immich.nix ../services/immich.nix
../services/jellyfin.nix ../services/jellyfin.nix
../services/kiwix.nix
../services/kopia.nix ../services/kopia.nix
../services/nextcloud.nix ../services/nextcloud.nix
../services/nginx-proxy-manager.nix ../services/nginx-proxy-manager.nix

View File

@ -6,7 +6,7 @@
}: let }: let
vectorchordVersion = "0.4.2"; vectorchordVersion = "0.4.2";
pgvectorsVersion = "0.2.0"; pgvectorsVersion = "0.2.0";
immichVersion = "2.3.1"; immichVersion = "2.5.2";
in { in {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
immich-database = { immich-database = {

40
system/services/kiwix.nix Normal file
View File

@ -0,0 +1,40 @@
{
config,
lib,
pkgs,
...
}: let
kiwixVersion = "3.8.1";
in {
virtualisation.oci-containers.containers = {
kiwix = {
image = "ghcr.io/kiwix/kiwix-serve:${kiwixVersion}";
autoStart = true;
dependsOn = [];
ports = [
# "8080:80"
];
volumes = [
# TODO: Add network location for .zim files
"kiwix_data:/data"
];
environment = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Berlin";
};
cmd = ["*.zim"];
extraOptions = [
# "--privileged"
# "--device=nvidia.com/gpu=all"
"--net=behind-nginx"
];
};
};
}

View File

@ -126,6 +126,7 @@ in {
# (mkUDir ".nv" m755) # Unity # (mkUDir ".nv" m755) # Unity
(mkUDir ".ollama" m755) (mkUDir ".ollama" m755)
# (mkUDir ".plastic4" m755) # Unity # (mkUDir ".plastic4" m755) # Unity
(mkUDir ".tiddl" m755)
(mkUDir ".var/app" m755) (mkUDir ".var/app" m755)
(mkUDir ".vim/undo" m755) (mkUDir ".vim/undo" m755)
(mkUDir ".zotero" m755) (mkUDir ".zotero" m755)