This commit is contained in:
2025-11-23 14:49:41 +01:00
parent 32d47436fb
commit 2295431eeb
17 changed files with 110 additions and 45 deletions

View File

@@ -1,13 +1,13 @@
{ config, pkgs, lib, ... }:
let
extraPackages = with pkgs; [
mesa.drivers
mesa #.drivers
intel-media-driver
# not added due to collision
# https://github.com/NixOS/nixos-hardware/issues/1170
(if (lib.versionOlder lib.version "23.11")
then vaapiIntel
else intel-vaapi-driver)
# (if (lib.versionOlder lib.version "23.11")
# then vaapiIntel
# else intel-vaapi-driver)
libvdpau-va-gl
intel-ocl
intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
@@ -29,9 +29,10 @@ lib.mkMerge [
nixpkgs.config.vdpauSupport = true; # intel
nixpkgs.config.libmfxSupport = true; # intel
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; };
# TODO: test if this does anything
nixpkgs.config.packageOverrides = prev: {
vaapiIntel = prev.vaapiIntel.override { enableHybridCodec = true; };
intel-vaapi-driver = prev.intel-vaapi-driver.override { enableHybridCodec = true; };
};
}

15
hardware/gpu/zluda.nix Normal file
View File

@@ -0,0 +1,15 @@
{ pkgs, lib, ... }:
/*
ZLUDA runs CUDA binaries on non-CUDA runtimes like ROCM
Interestingly, ROCM can also runs on decent CPUs
*/
{
environment.systemPackages = [
pkgs.zluda # only lib
pkgs.pbsds.zluda-run # prefix to LD_LIBRARY_PATH and NIX_LD_LIBRARY_PATH
];
}

View File

@@ -26,6 +26,7 @@
inputs.nixos-hardware.nixosModules.common-cpu-intel-cpu-only
inputs.nixos-hardware.nixosModules.common-gpu-intel-sandy-bridge
../../../hardware/gpu/rocm.nix
../../../hardware/gpu/zluda.nix
../../../profiles/hidpi.nix
../../../profiles/nix-ld.nix

View File

@@ -169,6 +169,10 @@ home-switch *_:
"$new_home"/activate
# QoL
alias hm-build := home-build
alias hm-build-diff := home-build-diff
alias hm-build-closure-size := home-build-closure-size
alias hm-switch := home-switch
alias build-home := home-build
alias build-diff-home := home-build-diff
alias build-closure-size-home := home-build-closure-size

View File

@@ -1,4 +1,4 @@
final: prev:
final: prev: # TODO: not prev: final: ?
let
inherit (final) lib;
@@ -20,8 +20,12 @@ in
nom-home-manager = mkNomWrapper final.home-manager;
nom-system-manager = mkNomWrapper final.system-manager;
# TODO: make these automatic, maybe use by-name?
v4l2-play = final.callPackage ./../pkgs/v4l2-play { };
device-mon = final.callPackage ./../pkgs/device-mon { };
zluda-run = final.callPackage ./../pkgs/zluda-run.nix { };
# TODO: move to separate flake, maintain with CI
#pdoc-docs = (final.callPackage ./../pkgs/pdocs.nix {}).pdocs;
#pdoc3-docs = (final.callPackage ./../pkgs/pdocs.nix {}).pdocs3;
});

15
pkgs/zluda-run.nix Normal file
View File

@@ -0,0 +1,15 @@
{
lib,
writeShellScriptBin,
zluda,
}:
writeShellScriptBin "zluda-run" ''
export LD_LIBRARY_PATH="${lib.getLib zluda}/lib''${LD_LIBRARY_PATH:+":''$LD_LIBRARY_PATH"}"
if [[ -v NIX_LD_LIBRARY_PATH ]]; then
export NIX_LD_LIBRARY_PATH="${lib.getLib zluda}/lib''${NIX_LD_LIBRARY_PATH:+":''$NIX_LD_LIBRARY_PATH"}"
fi
# exec -a "$0" "$@"
exec "$@"
''

View File

@@ -0,0 +1,5 @@
# TODO:
# * [ ] maybe use kuklef.se?
# * [ ] read-only mirror of pvv wiki @ mirror.pbsds.net/pvv-wiki
# * [ ] read-only mirror of pvv gitea @ mirror.pbsds.net/pvv-git
# * [ ] link to these in PVV "502 Bad Gateway" responses?

View File

@@ -0,0 +1,9 @@
/*
TODO:
https://github.com/NuschtOS/search
https://github.com/NuschtOS/search.nuschtos.de
https://github.com/NuschtOS/search.nuschtos.de/blob/046def183c27b25cb6b3f4eec1e3e2149f358085/flake.nix#L155
*/

View File

@@ -0,0 +1,9 @@
/*
TODO:
* searxng or https://github.com/neon-mmd/websurfx
* inspiration for list of engines:
* https://github.com/DaRacci/nix-config/blob/bc0089bac42a7d6b47abd2fe0918e228805e8352/hosts/server/nixcloud/search.nix#L127
* nuchtos?
*/

View File

@@ -19,7 +19,7 @@
# Only datasets with the com.sun:auto-snapshot property set to true will be snapshotted.
# zfs set com.sun:auto-snapshot=true DATASET
services.zfs.autoSnapshot.enable = true; # simply runs zfstools
services.zfs.autoSnapshot.enable = !config.virtualisation.isVmVariant; # simply runs zfstools
# default args, can be overridden per-dataset
# zfs set com.sun:auto-snapshot:weekly=false DATASET
services.zfs.autoSnapshot.frequent = 4; # 15 min
@@ -47,7 +47,7 @@
# # sudo zfs set sharenfs="-maproot=0:0 -network=100.64.0.0/10" Reidun/shared
# # sudo zfs set sharenfs="-maproot=0:0 -network=100.64.0.0/10" Freon
# # sudo zfs set sharenfs="rw=100.64.0.0/10" Meconium
server.enable = lib.mkDefault true;
server.enable = lib.mkDefault (!config.virtualisation.isVmVariant);
# fixed rpc.statd port; for firewall
server.lockdPort = 4001;

View File

@@ -109,7 +109,6 @@ lib.mkIf (!config.virtualisation.isVmVariant)
"/oses/smartos"
"/oses/vmware"
"/oses/windows"
"/password"
#"/software" # not mounted server side
"/software/esx"
"/software/jvm"

View File

@@ -62,7 +62,7 @@
# config.services.headscale.group
];
initialHashedPassword = "$6$yNgxTHcP1UYkNwuZ$1sBehnKgPjVnDe0tSV8kyfynWpfjDzuohZX6SoTrMnYFa3/aiMOtI6JppYevl.M6qYhBIT0XBvL6TqSSFWn8B/";
initialHashedPassword = "$6$yNgxTHcP1UYkNwuZ$1sBehnKgPjVnDe0tSV8kyfynWpfjDzuohZX6SoTrMnYFa3/aiMOtI6JppYevl.M6qYhBIT0XBvL6TqSSFWn8B/"; # mkpasswd
# TODO: fetch from github?
openssh.authorizedKeys.keys = [

View File

@@ -44,4 +44,5 @@ in
};
# TODO: generate bat syntax cache: 'bat cache --build'
# TODO: JQ_COLORS: https://jqlang.org/manual/#colors
}

View File

@@ -13,13 +13,13 @@
# bash integration, optional
# https://ghostty.org/docs/features/shell-integration#manual-shell-integration-setup
# # Make order 101 to be placed exactly after bash completions, as Ghostty
# # documentation suggests sourcing the script as soon as possible
# programs.bash.initExtra = lib.mkOrder 101 ''
# if [[ -n "''${GHOSTTY_RESOURCES_DIR}" ]]; then
# builtin source "''${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash"
# fi
# '';
# Make order 101 to be placed exactly after bash completions, as Ghostty
# documentation suggests sourcing the script as soon as possible
programs.bash.initExtra = lib.mkOrder 101 ''
if [[ -n "''${GHOSTTY_RESOURCES_DIR}" ]]; then
builtin source "''${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash"
fi
'';
# try to make nautilus use this as the default gnome-console/gnome-terminal

View File

@@ -32,9 +32,15 @@
#programs.gh.enable = true; # adds read-only config to .config
#programs.git.gitui.enable = true;
programs.git.enable = true;
#programs.git.userName = "pbsds"
programs.git.userName = "Peder Bergebakken Sundt";
programs.git.userEmail = "pbsds@hotmail.com";
#programs.git.gitui.enable = true;
programs.git.lfs.enable = true;
programs.git.delta.enable = true;
programs.git.delta.options = {
# Delta uses ~/.gitconfig even when not invoked by git
@@ -42,17 +48,12 @@
max-line-length = 0;
features.syntax-theme = lib.mkIf config.programs.bat.enable config.programs.bat.config.theme;
};
#programs.git.lfs.enable = true;
#programs.git.userName = "pbsds"
programs.git.userName = "Peder Bergebakken Sundt";
programs.git.userEmail = "pbsds@hotmail.com";
# # sign commits with ssh key
# programs.git.extraConfig.gpg.format = "ssh";
# programs.git.signing.key = "${config.home.homeDirectory}/.ssh/my-key.pub";
# programs.git.signing.signByDefault = true;
# https://jvns.ca/blog/2024/02/16/popular-git-config-options/
programs.git.extraConfig.rerere.enabled = true;
#programs.git.extraConfig.help.autocorrect = "prompt";
@@ -99,20 +100,11 @@
#gcp = "git cherry-pick";
gca = "git commit --amend";
gcara = "git commit --amend --reset-author";
gc = "git branch | cut -c2- | gum choose | xargs -n'\n' --no-run-if-empty git checkout";
gc = "git branch | cut -c2- | gum choose | xargs -d'\n' --no-run-if-empty git checkout";
gbrm = "git fetch origin; git branch --merged | cut -c3- | grep -vE '^(main|master)$' | gum choose --no-limit --header 'Which branches to delete:' | xargs -n'\n' --no-run-if-empty git branch -D";
#gb = "git blame";
#gpo = "git push origin";
#gpf = "git push --force-with-lease --force-if-includes";
# TODO: use -c commit.template instead
gcm = ''git commit --message "$(printf '%s\n' ${lib.concatStringsSep " " [
''"$(curl -sL https://whatthecommit.com/index.txt)"''
''""''
''"$(curl -s 'https://printerfacts.cetacean.club/fact')"''
''""''
''"(made with https://whatthecommit.com/index.txt and https://printerfacts.cetacean.club/fact)"''
]})"; git show --name-status; '';
};
}

View File

@@ -18,7 +18,7 @@
programs.bash.initExtra = ''
if [ "$COLORTERM" = "truecolor" ] || [ "$TERM" == "xterm" ]; then
export TERM=xterm-256color
# export TERM=xterm-256color
export MICRO_TRUECOLOR=1
fi
'';

View File

@@ -81,14 +81,17 @@ in
# https://man.archlinux.org/man/extra/fzf/fzf.1.en#PREVIEW_WINDOW
# bat is installed in bat.nix
# this goes into home.sessionVariables.FZF_CTRL_T_OPTS which goes into a 'export ""' statement, i.e. it will eval bash variables
#"--preview 'head {}'"
# "--preview 'bat {}'"
# "--preview 'tail -n$FZF_LINES {} | bat --file-name {} --paging never --style plain'"
# "--preview 'tail -n\\$FZF_PREVIEW_LINES {} | bat --file-name {} --paging never --style plain'"
# "--preview 'bat {} --paging never --style plain' --preview-window follow"
"--preview 'if [[ -f {} ]]; then tail -n$FZF_LINES {} | bat --paging=never --style=plain --color=always --file-name {} ; elif [[ -e {}/.git ]]; then git -C {} status else file {} ; fi' --preview-window follow"
"--preview 'if [[ -f {} ]]; then tail -n\\$FZF_PREVIEW_LINES {} | bat --paging=never --style=plain --color=always --file-name {} ; elif [[ -e {}/.git ]]; then git -C {} status else file {} ; fi' --preview-window follow"
# TODO: add viu to ^
# https://github.com/junegunn/fzf/discussions/3363#discussioncomment-6419463
"--bind 'ctrl-a:reload:eval $FZF_DEFAULT_COMMAND --no-ignore'"
"--bind 'ctrl-a:reload:eval \\$FZF_DEFAULT_COMMAND --no-ignore'"
];
# ctrl-r
@@ -147,6 +150,8 @@ in
home.shellAliases.dush = "du -shc * | sort -h";
home.shellAliases.dushd = "du -shc * .[!.]?* | sort -h";
home.shellAliases.icat = "viu";
home.shellAliases.open = "xdg-open";
home.shellAliases.rwhich = mkArgsAlias ''which "$@" | xargs -d"\n" realpath --'';
home.shellAliases.rwhichcd = mkArgsAlias ''
@@ -214,7 +219,8 @@ in
entr # live reload
retry # retry command with optional backoff
glances
# bottom
btop # better htop
# bottom # better htop
faketty
# axel aria aria2 # brrr
xe # better xargs
@@ -222,14 +228,17 @@ in
fd # better find
# silver-searcher # 'ag'
ripgrep # 'rg'
# comby # ast-based rewrite
fx # js tui viewer
gron # grep-able json
jq # json queries
yq # includes xq (xml) and tomlq
# comby # ast-based source code rewrite
gron fastgron # grep-able json
jq # json query
# xq gojq # faster jq alternatives
yq # jq wrapper with more formats, includes yq (yaml), xq (xml) and tomlq
fx # jq tui viewer
ijq # interactive jq
#fq # jq for binaries
xh # "friendly fast curl"
htmlq # html css queries
# mdq # markdown queries
(pkgs.xan or null) # a jq for csv, zsv
# xee # xml xpath queries
pkgs.unstable.just # justfile
@@ -244,6 +253,7 @@ in
#xplr # tui file explorer
aha # ansi colors to html
(pkgs.colorized-logs or unstable.colorized-logs) # ansi2txt, pipetty
viu # kitty icat/chafa alternative
]);
home.file.".config/ncdu/config".text = ''