finalish slides
This commit is contained in:
parent
6860a82c05
commit
74b771e62c
11 changed files with 102 additions and 20 deletions
9
content/posts/nixcon2023/demo-config/configuration.nix
Normal file
9
content/posts/nixcon2023/demo-config/configuration.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{ pkgs, config, ... }: {
|
||||||
|
programs.fish.enable = true;
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/sda1";
|
||||||
|
};
|
||||||
|
boot.loader.grub.enable = false;
|
||||||
|
system.stateVersion = "23.05";
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
+++
|
+++
|
||||||
title = "NixCon 2023: Finding things in nixpkgs and NixOS source"
|
title = "NixCon 2023: Finding things in nixpkgs and NixOS source"
|
||||||
path = "/nixcon2023"
|
path = "/nixcon2023"
|
||||||
draft = true
|
draft = false
|
||||||
tags = ["nix", "nixcon"]
|
tags = ["nix", "nixcon"]
|
||||||
date = "2023-09-09"
|
date = "2023-09-09"
|
||||||
+++
|
+++
|
||||||
|
|
||||||
|
Slides here: <https://jade.fyi/nixcon2023/slides/>
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
content/posts/nixcon2023/slides/dynamic-demo.mp4
(Stored with Git LFS)
Normal file
BIN
content/posts/nixcon2023/slides/dynamic-demo.mp4
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -58,10 +58,11 @@
|
||||||
<section data-markdown><textarea data-template>
|
<section data-markdown><textarea data-template>
|
||||||
# the sources are for everyone
|
# the sources are for everyone
|
||||||
|
|
||||||
* We do need to improve our documentation
|
* We *do* need to improve our documentation
|
||||||
* Nix is uniquely participatory: a *lot* of us write modules and packages, which means reading sources
|
* Nix is uniquely participatory: a *lot* of us write modules and packages, which means reading sources
|
||||||
* Navigating the source is a bit of witchcraft, and there's a lot of it
|
* Navigating the source is a bit of witchcraft, and there's a lot of it
|
||||||
* With good tooling, the sources of the docs sometimes are faster than the docs
|
* With good tooling, the sources of the docs sometimes are faster than the docs
|
||||||
|
* We should have more interactive docs!
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
@ -101,8 +102,12 @@ dev/nixpkgs » tokei -t nix .
|
||||||
# Static analysis
|
# Static analysis
|
||||||
|
|
||||||
* Any method that takes 15 seconds or less and doesn't involve running any code
|
* Any method that takes 15 seconds or less and doesn't involve running any code
|
||||||
* I am showing the fancy ways of doing it
|
* First way to try:
|
||||||
* ripgrep is static analysis too; it's a good fallback
|
* Extremely fast
|
||||||
|
* Objective: "works most of the time"
|
||||||
|
* I am showing the fancy ways of doing it here
|
||||||
|
* ripgrep is static analysis too
|
||||||
|
* Objective of fancy ways: faster and less stuff to sort through
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
@ -118,8 +123,7 @@ Good for:
|
||||||
Limitations:
|
Limitations:
|
||||||
* does not eval everything
|
* does not eval everything
|
||||||
* needs some setup per-project
|
* needs some setup per-project
|
||||||
* completions are imperfect but they exist
|
* imperfect go-to-definition
|
||||||
* not sure how to get goto definition to go past args for some things
|
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
@ -145,10 +149,10 @@ Install from nixpkgs and configure in your editor. Then:
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section data-markdown><textarea data-template>
|
<section class="video" data-markdown><textarea data-template>
|
||||||
# demo (nixd)
|
# demo (nixd)
|
||||||
|
|
||||||
FIXME
|
<video class="r-stretch" src="./nixd.mp4" controls>
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
@ -158,11 +162,11 @@ FIXME
|
||||||
* Very old and simple source code index format
|
* Very old and simple source code index format
|
||||||
* Usually gets through abstraction by being too naive to get broken
|
* Usually gets through abstraction by being too naive to get broken
|
||||||
* Typically generated by simple parse-tree traversal
|
* Typically generated by simple parse-tree traversal
|
||||||
* Wide editor support ([VSCode extension](https://marketplace.visualstudio.com/items?itemName=jaydenlin.ctags-support), built into vim/emacs)
|
* Wide editor support ([VSCode extension](https://marketplace.visualstudio.com/items?itemName=jaydenlin.ctags-support); also built into vim/emacs)
|
||||||
|
|
||||||
Sample:
|
Sample:
|
||||||
|
|
||||||
```
|
```text
|
||||||
boot.initrd.luks.reusePassphrases nixos/modules/system/boot/luksroot.nix 533
|
boot.initrd.luks.reusePassphrases nixos/modules/system/boot/luksroot.nix 533
|
||||||
```
|
```
|
||||||
</textarea>
|
</textarea>
|
||||||
|
|
@ -173,19 +177,21 @@ boot.initrd.luks.reusePassphrases nixos/modules/system/boot/luksroot.nix
|
||||||
# ctags on nix
|
# ctags on nix
|
||||||
|
|
||||||
* `nix-doc tags .` in nixpkgs, then in vim you can `:tj fixedPoints`, `C-]`, etc.
|
* `nix-doc tags .` in nixpkgs, then in vim you can `:tj fixedPoints`, `C-]`, etc.
|
||||||
* [WIP ctags for NixOS options](https://github.com/NixOS/nixpkgs/pull/249243)
|
* [WIP ctags for NixOS options (#249243)](https://github.com/NixOS/nixpkgs/pull/249243)
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section data-markdown><textarea data-template>
|
<section class="video" data-markdown><textarea data-template>
|
||||||
# demo (ctags on nix)
|
# demo (ctags on nix)
|
||||||
|
|
||||||
FIXME
|
<video class="r-stretch" src="./nix-ctags.mp4" controls>
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section data-markdown><textarea data-template>
|
<section data-markdown><textarea data-template>
|
||||||
# summary (static analysis)
|
# summary (static analysis)
|
||||||
|
|
||||||
|
First try language server, then ctags, then ripgrep.
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
@ -264,6 +270,7 @@ null
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<!--
|
||||||
<section data-markdown><textarea data-template>
|
<section data-markdown><textarea data-template>
|
||||||
# `builtins.unsafeGetAttrPos`
|
# `builtins.unsafeGetAttrPos`
|
||||||
|
|
||||||
|
|
@ -282,6 +289,21 @@ s.nix"; line = 1193; }
|
||||||
</script></code></pre>
|
</script></code></pre>
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<section class="video" data-markdown><textarea data-template>
|
||||||
|
<video class="r-stretch" src="./dynamic-demo.mp4" controls>
|
||||||
|
</textarea>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section data-markdown><textarea data-template>
|
||||||
|
# bonus: using the debugger
|
||||||
|
|
||||||
|
* pass `--debugger` to nix
|
||||||
|
* use `builtins.break (value)` somewhere in the evaluation path
|
||||||
|
* then use `unsafeGetAttrPos` and others to figure out the source of a value
|
||||||
|
</textarea>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section data-markdown><textarea data-template>
|
<section data-markdown><textarea data-template>
|
||||||
# summary (dynamic analysis)
|
# summary (dynamic analysis)
|
||||||
|
|
@ -294,14 +316,19 @@ s.nix"; line = 1193; }
|
||||||
* `builtins.doc` (nix-doc)
|
* `builtins.doc` (nix-doc)
|
||||||
* \+ concise output on functions
|
* \+ concise output on functions
|
||||||
* \- issues with wrappers
|
* \- issues with wrappers
|
||||||
|
</textarea>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section data-markdown><textarea data-template>
|
||||||
|
# summary (dynamic analysis)
|
||||||
* `builtins.unsafeGetAttrPos`
|
* `builtins.unsafeGetAttrPos`
|
||||||
* \+ can get you close to the source if other things fail due to abstraction
|
* \+ gets close even with abstraction
|
||||||
* \- unergonomic args and return value for interactive use
|
* \- unergonomic args and return value for interactive use
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section data-markdown><textarea data-template>
|
<section data-markdown><textarea data-template>
|
||||||
# NixOS ctags ([PR](https://github.com/NixOS/nixpkgs/pull/249243))
|
# NixOS ctags ([PR #249243](https://github.com/NixOS/nixpkgs/pull/249243))
|
||||||
|
|
||||||
With the PR checked out:
|
With the PR checked out:
|
||||||
|
|
||||||
|
|
@ -313,10 +340,10 @@ $ nix build -f nixos/release.nix optionsCtags -o opts-tags
|
||||||
Then add `opts-tags` to ctags search path (`:set tags+=opts-tags` in vim).
|
Then add `opts-tags` to ctags search path (`:set tags+=opts-tags` in vim).
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section data-markdown><textarea data-template>
|
<section class="video" data-markdown><textarea data-template>
|
||||||
# NixOS ctags (demo)
|
# NixOS ctags (demo)
|
||||||
|
|
||||||
FIXME
|
<video class="r-stretch" src="./nixos-ctags.mp4" controls>
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
@ -326,14 +353,14 @@ FIXME
|
||||||
Getting the configuration into the repl:
|
Getting the configuration into the repl:
|
||||||
|
|
||||||
* Non-flakes: `nix repl -I nixos-config=/path/to/configuration.nix -f <nixpkgs/nixos>`
|
* Non-flakes: `nix repl -I nixos-config=/path/to/configuration.nix -f <nixpkgs/nixos>`
|
||||||
* Flakes: `nix repl`, `:lf .`, `nixosConfigurations.xx.{....}`
|
* Flakes: `nix repl` then `:lf .` then `nixosConfigurations.xx.{....}`
|
||||||
</textarea>
|
</textarea>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section data-markdown><textarea data-template>
|
<section class="video" data-markdown><textarea data-template>
|
||||||
# NixOS in the repl (demo)
|
# NixOS in the repl (demo)
|
||||||
|
|
||||||
FIXME
|
<video class="r-stretch" src="./nixos-repl.mp4" controls>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
nix-repl> config.documentation.man.generateCaches
|
nix-repl> config.documentation.man.generateCaches
|
||||||
|
|
@ -361,6 +388,22 @@ lue = true; } ]
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<section data-markdown><textarea data-template>
|
||||||
|
# questions?
|
||||||
|
|
||||||
|
slides: https://jade.fyi/nixcon2023
|
||||||
|
|
||||||
|
masto: @leftpaddotpy\@hachyderm.io
|
||||||
|
|
||||||
|
email: jade at jade dot fyi
|
||||||
|
|
||||||
|
code: https://github.com/LF-
|
||||||
|
|
||||||
|
github sponsors: https://github.com/sponsors/LF-
|
||||||
|
</textarea>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<script type="module" src="main.js"></script>
|
<script type="module" src="main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -11,4 +11,7 @@ Reveal.initialize({
|
||||||
transitionSpeed: "fast",
|
transitionSpeed: "fast",
|
||||||
transition: "none",
|
transition: "none",
|
||||||
slideNumber: true,
|
slideNumber: true,
|
||||||
|
|
||||||
|
margin: 0.04,
|
||||||
|
disableLayout: true,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
BIN
content/posts/nixcon2023/slides/nix-ctags.mp4
(Stored with Git LFS)
Normal file
BIN
content/posts/nixcon2023/slides/nix-ctags.mp4
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
content/posts/nixcon2023/slides/nixd.mp4
(Stored with Git LFS)
Normal file
BIN
content/posts/nixcon2023/slides/nixd.mp4
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
content/posts/nixcon2023/slides/nixos-ctags.mp4
(Stored with Git LFS)
Normal file
BIN
content/posts/nixcon2023/slides/nixos-ctags.mp4
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
content/posts/nixcon2023/slides/nixos-repl.mp4
(Stored with Git LFS)
Normal file
BIN
content/posts/nixcon2023/slides/nixos-repl.mp4
(Stored with Git LFS)
Normal file
Binary file not shown.
|
|
@ -1,3 +1,14 @@
|
||||||
|
.slides {
|
||||||
|
display: flex;
|
||||||
|
/*! flex: max-content; */
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.slides section:not(.video) {
|
||||||
|
max-width: var(--slide-width);
|
||||||
|
}
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--r-heading-text-transform: none !important;
|
--r-heading-text-transform: none !important;
|
||||||
--r-background-color: #190022 !important;
|
--r-background-color: #190022 !important;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue