From f0a7d563a385663513f24aecad92219ecfc83bd8 Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Sat, 26 Apr 2025 13:13:58 +0200 Subject: vault backup: 2025-04-26 13:13:58 --- .obsidian/graph.json | 6 +- .obsidian/workspace.json | 150 +++++++++++++++++---- A nice way to test flake output.md | 37 +++++ Basic building blocks of Nix.md | 21 +++ Building Go applications or packages with Nix.md | 35 +++++ .../Drawing 2025-04-26 13.13.29.excalidraw.md | 14 ++ GroupVPS Platform Knowledge Base.md | 11 ++ Nix.md | 7 + NixOS.md | 2 +- Specifying a License in a Flake output.md | 9 ++ Untitled.canvas | 1 + 11 files changed, 264 insertions(+), 29 deletions(-) create mode 100644 A nice way to test flake output.md create mode 100644 Basic building blocks of Nix.md create mode 100644 Building Go applications or packages with Nix.md create mode 100644 Excalidraw/Drawing 2025-04-26 13.13.29.excalidraw.md create mode 100644 GroupVPS Platform Knowledge Base.md create mode 100644 Nix.md create mode 100644 Specifying a License in a Flake output.md create mode 100644 Untitled.canvas diff --git a/.obsidian/graph.json b/.obsidian/graph.json index 4b5202e..fb280bb 100644 --- a/.obsidian/graph.json +++ b/.obsidian/graph.json @@ -1,7 +1,7 @@ { "collapse-filter": false, - "search": "tag:#work", - "showTags": true, + "search": "", + "showTags": false, "showAttachments": false, "hideUnresolved": false, "showOrphans": true, @@ -17,6 +17,6 @@ "repelStrength": 10, "linkStrength": 1, "linkDistance": 500, - "scale": 1.0136432647705078, + "scale": 0.45050811767578125, "close": true } \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 201a685..f1a2851 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -8,21 +8,117 @@ "type": "tabs", "children": [ { - "id": "84e32b3623ed3a00", + "id": "b3764c9f25704f99", "type": "leaf", "state": { "type": "markdown", "state": { - "file": "weekly/2025 W16.md", + "file": "GroupVPS Platform Knowledge Base.md", "mode": "source", + "source": false, "backlinks": true, - "source": false + "backlinkOpts": { + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + } }, "icon": "lucide-file", - "title": "2025 W16" + "title": "GroupVPS Platform Knowledge Base" + } + }, + { + "id": "822398f611b8f173", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "A nice way to test flake output.md", + "mode": "source", + "source": false, + "backlinks": true, + "backlinkOpts": { + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + } + }, + "icon": "lucide-file", + "title": "A nice way to test flake output" + } + }, + { + "id": "bb782d1a8c5850d8", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Building Go applications or packages with Nix.md", + "mode": "source", + "source": false, + "backlinks": true, + "backlinkOpts": { + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + } + }, + "icon": "lucide-file", + "title": "Building Go applications or packages with Nix" + } + }, + { + "id": "a26014d8fc4e2d9f", + "type": "leaf", + "state": { + "type": "split-diff-view", + "state": { + "aFile": "GroupVPS Platform Knowledge Base.md", + "bFile": "GroupVPS Platform Knowledge Base.md", + "aRef": "" + }, + "icon": "diff", + "title": "Diff: GroupVPS Platform Knowledge Base" + } + }, + { + "id": "98d6d636842f318b", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "A nice way to test flake output.md", + "mode": "source", + "source": false, + "backlinks": true, + "backlinkOpts": { + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + } + }, + "icon": "lucide-file", + "title": "A nice way to test flake output" } } - ] + ], + "currentTab": 3 } ], "direction": "vertical" @@ -41,7 +137,8 @@ "state": { "type": "file-explorer", "state": { - "sortOrder": "alphabetical" + "sortOrder": "alphabetical", + "autoReveal": false }, "icon": "lucide-folder-closed", "title": "Files" @@ -53,10 +150,10 @@ "state": { "type": "search", "state": { - "query": "nix shell", + "query": "", "matchingCase": false, "explainSearch": false, - "collapseAll": false, + "collapseAll": true, "extraContext": false, "sortOrder": "alphabetical" }, @@ -128,7 +225,9 @@ "type": "tag", "state": { "sortOrder": "frequency", - "useHierarchy": true + "useHierarchy": true, + "showSearch": false, + "searchQuery": "" }, "icon": "lucide-tags", "title": "Tags" @@ -173,37 +272,38 @@ "obsidian-excalidraw-plugin:New drawing": false } }, - "active": "84e32b3623ed3a00", + "active": "a26014d8fc4e2d9f", "lastOpenFiles": [ + "Excalidraw/Drawing 2025-04-26 13.13.29.excalidraw.md", + "Building Go applications or packages with Nix.md", + "A nice way to test flake output.md", + "Specifying a License in a Flake output.md", + "Basic building blocks of Nix.md", + "Nix.md", + "GroupVPS Platform Knowledge Base.md", + "Updating the image os admin user to fix password resets.md", + "Untitled.canvas", + "OVN upgrade.md", + "Using Libvirt to manage QEMU image bitmaps.md", + "About keyboard layout on Wayland.md", + "daily/17-Apr-2025.md", + "NixOS.md", "A useful Go oneliner to run a fileserver.md", + "Testing Golang programs.md", + "Benchmarking code in Golang.md", "weekly/2025 W16.md", "daily/10-Apr-2025.md", "A reason for becoming senior is that when Rutger is off I take most of his responsibilities.md", "daily/11-Apr-2025.md", "daily/18-Apr-2025.md", "daily/16-Apr-2025.md", - "daily/17-Apr-2025.md", "daily/14-Apr-2025.md", "weekly", "archive", "Network outage on single hypervisor causes Freenet to shutdown EVERYTHING.md", "We don't support filesystem discard syscalls on our openstack platform.md", "Exposing development headers on Nixos.md", - "Working with Nix shells.md", - "Inheriting from sets.md", - "daily/15-Apr-2025.md", - "Importing GPG keys from a keyserver.md", - "Build custom modules as profiles to manage various NixOS hosts.md", - "List of tags I use in this Vault and their purpose.md", - "NixOS - Advantage of imperative container management.md", - "NixOS - Imperative container management.md", - "conflict-files-obsidian-git.md", "daily", - "YAGNI.md", - "Writing a test double before the real implementation gives feedback on design.md", - "Using Libvirt to manage QEMU image bitmaps.md", - "Updating the image os admin user to fix password resets.md", - "The volume type of a Cinder volume can be changed.md", "ESP", "Excalidraw" ] diff --git a/A nice way to test flake output.md b/A nice way to test flake output.md new file mode 100644 index 0000000..cddf712 --- /dev/null +++ b/A nice way to test flake output.md @@ -0,0 +1,37 @@ +--- +tags: + - nix +--- +Flakes are described in [[Basic building blocks of Nix]]. + +A way to test flake outputs is by loading the flake in nix-repl and then using `:b` which builds a derivation. I learnt about `:b` from [this Nix Pill](https://nixos.org/guides/nix-pills/06-our-first-derivation.html). + +``` +box main 7s +❯ nix repl +Nix 2.24.14 +Type :? for help. +nix-repl> :lf . +Added 13 variables. + +nix-repl> outputs.packages.x86_64-linux.default +«derivation /nix/store/g8y3gdd2rr2j5awx8p75ih0k072571yr-box.drv» + +nix-repl> :b outputs.packages.x86_64-linux.default +error: builder for '/nix/store/g8y3gdd2rr2j5awx8p75ih0k072571yr-box.drv' failed with exit code 1; + last 9 log lines: + > Running phase: unpackPhase + > unpacking source archive /nix/store/gli7ljgsva1wchy3h4n2lmvs1rfssl40-source + > source root is source + > Running phase: patchPhase + > Running phase: updateAutotoolsGnuConfigScriptsPhase + > Running phase: configurePhase + > no configure script, doing nothing + > Running phase: buildPhase + > failed to initialize build cache at /homeless-shelter/.cache/go-build: mkdir /homeless-shelter: permission denied + For full logs, run 'nix log /nix/store/g8y3gdd2rr2j5awx8p75ih0k072571yr-box.drv'. +[0 built (1 failed)] +nix-repl> + +``` + diff --git a/Basic building blocks of Nix.md b/Basic building blocks of Nix.md new file mode 100644 index 0000000..17f3ea0 --- /dev/null +++ b/Basic building blocks of Nix.md @@ -0,0 +1,21 @@ +--- +tags: + - nix +--- +It's easy to forget the basic building blocks of [[Nix]], because mostly time is spent configuring settings that make it feel like it's just some kind of JSON. + +Then, what are those building blocks? +- Derivations +- Store derivation (.drv) +- Store +- The language + +Derivation = Description of how to build a package, specifying its exact inputs. Following this recipe should result in exactly the same package no matter when we run it. + +Derivation -> instantiate -> Store derivation. (`nix derivation show`) + + +### Flake +Armed with this knowledge it should be easier to recognize what a Flake actually is. We can specify inputs that we can use to build stuff which we specify in outputs. + +The outputs thus have to be derivations. These can be tested as described in [[A nice way to test flake output]]. \ No newline at end of file diff --git a/Building Go applications or packages with Nix.md b/Building Go applications or packages with Nix.md new file mode 100644 index 0000000..27be8e1 --- /dev/null +++ b/Building Go applications or packages with Nix.md @@ -0,0 +1,35 @@ +--- +tags: + - nix +--- +In [[A nice way to test flake output]] we see a failing build due to `go build` requiring an intermediate caching step. + +I learnt [from this article](https://discourse.nixos.org/t/go-package-compilation/29165/2) that there are some helper functions in Nixpkgs to build go packages that we should use. + +The [Go](https://github.com/NixOS/nixpkgs/blob/master/lib/licenses.nix) section of the Nixpkgs manual describes this proces in detail. + +Useful example: +```nix +{ + pet = buildGoModule rec { + pname = "pet"; + version = "0.3.4"; + + src = fetchFromGitHub { + owner = "knqyf263"; + repo = "pet"; + rev = "v${version}"; + hash = "sha256-Gjw1dRrgM8D3G7v6WIM2+50r4HmTXvx0Xxme2fH9TlQ="; + }; + + vendorHash = "sha256-ciBIR+a1oaYH+H1PcC8cD8ncfJczk1IiJ8iYNM+R6aA="; + + meta = { + description = "Simple command-line snippet manager, written in Go"; + homepage = "https://github.com/knqyf263/pet"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kalbasit ]; + }; + }; +} +``` diff --git a/Excalidraw/Drawing 2025-04-26 13.13.29.excalidraw.md b/Excalidraw/Drawing 2025-04-26 13.13.29.excalidraw.md new file mode 100644 index 0000000..63fb76c --- /dev/null +++ b/Excalidraw/Drawing 2025-04-26 13.13.29.excalidraw.md @@ -0,0 +1,14 @@ +--- + +excalidraw-plugin: parsed +tags: [excalidraw] + +--- +==⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠== You can decompress Drawing data with the command palette: 'Decompress current Excalidraw file'. For more info check in plugin settings under 'Saving' + + +## Drawing +```compressed-json +N4IgLgngDgpiBcIYA8DGBDANgSwCYCd0B3EAGhADcZ8BnbAewDsEAmcm+gV31TkQAswYKDXgB6MQHNsYfpwBGAOlT0AtmIBeNCtlQbs6RmPry6uA4wC0KDDgLFLUTJ2lH8MTDHQ0YNMWHRJMRZFAE5FFjIkT1UYRjAaBABtAF1ydCgoAGUAsD5QSXw8LOwNPkZOTExyHRgiACF0VABrQq5GXABhekx6fAQQAGIAM1GxkABfCaA== +``` +%% \ No newline at end of file diff --git a/GroupVPS Platform Knowledge Base.md b/GroupVPS Platform Knowledge Base.md new file mode 100644 index 0000000..439074f --- /dev/null +++ b/GroupVPS Platform Knowledge Base.md @@ -0,0 +1,11 @@ +--- +tags: + - work + - groupvps +--- +This will serve as my internal knowledge base about Group.ONE VPS Platform stuff. Notes on things I encounter in the wild and such should be linked here so I can quickly get an overview. + +[[Updating the image os admin user to fix password resets]] +[[Debugging issues with updating Puppet dependency]] +[[Using Libvirt to manage QEMU image bitmaps]] +[[OVN upgrade]] \ No newline at end of file diff --git a/Nix.md b/Nix.md new file mode 100644 index 0000000..adf40f4 --- /dev/null +++ b/Nix.md @@ -0,0 +1,7 @@ +--- +tags: + - nix +--- +Nix is a build system & package manager with its own functional programming language also called Nix. + +[[NixOS]] is a complete Linux operating system built and packaged with Nix. \ No newline at end of file diff --git a/NixOS.md b/NixOS.md index 63085c9..3a39f82 100644 --- a/NixOS.md +++ b/NixOS.md @@ -1,3 +1,3 @@ -A declaratively configured Linux OS using the Nix build system. +A declaratively configured Linux OS using the [[Nix]] build system. The [Manual](https://nixos.org/manual/nixos/stable/) holds a lot of valuable information. \ No newline at end of file diff --git a/Specifying a License in a Flake output.md b/Specifying a License in a Flake output.md new file mode 100644 index 0000000..b14b0a4 --- /dev/null +++ b/Specifying a License in a Flake output.md @@ -0,0 +1,9 @@ +--- +tags: + - nix +--- +While [[Building Go applications or packages with Nix]] I encountered a step where we need to specify a license. + +Documentation on this can be found [here](https://nixos.org/manual/nixpkgs/stable/#var-meta-license). [This](https://github.com/NixOS/nixpkgs/blob/master/lib/licenses.nix) file in Nixpkgs on Github shows available licenses. + +For example, the Apache-2.0 License is referenced through `lib.licenses.asl20`. \ No newline at end of file diff --git a/Untitled.canvas b/Untitled.canvas new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/Untitled.canvas @@ -0,0 +1 @@ +{} \ No newline at end of file -- cgit v1.2.3