lkjdsalkjdsalkj

This commit is contained in:
Peder Bergebakken Sundt 2025-04-09 13:14:23 +02:00
parent 7acf91d4b4
commit 2885b83f70
10 changed files with 49 additions and 24 deletions

26
.envrc

@ -19,7 +19,6 @@ elif command -v find >/dev/null; then
fi
if [[ ! -s .direnv/pull-date || "$now" != "$(cat .direnv/pull-date)" ]]; then
tmp=$(mktemp -p .direnv/tmp -d)
trap 'rm -rf "$tmp" >&/dev/null' ERR EXIT RETURN
if ! git diff --exit-code --quiet HEAD -- flake.lock >&/dev/null; then
cp flake.lock "$tmp"/dirty-flake.lock
git reset -- flake.lock
@ -28,18 +27,31 @@ if [[ ! -s .direnv/pull-date || "$now" != "$(cat .direnv/pull-date)" ]]; then
fi
git pull --rebase --autostash
if grep -q "^=======" flake.lock; then
# TODO: can this happen anymore?
# Can this happen anymore? Yes, if i forgot to push
git reset -- flake.lock
rm flake.lock # restore?
rm flake.lock # git restore?
git checkout -- flake.lock
elif [[ -s "$tmp"/clean-flake.lock ]] && ! diff -q "$tmp"/clean-flake.lock flake.lock >&/dev/null; then
cp "$tmp"/flake-dirty.lock flake.lock
fi
direnv allow # :3
# nix flake update
nix eval --file flake.nix --apply 'x: builtins.attrNames x.inputs' --json \
| jq .[] -r \
| grep -v '^nixpkgs-expensive$' \
| nix flake update # --output-lock-file "$tmp"/new-flake.lock
declare -a update_args=()
readarray -td $'\n' update_args < <(
nix eval --file flake.nix --apply 'x: builtins.attrNames x.inputs' --json \
| jq .[] -r \
| grep -v '^nixpkgs-expensive$'
)
# update_args+=(--output-lock-file "$tmp"/new-flake.lock)
if command -v pueue >/dev/null && pueue status >&/dev/null; then
nix flake update "${update_args[@]}"
else
echo >&2 "+ pueue add nix flake update ..."
pueue add --escape --immediate nix flake update "${update_args[@]}"
fi
unset update_args
printf "%s\n" "$now" > .direnv/pull-date
fi

@ -54,7 +54,7 @@
smartmontools
testdisk
usbutils
] ++ lib.optionals (builtins.elem config.nixpkgs.system [ "x86_64-linux" "aarch64_linux"]) [
] ++ lib.optionals (builtins.elem pkgs.stdenv.hostPlatform [ "x86_64-linux" "aarch64_linux"]) [
cage
weston
];
@ -119,7 +119,7 @@
security.sudo.execWheelOnly = true;
services.thermald.enable = lib.all (x: x) [
(config.nixpkgs.system == "x86_64-linux")
(pkgs.stdenv.hostPlatform.system == "x86_64-linux")
(!config.boot.isContainer or false)
];

@ -42,7 +42,7 @@ lib.mkMerge [
programs.nix-required-mounts.enable = true;
programs.nix-required-mounts.presets.nvidia-gpu.enable = true;
# adding "cuda", "opengl" and "nvidia-gpu" ^ overrides the implicit defaults
nix.settings.system-features = lib.mkIf (config.nixpkgs.system == "x86_64-linux") ["kvm" "nixos-test"];
nix.settings.system-features = lib.mkIf (pkgs.stdenv.hostPlatform.system == "x86_64-linux") ["kvm" "nixos-test"];
})
{

13
lib.nix

@ -17,17 +17,18 @@ let
nixosSystem:
let
cfg = nixosSystem.config;
inherit (nixosSystem.pkgs) lib;
inherit (nixosSystem) pkgs;
inherit (pkgs) lib;
in
{
# inherit cfg.nixpkgs.system; # TODO: cross systems
system =
if cfg.nixpkgs.hostPlatform.system == cfg.nixpkgs.buildPlatform.system then
cfg.nixpkgs.system
if pkgs.stdenv.hostPlatform.system == pkgs.stdenv.buildPlatform.system then
pkgs.stdenv.hostPlatform.system
else
{
hostPlatform = cfg.nixpkgs.hostPlatform.system;
buildPlatform = cfg.nixpkgs.buildPlatform.system;
# inherit (pkgs.stdenv) hostPlatform buildPlatform;
hostPlatform = pkgs.stdenv.hostPlatform.system;
buildPlatform = pkgs.stdenv.buildPlatform.system;
};
inherit (cfg.boot.binfmt) emulatedSystems;
inherit (cfg.networking) hostName fqdn search;

@ -10,10 +10,11 @@ in
options.pbsds.nginx.allSubdomains = lib.mkOption {
visible = false; internal = true; readOnly = true;
default = lib.pipe config.services.nginx.virtualHosts [
#(lib.mapAttrsToList (domain: vhost: [ domain ] ++ vhost.serverAliases))
(lib.mapAttrsToList (domain: vhost: [ domain ]))
lib.flatten
(builtins.filter (domain: domain != "" && domain != "_"))
# #(lib.mapAttrsToList (domain: vhost: [ domain ] ++ vhost.serverAliases))
# (lib.mapAttrsToList (domain: vhost: [ domain ]))
# lib.flatten
lib.attrNames
(lib.filter (domain: domain != "" && domain != "_"))
(lib.sort (x: y: x<y))
];
};
@ -78,6 +79,7 @@ in
# nginx return 444 for all nonexistent virtualhosts
services.nginx.virtualHosts."_" = {
default = true;
addSSL = true;
sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem";
sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem";

@ -3,7 +3,7 @@
services.docs-to-host.docs = [
{
dirname = "home-manager-manual";
path = "${inputs.home-manager.packages.${config.nixpkgs.system}.docs-html}/share/doc/home-manager";
path = "${inputs.home-manager.packages.${pkgs.stdenv.hostPlatform.system}.docs-html}/share/doc/home-manager";
basename= "index.xhtml";
desc = "Home-Manager - a user environment configurator";
}

@ -1,7 +1,7 @@
{ config, pkgs, lib, inputs, system, ... }:
let
# https://stackoverflow.com/a/60232211
system = config.nixpkgs.system;
system = pkgs.stdenv.hostPlatform.system;
mk-nixpkgs-manual = input:
input.legacyPackages.${system}.nixpkgs-manual or

@ -30,7 +30,9 @@ zeditor-remote() {
# ask tailscale
if command -v tailscale >/dev/null; then
tailscale status --json | jq .Peer[].HostName -r
# tailscale status --json | jq .Peer[].HostName -r
# tailscale status --json | jq '.Peer[].DNSName | rtrimstr(".")' -r
tailscale status --json | jq '.MagicDNSSuffix as $suffix | .Peer[].DNSName | rtrimstr(".") | rtrimstr("." + $suffix)' -r
fi
# search .ssh/known_hosts, strip DNS search domains to deduplicate

@ -23,6 +23,13 @@ in
# Warn if closing shell with running jobs.
"checkjobs"
];
# programs.bash.historySize = 10000; # in ram
# programs.bash.historyFileSize = 100000; # on file
programs.bash.historyControl = [
"erasedups"
"ignoreboth"
];
programs.bash.historyIgnore = [ "ls" "file" "cat" "type" "exit" ];
programs.bash.initExtra = ''
# tldr
if command -v tldr >/dev/null; then
@ -177,7 +184,7 @@ in
#fq # jq for binaries
xh # "friendly fast curl"
htmlq # html css queries
xan # a jq for csv, zsv
(pkgs.xan or null) # a jq for csv, zsv
# xee # xml xpath queries
just # justfile
gum

@ -54,6 +54,7 @@
"sopp.pbsds.net".host = "sopp.tail9aac63.ts.net";
"noximilien.pbsds.net".host = "noximilien.tail9aac63.ts.net";
"rocm.pbsds.net".proxyJump = "login.pvv.ntnu.no";
"furiphoneflx1.pbsds.net".user = "furios";
# nixos org
#"aarch64.nixos.community" = {};