summaryrefslogtreecommitdiff
path: root/3 resources/nix
diff options
context:
space:
mode:
authorJasper Ras <jras@hostnet.nl>2025-01-13 13:16:06 +0100
committerJasper Ras <jras@hostnet.nl>2025-01-13 13:16:06 +0100
commit9232b8d817d4cd4122947375156fa2fa1e9fba14 (patch)
treee4feb77f2e508f008b78f722e91488bb9a3f3806 /3 resources/nix
parented0753ad224f0c65133bd7a63180257eecd9f5e3 (diff)
vault backup: 2025-01-13 13:16:06
Diffstat (limited to '3 resources/nix')
-rw-r--r--3 resources/nix/Flake.md (renamed from 3 resources/nix/flakes.md)3
-rw-r--r--3 resources/nix/Overlays.md (renamed from 3 resources/nix/overlays.md)5
-rw-r--r--3 resources/nix/Package.md6
-rw-r--r--3 resources/nix/REPL.md (renamed from 3 resources/nix/repl.md)3
-rw-r--r--3 resources/nix/Shell.nix.md (renamed from 3 resources/nix/shell.nix.md)5
-rw-r--r--3 resources/nix/language.md5
-rw-r--r--3 resources/nix/language/Import.md (renamed from 3 resources/nix/language/keyword-import.md)3
-rw-r--r--3 resources/nix/language/Let.md (renamed from 3 resources/nix/language/keyword-let.md)3
-rw-r--r--3 resources/nix/language/Rec.md (renamed from 3 resources/nix/language/keyword-rec.md)3
-rw-r--r--3 resources/nix/language/With.md (renamed from 3 resources/nix/language/keyword-with.md)3
-rw-r--r--3 resources/nix/package.md3
-rw-r--r--3 resources/nix/packages/Apply custom patches.md (renamed from 3 resources/nix/packages/apply-patches.md)5
12 files changed, 36 insertions, 11 deletions
diff --git a/3 resources/nix/flakes.md b/3 resources/nix/Flake.md
index fb99500..754556f 100644
--- a/3 resources/nix/flakes.md
+++ b/3 resources/nix/Flake.md
@@ -1,3 +1,6 @@
+#nix #flake
+
+---
Nix flakes are source trees containing a file `flake.nix` at their root. The file `flake.nix` provides a standardized way to provide [[Zettelkast/Index/Nix]] artifacts. It's like a package manager for [[Zettelkast/Index/Nix]]. A flake can be dependent on other Flakes and it's possible to pin dependencies to exact revisions by using a `flake.lock` file.
Nix flake evaluation is hermetic, meaning that it produces the same result wherever it's built.k
diff --git a/3 resources/nix/overlays.md b/3 resources/nix/Overlays.md
index 70dad85..8ee33f3 100644
--- a/3 resources/nix/overlays.md
+++ b/3 resources/nix/Overlays.md
@@ -1,4 +1,7 @@
-Functions that accept two args (conventionally: final, prev) and return a set of [[package]]s.
+#nix #overlay
+
+---
+Functions that accept two args (conventionally: final, prev) and return a set of [[Package]]s.
The `prev` arguments holds the set of packages of the "parent" overlay while the `final` argument holds the end result of **all** overlays applied. This means that overlays depend on each other. It is unclear how we can tell on which overlay an overlay depends.
diff --git a/3 resources/nix/Package.md b/3 resources/nix/Package.md
new file mode 100644
index 0000000..32c6bd4
--- /dev/null
+++ b/3 resources/nix/Package.md
@@ -0,0 +1,6 @@
+#nix #packages
+
+---
+Packages != NixOS Modules
+
+Packages come from Nixpkgs. \ No newline at end of file
diff --git a/3 resources/nix/repl.md b/3 resources/nix/REPL.md
index 6a0fd4a..210b980 100644
--- a/3 resources/nix/repl.md
+++ b/3 resources/nix/REPL.md
@@ -1,2 +1,5 @@
+#nix #repl
+
+---
`nix repl` to interactively evaluate Nix expressions. `:p` if output is not full.
`nix-instantiate --eval <file>.nix` to evaluate a Nix expression from a file. `--strict`. \ No newline at end of file
diff --git a/3 resources/nix/shell.nix.md b/3 resources/nix/Shell.nix.md
index d5fa8ce..13715c2 100644
--- a/3 resources/nix/shell.nix.md
+++ b/3 resources/nix/Shell.nix.md
@@ -1,3 +1,6 @@
+#nix #shell
+
+---
Can be used to set up per dir environments, e.g using direnv to automatically activate them.
## Python
https://nixos.org/manual/nixpkgs/stable/#python
@@ -35,5 +38,5 @@ let
in python311.withPackages (ps: with ps; [ numpy my_toolz ]) ).env
```
-The [[keyword-import]] is required here because imports a nix expression from another source, in this case nixpkgs.
+The [[Import]] is required here because imports a nix expression from another source, in this case nixpkgs.
It is not required at line two, because python310Packages itself is already in the local scope. \ No newline at end of file
diff --git a/3 resources/nix/language.md b/3 resources/nix/language.md
deleted file mode 100644
index 01101d9..0000000
--- a/3 resources/nix/language.md
+++ /dev/null
@@ -1,5 +0,0 @@
-"Nix is like JSON, but with functions".
-
-[[keyword-rec]]
-[[keyword-let]]
-[[keyword-with]]
diff --git a/3 resources/nix/language/keyword-import.md b/3 resources/nix/language/Import.md
index 616c155..d201c74 100644
--- a/3 resources/nix/language/keyword-import.md
+++ b/3 resources/nix/language/Import.md
@@ -1,2 +1,5 @@
+#nix #keyword
+
+---
The import keyword brings a Nix expression from another source into scope such that we can reference it. For example, we can `import <nixpkgs>` and it would bring the entire attribute set that is Nixpkgs into scope and allows us to reference any of its attributes.
diff --git a/3 resources/nix/language/keyword-let.md b/3 resources/nix/language/Let.md
index 3b2f401..bfb4b31 100644
--- a/3 resources/nix/language/keyword-let.md
+++ b/3 resources/nix/language/Let.md
@@ -1,3 +1,6 @@
+#nix #keyword
+
+---
Keyword: `let`
Used to assign variables that can be used in an expression immediately following the let-binding.
```nix
diff --git a/3 resources/nix/language/keyword-rec.md b/3 resources/nix/language/Rec.md
index 456f877..b7050d3 100644
--- a/3 resources/nix/language/keyword-rec.md
+++ b/3 resources/nix/language/Rec.md
@@ -1,3 +1,6 @@
+#nix #keyword
+
+---
Recursive attribute sets can reference values declared earlier in the same set.
keyword: `rec`
```nix
diff --git a/3 resources/nix/language/keyword-with.md b/3 resources/nix/language/With.md
index 10763ff..b291907 100644
--- a/3 resources/nix/language/keyword-with.md
+++ b/3 resources/nix/language/With.md
@@ -1,3 +1,6 @@
+#nix #keyword
+
+---
The `with` keyword brings all attributes from a given set, e.g nixpkgs, into the local scope. Making them accessible as if they were declared in the same file.
An example, bringing everything from nixpkgs into scope:
diff --git a/3 resources/nix/package.md b/3 resources/nix/package.md
deleted file mode 100644
index 231e3a6..0000000
--- a/3 resources/nix/package.md
+++ /dev/null
@@ -1,3 +0,0 @@
-Packages != NixOS Modules
-
-Packages are from Nixpkgs. \ No newline at end of file
diff --git a/3 resources/nix/packages/apply-patches.md b/3 resources/nix/packages/Apply custom patches.md
index e703f81..370c53a 100644
--- a/3 resources/nix/packages/apply-patches.md
+++ b/3 resources/nix/packages/Apply custom patches.md
@@ -1,4 +1,7 @@
-We can apply patches to existing packages using [[overlays]]:
+#nix #packages #overlay
+
+---
+We can apply patches to existing packages using [[Overlays]]:
```nix
final: prev {
nova = prev.nova.overrideAttrs (old: {