This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
nix-touch: Update Nix store path registration times for LRU garbage collection | |
This tool updates the registrationTime field in the Nix database for a store path | |
and its dependencies, effectively marking them as "recently used" for GC purposes. | |
""" | |
import argparse | |
import sqlite3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
annotations: | |
cknix-expr: hello | |
kubectl.kubernetes.io/last-applied-configuration: | | |
{"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{"cknix-expr":"hello","kubenix/k8s-version":"1.33","kubenix/project-name":"kubenix"},"name":"testpod","namespace":"default"},"spec":{"containers":[{"command":["/nix/var/result/bin/sleep","infinity"],"env":[{"name":"PATH","value":"/nix/var/result/bin"}],"image":"dramforever/scratch:latest","name":"this","volumeMounts":[{"mountPath":"/etc/nix","name":"nix-config","readOnly":true},{"mountPath":"/nix","name":"cknix-volume","readOnly":false}]}],"hostNetwork":true,"volumes":[{"configMap":{"name":"nix-config"},"name":"nix-config"},{"csi":{"driver":"cknix.csi.store","volumeAttributes":{"expr":"let\n pkgs = (import (builtins.fetchTree {\n type = \"github\";\n repo = \"nixpkgs\";\n owner = \"NixOS\";\n ref = \"nixos-unstable\";\n }) {});\nin\n pkgs.buildEnv {\n name = \"testEnv\";\n paths = [\n pkgs.uutil |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[38;5;245m[39m[38;5;4m[1m /[0m | |
[38;5;245m├── [39m[38;5;4m[1m bin[0m | |
[38;5;245m├── [39m[38;5;4m[1m boot[0m | |
[38;5;245m├── [39m[38;5;4m[1m dev[0m | |
[38;5;245m│ ├── [39m[38;5;6m[1m core[0m ⇒ [38;5;6m[1m/proc/kcore[0m | |
[38;5;245m│ ├── [39m[38;5;6m[1m fd[0m ⇒ [38;5;6m[1m/proc/self/fd[0m | |
[38;5;245m│ ├── [39m[38;5;3m[1m full[0m | |
[38;5;245m│ ├── [39m[48;5;2m[38;5;0m mqueue[49m[39m | |
[38;5;245m│ ├── [39m[38;5;3m[1m null[0m | |
[38;5;245m│ ├── [39m[38;5;6m[1m ptmx[0m ⇒ [38;5;6m[1mpts/ptmx[0m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apiextensions.k8s.io/v1 | |
kind: CustomResourceDefinition | |
metadata: | |
annotations: | |
kubenix/k8s-version: '1.33' | |
kubenix/project-name: kubenix | |
name: expressions.cknix.cool | |
spec: | |
conversion: | |
strategy: None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apiextensions.k8s.io/v1 | |
kind: CustomResourceDefinition | |
metadata: | |
annotations: | |
kubenix/k8s-version: '1.33' | |
kubenix/project-name: kubenix | |
name: expressions.cknix.cool | |
spec: | |
conversion: | |
strategy: None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apiextensions.k8s.io/v1 | |
kind: CustomResourceDefinition | |
metadata: | |
annotations: | |
kubenix/k8s-version: '1.33' | |
kubenix/project-name: kubenix | |
name: expressions.cknix.cool | |
spec: | |
conversion: | |
strategy: None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
pkgs = import <nixpkgs> { }; | |
lib = pkgs.lib; | |
ipScript = pkgs.writeScript "sipscript" '' | |
#! ${lib.getExe pkgs.fish} | |
echo \'\' | |
${lib.getExe pkgs.ipcalc} $argv | |
echo \'\' | |
''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apply function to all strings in an attrset recursively through lists as well. | |
mapStringsDeep = | |
function: value: | |
if builtins.isString value then | |
function value | |
else if builtins.isAttrs value then | |
lib.mapAttrs (name: mapStringsDeep function) value | |
else if builtins.isList value then | |
map (mapStringsDeep function) value | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[01:22:40]❌1 ❯ nvd diff /nix/var/nix/profiles/system-838-link/ /nix/var/nix/profiles/system-839-link/ | |
<<< /nix/var/nix/profiles/system-838-link | |
>>> /nix/var/nix/profiles/system-839-link | |
Version changes: | |
[U.] #001 bc 1.08.1 -> 1.08.2 | |
[U.] #002 breeze-icons 6.14.0 -> 6.15.0 | |
[U*] #003 curl 8.13.0 x2, 8.13.0-bin, 8.13.0-debug, 8.13.0-man -> 8.14.1 x2, 8.14.1-bin, 8.14.1-debug, 8.14.1-man | |
[U.] #004 elfutils 0.192 x2, 0.192-bin, 0.192-dev -> 0.193 x2, 0.193-bin, 0.193-dev | |
[U.] #005 ell 0.76 x2 -> 0.77 x2 | |
[D*] #006 file 5.46 x3, 5.46-dev, 5.46-man -> 5.45 x3, 5.45-dev, 5.45-man |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: nix will also try to replace @@escapeCode@@ and @@text@@ with "@@" and whatever is in the full text. Won't matter in practice | |
let | |
replaceStrings' = | |
{ escapeCode, text, ... }@replacements: | |
let | |
names = builtins.map (name: "${escapeCode}${name}${escapeCode}") (builtins.attrNames replacements); | |
values = builtins.attrValues replacements; | |
replacedText = builtins.replaceStrings names values text; | |
verificationMatches = builtins.match "^.*(@@.*@@).*$" replacedText; | |
verificationError = "Found unreplaced text ${builtins.concatStringsSep " " verificationMatches}"; |
NewerOlder