Reorder sections
This commit is contained in:
parent
6aac34922d
commit
c9cd092a8f
3 changed files with 2172 additions and 1358 deletions
3293
cheatsheet.pdf
3293
cheatsheet.pdf
File diff suppressed because it is too large
Load diff
|
|
@ -12,47 +12,49 @@
|
|||
margin: 1cm,
|
||||
)
|
||||
|
||||
#title()
|
||||
#grid(
|
||||
columns: (80pt, auto),
|
||||
[#block(image("nix-snowflake-colours.svg", width: 64pt))],
|
||||
[#title()
|
||||
|
||||
#box(image("sipb.svg", height: 12pt)) Made by #context document.author.first()
|
||||
Made by #context document.author.first() #box(image("sipb.svg", height: 15pt))
|
||||
|
||||
#context document.description
|
||||
#context document.description]
|
||||
)
|
||||
|
||||
#table(
|
||||
stroke: none,
|
||||
columns: (40%, auto),
|
||||
columns: (35%, auto),
|
||||
table.header(table.cell(fill: silver, align: center, [Task]), table.cell(fill: silver, align: center, [Command])),
|
||||
table.header(level: 2, repeat: false, table.cell(fill: aqua, [*Running software*]), table.cell(fill: aqua, [])),
|
||||
[Search for software], [```bash nix search nixpkgs hello```],
|
||||
[Run program], [```bash nix run nixpkgs#hello``` #footnote[Pass `--` before any arguments to the program]],
|
||||
[Run program from other nixpkgs branch], ```bash nix run nixpkgs/nixos-25.11#hello```,
|
||||
[Run program from another flake], ```bash nix run nix run git+https://git.unnamed.website/sdc/#sd-qt```,
|
||||
[Run program from another flake], ```bash nix run nix run github:user/nixpkgs/branch#hello```,
|
||||
[Find nixpkgs revision for a specific version of a program], [See https://lazamar.co.uk/nix-versions/],
|
||||
[Get shell with program], ```bash nix shell nixpkgs#hello```,
|
||||
[Run AppImage], ```bash appimage-run hello.AppImage```,
|
||||
table.header(level: 2, repeat: false, table.cell(fill: lime, [*Store operations*]), table.cell(fill: lime, [])),
|
||||
table.header(level: 2, repeat: false, table.cell(fill: lime, [*Building the system*]), table.cell(fill: lime, [])),
|
||||
[Update flake inputs], ```bash nix flake update```,
|
||||
[Build and deploy to this machine], ```bash nixos-rebuild switch --sudo```,
|
||||
[Build on remote machine and deploy to current machine], [```bash sudo nixos-rebuild switch --build-host user@remote --use-substitutes``` #footnote[This needs root on the current machine to add untrusted paths to the Nix store]],
|
||||
[Build on current machine and deploy to remote machine], [```bash nixos-rebuild switch --flake .#remote-machine-hostname --target-host root@remote``` #footnote[This needs root on the remote machine for the same reason]],
|
||||
[Build and run VM from config], [```bash nixos-rebuild build-vm && result/bin/run-$hostname-vm -m 4G -smp 4 -device virtio-vga-gl -display sdl,gl=on``` #footnote[You may need to change all occurrences of the QEMU version in the run script if the config uses a different nixpkgs revision than the host]],
|
||||
[Build ISO from config], [Add `"/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix"` as a module, then run ```bash nix build .#nixosConfigurations.$hostname.config.system.build.isoImage```],
|
||||
table.header(level: 2, repeat: false, table.cell(fill: yellow, [*System generations*]), table.cell(fill: yellow, [])),
|
||||
[List system generations], ```bash nixos-rebuild list-generations```,
|
||||
[Get changes between system generations], ```bash nix profile diff-closures --profile /nix/var/nix/profiles/system```,
|
||||
[Roll back one generation], ```bash nixos-rebuild switch --sudo --rollback```,
|
||||
[Switch to generation], ```bash sudo nix-env --switch-generation 12345 -p /nix/var/nix/profiles/system && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch```,
|
||||
table.header(level: 2, repeat: false, table.cell(fill: orange, [*Store operations*]), table.cell(fill: orange, [])),
|
||||
[Get size of system], ```bash nix path-info -Sh /nix/var/nix/profiles/system```,
|
||||
[Get size of Nix store], ```bash sqlite3 /nix/var/nix/db/db.sqlite 'SELECT SUM(narSize) FROM ValidPaths'```,
|
||||
[Get largest packages], ```bash sqlite3 /nix/var/nix/db/db.sqlite 'SELECT * FROM ValidPaths ORDER BY narSize DESC LIMIT 20'```,
|
||||
[Clean Nix store], ```bash sudo nix-collect-garbage && nix store optimise```,
|
||||
[Check what depends on path], ```bash nix-store --query --referrers /nix/store/blah```,
|
||||
table.header(level: 2, repeat: false, table.cell(fill: yellow, [*System generations*]), table.cell(fill: yellow, [])),
|
||||
[List system generations], ```bash nixos-rebuild list-generations```,
|
||||
[Switch to generation], ```bash sudo nix-env --switch-generation 12345 -p /nix/var/nix/profiles/system && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch```,
|
||||
[Get changes between system generations], ```bash nix profile diff-closures --profile /nix/var/nix/profiles/system```,
|
||||
table.header(level: 2, repeat: false, table.cell(fill: orange, [*Building*]), table.cell(fill: orange, [])),
|
||||
[Update flake inputs], ```bash nix flake update```,
|
||||
[Build and deploy to this machine], ```bash nixos-rebuild switch --sudo```,
|
||||
[Build on remote machine and deploy to current machine], [```bash sudo nixos-rebuild switch --build-host user@remote --use-substitutes``` #footnote[This needs root on the current machine to add untrusted paths to the Nix store]],
|
||||
[Build on current machine and deploy to remote machine], ```bash nixos-rebuild switch --flake .#remote-machine-hostname --target-host root@remote```,
|
||||
[Build VM from config], [```bash nixos-rebuild build-vm && result/bin/run-* -m 4G -smp 4 -device virtio-vga-gl -display sdl,gl=on``` #footnote[You may need to change all occurrences of the QEMU version in the run script if the config uses a different nixpkgs]],
|
||||
[Build ISO from config], [Add `"/installer/cd-dvd/installation-cd-minimal-new-kernel-no-zfs.nix"` as a module, then run ```bash nix build .#nixosConfigurations.$hostname.config.system.build.isoImage```],
|
||||
[Delete generations older than 7 days], ```bash sudo nix-collect-garbage --delete-older-than 7d```,
|
||||
[Check what depends on path], ```bash nix-store --query --referrers /nix/store/aaaaaa```,
|
||||
table.header(level: 2, repeat: false, table.cell(fill: fuchsia, [*Writing Nix code*]), table.cell(fill: fuchsia, [])),
|
||||
[Run Nix file], ```bash nix eval -f main.nix```,
|
||||
[Inspect system config in REPL], ```bash nix repl .#nixosConfigurations.$hostname```,
|
||||
[Format flake], [Add `formatter.${system} = pkgs.nixfmt-tree;` to your flake outputs, then run ```bash nix fmt```],
|
||||
)
|
||||
// | Install specific version of package | https://lazamar.co.uk/nix-versions/ |
|
||||
|
||||
// | Fix uv `libstdc++.so.6` error | `LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH uv run` |
|
||||
|
||||
|
||||
// | Run program | `nix run nixpkgs#hello` (needs `--` if passing args) |
|
||||
|
|
|
|||
187
nix-snowflake-colours.svg
Normal file
187
nix-snowflake-colours.svg
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="535"
|
||||
height="535"
|
||||
viewBox="0 0 501.56251 501.56249"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
|
||||
sodipodi:docname="nix-snowflake-colours.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5562">
|
||||
<stop
|
||||
style="stop-color:#699ad7;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop5564" />
|
||||
<stop
|
||||
id="stop5566"
|
||||
offset="0.24345198"
|
||||
style="stop-color:#7eb1dd;stop-opacity:1" />
|
||||
<stop
|
||||
style="stop-color:#7ebae4;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop5568" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient5053">
|
||||
<stop
|
||||
style="stop-color:#415e9a;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop5055" />
|
||||
<stop
|
||||
id="stop5057"
|
||||
offset="0.23168644"
|
||||
style="stop-color:#4a6baf;stop-opacity:1" />
|
||||
<stop
|
||||
style="stop-color:#5277c3;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop5059" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5562"
|
||||
id="linearGradient4328"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(70.650339,-1055.1511)"
|
||||
x1="200.59668"
|
||||
y1="351.41116"
|
||||
x2="290.08701"
|
||||
y2="506.18814" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient5053"
|
||||
id="linearGradient4330"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="translate(864.69589,-1491.3405)"
|
||||
x1="-584.19934"
|
||||
y1="782.33563"
|
||||
x2="-496.29703"
|
||||
y2="937.71399" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.70904368"
|
||||
inkscape:cx="99.429699"
|
||||
inkscape:cy="195.33352"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer3"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1050"
|
||||
inkscape:window-x="1920"
|
||||
inkscape:window-y="30"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:snap-global="true"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer3"
|
||||
inkscape:label="gradient-logo"
|
||||
style="display:inline;opacity:1"
|
||||
transform="translate(-156.41121,933.30685)">
|
||||
<g
|
||||
id="g2"
|
||||
transform="matrix(0.99994059,0,0,0.99994059,-0.06321798,33.188377)"
|
||||
style="stroke-width:1.00006">
|
||||
<path
|
||||
sodipodi:nodetypes="cccccccccc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path3336-6"
|
||||
d="m 309.54892,-710.38827 122.19683,211.67512 -56.15706,0.5268 -32.6236,-56.8692 -32.85645,56.5653 -27.90237,-0.011 -14.29086,-24.6896 46.81047,-80.4901 -33.22946,-57.8257 z"
|
||||
style="opacity:1;fill:url(#linearGradient4328);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.00018;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<use
|
||||
height="100%"
|
||||
width="100%"
|
||||
transform="rotate(60,407.11155,-715.78724)"
|
||||
id="use3439-6"
|
||||
inkscape:transform-center-y="151.59082"
|
||||
inkscape:transform-center-x="124.43045"
|
||||
xlink:href="#path3336-6"
|
||||
y="0"
|
||||
x="0"
|
||||
style="stroke-width:1.00006" />
|
||||
<use
|
||||
height="100%"
|
||||
width="100%"
|
||||
transform="rotate(-60,407.31177,-715.70016)"
|
||||
id="use3445-0"
|
||||
inkscape:transform-center-y="75.573958"
|
||||
inkscape:transform-center-x="-168.20651"
|
||||
xlink:href="#path3336-6"
|
||||
y="0"
|
||||
x="0"
|
||||
style="stroke-width:1.00006" />
|
||||
<use
|
||||
height="100%"
|
||||
width="100%"
|
||||
transform="rotate(180,407.41868,-715.7565)"
|
||||
id="use3449-5"
|
||||
inkscape:transform-center-y="-139.94592"
|
||||
inkscape:transform-center-x="59.669705"
|
||||
xlink:href="#path3336-6"
|
||||
y="0"
|
||||
x="0"
|
||||
style="stroke-width:1.00006" />
|
||||
<path
|
||||
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient4330);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.00018;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 309.54892,-710.38827 122.19683,211.67512 -56.15706,0.5268 -32.6236,-56.8692 -32.85645,56.5653 -27.90237,-0.011 -14.29086,-24.6896 46.81047,-80.4901 -33.22946,-57.8256 z"
|
||||
id="path4260-0"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cccccccccc" />
|
||||
<use
|
||||
height="100%"
|
||||
width="100%"
|
||||
transform="rotate(120,407.33916,-716.08356)"
|
||||
id="use4354-5"
|
||||
xlink:href="#path4260-0"
|
||||
y="0"
|
||||
x="0"
|
||||
style="display:inline;stroke-width:1.00006" />
|
||||
<use
|
||||
height="100%"
|
||||
width="100%"
|
||||
transform="rotate(-120,407.28823,-715.86995)"
|
||||
id="use4362-2"
|
||||
xlink:href="#path4260-0"
|
||||
y="0"
|
||||
x="0"
|
||||
style="display:inline;stroke-width:1.00006" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.4 KiB |
Loading…
Add table
Add a link
Reference in a new issue