This commit is contained in:
Peder Bergebakken Sundt 2024-10-19 04:05:19 +02:00
parent f2452c241d
commit 4cc421ec43
11 changed files with 67 additions and 10 deletions

View File

@ -33,8 +33,10 @@
hardware.nvidia.modesetting.enable = lib.mkDefault true; # needed for most wayland compositors hardware.nvidia.modesetting.enable = lib.mkDefault true; # needed for most wayland compositors
hardware.nvidia.nvidiaSettings = lib.mkDefault true; hardware.nvidia.nvidiaSettings = lib.mkDefault true;
# https://discourse.nixos.org/t/nvidia-docker-container-runtime-doesnt-detect-my-gpu/51336/2?u=pbsds
virtualisation.docker.enableNvidia = lib.mkDefault true; # deprecated virtualisation.docker.enableNvidia = lib.mkDefault true; # deprecated
virtualisation.podman.enableNvidia = lib.mkDefault true; # deprecated virtualisation.podman.enableNvidia = lib.mkDefault true; # deprecated
# this works, but you have to use `--device nvidia.com/gpu=all` rather than --gpus
hardware.nvidia-container-toolkit.enable = lib.mkDefault true; hardware.nvidia-container-toolkit.enable = lib.mkDefault true;
services.ollama.acceleration = lib.mkDefault "cuda"; services.ollama.acceleration = lib.mkDefault "cuda";

View File

@ -10,9 +10,9 @@
./hardware-configuration.nix ./hardware-configuration.nix
../../profiles/sshd.nix ../../profiles/sshd.nix
#../../profiles/no-suspend.nix #../../profiles/no-suspend.nix
#../../profiles/oci/podman.nix ../../profiles/oci/podman.nix
#../../profiles/oci/docker.nix #../../profiles/oci/docker.nix
#../../profiles/oci/distrobox.nix ../../profiles/oci/distrobox.nix
../../users/pbsds ../../users/pbsds
../../users/pbsds/syncthing.nix ../../users/pbsds/syncthing.nix

View File

@ -1,5 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
# TODO: should max-builds be enforced on thisHost as well?
let let
inherit (builtins) inherit (builtins)
map map

View File

@ -1,4 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
# TODO: use tailscale if enabled
{ {
# TODO: wireguard # TODO: wireguard
#boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ]; #boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ];

View File

@ -1,4 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
# TODO: use tailscale if enabled
{ {
# TODO: wireguard # TODO: wireguard
#boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ]; #boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ];

View File

@ -1,4 +1,7 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
# TODO: use tailscale if enabled
{ {
# TODO: wireguard # TODO: wireguard
#boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ]; #boot.kernelParams = [ "nfs.nfs4_disable_idmapping=0" "nfsd.nfs4_disable_idmapping=0" ];

View File

@ -1,5 +1,19 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
/*
# via https://distrobox.it/compatibility/#containers-distros
use --nvidia for cuda support
distrobox create --name alpine --init --yes --image docker.io/libary/alpine:latest
distrobox create --name arch --init --yes --image docker.io/libary/archlinux:latest
distrobox create --name debian --init --yes --image docker.io/libary/debian:testing
distrobox create --name fedora --init --yes --image quay.io/fedora/fedora:rawhide
distrobox create --name gentoo --init --yes --image docker.io/gentoo/stage3:latest
#distrobox create --name ubuntu --init --yes --image quay.io/toolbx/ubuntu-toolbox:latest
*/
{ {
assertions = [ assertions = [
@ -12,11 +26,14 @@
environment.systemPackages = [ environment.systemPackages = [
pkgs.distrobox pkgs.distrobox
]; ];
# ++ lib.optionals (!config.virtualisation.docker.enable && !config.virtualisation.podman.enable) [
# pkgs.lilipod
#];
# update periodically # update periodically
systemd.user = { systemd.user = {
timers."distrobox-update" = { timers."distrobox-update" = {
enable = true; enable = config.system.autoUpgrade.enable;
wantedBy = ["timers.target"]; wantedBy = ["timers.target"];
timerConfig = { timerConfig = {
OnBootSec = "1h"; OnBootSec = "1h";
@ -26,7 +43,7 @@
}; };
services."distrobox-update" = { services."distrobox-update" = {
enable = true; enable = config.system.autoUpgrade.enable;
script = '' script = ''
${pkgs.distrobox}/bin/distrobox upgrade --all ${pkgs.distrobox}/bin/distrobox upgrade --all
''; '';

View File

@ -142,11 +142,6 @@
manix-fzf = ''manix "" 2>/dev/null | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix''; manix-fzf = ''manix "" 2>/dev/null | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix'';
# TODO: move to /run/user/...
/* nixpkgs-review = ''mkdir -p /dev/shm/nixpkgs-review && ln -sfn /dev/shm/nixpkgs-review $HOME/.cache/nixpkgs-review && nixpkgs-review''; */
/* nixpkgs-review = ''cd ~/repos/nixpkgs/master/; nixpkgs-review --systems "$(gum choose --no-limit --ordered x86_64-linux aarch64-linux aarch64-darwin x86_64-darwin i686-linux riscv64-linux x86_64-freebsd aarch64-freebsd i686-freebsd riscv64-freebsd | xargs)"''; */
mnixpkgs-review = ''nixpkgs-review --systems "$(gum choose --no-limit --ordered {linux,darwin,freebsd}-{x86_64,aarch64,i686,riscv64} | sed -E 's/^([^-]*)-([^-]*)$/\2-\1/' | xargs)"'';
killall = "killall -v"; killall = "killall -v";
bin = "python -c 'import sys; sys.stdout.write(sys.stdin.read().strip())' | curl -is -X POST https://i.kuklef.se/upload -F content=@- -F expiration=10d | grep '^location:' | cut -d' ' -f2-"; bin = "python -c 'import sys; sys.stdout.write(sys.stdin.read().strip())' | curl -is -X POST https://i.kuklef.se/upload -F content=@- -F expiration=10d | grep '^location:' | cut -d' ' -f2-";

View File

@ -38,6 +38,7 @@
emote emote
normcap # doesn't work on wayland normcap # doesn't work on wayland
gcolor3
icon-library icon-library
gitg gitg

View File

@ -41,8 +41,9 @@
".remote.toml" ".remote.toml"
".remoteenv" ".remoteenv"
"result" "result"
"results"
"result-*" "result-*"
"results"
"results-*"
"__pycache__" "__pycache__"
"*.pyc" "*.pyc"
]; ];

View File

@ -48,6 +48,28 @@
fi fi
done done
} }
_choose_nix_systems() {
# x86_64-linux aarch64-linux aarch64-darwin x86_64-darwin i686-linux riscv64-linux x86_64-freebsd aarch64-freebsd i686-freebsd riscv64-freebsd
gum choose --no-limit --ordered --height 15 {linux,darwin,freebsd}-{x86_64,aarch64,i686,riscv64} \
| sed -E 's/^([^-]*)-([^-]*)$/\2-\1/'
}
mnix-build() {
# TODO: somehow store the out-links
_choose_nix_systems | xe -j0 -s 'nix-instantiate --system "$1" . '"$(printf " %q" "$@")" | xargs nix-build --keep-going --no-out-link
}
mnom-build() {
# TODO: somehow store the out-links
_choose_nix_systems | xe -j0 -s 'nix-instantiate --system "$1" . '"$(printf " %q" "$@")" | xargs nom-build --keep-going --no-out-link
}
mnixpkgs-review() {
# TODO: use /run/user/...
# mkdir -p /dev/shm/nixpkgs-review
# ln -sfn /dev/shm/nixpkgs-review $HOME/.cache/nixpkgs-review
nixpkgs-review --systems "$(_choose_nix_systems | xargs)" "$@"
}
''; '';
imports = [ ../modules/jump.nix ]; imports = [ ../modules/jump.nix ];
@ -103,6 +125,14 @@
#home.shellAliases.mv = "mv -i"; #home.shellAliases.mv = "mv -i";
#home.shellAliases.cp = "cp -i"; #home.shellAliases.cp = "cp -i";
home.shellAliases.inom-build = "nom-build --system i686-linux -j0";
home.shellAliases.inix-build = "nix-build --system i686-linux -j0";
home.shellAliases.rnom-build = "nom-build --system riscv64-linux -j0";
home.shellAliases.rnix-build = "nix-build --system riscv64-linux -j0";
home.shellAliases.fnom-build = "nom-build --system x86_64-freebsd -j0";
home.shellAliases.fnix-build = "nix-build --system x86_64-freebsd -j0";
home.shellAliases.anom-build = "nom-build --system aarch64-linux -j0";
home.shellAliases.anix-build = "nix-build --system aarch64-linux -j0";
home.shellAliases.dnom-build = "nom-build --system x86_64-darwin -j0"; home.shellAliases.dnom-build = "nom-build --system x86_64-darwin -j0";
home.shellAliases.dnix-build = "nix-build --system x86_64-darwin -j0"; home.shellAliases.dnix-build = "nix-build --system x86_64-darwin -j0";
home.shellAliases.danom-build = "nom-build --system aarch64-darwin -j0"; home.shellAliases.danom-build = "nom-build --system aarch64-darwin -j0";