mirror of
https://gitlab.com/EternalWanderer/voidcruiser.nl
synced 2024-11-28 20:03:50 +01:00
Compare commits
3 commits
4802063ae7
...
d223262047
Author | SHA1 | Date | |
---|---|---|---|
Nox Sluijtman | d223262047 | ||
Nox Sluijtman | 81e7e362e8 | ||
Nox Sluijtman | 276e7436d0 |
|
@ -27,10 +27,6 @@ contentTypeName = 'rambles'
|
|||
identifier = "rambles"
|
||||
name = "rambles"
|
||||
url = "/rambles/"
|
||||
[[menu.services]]
|
||||
identifier = "alpine repo"
|
||||
name = "alpine repo"
|
||||
url = "https://alpine.voidcruiser.nl"
|
||||
[[menu.services]]
|
||||
identifier = "searXNG instance"
|
||||
name = "searXNG instance"
|
||||
|
|
|
@ -10,7 +10,6 @@ description: "The obligatory about page"
|
|||
|
||||
# The site itself
|
||||
|
||||
|
||||
- Colorscheme: [Gruvbox](https://github.com/morhetz/gruvbox)
|
||||
Depending on `prefers-color-scheme:` in your browser settings being `light` or not, you get to see the light variant or not.
|
||||
- This site is viewable and usable on every browser I've thrown at it so far.\
|
||||
|
@ -28,29 +27,18 @@ Here's the browser list:
|
|||
- Netsurf
|
||||
- Nyxt
|
||||
|
||||
# Various devices in posession of [$HUMANOID](#HUMANOID)
|
||||
|
||||
| hostname | os | device/model/main board | role |
|
||||
|---|---|---|---|
|
||||
| hazyMonolith | Debian 11 | HP Z210 Workstation | Used to be an entertainment box but got superceded by voidBerry. These days, mainly standing under my desk being a thing to put my feed up on.|
|
||||
| voidSlab | Alpine Edge | ThinkPad T440p |Daily driver for lighter and less serious things.|
|
||||
| RejuvinatedBrick | Alpine Edge |Dell Latitude E5500 |Being a beautiful brick to nagivate Gopher and Gemini.|
|
||||
| voidCreeper | NixOS 22.05 | HP Omen 15 |Central heating if my actual central heating fails and running the few games I still play these days.|
|
||||
| HappyThonk | NixOS 21.11 | ThinkCentre Edge something-something |Experimental box if I need something slightly stronger then a Raspberry Pi.|
|
||||
| PicturePlanck | Debian 11 | Raspberry Pi 4B |Home server.|
|
||||
| voidBerry | Debian 11 | Raspberry Pi 4B |Light entertainment box.|
|
||||
|
||||
# Software used by [$HUMANOID](#HUMANOID)
|
||||
|
||||
| category | programs |
|
||||
|---|---|
|
||||
| Window manager: | DWM, XMonad
|
||||
| Graphical browser: | FireFox, LibreWolf, UnGoogled Chromium, Brave, Qutebrowser
|
||||
| Operating system: | NixOS, Debian, Alpine |
|
||||
| Window manager: | XMonad
|
||||
| Graphical browser: | LibreWolf, UnGoogled Chromium, Qutebrowser
|
||||
| Text browser: | Lynx, w3m
|
||||
| Gemini client: | Lagrange, Amfora
|
||||
| Terminal: | ST, Kitty
|
||||
| Text editors: | Vim, NeoVim VSCodium with NVim plugin
|
||||
| Image viewer: | sxiv, nsxiv
|
||||
| Video player: | MPV
|
||||
| Music player: | MPD + NCMPCPP
|
||||
| Terminal: | Kitty
|
||||
| Text editors: | Vim, NeoVim, VSCodium with NVim plugin
|
||||
| Image viewer: | nsxiv
|
||||
| Video player: | mpv
|
||||
| Music player: | mpd + ncmpcpp
|
||||
|
||||
|
|
224
src/content/rambles/config-snippets.md
Normal file
224
src/content/rambles/config-snippets.md
Normal file
|
@ -0,0 +1,224 @@
|
|||
---
|
||||
title: "Config Snippets"
|
||||
date: "2024-04-09T18:38:46+02:00"
|
||||
author: "$HUMANOID"
|
||||
tags: ["xmonad", "haskell", "nix"]
|
||||
description: "A few things in my config worth highlighting."
|
||||
toc: true
|
||||
---
|
||||
|
||||
# Mess
|
||||
|
||||
First I'm going to address an elephant in the room:
|
||||
|
||||
> Why aren't you publishing your dotfiles?
|
||||
|
||||
They're too much of a mess with a bunch personal data entwined in the commit
|
||||
history that I don't feel comfortable publicly throwing onto the internet.
|
||||
|
||||
# Nix snippets
|
||||
|
||||
It's no secret that I've picked up NixOS a few years ago. To that end, there are
|
||||
a few things that I don't think I've seen other people do that I would like to
|
||||
share here.
|
||||
|
||||
## `home-manager` color scheme
|
||||
|
||||
Some time ago, I came across the
|
||||
[nix-colors](https://github.com/Misterio77/nix-colors) project and came to the
|
||||
conclusion that it didn't fit my needs. As a result, I put/hacked a function
|
||||
together that extracts the color schemes from
|
||||
[`pkgs.kitty-themes`](https://search.nixos.org/packages?show=kitty-themes&query=kitty-themes).
|
||||
I won't go into the integration details in my personal config as it's not
|
||||
exactly something I would call ergonomic. However, this is the function I came
|
||||
up with:
|
||||
|
||||
{{< start-details summary="Expand to see a rather lengthy nix expression" >}}
|
||||
```nix
|
||||
{ lib, config, pkgs, ... }:
|
||||
arg:
|
||||
with lib;
|
||||
let cfg = config.colorscheme;
|
||||
|
||||
getKittyTheme = with builtins; (theme:
|
||||
let matching = filter (x: x.name == theme)
|
||||
(fromJSON
|
||||
(readFile
|
||||
"${pkgs.kitty-themes}/share/kitty-themes/themes.json"));
|
||||
|
||||
in throwIf (length matching == 0)
|
||||
"kitty-themes does not contain a theme named ${theme}"
|
||||
"${pkgs.kitty-themes}/share/kitty-themes/${(head matching).file}");
|
||||
|
||||
unwrapKittyTheme = with pkgs; path: let
|
||||
theme = runCommand "theme.toml" { nativebuildinputs = [ coreutils ]; } ''
|
||||
cat '${path}' | sed -E '/^#|^$/d;s/\s+(.*)/ = "\1"/g' > $out
|
||||
'';
|
||||
in (builtins.fromTOML (builtins.readFile theme));
|
||||
|
||||
defaultTheme = {
|
||||
selection_foreground = "";
|
||||
selection_background = "";
|
||||
foreground = "";
|
||||
background = "";
|
||||
color0 = "";
|
||||
color1 = "";
|
||||
color2 = "";
|
||||
color3 = "";
|
||||
color4 = "";
|
||||
color5 = "";
|
||||
color6 = "";
|
||||
color7 = "";
|
||||
color8 = "";
|
||||
color9 = "";
|
||||
color10 = "";
|
||||
color11 = "";
|
||||
color12 = "";
|
||||
color13 = "";
|
||||
color14 = "";
|
||||
color15 = "";
|
||||
cursor = "";
|
||||
cursor_text_color = "";
|
||||
url_color = "";
|
||||
};
|
||||
|
||||
in defaultTheme // unwrapKittyTheme (getKittyTheme arg)
|
||||
```
|
||||
{{< end-details >}}
|
||||
|
||||
This function takes a name and matches that against the contents of
|
||||
`pkgs.kitty-themes`. If it fails to find something, it throws an error; If does
|
||||
find something, it returns that file, converts that to something approach TOML
|
||||
syntax, which is then parsed using `builtins.fromTOML` and merged with a
|
||||
minimum-viable-colorscheme, ensuring all colors are at the least declared as an
|
||||
empty string; I ran into issues here when using this output in combination with
|
||||
Qutebrowser when referring to colors that didn't exist in certain colorschemes.
|
||||
|
||||
## Qutebrowser
|
||||
|
||||
I manage my Qutebrowser config using the `home-manager` module (obviously). In
|
||||
my Qutebrowser config, I have JavaScript disabled by default and use a list of
|
||||
exception for trusted sites. When I first tried to set this up, I bumped into
|
||||
the obvious problem that Nix doesn't allow you to bind multiple values to a
|
||||
single name. Luckily, the Qutebrowser module has an `extraConfig` option which
|
||||
takes a string. At first I had a bunch of lines for those exceptions:
|
||||
|
||||
```
|
||||
config.set('content.javascript.enabled', True, 'https://hoogle.haskell.org/*')
|
||||
config.set('content.javascript.enabled', True, 'https://search.nixos.org/*')
|
||||
config.set('content.javascript.enabled', True, 'https://nix.dev/*')
|
||||
config.set('content.javascript.enabled', True, 'https://voidcruiser.nl/searx/*')
|
||||
```
|
||||
|
||||
However, I quickly got sick of the inherent inefficiency and illegibility of
|
||||
this approach, so I wrote a few little functions:
|
||||
|
||||
```nix
|
||||
...
|
||||
programs.qutebrowser.extraConfig = let
|
||||
enableJS = url: "config.set('content.javascript.enabled', True, '${url}')";
|
||||
javaScriptExceptions = [
|
||||
"https://hoogle.haskell.org/*"
|
||||
"https://search.nixos.org/*"
|
||||
"https://nix.dev/*"
|
||||
"https://voidcruiser.nl/searx/*"
|
||||
];
|
||||
in ''
|
||||
${with builtins; concatStringSep "\n" (map enableJS javaScriptExceptions)}
|
||||
|
||||
# things I haven't managed to abstract properly yet
|
||||
'';
|
||||
...
|
||||
```
|
||||
|
||||
This takes the contents supplied in `javaScriptExceptions` and generates a
|
||||
viable config line based on each item by mapping over it with the `enableJS`
|
||||
function. Since the Qutebrowser config syntax can't read the nix list syntax,
|
||||
the items of the resulting list and than concatenated using `\n` or a newline
|
||||
character.
|
||||
|
||||
# XMonad
|
||||
|
||||
My XMonad configuration has a bunch of weird shit in it, some of which I'm proud
|
||||
of, some of which still has bugs that I keep telling myself I will get to At
|
||||
Some Point™. Here are some of the nicer bits.
|
||||
|
||||
## Volume control using scroll wheel
|
||||
|
||||
I have bound `Super + scroll {up,down}` bound to {increase,decrease} volume
|
||||
respectively.
|
||||
|
||||
```haskell
|
||||
...
|
||||
, ((modMask, button4), \_ -> safeSpawn "pulsemixer" ["--change-volume","+1"])
|
||||
, ((modMask, button5), \_ -> safeSpawn "pulsemixer" ["--change-volume","-1"])
|
||||
, ((modMask .|. shiftMask, button4), \_ -> safeSpawn "pulsemixer" ["--change-volume","+5"])
|
||||
, ((modMask .|. shiftMask, button5), \_ -> safeSpawn "pulsemixer" ["--change-volume","-5"])
|
||||
...
|
||||
|
||||
```
|
||||
|
||||
The hard part here was coming to the realisation that using a lambda that
|
||||
discards its argument was the best way to handle interactions while satisfying
|
||||
the type signature.
|
||||
|
||||
Other than that, these functions are quite straightforward. `button4` is 'scroll
|
||||
up' while `button5` is 'scroll down'. I don't recall where I found this, but it
|
||||
was somewhere in the documentation. As a result, when XMonad registers a
|
||||
combination of `modMask` and either of the scroll directions, it uses
|
||||
`pulsemixer` to increase or decrease the volume.
|
||||
|
||||
## Kitty wrappers
|
||||
|
||||
I use the [Kitty terminal](https://sw.kovidgoyal.net/kitty/). Kitty has a huge
|
||||
feature list, of which I feel like I use about 20% at most. One of these
|
||||
features is the ability to override config options using the `-o` parameter.
|
||||
This allows you to set a different font(size) or colorscheme or what have you.
|
||||
|
||||
I wanted to be able to start a `BQN` repl with the BQN386 font right from my
|
||||
window manager. So I wrote a few functions that take various arguments and
|
||||
supply them to Kitty without excessive syntax.
|
||||
|
||||
The simplest one of these is `kittyWithOverrides`. It can only take a list of
|
||||
`-o` parameters.
|
||||
|
||||
```haskell
|
||||
kittyWithOverrides :: [String] -> X ()
|
||||
kittyWithOverrides = spawn . ("kitty " ++) . (unwords . map ("-o " ++))
|
||||
```
|
||||
|
||||
Here is how I use this function to create a `BQN` repl window function:
|
||||
|
||||
```haskell
|
||||
largeTextBQN shell = [ "font_size=17"
|
||||
, "font_family='BQN386 Unicode'"
|
||||
, "shell='" ++ shell ++ "'"
|
||||
]
|
||||
|
||||
bqn = kittyWithOverrides $ largeTextBQN "bqn"
|
||||
```
|
||||
|
||||
_Note:_ I use a `largeTextBQN` function rather than a `where` binding, because I
|
||||
use the same settings for a few other repls as well.
|
||||
|
||||
This string will evaluate to the following at compile time:
|
||||
```
|
||||
kitty -o font_size=17 -o font_family='BQN386 Unicode' -o shell='/nix/store/6xwwmv4ljbfckkyklh512zxy6l9s0wv4-cbqn-standalone-0.4.0/bin/bqn'
|
||||
```
|
||||
|
||||
…which will then be fed to `spawn`, thereby executing it. If I were to spend
|
||||
more time on it, I could figure out a way to do this properly using `safeSpawn`
|
||||
or one of its variants, but as it stands, I'm too lazy to do so.
|
||||
|
||||
For a more general interface I wrote a `kittyWithParams` function:
|
||||
|
||||
```haskell
|
||||
kittyWithParams :: [(String,String)] -> X ()
|
||||
kittyWithParams = spawn . ("kitty " ++) . unwords . map unwrapParams
|
||||
where unwrapParams (flag,parameter) = case last flag of
|
||||
'=' -> flag ++ parameter
|
||||
_ -> flag ++ " " ++ parameter
|
||||
```
|
||||
|
||||
Comparatively, it is rather messy. Still, the basic functionality is there and
|
||||
I'm quite happy with how it works.
|
|
@ -21,11 +21,11 @@ in my path, largely without a care in the world. Or rather, that's how it feels.
|
|||
|
||||
Where Deadlink succeeds- and Doom Etenral fails is the implementation of
|
||||
weakspots. In Eternal, if you want to shoot a weakspot, you don't have much of a
|
||||
choice but to switch to the machinegun or not-railgun; those being the only
|
||||
precision weapons. In Deadlink, if you manage to shoot some poor dude's head
|
||||
with a rocket launcher, the game will still give you the weakspot damage --
|
||||
despite normal enemies being able to withstand about a quarter of a rocket to
|
||||
the feet at most.
|
||||
choice but to switch to the machinegun or not-railgunb (I forget its actual
|
||||
name); those being the only precision weapons. In Deadlink, if you manage to
|
||||
shoot some poor dude's head with a rocket launcher, the game will still give you
|
||||
the weakspot damage -- despite normal enemies being able to withstand about a
|
||||
quarter of a rocket to the feet at most.
|
||||
|
||||
Another big mistake that Eternal makes is the tutorialising every restrictive
|
||||
mechanic that it introduces, while Deadlink lets the player largely figure out
|
||||
|
|
|
@ -16,11 +16,3 @@ I have got to say that the theming of SearXNG has improved quite a lot either ov
|
|||
At the very least I think the default theme looks quite nice these days.
|
||||
|
||||
{{< noscript content="SearXNG does make use of JavaScript for certain functions, but it's purely to make using it a smoother experiece and it's perfectly functional without JavaScript." >}}
|
||||
|
||||
# [Alpine repository](https://alpine.voidcruiser.nl)[(onion)](http://imerwns46jfdawado7xxb42i2kx7wjy6eyzugxehehxluh4hjqpebmyd.onion)
|
||||
|
||||
I use [suckless' dwm](https://dwm.suckless.org) on every other machine I use.
|
||||
Since I can't be bothered to always keep cloning the repo, I thought I'd make package based on it.
|
||||
Why Alpine of all things? It's my second most used distro after Debian.
|
||||
Since it's as lightweight as it is, I'd say it's a natural fit for suckless utilities.
|
||||
(also perhaps because the process of making package was really quite easy).
|
||||
|
|
Loading…
Reference in a new issue