diff --git a/flake.lock b/flake.lock
index c8f9a03..82917b9 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
"nodes": {
"flake-utils": {
"locked": {
- "lastModified": 1644229661,
- "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
+ "lastModified": 1659877975,
+ "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
- "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
+ "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
@@ -17,16 +17,16 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1646933238,
- "narHash": "sha256-RZJnLN0o4B35eTnUc2tEAD12X5TNeeJhhvH3Fd6Pmdo=",
+ "lastModified": 1665613119,
+ "narHash": "sha256-VTutbv5YKeBGWou6ladtgfx11h6et+Wlkdyh4jPJ3p0=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "bacbfd713b4781a4a82c1f390f8fe21ae3b8b95b",
+ "rev": "e06bd4b64bbfda91d74f13cb5eca89485d47528f",
"type": "github"
},
"original": {
"id": "nixpkgs",
- "ref": "nixos-21.11",
+ "ref": "nixos-22.05",
"type": "indirect"
}
},
diff --git a/flake.nix b/flake.nix
index b2cb153..a43c72f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -4,12 +4,8 @@
nixConfig.bash-prompt = "[nix]λ ";
inputs = {
- nixpkgs.url = "nixpkgs/nixos-21.11";
-
- flake-utils = {
- url = "github:numtide/flake-utils";
- inputs.nixpkgs.follows = "nixpkgs";
- };
+ nixpkgs.url = "nixpkgs/nixos-22.05";
+ flake-utils.url = "github:numtide/flake-utils";
};
outputs = { flake-utils, nixpkgs, self }:
diff --git a/src/css/styles.css b/src/css/styles.css
index 47c377a..5f1c57f 100644
--- a/src/css/styles.css
+++ b/src/css/styles.css
@@ -65,6 +65,9 @@ The content `
` is where all your content goes.
padding: 2.5em 2em 0;
border-bottom: 1px solid #00000088;
margin-bottom: 2.5em;
+ background-image: url(./images/background.jpg);
+ background-size: cover;
+ height: 25vh;
}
/* .header h1 {
margin: 0.2em 0;
@@ -390,4 +393,4 @@ Hides the menu at `48em`, but modify this based on your app's needs.
left: 0;
width: 100%;
height: 100%;
-}
\ No newline at end of file
+}
diff --git a/src/images/background.jpg b/src/images/background.jpg
new file mode 100644
index 0000000..cf777a6
Binary files /dev/null and b/src/images/background.jpg differ
diff --git a/src/images/nix_banner.png b/src/images/nix_banner.png
new file mode 100644
index 0000000..b1b1df6
Binary files /dev/null and b/src/images/nix_banner.png differ
diff --git a/src/index.html b/src/index.html
index e5573c2..a0f3a25 100644
--- a/src/index.html
+++ b/src/index.html
@@ -7,13 +7,15 @@ title: "Nani"
---
@@ -30,7 +32,9 @@ title: "Nani"
$title$
$date$
-
$desc$
+ $if(desc)$
+
$desc$
+ $endif$
diff --git a/src/posts/2022-10-16-the-arrow-operator.md b/src/posts/2022-10-16-the-arrow-operator.md
new file mode 100644
index 0000000..24f8297
--- /dev/null
+++ b/src/posts/2022-10-16-the-arrow-operator.md
@@ -0,0 +1,56 @@
+---
+title: "The nix arrow operator"
+keywords: nix, language, programming-language
+image: './images/nix_banner.png'
+series: "Nix shorts"
+---
+
+There is a specal operator in nix, written as `->`. It is not a c dereference struct pointer operator, nor is it a haskell function type definition. It is a boolean operator, which represents the "implies arrow" from [propositional logic][prop-log]. This is especially useful in nix, because of its usage in modules.
+
+## The `myService` module
+
+Let's say you have made a module for `myService` with two options called `myService.enable`, and `myService.address`. `myService` needs an address in order to work properly. If `myService` is not enabled, the value of `myService.address` doesn't really matter. Set or `null`, the result will be the same either way. If `myService` is enabled however, it is crucial that we report an error if `myService.address` is not set. `myService` can not work without it.
+
+In order to make sure that this never happens, we need to assert that this is not the case. This could be done by asserting that this boolean expression is true.
+
+`((!myService.enable) || myService.address != null)`
+
+or in plain english: "Either myService is not enabled, or the address has to not be null"
+
+This is equivalent to this boolean expression:
+
+`myService.enable -> myService.address != null`
+
+or in plain english: "myService being enabled implies that the address is not null".
+
+Asserting these kinds of inter-setting dependencies are common enough in nix modules to provide grounds for having `->` as its own boolean operator.
+
+## Full example
+
+```nix
+# modules/myService.nix
+{ lib, config }: let
+ cfg = config.myService;
+in {
+ options = {
+ enable = lib.mkEnableOption "myService";
+ address = lib.mkOption {
+ example = "127.0.0.1";
+ description = "The address of myService";
+ type = lib.types.string;
+ };
+ };
+ config = {
+ # ...
+
+ assertions = [
+ {
+ assertion = cfg.enable -> cfg.address != null;
+ message = "myService needs an address";
+ }
+ ];
+ };
+}
+```
+
+[prop-log]: https://iep.utm.edu/prop-log/
diff --git a/src/templates/default.html b/src/templates/default.html
index b5e62f3..11557ed 100644
--- a/src/templates/default.html
+++ b/src/templates/default.html
@@ -74,6 +74,7 @@
+