Compare commits

...

338 Commits

Author SHA1 Message Date
Colin 7bb7a24b22 sanebox: tidy up the quoting in a few more edge-cases 2024-05-18 00:00:03 +00:00
Colin 795786f46b sanebox: prefer `case` statments over if/elif/elif... constructs 2024-05-17 23:32:51 +00:00
Colin 26aa68ee59 sanebox: replace short-circuit eval idiom with if/else 2024-05-17 23:21:36 +00:00
Colin 85c0e72bf1 sanebox: remove unnecessary quotes in case statement 2024-05-17 23:15:00 +00:00
Colin bf98da0061 sanebox: remove extraneous quotes
probably some still remain
2024-05-17 23:01:24 +00:00
Colin 76434b6970 sanebox: make it more obvious what we substitute at build-time 2024-05-17 22:27:55 +00:00
Colin 0698d4be24 landlock-sandboxer: define meta.mainProgram 2024-05-17 22:26:55 +00:00
Colin afb9d273ab servo: re-enable slskd 2024-05-17 22:00:46 +00:00
Colin 0003d79324 sane-tag-music: add a `print-missing` subcommand 2024-05-17 09:41:50 +00:00
Colin e9bfc6cebd sane-tag-music: fix help message formatting 2024-05-17 09:20:33 +00:00
Colin aeed9ffd5b sane-sync-music: prune directories left empty by sync 2024-05-17 08:59:36 +00:00
Colin 9c27b8e864 swaync: sort icons 2024-05-17 08:42:35 +00:00
Colin af34d395fc swaync: fix Discord icon 2024-05-17 07:18:23 +00:00
Colin 008b659a10 swaync: reorder icons 2024-05-17 05:49:28 +00:00
Colin 1ce2839df9 swaync: clean up icons a bit more 2024-05-17 05:45:15 +00:00
Colin 022d15c2c7 swaync: increase font size of service icons 2024-05-17 03:42:32 +00:00
Colin 908a2ca6c3 swaync: fix a bug that i couldnt see all icons on the same row 2024-05-17 03:21:41 +00:00
Colin 614eebfdc0 todo.md: document a sandbox link cache bug 2024-05-17 03:21:11 +00:00
Colin 42fb79b025 swaync: improve gnome-calls icon 2024-05-17 00:49:40 +00:00
Colin 4265ea9b99 calls: auto-start 2024-05-17 00:41:32 +00:00
Colin a7d376778e gnome-calls: re-enable 2024-05-17 00:36:56 +00:00
Colin 157af52112 feeds: add Grumpy.website 2024-05-16 19:25:22 +00:00
Colin c7838486d3 nixpkgs: 2024-05-14 -> 2024-05-16, nixpkgs-wayland
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/a47743431bb52c25eecbeda1bb2350902478befe' (2024-05-14)
  → 'github:nixos/nixpkgs/1887e39d7e68bb191eb804c0f976ad25b3980595' (2024-05-16)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/18198ef6f41074a6b42318dacb6fa4712b893ba4' (2024-05-14)
  → 'github:nixos/nixpkgs/977a49df312d89b7dfbb3579bf13b7dfe23e7878' (2024-05-16)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/ce959368cbc8202181f37a464c825d54720b6b68' (2024-05-14)
  → 'github:nix-community/nixpkgs-wayland/5e2c5345f3204c867c9d4183cbb68069d0f7a951' (2024-05-16)
• Updated input 'nixpkgs-wayland/nix-eval-jobs':
    'github:nix-community/nix-eval-jobs/63154bdfb22091041b307d17863bdc0e01a32a00' (2024-05-09)
  → 'github:nix-community/nix-eval-jobs/bb95091f6c6f38f6cfc215a1797a2dd466312c8b' (2024-05-15)
```
2024-05-16 09:46:40 +00:00
Colin 1ac5b56f34 todo.md: task to fix ip netns sandboxing 2024-05-16 09:42:05 +00:00
Colin 5924d092f4 coturn: expand documentation 2024-05-16 09:41:53 +00:00
Colin 63cbcb0896 todo.md: add a few improvements to make 2024-05-16 04:39:35 +00:00
Colin 7cff078698 todo.md: remove completed items 2024-05-16 04:10:09 +00:00
Colin a5f6aae6f5 desko: use stock systemd resolver
i need a backup system to use when things are broken, and this helps with debugging as well
2024-05-16 03:12:30 +00:00
Colin fd94422982 distcc: purge 2024-05-16 02:51:38 +00:00
Colin 55a7119e3f ccache: purge 2024-05-16 02:51:03 +00:00
Colin d258d4ddd5 desko: re-enable firewall 2024-05-16 02:49:03 +00:00
Colin c39aab34e0 refactor: nix_serve_privkey -> nix_signing_key 2024-05-16 02:48:16 +00:00
Colin 9d725a0974 servo: disable unused nixcache.uninsane.org 2024-05-16 02:46:23 +00:00
Colin 4a15339e0e desko: re-introduce the nix_serve key, which is actually needed for SSH deployements, not just nix-serve 2024-05-16 02:43:32 +00:00
Colin df4ef0ce5a desko: disable nix-serve 2024-05-16 02:35:27 +00:00
Colin 3bb5546aaf systemd-logind: fix to not sleep when i close the lid (again) 2024-05-16 02:13:02 +00:00
Colin 4de3c6d664 sanebox: fix tab typo when parsing the link cache 2024-05-16 00:15:57 +00:00
Colin b5502ea401 sanebox: remove --sanebox-cache-symlink flag 2024-05-15 23:59:38 +00:00
Colin 1211023c55 modules/programs: remove dead code from per-user profiles 2024-05-15 23:58:10 +00:00
Colin b4229ecb1e sanebox: load the link cache from a static /etc path instead of via CLI args 2024-05-15 23:55:15 +00:00
Colin 348837ff4a programs: sandboxing: replace profiles with raw CLI args 2024-05-15 09:13:20 +00:00
Colin 17eaa7446a sanebox: remove all profile-related features except for direct, path-based profile loading 2024-05-15 09:13:20 +00:00
Colin 530664294a programs: sandbox: always specify --sanebox-profile-dir instead of loading from XDG_DATA_DIRS 2024-05-15 08:54:16 +00:00
Colin b649071d98 programs: sandboxing: make the profiles be generic across users
this is a step toward making the profile not even be dynamically loaded, since its content is no longer dynamic :)
2024-05-15 08:48:09 +00:00
Colin ea2653b7ce programs: sandboxing: pass home- and runtime-relative paths to the sandboxer, instead of making absolute first 2024-05-15 08:20:09 +00:00
Colin d97f0f7300 sanebox: implement --sanebox-home-path and --sanebox-run-path flags 2024-05-15 08:05:00 +00:00
Colin ee43fcdb89 rename LG TV -> Cuddlevision 2024-05-15 07:50:38 +00:00
Colin 4c1b1282d6 modules/programs: sandbox: be compatible with systemd resolved again 2024-05-15 02:57:40 +00:00
Colin bc73a16475 networkmanager: fix to be compatible when systemd-resolved is enabled 2024-05-15 02:57:40 +00:00
Colin adfaa7f9c1 sane-sandboxed -> sanebox 2024-05-15 01:41:40 +00:00
Colin f9a6873ee9 signal-desktop: remove NIXOS_OZONE_WL=1 hack (no longer required) 2024-05-15 00:10:00 +00:00
Colin 66f73c92bd trust-dns: asSystemResolver: listen also on ipv6 address 2024-05-14 23:38:01 +00:00
Colin d5e8974a4a refactor: trust-dns: listenAddrs -> listenAddrsIpv4 2024-05-14 23:22:50 +00:00
Colin e040a5b0c5 servo: trust-dns: remove hn-resolver
my hosts run their own recursive DNS resolvers now, so there's no need for the wireguard VPN to provide them with that
2024-05-14 23:20:19 +00:00
Colin d2ac88d66d nixpatches: upstream the gnome-keyring cross compilation patch 2024-05-14 23:12:59 +00:00
Colin b534af5203 signal-desktop: use nixpkgs' nodejs instead of the signal pin
it still seems stable
2024-05-14 23:12:41 +00:00
Colin b06b75441c signal-desktop: 7.0.0 -> 7.8.0 2024-05-14 23:05:00 +00:00
Colin 1f405fb2ba element-desktop: update electron_28 -> electron_29 2024-05-14 22:32:56 +00:00
Colin ffe9dcedf7 koreader: 2024.03 -> 2024.04 2024-05-14 22:12:23 +00:00
Colin fc649de64c fractal: remove dead code 2024-05-14 20:56:50 +00:00
Colin 1210696e3a fractal: re-enable jpeg decoding 2024-05-14 20:56:37 +00:00
Colin 47ced34c84 fractal: 6-unstable-2024-01-31 -> 7 2024-05-14 20:15:27 +00:00
Colin ae7034d942 nixpkgs: 2024-05-13 -> 2024-05-14; nixpkgs-wayland
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/eda36d7cf3391ad06097009b08822fb74acd5e00' (2024-05-13)
  → 'github:nixos/nixpkgs/a47743431bb52c25eecbeda1bb2350902478befe' (2024-05-14)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/0a949cf2618e8eab83aa008f1f8e03db137ed36c' (2024-05-13)
  → 'github:nixos/nixpkgs/18198ef6f41074a6b42318dacb6fa4712b893ba4' (2024-05-14)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/ed18785b8816fa878bdd9df7f2e8722695401ef8' (2024-05-13)
  → 'github:nix-community/nixpkgs-wayland/ce959368cbc8202181f37a464c825d54720b6b68' (2024-05-14)
```
2024-05-14 18:04:22 +00:00
Colin f3cf9e0bed trust-dns: set it to NOT be the system resolver for servo
trust-dns recursor is too beta for servo
2024-05-14 09:03:10 +00:00
Colin 3a7c9022af trust-dns: bump StartLimitBurst so systemd doesnt abort the service too early 2024-05-14 08:50:37 +00:00
Colin 2a199bf373 trust-dns: recursor: merge DHCP DNS servers from all non-downed connections
otherwise overwriting the toml configs gets messy, when interfaces come up in unpredictable order
2024-05-14 08:25:59 +00:00
Colin 53198128e8 trust-dns: hook NetworkManager for state changes
there may be some edgecases to sort out around e.g. first-run,
but so far it seems to be importing the DHCP search zones :)
2024-05-14 07:42:41 +00:00
Colin bee3eea040 modules/programs: sandbox: remove no-longer-needed /run/systemd/resolve from sandbox 2024-05-14 04:18:29 +00:00
Colin 1e202baa8a networkmanager: tune config
mostly just pruning unused features
2024-05-14 04:18:29 +00:00
Colin 39eb1d150a dns: deploy trust-dns as the default recursive resolver
outstanding issues: native.uninsane.org doesn't resolve. appears possibly to be an issue with following CNAMEs
2024-05-14 04:18:29 +00:00
Colin 68e6666819 trust-dns: use my patched version 2024-05-14 04:18:29 +00:00
Colin 447e1feb9c sway: fix Super+L shortcut to actually lock 2024-05-14 04:17:05 +00:00
Colin 26e3c3e5b7 s6-rc: fix `persist.byStore.persist` typo 2024-05-14 04:16:50 +00:00
Colin 38c038f4f7 sane-sandboxed: fix typo in linkCache queries, which would otherwise break for paths containing spaces 2024-05-14 01:22:08 +00:00
Colin 3557994cbb gnome-clocks: fix sound an sandboxing artifacts 2024-05-14 01:21:37 +00:00
Colin f3106ee316 programs: maxBuildCost: fix to actually build everything by default 2024-05-13 22:57:40 +00:00
Colin bef0099eec scripts/clean: fix to cleanup more dangling `result` symlinks 2024-05-13 22:45:33 +00:00
Colin 67434caf45 scripts: add a script to clean the git dir 2024-05-13 22:45:33 +00:00
Colin be84ab1f45 programs: set `buildCost=1` for assorted low-priority programs 2024-05-13 22:45:33 +00:00
Colin 43d32641f3 programs: buildCost: introduce a new level between `min` and `light` 2024-05-13 22:45:33 +00:00
Colin 9bf0dbabae gnome.seahorse: disable 2024-05-13 22:45:33 +00:00
Colin 8c7880774e monero-gui: disable 2024-05-13 22:45:33 +00:00
Colin 5774aa4a8f zulip: dont ship 2024-05-13 22:45:33 +00:00
Colin 6c6d11578e cross: fix `curl-impersonate-chome` build 2024-05-13 22:45:33 +00:00
Colin f33e960bdf cross: gnome-keyring: patch via nixpkgs patch instead of override 2024-05-13 22:45:33 +00:00
Colin 14202a5bcc neovim: wrap in such a way as to avoid cross-compilation-specific patching 2024-05-13 22:45:33 +00:00
Colin 3d2babf2bb overlays/cross: sync upstreaming status 2024-05-13 22:45:33 +00:00
Colin 9d51b2ecc7 nixpatches: stop applying patches i dont need 2024-05-13 22:45:33 +00:00
Colin 0b855efb5f nixpkgs: bump; nixpkgs-wayland: bump
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/6a217e9b1d39415076c7a6cfc44be5e935e7a839' (2024-05-13)
  → 'github:nixos/nixpkgs/eda36d7cf3391ad06097009b08822fb74acd5e00' (2024-05-13)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/6bc8c8a7ac13182ee24a5e2caab7ad739f1c55c5' (2024-05-13)
  → 'github:nixos/nixpkgs/0a949cf2618e8eab83aa008f1f8e03db137ed36c' (2024-05-13)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/5f7272dff81558143f93e2cb32189a52ef965892' (2024-05-13)
  → 'github:nix-community/nixpkgs-wayland/ed18785b8816fa878bdd9df7f2e8722695401ef8' (2024-05-13)
```
2024-05-13 22:45:33 +00:00
Colin 2ae286ff75 nixpkgs: 2024-05-08 -> 2024-05-13, nixpkgs-wayland, sops-nix
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/c8e3f684443d7c2875ff169f6ef2533534105e7b' (2024-05-08)
  → 'github:nixos/nixpkgs/6a217e9b1d39415076c7a6cfc44be5e935e7a839' (2024-05-13)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/a751e2faa2fc94c1337c32aaf6a6e417afe90be9' (2024-05-08)
  → 'github:nixos/nixpkgs/6bc8c8a7ac13182ee24a5e2caab7ad739f1c55c5' (2024-05-13)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/7dc8fb2aa7db995ac1ce2a8f2f8d8784b2af591c' (2024-05-08)
  → 'github:nix-community/nixpkgs-wayland/5f7272dff81558143f93e2cb32189a52ef965892' (2024-05-13)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/26fabca301e1133abd3d9192b1bcb6fb45b30f1d' (2024-05-05)
  → 'github:nix-community/lib-aggregate/09883ca828e8cfaacdb09e29190a7b84ad1d9925' (2024-05-12)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/4b620020fd73bdd5104e32c702e65b60b6869426' (2024-05-05)
  → 'github:nix-community/nixpkgs.lib/58e03b95f65dfdca21979a081aa62db0eed6b1d8' (2024-05-12)
• Updated input 'nixpkgs-wayland/nix-eval-jobs':
    'github:nix-community/nix-eval-jobs/7b6640f2a10701bf0db16aff048070f400e8ea7c' (2024-04-23)
  → 'github:nix-community/nix-eval-jobs/63154bdfb22091041b307d17863bdc0e01a32a00' (2024-05-09)
• Updated input 'nixpkgs-wayland/nix-eval-jobs/nixpkgs':
    'github:NixOS/nixpkgs/1e1dc66fe68972a76679644a5577828b6a7e8be4' (2024-04-22)
  → 'github:NixOS/nixpkgs/ad7efee13e0d216bf29992311536fce1d3eefbef' (2024-05-06)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/893e3df091f6838f4f9d71c61ab079d5c5dedbd1' (2024-05-06)
  → 'github:Mic92/sops-nix/b6cb5de2ce57acb10ecdaaf9bbd62a5ff24fa02e' (2024-05-12)
• Updated input 'sops-nix/nixpkgs-stable':
    'github:NixOS/nixpkgs/b980b91038fc4b09067ef97bbe5ad07eecca1e76' (2024-05-04)
  → 'github:NixOS/nixpkgs/8e47858badee5594292921c2668c11004c3b0142' (2024-05-11)
```
2024-05-13 22:45:33 +00:00
Colin a05fa53ee1 curlftpfs: EXPERIMENT: double the connect timeout to see if this reduces dropped conns 2024-05-13 07:52:43 +00:00
Colin 46d95805e9 programs: simplify sandbox symlink closure code 2024-05-13 07:49:00 +00:00
Colin 9346a066d1 sane-sandboxed: fix typo in `derefOnce` 2024-05-13 06:49:43 +00:00
Colin 567531727e sane-sandboxed: fix typos in `normPath` 2024-05-13 06:32:13 +00:00
Colin 6c65e4b313 sane-sandboxed: be a little more careful with out vars 2024-05-13 04:00:15 +00:00
Colin e6b13adb61 sane-open: associate `rofi-applications.desktop` with keyboard 2024-05-13 03:19:03 +00:00
Colin bd3e06982b sane-sandboxed: tweak symlink caching to allow /run/current-system to be bind-mounted instead of symlinked 2024-05-13 02:11:47 +00:00
Colin 660ba94c7c sane-sandboxed: introduce a symlink cache to reduce `readlink` calls even more
it's all a bit silly. i still do a bunch of -L tests: i just avoid the costly readlink fork :|
2024-05-13 01:31:30 +00:00
Colin 11ddce043d sane-sandboxed: reduce forking (use out vars) 2024-05-12 22:35:05 +00:00
Colin 980fe6b33c sane-sandboxed: use `local` where applicable 2024-05-12 22:15:34 +00:00
Colin 016df3ff74 sane-open: launch some .desktop files even when they point outside ~/.local/share/applications
an unfortunate reality is that symlinks tend to get dereferenced too
early by other programs.
2024-05-12 22:13:28 +00:00
Colin d827235d31 sane-sandboxed: be more strict internally about keeping `paths` var as absolute-paths 2024-05-12 21:44:33 +00:00
Colin f7a25d1421 sane-sandboxed: bwrap: expose symlinks to the sandbox directly, instead of binding
some things (e.g. `sane-open`) require the symlink, and lose too much
info when working only with the bind. having the sandboxed environment
stay similar to the out env sould make debugging things simpler
2024-05-12 21:42:31 +00:00
Colin d148b19767 sane-sandboxed: expand symlinks before binding them into the sandbox 2024-05-12 21:41:49 +00:00
Colin 89135d08cb rofi: file browser: include an entry to open the app launcher 2024-05-12 19:46:51 +00:00
Colin 15a5afd2c4 sane-open: special-case how i open .desktop files to be compatible with portals 2024-05-12 19:46:03 +00:00
Colin e63e359417 sane-open: fix so we can launch read-only files 2024-05-12 17:50:11 +00:00
Colin 3c1a74998e applications: hide .desktop files which arent meant to be user-visible 2024-05-12 17:43:07 +00:00
Colin eadf85f66d sane-open: associate as the default launcher for .desktop files 2024-05-12 17:41:00 +00:00
Colin 536eb2154a sane-open: add auto-keyboard action for a few more apps 2024-05-12 17:23:08 +00:00
Colin e62365436c sane-cast: implement `--device` option to choose a specific device non-interactively 2024-05-11 00:40:38 +00:00
Colin 4b04c283b6 fcitx5: temporarily disable 2024-05-10 17:51:37 +00:00
Colin def5816003 sane-vpn: fix "regions" printing to print all regions 2024-05-10 09:07:59 +00:00
Colin 6f2ae56126 sane-cast: add an --always-ask option 2024-05-10 07:01:16 +00:00
Colin a40f05260a unl0kr: simplify the crash edge-case handling 2024-05-09 08:42:41 +00:00
Colin 2b539fafcd unl0kr: handle some crashy edgecases 2024-05-09 08:38:22 +00:00
Colin 954c5c8344 trust-dns: fix so it starts as part of boot 2024-05-09 07:19:17 +00:00
Colin 2a8ecf0423 nixpkgs: 2024-04-28 -> 2024-05-08; nixpkgs-wayland, sops-nix
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/0e395f4da1693e39239ffac7abf73a0a6931c961' (2024-04-28)
  → 'github:nixos/nixpkgs/c8e3f684443d7c2875ff169f6ef2533534105e7b' (2024-05-08)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/93909e9c7b05634ad924ff97c259ae0859b81756' (2024-04-28)
  → 'github:nixos/nixpkgs/a751e2faa2fc94c1337c32aaf6a6e417afe90be9' (2024-05-08)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/4e58e2cf22d11426ed2f997551f3650de0639e3a' (2024-04-28)
  → 'github:nix-community/nixpkgs-wayland/7dc8fb2aa7db995ac1ce2a8f2f8d8784b2af591c' (2024-05-08)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/49d9b510614b9bd137e067eb31445a8feca83313' (2024-04-28)
  → 'github:nix-community/lib-aggregate/26fabca301e1133abd3d9192b1bcb6fb45b30f1d' (2024-05-05)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/ade4fb7bbf04cd52bc1705734d5dc67755d77ec9' (2024-04-28)
  → 'github:nix-community/nixpkgs.lib/4b620020fd73bdd5104e32c702e65b60b6869426' (2024-05-05)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/f1b0adc27265274e3b0c9b872a8f476a098679bd' (2024-04-23)
  → 'github:Mic92/sops-nix/893e3df091f6838f4f9d71c61ab079d5c5dedbd1' (2024-05-06)
• Updated input 'sops-nix/nixpkgs-stable':
    'github:NixOS/nixpkgs/74574c38577914733b4f7a775dd77d24245081dd' (2024-04-20)
  → 'github:NixOS/nixpkgs/b980b91038fc4b09067ef97bbe5ad07eecca1e76' (2024-05-04)
```
2024-05-09 05:26:23 +00:00
Colin a056ca84be todo.md: fix multiple-schlocks bug 2024-05-07 15:26:08 +00:00
Colin 8d8bf00a34 s6-rc: use `s6-rc stop` instead of exiting 125 in the no-restart branch of "restartCondition = on-failure"
exiting 125 stops the service, but does NOT put it in the down state, preventing it from being re-started
2024-05-07 15:24:14 +00:00
Colin f58bcb4767 swaylock, schlock: convert to services 2024-05-07 15:02:46 +00:00
Colin 4f56acc316 s6-rc: implement `restartCondition` to allow restarting of the service only on failure 2024-05-07 15:01:40 +00:00
Colin fdf1b20368 s6-rc: propagate service status out of `run` script 2024-05-07 12:50:09 +00:00
Colin c12691a3a0 todo.md: document multi-instance schlock issue 2024-05-06 17:31:54 +00:00
Colin 06bfa05ec1 todo.md: complete swaync modem toggle perm bug 2024-05-06 17:29:41 +00:00
Colin 32e06ce998 programs: gnome-disk-utility: grant sandbox access to ~/tmp 2024-05-06 05:15:28 +00:00
Colin c0a7b831cd sane-open: more robust auto-application/file detection 2024-05-05 05:19:07 +00:00
Colin 8c04023eba sway: fix sane-open integration to not mistake it as a file 2024-05-05 05:04:25 +00:00
Colin cf3cfc5249 sane-open: add debug logging 2024-05-05 05:03:22 +00:00
Colin a1625ea41d programs: ship zulip 2024-05-04 08:28:48 +00:00
Colin 2cedd2beb4 readme: fix renamed `users.nix` -> `users/default.nix` 2024-05-02 10:30:41 +00:00
Colin 6544b9aca4 doc: dns: fix typo 2024-05-02 10:27:38 +00:00
Colin 08a9b838e5 sane-input-handler: fix log bog 2024-04-30 19:22:37 +00:00
Colin b7dd40e558 sane-open-desktop -> sane-open and have it auto-open/close the keyboard based on what an app wants 2024-04-30 19:22:37 +00:00
Colin 7f2abf7e6e sane-input-handler: fix missing newline when logging 2024-04-30 15:30:39 +00:00
Colin 825812e511 sane-input-handler: reset rofi directory to ~ when using the app + fsbrowser 2024-04-30 15:29:00 +00:00
Colin 69e5495cc9 sane-input-handler: set keyboard as appropriate for file/app browser 2024-04-30 15:16:59 +00:00
Colin b422f15b59 sane-input-handler: swap volup tap/hold actions 2024-04-30 14:38:17 +00:00
Colin 889b332ade trust-dns: split the parts which are generalizable into their own file
i can try to build this into a recursive resolver for *all* my hosts
2024-04-30 14:35:56 +00:00
Colin 46d1a49f0f servo: enable `sane-cast` program 2024-04-29 21:50:03 +00:00
Colin 1b156dcb0a networkmanager: fix eval error when not enabled 2024-04-29 05:58:32 +00:00
Colin efd2f14a13 nixpkgs: 2024-04-27 -> 2024-04-28; nixpkgs-wayland
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/19c30e016f04874d60ed0922bf58be4aa9a15e53' (2024-04-27)
  → 'github:nixos/nixpkgs/0e395f4da1693e39239ffac7abf73a0a6931c961' (2024-04-28)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/77759bd39047f1b92f12b26b55029f0cc2c88093' (2024-04-27)
  → 'github:nixos/nixpkgs/93909e9c7b05634ad924ff97c259ae0859b81756' (2024-04-28)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/ff41a88e80aaf3ae1561cc6a54636fc46f9214de' (2024-04-27)
  → 'github:nix-community/nixpkgs-wayland/4e58e2cf22d11426ed2f997551f3650de0639e3a' (2024-04-28)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/3b32a98eb3053f8c8ca55497d1881443ef2996e6' (2024-04-21)
  → 'github:nix-community/lib-aggregate/49d9b510614b9bd137e067eb31445a8feca83313' (2024-04-28)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/6882347415e352cfc9c277cc01f73e0f5cb7b93c' (2024-04-21)
  → 'github:nix-community/nixpkgs.lib/ade4fb7bbf04cd52bc1705734d5dc67755d77ec9' (2024-04-28)
```
2024-04-29 04:16:33 +00:00
Colin d4d06d037c replace pipewire ffadoSupport toggle with a patch to fix cross compilation 2024-04-28 15:07:28 +00:00
Colin 9525c09c41 cross: remove obsoleted gpodder patch 2024-04-27 17:10:50 +00:00
Colin e5876a1e5b nixpkgs: 2024-04-26 -> 2024-04-27; nixpkgs-wayland -> 2024-04-27
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/7d3f4eadec32d447a5f20d87fa309f00986cb288' (2024-04-26)
  → 'github:nixos/nixpkgs/19c30e016f04874d60ed0922bf58be4aa9a15e53' (2024-04-27)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/0b868df4ced96400774414f5baf30b696215b98f' (2024-04-26)
  → 'github:nixos/nixpkgs/77759bd39047f1b92f12b26b55029f0cc2c88093' (2024-04-27)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/ca9d278400c170935a95dd75e7e2537c2afd1cb7' (2024-04-26)
  → 'github:nix-community/nixpkgs-wayland/ff41a88e80aaf3ae1561cc6a54636fc46f9214de' (2024-04-27)
```
2024-04-27 16:18:28 +00:00
Colin 1757ea4492 cross: upstream eyeD3 patch 2024-04-27 13:31:47 +00:00
Colin 39d31c3ffd swaync-service-dispatcher: add `-b` to block on service state query, to avoid incorrect responses when run in parallel 2024-04-27 12:32:12 +00:00
Colin c50ef59102 swaync: fix service state tracking for oneshot services 2024-04-27 12:13:34 +00:00
Colin 5fc4ca6dad modemmanager: ship udev rules 2024-04-27 12:01:01 +00:00
Colin 35c7527946 modemmanager: fix so it's active on boot 2024-04-27 11:54:08 +00:00
Colin 7e8a014f37 NetworkManager: use the upstream service file 2024-04-27 10:58:21 +00:00
Colin 4ce951bbed wpa_supplicant: re-enable 2024-04-27 10:34:25 +00:00
Colin f784550b9b networkmanager: migrate from nixpkgs service to my own 2024-04-27 09:51:55 +00:00
Colin 1f2bbd4aec refactor: split modemmanager stuff into own file 2024-04-27 08:32:15 +00:00
Colin 2389757581 firefox-extensions.browserpass-extension: 3.7.2-2023-06-18 -> 3.8.0 2024-04-27 08:32:05 +00:00
Colin 9021ab9f05 s6: fix oneshot service runner
the runner previously couldn't find the 'live' directory, where the service state lives. now it can
2024-04-27 08:05:54 +00:00
Colin 547d71c19a nixpkgs: 2024-04-24 -> 2024-04-26, nixpkgs-wayland
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/acba655f267a49327f2cea95003f17b8540909c0' (2024-04-24)
  → 'github:nixos/nixpkgs/7d3f4eadec32d447a5f20d87fa309f00986cb288' (2024-04-26)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/1eb9a6980dee3970850f47ba8139c7402f54a9a0' (2024-04-24)
  → 'github:nixos/nixpkgs/0b868df4ced96400774414f5baf30b696215b98f' (2024-04-26)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/80659e4b2805654de851996e682b063a5d7eea5e' (2024-04-24)
  → 'github:nix-community/nixpkgs-wayland/ca9d278400c170935a95dd75e7e2537c2afd1cb7' (2024-04-26)
```
2024-04-27 06:33:24 +00:00
Colin 79bba42768 s6-rc: fix oneshot services to generate `up`, not `run` 2024-04-27 06:33:24 +00:00
Colin 8dd4fe06f3 s6: longshot -> longrun (typo) 2024-04-27 05:22:35 +00:00
Colin 19115dfb65 eg25-control: port to s6 (hopefully) 2024-04-26 21:44:13 +00:00
Colin 4c0ae75b00 todo.md: more context for the uosc volume issue 2024-04-26 17:21:32 +00:00
Colin 34842c00fe moby: make the modem powerable by the user, without root
this should allow migrating eg25-control to a user service
2024-04-26 17:19:38 +00:00
Colin 46a513b263 feeds: subscribe to SamuelDR 2024-04-26 17:19:38 +00:00
Colin 6129fbf2b3 lemmy: upstream the proxy headers 2024-04-26 16:44:43 +00:00
Colin 242541304e todo.md: document a few moby bugs around modem 2024-04-26 13:05:34 +00:00
Colin f3d2dee470 lemmy: fix federation (broke due to invalid HTTP signatures) 2024-04-26 10:31:47 +00:00
Colin 3d207ab7bb coturn: allocate 256 ports instead of 16 2024-04-26 08:47:52 +00:00
Colin 95447eb765 goaccess: fix missing state dir 2024-04-26 08:47:09 +00:00
Colin 593268f620 coturn: run inside ovpns namespace 2024-04-26 08:01:34 +00:00
Colin 5c98a51cd6 dino: build without echo cancelation
this reduces CPU load on moby; it may also have implications for incoming call audio though, still sorting that out
2024-04-26 05:11:43 +00:00
Colin 4453bde815 dino: increase buffering 20ms -> 100ms (closer to 82ms, actually) 2024-04-25 11:28:22 +00:00
Colin 7843f9650a feeds: subscribe to The Amp Hour (podcast) 2024-04-25 05:54:10 +00:00
Colin 82dce71b9c feeds: add microarch.club podcast 2024-04-25 05:51:52 +00:00
Colin 8a981c3ca9 hackgregator: init at 2024-12-05
N.B.: it uses appstream/bwrap, and hence much be run with capsh --caps=
2024-04-25 03:56:57 +00:00
Colin 9c00c2c5cc zsh: add `exit` aliases: `ecit`, `exi5` 2024-04-25 01:51:45 +00:00
Colin aad645f2c5 nixpkgs: 2024-04-22 -> 2024-04-24; nixpkgs-wayland; sops-nix
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/fe2b7d6a922c875221671df6aa360b6e73d47e2f' (2024-04-22)
  → 'github:nixos/nixpkgs/acba655f267a49327f2cea95003f17b8540909c0' (2024-04-24)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/8a3f95b79ba3083cfff90752296ef8a52a6bec9a' (2024-04-22)
  → 'github:nixos/nixpkgs/1eb9a6980dee3970850f47ba8139c7402f54a9a0' (2024-04-24)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/f01c36f09cc5c2d77cbab4475528e06d6641bff4' (2024-04-22)
  → 'github:nix-community/nixpkgs-wayland/80659e4b2805654de851996e682b063a5d7eea5e' (2024-04-24)
• Updated input 'nixpkgs-wayland/nix-eval-jobs':
    'github:nix-community/nix-eval-jobs/6b03a93296faf174b97546fd573c8b379f523a8d' (2024-01-14)
  → 'github:nix-community/nix-eval-jobs/7b6640f2a10701bf0db16aff048070f400e8ea7c' (2024-04-23)
• Updated input 'nixpkgs-wayland/nix-eval-jobs/flake-parts':
    'github:hercules-ci/flake-parts/34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5' (2023-12-01)
  → 'github:hercules-ci/flake-parts/9126214d0a59633752a136528f5f3b9aa8565b7d' (2024-04-01)
• Updated input 'nixpkgs-wayland/nix-eval-jobs/nix-github-actions':
    'github:nix-community/nix-github-actions/93e39cc1a087d65bcf7a132e75a650c44dd2b734' (2023-11-28)
  → 'github:nix-community/nix-github-actions/5163432afc817cf8bd1f031418d1869e4c9d5547' (2023-12-29)
• Updated input 'nixpkgs-wayland/nix-eval-jobs/nixpkgs':
    'github:NixOS/nixpkgs/d6863cbcbbb80e71cecfc03356db1cda38919523' (2023-12-21)
  → 'github:NixOS/nixpkgs/1e1dc66fe68972a76679644a5577828b6a7e8be4' (2024-04-22)
• Updated input 'nixpkgs-wayland/nix-eval-jobs/treefmt-nix':
    'github:numtide/treefmt-nix/2961375283668d867e64129c22af532de8e77734' (2023-12-19)
  → 'github:numtide/treefmt-nix/49dc4a92b02b8e68798abd99184f228243b6e3ac' (2024-04-01)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/4371a1301c4d36cc791069d90ae522613a3a335e' (2024-04-22)
  → 'github:Mic92/sops-nix/f1b0adc27265274e3b0c9b872a8f476a098679bd' (2024-04-23)
```
2024-04-24 22:19:36 +00:00
Colin d01e49f566 pipewire: switch back to `bwrap` sandboxing and document limitations 2024-04-24 13:14:35 +00:00
Colin 7447d4879e pipewire: man: link to docs 2024-04-24 10:33:23 +00:00
Colin 215864e3d4 pipewire: reduce realtime priority so it doesnt crash moby gpu driver 2024-04-24 09:36:22 +00:00
Colin 0cbb81cfea WIP: pipewire: trying to tune so lima doesnt crash 2024-04-24 09:20:13 +00:00
Colin 9d7816a1cd koreader: fix sandboxing so that i can open links again 2024-04-24 01:02:02 +00:00
Colin 461aa5ede0 htop: include "PRIORITY" column 2024-04-23 12:01:15 +00:00
Colin b5874f4b49 sane-cast: fix casting for relative paths to mp4-only devices 2024-04-23 09:12:53 +00:00
Colin 10fc7bbb84 curlftpfs: document sandbox attempt 2024-04-23 09:08:05 +00:00
Colin 87e3f2a9ef pipewire: split rtkit into own file, and use defaults from pipewire project 2024-04-23 09:08:05 +00:00
Colin 5006692594 linux-megous: 6.7-20240306 -> 6.8-20240405 2024-04-23 09:08:05 +00:00
Colin 9481131daf pipewire: sandbox with landlock (so that rtkit integration works) and split rtkit into own file 2024-04-23 09:08:05 +00:00
Colin ae418fb2d1 valgrind: mark as not sandboxable 2024-04-23 09:08:05 +00:00
Colin c174eddddf wireplumber: sandbox such that it gets higher sched priority 2024-04-23 09:08:05 +00:00
Colin 6d74c6616c pipewire: shrink the mount sandbox 2024-04-23 09:08:05 +00:00
Colin 7db40fbf47 sane-cast: add a menu for choosing which device to cast to whenever there are multiple 2024-04-23 08:10:05 +00:00
Colin 152a5d4c92 sane-cast: integrate with mpv 2024-04-23 07:52:48 +00:00
Colin e33b7d7701 sane-cast: init 2024-04-23 07:37:17 +00:00
Colin 01e176d902 libjxl: fix hash 2024-04-23 05:42:24 +00:00
Colin fd771cdb2c fs: mount media/torrents instead of media/freeleech (the latter was removed) 2024-04-23 01:25:57 +00:00
Colin 243e8b831b libjxl cross patch: push upstream 2024-04-22 23:40:06 +00:00
Colin 9a8b4395f1 nixpkgs: 2024-04-19 -> 2024-04-22; nixpkgs-wayland, sops-nix
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/6ad1fe08582fcdfedb2cb7c31b4a016a227bd38a' (2024-04-19)
  → 'github:nixos/nixpkgs/fe2b7d6a922c875221671df6aa360b6e73d47e2f' (2024-04-22)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/40d15ed86dd08eff6a29e0a9abc416001d19cd67' (2024-04-19)
  → 'github:nixos/nixpkgs/8a3f95b79ba3083cfff90752296ef8a52a6bec9a' (2024-04-22)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/ab0f8d391a960764348935e6497fc62ba0d2378d' (2024-04-19)
  → 'github:nix-community/nixpkgs-wayland/f01c36f09cc5c2d77cbab4475528e06d6641bff4' (2024-04-22)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/f347ed9a1cab12c27541ed4d173e2f2d5c9bc0bb' (2024-04-14)
  → 'github:nix-community/lib-aggregate/3b32a98eb3053f8c8ca55497d1881443ef2996e6' (2024-04-21)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/361d8a4f443bbfab20bd6d222f9022b8c6665906' (2024-04-14)
  → 'github:nix-community/nixpkgs.lib/6882347415e352cfc9c277cc01f73e0f5cb7b93c' (2024-04-21)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/b94c6edbb8355756c53efc8ca3874c63622f287a' (2024-04-18)
  → 'github:Mic92/sops-nix/4371a1301c4d36cc791069d90ae522613a3a335e' (2024-04-22)
• Updated input 'sops-nix/nixpkgs-stable':
    'github:NixOS/nixpkgs/8494ae076b7878d61a7d2d25e89a847fe8f8364c' (2024-04-18)
  → 'github:NixOS/nixpkgs/74574c38577914733b4f7a775dd77d24245081dd' (2024-04-20)
```
2024-04-22 22:44:15 +00:00
Colin 4c7cd06212 go2tv: clarify compatibility 2024-04-22 12:45:55 +00:00
Colin d0de6a9254 sftpgo: reduce the passive port range
hopefully this eases the load on the upstream firewall's UPNP service
2024-04-22 12:08:23 +00:00
Colin 12f2798140 servo: sftpgo: move to own directory 2024-04-22 12:05:16 +00:00
Colin bd92076291 fontconfig: populate the cache directory even when cross compiling 2024-04-22 09:47:20 +00:00
Colin 9cbe774c5a sane-input-handler: fix power_hold -> power_tap_1_hold when inhibited by rofi 2024-04-22 06:27:33 +00:00
Colin b4653b20a2 moby: button map: move vol{up,down}_hold to only act in power-off, else they may falsely trigger during other power-on actions 2024-04-22 05:13:29 +00:00
Colin 2c011df252 moby: tweak button mappings
- power hold: toggle media
- power x1 -> hold: kill

now nothing in screenoff uses power x2, which means we can get to
screen-on without waiting for any timeout.
2024-04-22 05:10:35 +00:00
Colin 9d472bb290 sane-input-handler: clean up suggestedPrograms 2024-04-22 04:13:56 +00:00
Colin 95b21cbed9 moby: update improve button mappings
- power + volup: screenshot
- power + voldown: camera
- volup_hold: file browser
- remove modal media controls
2024-04-22 04:05:52 +00:00
Colin 82007c9b40 bonsai: store the config in ~/.config to allow easier online editing 2024-04-22 04:05:15 +00:00
Colin 50c72de4f9 megapixels: fix folder icon to actually open ~/Pictures/Photos 2024-04-22 00:16:46 +00:00
Colin 36237a3201 megapixels: remove unnecessary `~/tmp` directory from sandbox 2024-04-22 00:16:14 +00:00
Colin eb9df628e6 megapixels: remove unnecessary ~/.local/share/applications from sandbox 2024-04-21 23:49:29 +00:00
Colin 6e04e288ea todo.md: document rofi crashes 2024-04-21 23:21:43 +00:00
Colin a92960d778 megapixels: place photos in ~/Pictures/Photos instead of directly in ~/Pictures 2024-04-21 23:13:49 +00:00
Colin ef9b0e9309 megapixels: fix .dng -> .jpg conversion 2024-04-21 21:59:05 +00:00
Colin 350e00e0cd firefox: decrease scrollbar width 20px -> 14px 2024-04-21 21:08:07 +00:00
Colin e924363dfb sysvol: 2024-02-08 -> 2024-04-11
it no longer flashes the volume on init
2024-04-21 20:43:03 +00:00
Colin b12f31652c todo.md: update `blast` items 2024-04-21 11:15:22 +00:00
Colin b77e811ad4 blast-to-default: leverage sane-die-with-parent 2024-04-21 11:09:23 +00:00
Colin a000a722ba mpv: fix so sane-sysvol doesnt hang exit 2024-04-21 10:08:46 +00:00
Colin 4dde01245e mpv: sane_sysvol: fix non_blocking_popen to use metatables and be more readable 2024-04-21 03:47:01 +00:00
Colin f50c0a98c2 sane-sysvol -> sane_sysvol, sane-cast -> sane_cast
when a script contains a dash, mpv silently renames *parts* of it to _, which causes confusion
2024-04-21 00:27:30 +00:00
Colin 0625bfdd10 mpv: sane-cast: fix crash due to missing `table.concat` function 2024-04-21 00:24:46 +00:00
Colin 4dfee58d09 sops: fix sandbox path 2024-04-20 21:43:13 +00:00
Colin a7b8eb179b pipewire: move the clock quantum config into sane.programs proper
this ensures it's available in the sandbox
2024-04-20 09:09:05 +00:00
Colin f10bb6c86c sftpgo: adjust file mode to be compatible with Kodi 2024-04-20 08:07:00 +00:00
Colin a59a7b5346 feeds: podcasts: add Tech Tales 2024-04-19 21:46:03 +00:00
Colin 1bd715e57e nixpkgs: 2024-04-18 -> 2024-04-19; nixpkgs-wayland, sops-nix
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/19d2eb80a0e23daf1c4a8cf25b1011fbdb2260fb' (2024-04-18)
  → 'github:nixos/nixpkgs/6ad1fe08582fcdfedb2cb7c31b4a016a227bd38a' (2024-04-19)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/457c34178411e0072e59564ee7986e86255a6eff' (2024-04-18)
  → 'github:nixos/nixpkgs/40d15ed86dd08eff6a29e0a9abc416001d19cd67' (2024-04-19)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/7867aa617c6eb205b1ac1b71d98cd18a2561bb18' (2024-04-17)
  → 'github:nix-community/nixpkgs-wayland/ab0f8d391a960764348935e6497fc62ba0d2378d' (2024-04-19)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/cc535d07cbcdd562bcca418e475c7b1959cefa4b' (2024-04-15)
  → 'github:Mic92/sops-nix/b94c6edbb8355756c53efc8ca3874c63622f287a' (2024-04-18)
• Updated input 'sops-nix/nixpkgs-stable':
    'github:NixOS/nixpkgs/c27f3b6d8e29346af16eecc0e9d54b1071eae27e' (2024-04-13)
  → 'github:NixOS/nixpkgs/8494ae076b7878d61a7d2d25e89a847fe8f8364c' (2024-04-18)
```
2024-04-19 20:33:48 +00:00
Colin b7d2020f10 sane-tag-music: fix --help message 2024-04-19 07:29:20 +00:00
Colin 317996b609 clightning-sane: document the `status` command more 2024-04-19 07:29:20 +00:00
Colin e197f6f54d clightning-sane: fix build 2024-04-19 07:29:20 +00:00
Colin 135f63480b clightning-sane: add a help message 2024-04-19 07:29:20 +00:00
Colin d9ffa5bb5a wike: fix sandboxing for 3.0 2024-04-19 01:26:58 +00:00
Colin f59f13588f jackett/transmission/slskd: validate public IP address before starting 2024-04-18 20:05:59 +00:00
Colin c668a895d4 static-nix-shell: populate meta.mainProgram 2024-04-18 20:00:47 +00:00
Colin 9442a87311 sane-ip-check: add an --expect option to abort if IP address is not as expected 2024-04-18 19:46:16 +00:00
Colin 3bd56fb565 sane-ip-check: refactor: split out a `main` function 2024-04-18 19:42:16 +00:00
Colin bdc3b1ed0e sane-ip-check: port argument parsing to argparse 2024-04-18 19:40:44 +00:00
Colin 40af93a7fb feeds: add apenwarr 2024-04-18 17:29:50 +00:00
Colin cd4fc97bde nixpkgs: 2024-04-17 -> 2024-04-18; nixpkgs-wayland
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/73f2b40dfc3413958695ae66fca3a52ee68451d6' (2024-04-17)
  → 'github:nixos/nixpkgs/19d2eb80a0e23daf1c4a8cf25b1011fbdb2260fb' (2024-04-18)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/2528b053e7c482baa8cd93cdce81172c3f0a3cee' (2024-04-17)
  → 'github:nixos/nixpkgs/457c34178411e0072e59564ee7986e86255a6eff' (2024-04-18)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/b0260157fccc94f4fe5a09fb3a1b1f62a87ae397' (2024-04-17)
  → 'github:nix-community/nixpkgs-wayland/7867aa617c6eb205b1ac1b71d98cd18a2561bb18' (2024-04-17)
```
2024-04-18 06:56:13 +00:00
Colin a36ff517e7 servo: slskd: disable 2024-04-18 06:55:56 +00:00
Colin 3642ead646 trust-dns: 0.24.0 -> 0.24.1 2024-04-18 06:03:34 +00:00
Colin 60c370df3f sftpgo: fix domain name in banner 2024-04-18 05:01:57 +00:00
Colin d80852c6c1 sftpgo: re-enable password login 2024-04-18 04:58:59 +00:00
Colin 62b3047fff sftpgo: support FTPS 2024-04-18 04:34:41 +00:00
Colin de2c3a30ff programs: ship lftp ftp client 2024-04-18 04:17:10 +00:00
Colin c08280589d lsof: fix sandboxing 2024-04-17 23:43:42 +00:00
Colin 9a9ffcbea9 transmission: fix faulty "find" expression (thanks shellcheck!) 2024-04-17 23:32:00 +00:00
Colin 733efcfaf7 servo: nginx: forceSSL for anything media related 2024-04-17 22:49:24 +00:00
Colin b34d984572 servo: transmission: remove noisy files upon torrent completion 2024-04-17 20:47:00 +00:00
Colin e2b58e1b77 servo: transmission: be extra strict about requiring VPN 2024-04-17 19:52:11 +00:00
Colin b7e5bc5972 servo: sftpgo: disable external access 2024-04-17 19:41:57 +00:00
Colin 831b4ad72a nixpkgs: 2024-04-16 -> 2024-04-17; nixpkgs-wayland -> 2024-04-17
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/097ced11fa37dec3146e0480026c0c10d7d35e6f' (2024-04-16)
  → 'github:nixos/nixpkgs/73f2b40dfc3413958695ae66fca3a52ee68451d6' (2024-04-17)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/7f1c8f1b9071c77b81b62e3be62ef5e3d0c578ad' (2024-04-16)
  → 'github:nixos/nixpkgs/2528b053e7c482baa8cd93cdce81172c3f0a3cee' (2024-04-17)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/a03b8253e5cedb72a0957f7d534ad2702d7a54f0' (2024-04-15)
  → 'github:nix-community/nixpkgs-wayland/b0260157fccc94f4fe5a09fb3a1b1f62a87ae397' (2024-04-17)
```
2024-04-17 09:54:45 +00:00
Colin 54cefa247a dino: record another bug 2024-04-17 09:53:08 +00:00
Colin e3898449b7 sane-tag-music: allow manually specifying the track number 2024-04-17 09:45:10 +00:00
Colin e5bad6a74c sane-tag-music: fixup track numbers 2024-04-17 07:56:52 +00:00
Colin 254343a6af todo.md: sync 2024-04-17 02:26:09 +00:00
Colin 28bfd75114 sane-tag-music: split into two operations 2024-04-17 02:25:54 +00:00
Colin b7fd5e78cc swaync: show volume-per-app (TODO: stylize it better) 2024-04-17 01:37:03 +00:00
Colin 79985ff009 dino: docs: update notes about BUGS 2024-04-16 20:50:00 +00:00
Colin 62f5b9276f pwvucontrol: whitelist DRI inside the sandbox, for better perf 2024-04-16 20:49:33 +00:00
Colin 276844af0b sane-tag-music: update docs 2024-04-16 19:56:58 +00:00
Colin 13c1f01a6b servo: pleroma: migrate port 4000 -> 4040
port 4000 is used by NFS
2024-04-16 18:57:54 +00:00
Colin 5f281f57de servo: transmission: inline nested torrent directories 2024-04-16 18:25:41 +00:00
Colin 089e434e3f servo: transmission: fix group permissions of media when copying them to public dir 2024-04-16 16:31:10 +00:00
Colin b068b50d7c sane-bt: require specifying a title when torrenting films 2024-04-16 16:05:39 +00:00
Colin 14911868e4 nixpkgs: 2024-04-14 -> 2024-04-16; nixpkgs-wayland, sops-nix, uninsane-dot-org
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/2d0506704b7d92cc610412b176b515fe1a782095' (2024-04-14)
  → 'github:nixos/nixpkgs/097ced11fa37dec3146e0480026c0c10d7d35e6f' (2024-04-16)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/bc59f72803cf40fb50f05cb73068d85b5ce21297' (2024-04-14)
  → 'github:nixos/nixpkgs/7f1c8f1b9071c77b81b62e3be62ef5e3d0c578ad' (2024-04-16)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/b816217ba4fc77d19ca033ab8f13b35ba0331e91' (2024-04-13)
  → 'github:nix-community/nixpkgs-wayland/a03b8253e5cedb72a0957f7d534ad2702d7a54f0' (2024-04-15)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/2737d0204685c3274390229a09eb8f7eaa1a9e89' (2024-04-07)
  → 'github:nix-community/lib-aggregate/f347ed9a1cab12c27541ed4d173e2f2d5c9bc0bb' (2024-04-14)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/3c62b6a12571c9a7f65ab037173ee153d539905f' (2024-04-07)
  → 'github:nix-community/nixpkgs.lib/361d8a4f443bbfab20bd6d222f9022b8c6665906' (2024-04-14)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/226062b47fe0e2130ba3ee9f4f1c880dc815cf87' (2024-04-14)
  → 'github:Mic92/sops-nix/cc535d07cbcdd562bcca418e475c7b1959cefa4b' (2024-04-15)
• Updated input 'uninsane-dot-org':
    'git+https://git.uninsane.org/colin/uninsane?ref=refs/heads/master&rev=b9502e6f190752d327f8cee7fa4b139094bd7c16' (2024-03-25)
  → 'git+https://git.uninsane.org/colin/uninsane?ref=refs/heads/master&rev=af8420d1c256d990b5e24de14ad8592a5d85bf77' (2024-04-15)
```
2024-04-16 04:59:59 +00:00
Colin 539fe48947 swaync: cleanup 2024-04-16 04:14:07 +00:00
Colin 259c3af526 swaync-fbcli: fix CPU pegging when canceling a phone ringer 2024-04-16 02:18:51 +00:00
Colin 6b5e0e57bc swaync: unify the *DEBUG variables 2024-04-15 21:29:17 +00:00
Colin b55c903a81 todo.md: made it so unl0kr starts with keyboard 2024-04-15 21:11:20 +00:00
Colin 4f06f0dc5e unl0kr: disable animations 2024-04-15 21:10:55 +00:00
Colin c0dde0e540 unl0kr: populate config file with upstream defaults 2024-04-15 21:05:21 +00:00
Colin 6779063578 todo.md: sync 2024-04-15 19:57:58 +00:00
Colin 2eea562d1f sandbox: remove unused "binMap" option 2024-04-15 19:56:33 +00:00
Colin 0385c09f23 sane-sandboxed: split out into an actual package 2024-04-15 18:57:22 +00:00
Colin bd57b95598 swaync-fbcli: fix so that the child actually exits when killed (critical is to use SIGINT) 2024-04-15 18:32:50 +00:00
Colin 465da7c939 swaync-fbcli: migrate an "echo" to a "log" 2024-04-15 18:22:30 +00:00
Colin 44f76e656a swaync-fbcli: fix that pkill expression wouldn't work for wrapped binaries 2024-04-15 18:21:27 +00:00
Colin 824046aca1 swaync-fbcli: fix CPU pegging 2024-04-15 18:09:21 +00:00
Colin 827c50ff43 swaync: cleanup the swaync-fbcli helper 2024-04-15 18:00:51 +00:00
Colin 0230291bb2 swaync: move the pkill logic into swaync-fbcli 2024-04-15 17:46:40 +00:00
Colin 3d3618256d swaync: split the fbcli wrapper into its own file 2024-04-15 17:46:40 +00:00
Colin 590cb2dd7f feeds: sort the list 2024-04-15 16:21:31 +00:00
Colin d9dcab544c feeds: unsubscribe from Profectus 2024-04-15 16:20:17 +00:00
Colin 4ee0f0c659 feeds: disable TheSideView 2024-04-15 14:59:50 +00:00
Colin 7692ab0b3e firefox-extensions.sidebery: build from source 2024-04-15 05:25:19 +00:00
Colin 2af5bb3d78 i-still-dont-care-about-cookies: enable 2024-04-15 03:36:49 +00:00
Colin e72a0a4300 firefox extensions: support more manifest formats 2024-04-15 03:36:27 +00:00
Colin 6b0cbf684f sidebery: 5.2.0.1 -> 5.2.0.7 2024-04-15 03:36:03 +00:00
Colin 62af314238 firefox-extensions.i-still-dont-care-about-cookies: init at 1.1.4 2024-04-15 03:02:19 +00:00
Colin e8745b4312 firefox-extensions: ublock, metamask -> latest 2024-04-15 02:35:49 +00:00
Colin 5a10173ba3 schlock: fix to run on modern sway 2024-04-15 02:07:20 +00:00
Colin 2d8fe1d3e5 bonsai: tune niceness to hopefully be more responsive 2024-04-15 01:46:32 +00:00
Colin 0741d87bcb rofi: theme so that i can read more text on narrow moby display 2024-04-15 00:04:10 +00:00
Colin 2587c27f89 font-manager: fix sandboxing 2024-04-14 21:55:52 +00:00
Colin 2d74d0725d feeds: podcasts: add Money Stuff 2024-04-14 20:39:53 +00:00
Colin b0d1d2e1af coppwr: remove (it's been upstreamed into nixpkgs) 2024-04-14 16:16:46 +00:00
Colin 61dc79a2ea cross: remove upstreamed webkitgtk patch 2024-04-14 16:08:48 +00:00
Colin 7804236499 xdg-terminal-exec: remove upstreamed patched 2024-04-14 14:16:50 +00:00
Colin f908762cf8 nixpkgs: 2024-04-06 -> 2024-04-14; nixpkgs-wayland, sops-nix
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/7c74352f2f7eca1925729f5c9c80cb89df8e74a2' (2024-04-06)
  → 'github:nixos/nixpkgs/2d0506704b7d92cc610412b176b515fe1a782095' (2024-04-14)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/c58702222e0a29fd01cc42d70737d699995f6389' (2024-04-06)
  → 'github:nixos/nixpkgs/bc59f72803cf40fb50f05cb73068d85b5ce21297' (2024-04-14)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/9b77653338f52da4b498abdf4835efb6ff6e453e' (2024-04-04)
  → 'github:nix-community/nixpkgs-wayland/b816217ba4fc77d19ca033ab8f13b35ba0331e91' (2024-04-13)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/9c06929b83e57c18d125f1105ba6a423f24083d2' (2024-03-31)
  → 'github:nix-community/lib-aggregate/2737d0204685c3274390229a09eb8f7eaa1a9e89' (2024-04-07)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/90b1a963ff84dc532db92f678296ff2499a60a87' (2024-03-31)
  → 'github:nix-community/nixpkgs.lib/3c62b6a12571c9a7f65ab037173ee153d539905f' (2024-04-07)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/99b1e37f9fc0960d064a7862eb7adfb92e64fa10' (2024-03-31)
  → 'github:Mic92/sops-nix/226062b47fe0e2130ba3ee9f4f1c880dc815cf87' (2024-04-14)
• Updated input 'sops-nix/nixpkgs-stable':
    'github:NixOS/nixpkgs/2b4e3ca0091049c6fbb4908c66b05b77eaef9f0c' (2024-03-30)
  → 'github:NixOS/nixpkgs/c27f3b6d8e29346af16eecc0e9d54b1071eae27e' (2024-04-13)
```
2024-04-14 14:15:02 +00:00
Colin feb36d19ac programs: ship cups 2024-04-14 03:33:55 +00:00
Colin 06185ac870 todo.md: add a way to exit mpv fullscreen on moby 2024-04-13 20:30:30 +00:00
Colin a8915661a7 style: refine the base pink color for mpv and sway/waybar
this matches swaync a little better. mpv had to be made lighter, i think because of transparency stuff. probably sway/waybar could be made normal lightness
2024-04-13 20:29:24 +00:00
Colin d57aa473ac overlays/pkgs-debug: cleanup 2024-04-13 20:29:24 +00:00
Colin a28b7d5616 todo.md: more mobile games, mpv improvements 2024-04-13 20:29:24 +00:00
Colin dd58ba8b00 gvfs: enable as part of nautilus, not sway 2024-04-13 20:29:24 +00:00
Colin a21508b6ba todo.md: fix schlock (moby) 2024-04-13 20:29:24 +00:00
Colin 94cff99f53 todo.md: ftps support 2024-04-13 20:29:24 +00:00
Colin 8aa8d773de cherry-pick orc update to fix Dino calls 2024-04-13 20:29:24 +00:00
Colin 0a888e205e programs: ship objdump 2024-04-13 20:29:24 +00:00
Colin 898dc89c8f overlays: add `pkgsDebug` for building packages with debug symbols and such 2024-04-13 20:29:24 +00:00
Colin 4b22fd95bf introduce 'moby-min' host variant for the quickest deployment (no webkitgtk) 2024-04-13 20:29:24 +00:00
Colin 527a9e7612 feeds: add The Side View 2024-04-10 04:47:34 +00:00
Colin 3686e6e508 feeds: subscribe to Future of Coding 2024-04-10 03:06:30 +00:00
Colin cda50db23b loupe: associate with avif filetype 2024-04-09 19:22:59 +00:00
Colin 344e24fcd2 todo.md: ssh doesnt give the right linux capabilities 2024-04-09 18:38:04 +00:00
Colin 9be6960bbf sway: disable shortcuts for creating sub-splits
i'm just always accidentally triggering them
2024-04-09 16:24:02 +00:00
Colin a45aabfb72 sway: todo: load background from a more traditional path 2024-04-09 16:19:56 +00:00
Colin 602bf59843 todo.md: disable sway sub-layouts 2024-04-09 16:15:27 +00:00
Colin 895d7f6f20 todo.md: note that mpv exit hangs because of sane-sysvol 2024-04-09 16:13:43 +00:00
Colin 876103ff7b mpv: remove legacy ao=alsa and volume-max config 2024-04-09 16:10:05 +00:00
Colin 46cda87d5e notejot: fix sandboxing 2024-04-09 15:44:01 +00:00
Colin d728dfcd70 mpv: uosc: tweak the maximize button to actually act as a fullscreen toggle 2024-04-09 10:14:40 +00:00
Colin 19fcd0318c mpv: remove the double-click-to-fullscreen shortcut 2024-04-09 10:09:17 +00:00
Colin 030f6d1a99 mpv: fix so pseudo-gui mode doesnt break logging 2024-04-09 09:58:16 +00:00
Colin 86b495cb9f mpv: sane-sysvol: integrate with uosc mute button 2024-04-09 08:05:00 +00:00
Colin c897f4fa4b mpv: sane-sysvol: fix pipewire mute to reflect onto uosc volume level
ideally it would actually show up as the mute parameter!
2024-04-09 08:05:00 +00:00
Colin 8181a0664d mpv: sane-sysvol: remove the unused id tracking 2024-04-09 08:05:00 +00:00
Colin c37e94493f mpv: sane-sysvol: optimize 2024-04-09 08:05:00 +00:00
Colin b9e107510d mpv: sane-sysvol: dont force system volume to zero on init 2024-04-09 08:05:00 +00:00
Colin 976ae65529 todo.md: remove deprecated use of 'crypt' 2024-04-09 08:05:00 +00:00
Colin 0f4c1ccfe3 mpv: update input.conf for sane-cast rename 2024-04-09 08:05:00 +00:00
Colin 9d9413c790 mpv: announce pipewire volume changes so uosc can listen for them 2024-04-09 08:05:00 +00:00
Colin 64c28ae657 mpv: don't need to force uosc volume state to 0 by default; nil is OK 2024-04-09 08:05:00 +00:00
Colin d221625eb3 todo.md: add work around signal, mpv 2024-04-09 08:05:00 +00:00
Colin 1f4c885748 mpv: sane-sysvol script: init
it's a one-way volume control, but that's a start
2024-04-09 08:05:00 +00:00
Colin 0545b178af mpv: rename plugin: sane -> sane-cast 2024-04-09 08:04:51 +00:00
Colin fe4b6c36c4 feeds: subscribe to jwz.org 2024-04-09 03:55:25 +00:00
Colin fce3436c88 servo: expose Milkbags to the internet :) 2024-04-08 06:55:09 +00:00
209 changed files with 7937 additions and 23392 deletions

View File

@ -22,7 +22,7 @@ you might specifically be interested in these files (elaborated further in #key-
- my way of deploying dotfiles/configuring programs per-user:
- [modules/fs/](./modules/fs/default.nix)
- [modules/programs/](./modules/programs/default.nix)
- [modules/users.nix](./modules/users.nix)
- [modules/users/](./modules/users/default.nix)
[nixpkgs]: https://github.com/NixOS/nixpkgs
[sops]: https://github.com/Mic92/sops-nix
@ -109,9 +109,10 @@ i.e. you might find value in using these in your own config:
- `sane.programs.firefox.sandbox.whitelistWayland = true; # allow it to render a wayland window`
- `sane.programs.firefox.sandbox.extraHomePaths = [ "Downloads" ]; # allow it read/write access to ~/Downloads`
- integrated with `fs` and `persist` modules so that programs' config files and persisted data stores are linked into the sandbox w/o any extra involvement.
- `modules/users.nix`
- `modules/users/`
- convenience layer atop the above modules so that you can just write
`fs.".config/git"` instead of `fs."/home/colin/.config/git"`
- per-user services managed by [s6-rc](https://www.skarnet.org/software/s6-rc/)
some things in here could easily find broader use. if you would find benefit in
them being factored out of my config, message me and we could work to make that happen.

24
TODO.md
View File

@ -1,10 +1,21 @@
## BUGS
- moby: megapixels doesn't load in sandbox
- when moby wlan is explicitly set down (via ip link set wlan0 down), /var/lib/trust-dns/dhcp-configs doesn't get reset
- trust-dns: can't recursively resolve api.mangadex.org
- and *sometimes* apple.com fails
- sandbox: `ip netns exec ovpns bash`: doesn't work
- sandbox: link cache means that if i update ~/.config/... files inline, sandboxed programs still see the old version
- mpv: no way to exit fullscreen video on moby
- uosc hides controls on FS, and touch doesn't support unhiding
- Signal restart loop drains battery
- decrease s6 restart time?
- `ssh` access doesn't grant same linux capabilities as login
- ringer (i.e. dino incoming call) doesn't prevent moby from sleeping
- sway mouse/kb hotplug doesn't work
- `nix` operations from lappy hang when `desko` is unreachable
- could at least direct the cache to `http://desko-hn:5001`
- sysvol (volume overlay): when casting with `blast`, sysvol doesn't react to volume changes
## REFACTORING:
- REMOVE DEPRECATED `crypt` from sftpgo_auth_hook
- consolidate ~/dev and ~/ref
- ~/dev becomes a link to ~/ref/cat/mine
- fold hosts/common/home/ssh.nix -> hosts/common/users/colin.nix
@ -21,13 +32,15 @@
### upstreaming
- add updateScripts to all my packages in nixpkgs
- REVIEW/integrate jellyfin dataDir config: <https://github.com/NixOS/nixpkgs/pull/233617>
#### upstreaming to non-nixpkgs repos
- gtk: build schemas even on cross compilation: <https://github.com/NixOS/nixpkgs/pull/247844>
## IMPROVEMENTS:
- systemd/journalctl: use a less shit pager
- there's an env var for it: SYSTEMD_PAGER? and a flag for journalctl
### security/resilience
- validate duplicity backups!
- encrypt more ~ dirs (~/archives, ~/records, ..?)
@ -45,7 +58,7 @@
- <https://github.com/flatpak/xdg-dbus-proxy>
- remove `.ssh` access from Firefox!
- limit access to `~/knowledge/secrets` through an agent that requires GUI approval, so a firefox exploit can't steal all my logins
- port sane-sandboxed to a compiled language (hare?)
- port sanebox to a compiled language (hare?)
- it adds like 50-70ms launch time _on my laptop_. i'd hate to know how much that is on the pinephone.
- remove /run/wrappers from the sandbox path
- they're mostly useless when using no-new-privs, just an opportunity to forget to specify deps
@ -56,6 +69,7 @@
- integrate `nix check` into Gitea actions?
### user experience
- rofi: sort items case-insensitively
- xdg-desktop-portal shouldn't kill children on exit
- *maybe* a job for `setsid -f`?
- replace starship prompt with something more efficient
@ -80,6 +94,8 @@
- numberlink (generic name for Flow Free). not packaged in Nix
- Neverball (https://neverball.org/screenshots.php). nix: as `neverball`
- blurble (https://linuxphoneapps.org/games/app.drey.blurble/). nix: not as of 2024-02-05
- Trivia Quiz (https://linuxphoneapps.org/games/io.github.nokse22.trivia-quiz/)
- sane-sync-music: remove empty dirs
#### moby
- fix cpuidle (gets better power consumption): <https://xnux.eu/log/077.html>

View File

@ -24,11 +24,11 @@
]
},
"locked": {
"lastModified": 1701473968,
"narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=",
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
@ -61,11 +61,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1711886936,
"narHash": "sha256-D2WENp9GuaCostvNcQ7vElekk0V5cuMdnFZ7NfRhVrQ=",
"lastModified": 1715515815,
"narHash": "sha256-yaLScMHNFCH6SbB0HSA/8DWDgK0PyOhCXoFTdHlWkhk=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "9c06929b83e57c18d125f1105ba6a423f24083d2",
"rev": "09883ca828e8cfaacdb09e29190a7b84ad1d9925",
"type": "github"
},
"original": {
@ -99,11 +99,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1705242886,
"narHash": "sha256-TLj334vRwFtSym3m+NnKcNCnKKPNoTC/TDZL40vmOso=",
"lastModified": 1715804156,
"narHash": "sha256-GtIHP86Cz1kD9xZO/cKbNQACHKdoT9WFbLJAq6W2EDY=",
"owner": "nix-community",
"repo": "nix-eval-jobs",
"rev": "6b03a93296faf174b97546fd573c8b379f523a8d",
"rev": "bb95091f6c6f38f6cfc215a1797a2dd466312c8b",
"type": "github"
},
"original": {
@ -121,11 +121,11 @@
]
},
"locked": {
"lastModified": 1701208414,
"narHash": "sha256-xrQ0FyhwTZK6BwKhahIkUVZhMNk21IEI1nUcWSONtpo=",
"lastModified": 1703863825,
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "93e39cc1a087d65bcf7a132e75a650c44dd2b734",
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
"type": "github"
},
"original": {
@ -136,11 +136,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1703134684,
"narHash": "sha256-SQmng1EnBFLzS7WSRyPM9HgmZP2kLJcPAz+Ug/nug6o=",
"lastModified": 1715037484,
"narHash": "sha256-OUt8xQFmBU96Hmm4T9tOWTu4oCswCzoVl+pxSq/kiFc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d6863cbcbbb80e71cecfc03356db1cda38919523",
"rev": "ad7efee13e0d216bf29992311536fce1d3eefbef",
"type": "github"
},
"original": {
@ -152,11 +152,11 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1711846064,
"narHash": "sha256-cqfX0QJNEnge3a77VnytM0Q6QZZ0DziFXt6tSCV8ZSc=",
"lastModified": 1715474941,
"narHash": "sha256-CNCqCGOHdxuiVnVkhTpp2WcqSSmSfeQjubhDOcgwGjU=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "90b1a963ff84dc532db92f678296ff2499a60a87",
"rev": "58e03b95f65dfdca21979a081aa62db0eed6b1d8",
"type": "github"
},
"original": {
@ -167,11 +167,11 @@
},
"nixpkgs-next-unpatched": {
"locked": {
"lastModified": 1712383280,
"narHash": "sha256-YL8miM11o/jMqOwt5DsdyhPgh/JgCl1kOIzvX7ukniY=",
"lastModified": 1715839255,
"narHash": "sha256-IKUEASEZKDqOC/q6RP54O3Dz3C2+BBi+VtnIbhBpBbw=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7c74352f2f7eca1925729f5c9c80cb89df8e74a2",
"rev": "1887e39d7e68bb191eb804c0f976ad25b3980595",
"type": "github"
},
"original": {
@ -183,11 +183,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1711819797,
"narHash": "sha256-tNeB6emxj74Y6ctwmsjtMlzUMn458sBmwnD35U5KIM4=",
"lastModified": 1715458492,
"narHash": "sha256-q0OFeZqKQaik2U8wwGDsELEkgoZMK7gvfF6tTXkpsqE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2b4e3ca0091049c6fbb4908c66b05b77eaef9f0c",
"rev": "8e47858badee5594292921c2668c11004c3b0142",
"type": "github"
},
"original": {
@ -199,11 +199,11 @@
},
"nixpkgs-unpatched": {
"locked": {
"lastModified": 1712398506,
"narHash": "sha256-oopwPeBKBXQEw2BlyK2jEs2farZ5uMjAZU7H4FpGuGE=",
"lastModified": 1715851096,
"narHash": "sha256-ed72tDlrU4/PBWPYoxPk+HFazU3Yny0stTjlGZ7YeMA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c58702222e0a29fd01cc42d70737d699995f6389",
"rev": "977a49df312d89b7dfbb3579bf13b7dfe23e7878",
"type": "github"
},
"original": {
@ -223,11 +223,11 @@
]
},
"locked": {
"lastModified": 1712237761,
"narHash": "sha256-NoMBBCADTms3yx5BL+sbc7vfDivNiYULO6t9GBAsPt0=",
"lastModified": 1715843614,
"narHash": "sha256-qveerNXc6yF2digoKDR9Hj/o0n8Y3bW/yET6sRochv0=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "9b77653338f52da4b498abdf4835efb6ff6e453e",
"rev": "5e2c5345f3204c867c9d4183cbb68069d0f7a951",
"type": "github"
},
"original": {
@ -254,11 +254,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1711855048,
"narHash": "sha256-HxegAPnQJSC4cbEbF4Iq3YTlFHZKLiNTk8147EbLdGg=",
"lastModified": 1715482972,
"narHash": "sha256-y1uMzXNlrVOWYj1YNcsGYLm4TOC2aJrwoUY1NjQs9fM=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "99b1e37f9fc0960d064a7862eb7adfb92e64fa10",
"rev": "b6cb5de2ce57acb10ecdaaf9bbd62a5ff24fa02e",
"type": "github"
},
"original": {
@ -291,11 +291,11 @@
]
},
"locked": {
"lastModified": 1702979157,
"narHash": "sha256-RnFBbLbpqtn4AoJGXKevQMCGhra4h6G2MPcuTSZZQ+g=",
"lastModified": 1711963903,
"narHash": "sha256-N3QDhoaX+paWXHbEXZapqd1r95mdshxToGowtjtYkGI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "2961375283668d867e64129c22af532de8e77734",
"rev": "49dc4a92b02b8e68798abd99184f228243b6e3ac",
"type": "github"
},
"original": {
@ -311,11 +311,11 @@
]
},
"locked": {
"lastModified": 1711371733,
"narHash": "sha256-+brjlMyLVnVADY31sN82Ap0IsPE2WZEwHUd94sY6BXI=",
"lastModified": 1713198740,
"narHash": "sha256-8SUaqMJdAkMOI9zhvlToL7eCr5Sl+2o2pDQ7nq+HoJU=",
"ref": "refs/heads/master",
"rev": "b9502e6f190752d327f8cee7fa4b139094bd7c16",
"revCount": 237,
"rev": "af8420d1c256d990b5e24de14ad8592a5d85bf77",
"revCount": 239,
"type": "git",
"url": "https://git.uninsane.org/colin/uninsane"
},

View File

@ -108,20 +108,22 @@
nixpkgs' = patchNixpkgs "master" nixpkgs-unpatched;
nixpkgsCompiledBy = system: nixpkgs'.legacyPackages."${system}";
evalHost = { name, local, target, light ? false, nixpkgs ? nixpkgs' }: nixpkgs.lib.nixosSystem {
evalHost = { name, local, target, variant ? null, nixpkgs ? nixpkgs' }: nixpkgs.lib.nixosSystem {
system = target;
modules = [
{
nixpkgs.buildPlatform.system = local;
# nixpkgs.config.replaceStdenv = { pkgs }: pkgs.ccacheStdenv;
}
(optionalAttrs (local != target) {
# XXX(2023/12/11): cache.nixos.org uses `system = ...` instead of `hostPlatform.system`, and that choice impacts the closure of every package.
# so avoid specifying hostPlatform.system on non-cross builds, so i can use upstream caches.
nixpkgs.hostPlatform.system = target;
})
(optionalAttrs light {
sane.enableSlowPrograms = false;
(optionalAttrs (variant == "light") {
sane.maxBuildCost = 2;
})
(optionalAttrs (variant == "min") {
sane.maxBuildCost = 0;
})
(import ./hosts/instantiate.nix { hostName = name; })
self.nixosModules.default
@ -139,11 +141,13 @@
hosts = {
servo = { name = "servo"; local = "x86_64-linux"; target = "x86_64-linux"; };
desko = { name = "desko"; local = "x86_64-linux"; target = "x86_64-linux"; };
desko-light = { name = "desko"; local = "x86_64-linux"; target = "x86_64-linux"; light = true; };
desko-light = { name = "desko"; local = "x86_64-linux"; target = "x86_64-linux"; variant = "light"; };
lappy = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; };
lappy-light = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; light = true; };
lappy-light = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; variant = "light"; };
lappy-min = { name = "lappy"; local = "x86_64-linux"; target = "x86_64-linux"; variant = "min"; };
moby = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; };
moby-light = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; light = true; };
moby-light = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; variant = "light"; };
moby-min = { name = "moby"; local = "x86_64-linux"; target = "aarch64-linux"; variant = "min"; };
rescue = { name = "rescue"; local = "x86_64-linux"; target = "x86_64-linux"; };
};
hostsNext = mapAttrs' (h: v: {
@ -285,7 +289,7 @@
# - sandbox friendliness (especially: `git` doesn't have to be run as root)
if [ -n "$addr" ]; then
sudo nix store sign -r -k /run/secrets/nix_serve_privkey "$storePath"
sudo nix store sign -r -k /run/secrets/nix_signing_key "$storePath"
# add more `-v` for more verbosity (up to 5).
# builders-use-substitutes false: optimizes so that the remote machine doesn't try to get paths from its substituters.
# we already have all paths here, and the remote substitution is slow to check and SERIOUSLY flaky on moby in particular.
@ -408,14 +412,17 @@
desko-light = deployApp "desko-light" "desko" "switch";
lappy = deployApp "lappy" "lappy" "switch";
lappy-light = deployApp "lappy-light" "lappy" "switch";
lappy-min = deployApp "lappy-min" "lappy" "switch";
moby = deployApp "moby" "moby" "switch";
moby-light = deployApp "moby-light" "moby" "switch";
moby-min = deployApp "moby-min" "moby" "switch";
moby-test = deployApp "moby" "moby" "test";
servo = deployApp "servo" "servo" "switch";
# like `nixos-rebuild --flake . switch`
self = deployApp "$(hostname)" "" "switch";
self-light = deployApp "$(hostname)-light" "" "switch";
self = deployApp "$(hostname)" "" "switch";
self-light = deployApp "$(hostname)-light" "" "switch";
self-min = deployApp "$(hostname)-min" "" "switch";
type = "app";
program = builtins.toString (pkgs.writeShellScript "deploy-all" ''
@ -431,12 +438,16 @@
desko-light = deployApp "desko-light" "desko" null;
lappy = deployApp "lappy" "lappy" null;
lappy-light = deployApp "lappy-light" "lappy" null;
lappy-min = deployApp "lappy-min" "lappy" null;
moby = deployApp "moby" "moby" null;
moby-light = deployApp "moby-light" "moby" null;
moby-min = deployApp "moby-min" "moby" null;
servo = deployApp "servo" "servo" null;
type = "app";
program = builtins.toString (pkgs.writeShellScript "predeploy-all" ''
# copy the -light variants first; this might be run while waiting on a full build. or the full build failed.
# copy the -min/-light variants first; this might be run while waiting on a full build. or the full build failed.
nix run '.#preDeploy.moby-min' -- "$@"
nix run '.#preDeploy.lappy-min' -- "$@"
nix run '.#preDeploy.moby-light' -- "$@"
nix run '.#preDeploy.lappy-light' -- "$@"
nix run '.#preDeploy.desko-light' -- "$@"
@ -541,6 +552,9 @@
''
# build minimally-usable hosts first, then their full image.
# this gives me a minimal image i can deploy or copy over, early.
${checkHost "lappy-min"}
${checkHost "moby-min"}
${checkHost "desko-light"}
${checkHost "moby-light"}
${checkHost "lappy-light"}

View File

@ -4,18 +4,16 @@
./fs.nix
];
sane.services.trust-dns.asSystemResolver = false; # TEMPORARY: TODO: re-enable trust-dns
# sane.programs.devPkgs.enableFor.user.colin = true;
# sane.guest.enable = true;
# services.distccd.enable = true;
# sane.programs.distcc.enableFor.user.guest = true;
# TODO: remove emulation, but need to fix nixos-rebuild to moby for that.
# sane.roles.build-machine.emulation = true;
# don't enable wifi by default: it messes with connectivity.
# systemd.services.iwd.enable = false;
# systemd.services.wpa_supplicant.enable = false;
sops.secrets.colin-passwd.neededForUsers = true;
sane.ports.openFirewall = true; # for e.g. nix-serve
sane.roles.build-machine.enable = true;
sane.roles.client = true;
sane.roles.dev-machine = true;
@ -23,17 +21,14 @@
sane.services.wg-home.enable = true;
sane.services.wg-home.ip = config.sane.hosts.by-name."desko".wg-home.ip;
sane.services.duplicity.enable = true;
sane.services.nixserve.secretKeyFile = config.sops.secrets.nix_serve_privkey.path;
sane.nixcache.substituters.desko = false;
sane.nixcache.remote-builders.desko = false;
sane.programs.cups.enableFor.user.colin = true;
sane.programs.sway.enableFor.user.colin = true;
sane.programs.iphoneUtils.enableFor.user.colin = true;
sane.programs.steam.enableFor.user.colin = true;
# sane.programs.devPkgs.enableFor.user.colin = true;
sane.programs."gnome.geary".config.autostart = true;
sane.programs.signal-desktop.config.autostart = true;
@ -43,10 +38,6 @@
# needed to use libimobiledevice/ifuse, for iphone sync
services.usbmuxd.enable = true;
# don't enable wifi by default: it messes with connectivity.
systemd.services.iwd.enable = false;
systemd.services.wpa_supplicant.enable = false;
# default config: https://man.archlinux.org/man/snapper-configs.5
# defaults to something like:
# - hourly snapshots

View File

@ -14,10 +14,12 @@
boot.loader.efi.canTouchEfiVariables = false;
sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ];
sane.programs.cups.enableFor.user.colin = true;
sane.programs.stepmania.enableFor.user.colin = true;
sane.programs.sway.enableFor.user.colin = true;
sane.programs."gnome.geary".config.autostart = true;
sane.programs.signal-desktop.config.autostart = true;
sane.programs.stepmania.enableFor.user.colin = true;
sops.secrets.colin-passwd.neededForUsers = true;

View File

@ -25,10 +25,6 @@
sane.services.wg-home.enable = true;
sane.services.wg-home.ip = config.sane.hosts.by-name."moby".wg-home.ip;
# for some reason desko -> moby deploys are super flaky when desko is also a nixcache (not true of desko -> lappy deploys, though!)
# > unable to download 'http://desko:5001/<hash>.narinfo': Server returned nothing (no headers, no data) (52)
sane.nixcache.substituters.desko = false;
# XXX colin: phosh doesn't work well with passwordless login,
# so set this more reliable default password should anything go wrong
users.users.colin.initialPassword = "147147";
@ -62,18 +58,8 @@
# HACK/TODO: make `programs.P.env.VAR` behave according to `mime.priority`
sane.programs.firefox.env = lib.mkForce {};
sane.programs.epiphany.env.BROWSER = "epiphany";
# note the .conf.d approach: using ~/.config/pipewire/pipewire.conf directly breaks all audio,
# presumably because that deletes the defaults entirely whereas the .conf.d approach selectively overrides defaults
sane.user.fs.".config/pipewire/pipewire.conf.d/10-fix-dino-mic-cutout.conf".symlink.text = ''
# config docs: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#properties>
# useful to run `pw-top` to see that these settings are actually having effect,
# and `pw-metadata` to see if any settings conflict (e.g. max-quantum < min-quantum)
#
# restart pipewire after editing these files:
# - `systemctl --user restart pipewire`
# - pipewire users will likely stop outputting audio until they are also restarted
#
sane.programs.pipewire.config = {
# tune so Dino doesn't drop audio
# there's seemingly two buffers for the mic (see: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#pipewire-buffering-explained>)
# 1. Pipewire buffering out of the driver and into its own member.
# 2. Pipewire buffering into Dino.
@ -84,11 +70,9 @@
# `pw-metadata -n settings 0 clock.force-quantum 1024` reduces to about 1 error per second.
# `pw-metadata -n settings 0 clock.force-quantum 2048` reduces to 1 error every < 10s.
# pipewire default config includes `clock.power-of-two-quantum = true`
context.properties = {
default.clock.min-quantum = 2048
default.clock.max-quantum = 8192
}
'';
min-quantum = 2048;
max-quantum = 8192;
};
boot.loader.efi.canTouchEfiVariables = false;
# /boot space is at a premium. default was 20.
@ -128,14 +112,6 @@
# enable rotation sensor
hardware.sensor.iio.enable = true;
# TODO: move elsewhere...
systemd.services.ModemManager.serviceConfig = {
# N.B.: the extra "" in ExecStart serves to force upstream ExecStart to be ignored
ExecStart = [ "" "${pkgs.modemmanager}/bin/ModemManager --debug" ];
# --debug sets DEBUG level logging: so reset
ExecStartPost = [ "${pkgs.modemmanager}/bin/mmcli --set-logging=INFO" ];
};
services.udev.extraRules = let
chmod = "${pkgs.coreutils}/bin/chmod";
chown = "${pkgs.coreutils}/bin/chown";

View File

@ -64,6 +64,5 @@
"dialout" # TODO: figure out if dialout is required. that's for /dev/ttyUSB1, but geoclue probably doesn't read that?
];
sane.services.eg25-control.enable = true;
sane.programs.where-am-i.enableFor.user.colin = true;
}

View File

@ -22,13 +22,12 @@
"sane-scripts.stop-all-servo"
];
sane.services.dyn-dns.enable = true;
sane.services.trust-dns.asSystemResolver = false; # TODO: enable once it's all working well
sane.services.wg-home.enable = true;
sane.services.wg-home.visibleToWan = true;
sane.services.wg-home.forwardToWan = true;
sane.services.wg-home.routeThroughServo = false;
sane.services.wg-home.ip = config.sane.hosts.by-name."servo".wg-home.ip;
sane.nixcache.substituters.servo = false;
sane.nixcache.substituters.desko = false;
sane.nixcache.remote-builders.desko = false;
sane.nixcache.remote-builders.servo = false;
# sane.services.duplicity.enable = true; # TODO: re-enable after HW upgrade

View File

@ -24,7 +24,7 @@ lib.mkIf false
# services.calibre-web.options.calibreLibrary = svc-dir;
services.nginx.virtualHosts."calibre.uninsane.org" = {
addSSL = true;
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${ip}:${builtins.toString port}";

View File

@ -24,50 +24,64 @@
# that is NOT the case when the STUN server and client A are on the same LAN
# even if client A contacts the STUN server via its WAN address with port reflection enabled.
# hence, there's no obvious way to put the STUN server on the same LAN as either client and expect the rest to work.
# - there an old version which *half worked*, which is:
# - run the turn server in the root namespace.
# - bind the turn server to the veth connecting it to the VPN namespace (so it sends outgoing traffic to the right place).
# - NAT the turn port range from VPN into root namespace (so it receives incomming traffic).
# - this approach would fail the prosody conversations.im check, but i didn't notice *obvious* call routing errors.
#
# debugging:
# - log messages like 'usage: realm=<turn.uninsane.org>, username=<1715915193>, rp=14, rb=1516, sp=8, sb=684'
# - rp = received packets
# - rb = received bytes
# - sp = sent packets
# - sb = sent bytes
{ lib, ... }:
let
# TODO: this range could be larger, but right now that's costly because each element is its own UPnP forward
# TURN port range (inclusive)
turnPortLow = 49152;
turnPortHigh = 49167;
# TURN port range (inclusive).
# default coturn behavior is to use the upper quarter of all ports. i.e. 49152 - 65535.
# i believe TURN allocations expire after either 5 or 10 minutes of inactivity.
turnPortLow = 49152; # 49152 = 0xc000
turnPortHigh = turnPortLow + 256;
turnPortRange = lib.range turnPortLow turnPortHigh;
in
{
sane.ports.ports = lib.mkMerge ([
{
"3478" = {
# this is the "control" port.
# i.e. no client data is forwarded through it, but it's where clients request tunnels.
protocol = [ "tcp" "udp" ];
# visibleTo.lan = true;
# visibleTo.wan = true;
visibleTo.ovpn = true;
description = "colin-stun-turn";
};
"5349" = {
# the other port 3478 also supports TLS/DTLS, but presumably clients wanting TLS will default 5349
protocol = [ "tcp" ];
# visibleTo.lan = true;
# visibleTo.wan = true;
visibleTo.ovpn = true;
description = "colin-stun-turn-over-tls";
};
}
] ++ (builtins.map
(port: {
"${builtins.toString port}" = let
count = port - turnPortLow + 1;
numPorts = turnPortHigh - turnPortLow + 1;
in {
protocol = [ "tcp" "udp" ];
# visibleTo.lan = true;
# visibleTo.wan = true;
visibleTo.ovpn = true;
description = "colin-turn-${builtins.toString count}-of-${builtins.toString numPorts}";
};
})
turnPortRange
));
# the port definitions are only needed if running in the root net namespace
# sane.ports.ports = lib.mkMerge ([
# {
# "3478" = {
# # this is the "control" port.
# # i.e. no client data is forwarded through it, but it's where clients request tunnels.
# protocol = [ "tcp" "udp" ];
# # visibleTo.lan = true;
# # visibleTo.wan = true;
# visibleTo.ovpn = true; # forward traffic from the VPN to the root NS
# description = "colin-stun-turn";
# };
# "5349" = {
# # the other port 3478 also supports TLS/DTLS, but presumably clients wanting TLS will default 5349
# protocol = [ "tcp" ];
# # visibleTo.lan = true;
# # visibleTo.wan = true;
# visibleTo.ovpn = true;
# description = "colin-stun-turn-over-tls";
# };
# }
# ] ++ (builtins.map
# (port: {
# "${builtins.toString port}" = let
# count = port - turnPortLow + 1;
# numPorts = turnPortHigh - turnPortLow + 1;
# in {
# protocol = [ "tcp" "udp" ];
# # visibleTo.lan = true;
# # visibleTo.wan = true;
# visibleTo.ovpn = true;
# description = "colin-turn-${builtins.toString count}-of-${builtins.toString numPorts}";
# };
# })
# turnPortRange
# ));
services.nginx.virtualHosts."turn.uninsane.org" = {
# allow ACME to procure a cert via nginx for this domain
@ -103,22 +117,28 @@ in
services.coturn.realm = "turn.uninsane.org";
services.coturn.cert = "/var/lib/acme/turn.uninsane.org/fullchain.pem";
services.coturn.pkey = "/var/lib/acme/turn.uninsane.org/key.pem";
#v disable to allow unauthenticated access (or set `services.coturn.no-auth = true`)
services.coturn.use-auth-secret = true;
services.coturn.static-auth-secret-file = "/var/lib/coturn/shared_secret.bin";
services.coturn.lt-cred-mech = true;
services.coturn.lt-cred-mech = true; #< XXX: use-auth-secret overrides lt-cred-mech
services.coturn.min-port = turnPortLow;
services.coturn.max-port = turnPortHigh;
# services.coturn.secure-stun = true;
services.coturn.extraConfig = lib.concatStringsSep "\n" [
"verbose"
# "Verbose" #< even MORE verbosity than "verbose"
# "no-multicast-peers" # disables sending to IPv4 broadcast addresses (e.g. 224.0.0.0/3)
"listening-ip=10.0.1.5"
# "Verbose" #< even MORE verbosity than "verbose" (it's TOO MUCH verbosity really)
"no-multicast-peers" # disables sending to IPv4 broadcast addresses (e.g. 224.0.0.0/3)
# "listening-ip=10.0.1.5" "external-ip=185.157.162.178" #< 2024/04/25: works, if running in root namespace
"listening-ip=185.157.162.178" "external-ip=185.157.162.178"
# old attempts:
# "external-ip=185.157.162.178/10.0.1.5"
"external-ip=185.157.162.178"
# "listening-ip=10.78.79.51" # can be specified multiple times; omit for *
# "external-ip=97.113.128.229/10.78.79.51"
# "external-ip=97.113.128.229"
# "mobility" # "mobility with ICE (MICE) specs support" (?)
];
systemd.services.coturn.serviceConfig.NetworkNamespacePath = "/run/netns/ovpns";
}

View File

@ -1,6 +1,22 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.pyln-client ])"
"""
clightning-sane: helper to perform common Lightning node admin operations:
- view channel balances
- rebalance channels
COMMON OPERATIONS:
- view channel balances: `clightning-sane status`
- rebalance channels to improve routability (without paying any fees): `clightning-sane autobalance`
FULL OPERATION:
- `clightning-sane status --full`
- `P$`: represents how many msats i've captured in fees from this channel.
- `COST`: rough measure of how much it's "costing" me to let my channel partner hold funds on his side of the channel.
this is based on the notion that i only capture fees from outbound transactions, and so the channel partner holding all liquidity means i can't capture fees on that liquidity.
"""
# pyln-client docs: <https://github.com/ElementsProject/lightning/tree/master/contrib/pyln-client>
# terminology:
# - "scid": "Short Channel ID", e.g. 123456x7890x0
@ -726,7 +742,7 @@ def main():
logging.basicConfig()
logger.setLevel(logging.INFO)
parser = argparse.ArgumentParser(description="rebalance lightning channel balances")
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--verbose", action="store_true", help="more logging")
parser.add_argument("--min-msat", default="999", help="min transaction size")
parser.add_argument("--max-msat", default="1000000", help="max transaction size")

View File

@ -20,7 +20,6 @@
./navidrome.nix
./nginx.nix
./nixos-prebuild.nix
./nixserve.nix
./ntfy
./pict-rs.nix
./pleroma.nix

View File

@ -2,7 +2,7 @@
{
imports = [
./nfs.nix
./sftpgo.nix
./sftpgo
];
users.groups.export = {};

View File

@ -9,24 +9,32 @@
{ config, lib, pkgs, sane-lib, ... }:
let
sftpgo_external_auth_hook = pkgs.static-nix-shell.mkPython3Bin {
pname = "sftpgo_external_auth_hook";
external_auth_hook = pkgs.static-nix-shell.mkPython3Bin {
pname = "external_auth_hook";
srcRoot = ./.;
};
in
{
# Client initiates a FTP "control connection" on port 21.
# - this handles the client -> server commands, and the server -> client status, but not the actual data
# - file data, directory listings, etc need to be transferred on an ephemeral "data port".
# - 50000-50100 is a common port range for this.
# 50000 is used by soulseek.
passiveStart = 50050;
passiveEnd = 50070;
in
{
sane.ports.ports = {
"21" = {
protocol = [ "tcp" ];
visibleTo.lan = true;
visibleTo.wan = true;
# visibleTo.wan = true;
description = "colin-FTP server";
};
"990" = {
protocol = [ "tcp" ];
visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-FTPS server";
};
} // (sane-lib.mapToAttrs
(port: {
name = builtins.toString port;
@ -37,12 +45,42 @@ in
description = "colin-FTP server data port range";
};
})
(lib.range 50050 50100)
(lib.range passiveStart passiveEnd)
);
# use nginx/acme to produce a cert for FTPS
services.nginx.virtualHosts."ftp.uninsane.org" = {
addSSL = true;
enableACME = true;
};
sane.dns.zones."uninsane.org".inet.CNAME."ftp" = "native";
services.sftpgo = {
enable = true;
group = "export";
package = lib.warnIf (lib.versionOlder "2.5.6" pkgs.sftpgo.version) "sftpgo update: safe to use nixpkgs' sftpgo but keep my own `patches`" pkgs.buildGoModule {
inherit (pkgs.sftpgo) name ldflags nativeBuildInputs doCheck subPackages postInstall passthru meta;
version = "2.5.6-unstable-2024-04-18";
src = pkgs.fetchFromGitHub {
# need to use > 2.5.6 for sftpgo_safe_fileinfo.patch to apply
owner = "drakkan";
repo = "sftpgo";
rev = "950cf67e4c03a12c7e439802cabbb0b42d4ee5f5";
hash = "sha256-UfiFd9NK3DdZ1J+FPGZrM7r2mo9xlKi0dsSlLEinYXM=";
};
vendorHash = "sha256-n1/9A2em3BCtFX+132ualh4NQwkwewMxYIMOphJEamg=";
patches = (pkgs.sftpgo.patches or []) ++ [
# fix for compatibility with kodi:
# ftp LIST operation returns entries over-the-wire like:
# - dgrwxrwxr-x 1 ftp ftp 9 Apr 9 15:05 Videos
# however not all clients understand all mode bits (like that `g`, indicating SGID / group sticky bit).
# instead, only send mode bits which are well-understood.
# the full set of bits, from which i filter, is found here: <https://pkg.go.dev/io/fs#FileMode>
./safe_fileinfo.patch
];
};
settings = {
ftpd = {
bindings = [
@ -58,16 +96,33 @@ in
port = 21;
debug = true;
}
{
# binding this means any wireguard client can connect
address = "10.0.10.5";
port = 990;
debug = true;
tls_mode = 2; # 2 = "implicit FTPS": client negotiates TLS before any FTP command.
}
{
# binding this means any LAN client can connect (also WAN traffic forwarded from the gateway)
address = "10.78.79.51";
port = 990;
debug = true;
tls_mode = 2; # 2 = "implicit FTPS": client negotiates TLS before any FTP command.
}
];
# active mode is susceptible to "bounce attacks", without much benefit over passive mode
disable_active_mode = true;
hash_support = true;
passive_port_range = {
start = 50050;
end = 50100;
start = passiveStart;
end = passiveEnd;
};
certificate_file = "/var/lib/acme/ftp.uninsane.org/full.pem";
certificate_key_file = "/var/lib/acme/ftp.uninsane.org/key.pem";
banner = ''
Welcome, friends, to Colin's FTP server! Also available via NFS on the same host, but LAN-only.
@ -75,14 +130,14 @@ in
Username: "anonymous"
Password: "anonymous"
CONFIGURE YOUR CLIENT FOR "PASSIVE" mode, e.g. `ftp --passive uninsane.org`.
CONFIGURE YOUR CLIENT FOR "PASSIVE" MODE, e.g. `ftp --passive ftp.uninsane.org`.
Please let me know if anything's broken or not as it should be. Otherwise, browse and transfer freely :)
'';
};
data_provider = {
driver = "memory";
external_auth_hook = "${sftpgo_external_auth_hook}/bin/sftpgo_external_auth_hook";
external_auth_hook = "${external_auth_hook}/bin/external_auth_hook";
# track_quota:
# - 0: disable quota tracking
# - 1: quota is updated on every upload/delete, even if user has no quota restriction
@ -95,6 +150,7 @@ in
users.users.sftpgo.extraGroups = [
"export"
"media"
"nginx" # to access certs
];
systemd.services.sftpgo = {

View File

@ -0,0 +1,32 @@
diff --git a/internal/ftpd/handler.go b/internal/ftpd/handler.go
index 036c3977..33211261 100644
--- a/internal/ftpd/handler.go
+++ b/internal/ftpd/handler.go
@@ -169,7 +169,7 @@ func (c *Connection) Stat(name string) (os.FileInfo, error) {
}
return nil, err
}
- return fi, nil
+ return vfs.NewFileInfo(name, fi.IsDir(), fi.Size(), fi.ModTime(), false), nil
}
// Name returns the name of this connection
@@ -315,7 +315,17 @@ func (c *Connection) ReadDir(name string) (ftpserver.DirLister, error) {
}, nil
}
- return c.ListDir(name)
+ lister, err := c.ListDir(name)
+ if err != nil {
+ return nil, err
+ }
+ return &patternDirLister{
+ DirLister: lister,
+ pattern: "*",
+ lastCommand: c.clientContext.GetLastCommand(),
+ dirName: name,
+ connectionPath: c.clientContext.Path(),
+ }, nil
}
// GetHandle implements ClientDriverExtentionFileTransfer

View File

@ -20,7 +20,7 @@
--ignore-panel=HOSTS \
--ws-url=wss://sink.uninsane.org:443/ws \
--port=7890 \
-o /var/lib/uninsane/sink/index.html
-o /var/lib/goaccess/index.html
'';
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
Type = "simple";
@ -28,17 +28,19 @@
RestartSec = "10s";
# hardening
WorkingDirectory = "/tmp";
# TODO: run as `goaccess` user and add `goaccess` user to group `nginx`.
NoNewPrivileges = true;
PrivateDevices = "yes";
PrivateTmp = true;
ProtectHome = "read-only";
ProtectSystem = "strict";
SystemCallFilter = "~@clock @cpu-emulation @debug @keyring @memlock @module @mount @obsolete @privileged @reboot @resources @setuid @swap @raw-io";
ReadOnlyPaths = "/";
ReadWritePaths = [ "/proc/self" "/var/lib/uninsane/sink" ];
PrivateDevices = "yes";
ProtectKernelModules = "yes";
ProtectKernelTunables = "yes";
ProtectSystem = "strict";
ReadOnlyPaths = [ "/var/log/nginx" ];
ReadWritePaths = [ "/proc/self" "/var/lib/goaccess" ];
StateDirectory = "goaccess";
SystemCallFilter = "~@clock @cpu-emulation @debug @keyring @memlock @module @mount @obsolete @privileged @reboot @resources @setuid @swap @raw-io";
WorkingDirectory = "/var/lib/goaccess";
};
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
@ -49,7 +51,7 @@
addSSL = true;
enableACME = true;
# inherit kTLS;
root = "/var/lib/uninsane/sink";
root = "/var/lib/goaccess";
locations."/ws" = {
proxyPass = "http://127.0.0.1:7890";

View File

@ -1,4 +1,4 @@
{ ... }:
{ lib, pkgs, ... }:
{
sane.persist.sys.byStore.plaintext = [
@ -12,6 +12,8 @@
systemd.services.jackett.serviceConfig = {
# run this behind the OVPN static VPN
NetworkNamespacePath = "/run/netns/ovpns";
ExecStartPre = [ "${lib.getExe pkgs.sane-scripts.ip-check} --no-upnp --expect 185.157.162.178" ]; # abort if public IP is not as expected
# patch jackett to listen on the public interfaces
# ExecStart = lib.mkForce "${pkgs.jackett}/bin/Jackett --NoUpdates --DataFolder /var/lib/jackett/.config/Jackett --ListenPublic";
};

View File

@ -75,7 +75,7 @@
# Jellyfin multimedia server
# this is mostly taken from the official jellfin.org docs
services.nginx.virtualHosts."jelly.uninsane.org" = {
addSSL = true;
forceSSL = true;
enableACME = true;
# inherit kTLS;

View File

@ -12,7 +12,7 @@ in
services.komga.port = 11319; # chosen at random
services.nginx.virtualHosts."komga.uninsane.org" = {
addSSL = true;
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${builtins.toString port}";

View File

@ -89,6 +89,16 @@ in
disable_symlinks on;
'';
};
locations."/share/Milkbags/" = {
alias = "/var/media/Videos/Milkbags/";
extraConfig = ''
# autoindex => render directory listings
autoindex on;
# don't follow any symlinks when serving files
# otherwise it allows a directory escape
disable_symlinks on;
'';
};
# allow matrix users to discover that @user:uninsane.org is reachable via matrix.uninsane.org
locations."= /.well-known/matrix/server".extraConfig =

View File

@ -1,21 +0,0 @@
{ config, ... }:
{
services.nginx.virtualHosts."nixcache.uninsane.org" = {
addSSL = true;
enableACME = true;
# inherit kTLS;
# serverAliases = [ "nixcache" ];
locations."/".extraConfig = ''
proxy_pass http://localhost:${toString config.services.nix-serve.port};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
'';
};
sane.dns.zones."uninsane.org".inet.CNAME."nixcache" = "native";
sane.services.nixserve.enable = true;
sane.services.nixserve.secretKeyFile = config.sops.secrets.nix_serve_privkey.path;
}

View File

@ -25,7 +25,7 @@ in
config :pleroma, Pleroma.Web.Endpoint,
url: [host: "fed.uninsane.org", scheme: "https", port: 443],
http: [ip: {127, 0, 0, 1}, port: 4000]
http: [ip: {127, 0, 0, 1}, port: 4040]
# secret_key_base: "{secrets.pleroma.secret_key_base}",
# signing_salt: "{secrets.pleroma.signing_salt}"
@ -167,7 +167,7 @@ in
enableACME = true;
# inherit kTLS;
locations."/" = {
proxyPass = "http://127.0.0.1:4000";
proxyPass = "http://127.0.0.1:4040";
recommendedProxySettings = true;
# documented: https://git.pleroma.social/pleroma/pleroma/-/blob/develop/installation/pleroma.nginx
extraConfig = ''

View File

@ -7,7 +7,8 @@
# debugging:
# - soulseek is just *flaky*. if you see e.g. DNS errors, even though you can't replicate them via `dig` or `getent ahostsv4`, just give it 10 minutes to work out:
# - "Soulseek.AddressException: Failed to resolve address 'vps.slsknet.org': Resource temporarily unavailable"
{ config, lib, ... }:
{ config, lib, pkgs, ... }:
{
sane.persist.sys.byStore.plaintext = [
{ user = "slskd"; group = "media"; path = "/var/lib/slskd"; method = "bind"; }
@ -68,12 +69,12 @@
# flags.volatile = true; # store searches and active transfers in RAM (completed transfers still go to disk). rec for btrfs/zfs
};
systemd.services.slskd = {
serviceConfig = {
# run this behind the OVPN static VPN
NetworkNamespacePath = "/run/netns/ovpns";
Restart = lib.mkForce "always"; # exits "success" when it fails to connect to soulseek server
RestartSec = "60s";
};
systemd.services.slskd.serviceConfig = {
# run this behind the OVPN static VPN
NetworkNamespacePath = "/run/netns/ovpns";
ExecStartPre = [ "${lib.getExe pkgs.sane-scripts.ip-check} --no-upnp --expect 185.157.162.178" ]; # abort if public IP is not as expected
Restart = lib.mkForce "always"; # exits "success" when it fails to connect to soulseek server
RestartSec = "60s";
};
}

View File

@ -26,6 +26,9 @@ let
torrent-done = pkgs.writeShellApplication {
name = "torrent-done";
runtimeInputs = with pkgs; [
acl
coreutils
findutils
rsync
util-linux
];
@ -52,6 +55,27 @@ let
destructive mkdir -p "$(dirname "$MEDIA_DIR")"
destructive rsync -arv "$TR_TORRENT_DIR/" "$MEDIA_DIR/"
# make the media rwx by anyone in the group
destructive find "$MEDIA_DIR" -type d -exec setfacl --recursive --modify d:g::rwx,o::rx {} \;
destructive find "$MEDIA_DIR" -type d -exec chmod g+rw,a+rx {} \;
# if there's a single directory inside the media dir, then inline that
subdirs=("$MEDIA_DIR"/*)
if [ ''${#subdirs} -eq 1 ]; then
dirname="''${subdirs[0]}"
if [ -d "$dirname" ]; then
mv "$dirname"/* "$MEDIA_DIR/" && rmdir "$dirname"
fi
fi
# remove noisy files:
find "$MEDIA_DIR/" -type f \(\
-iname 'www.YTS.*.jpg' \
-o -iname 'WWW.YIFY*.COM.jpg' \
-o -iname 'YIFY*.com.txt' \
-o -iname 'YTS*.com.txt' \
\) -exec rm {} \;
# dedupe the whole media library.
# yeah, a bit excessive: move this to a cron job if that's problematic.
destructive hardlink /var/media --reflink=always --ignore-time --verbose
@ -81,8 +105,8 @@ in
# DOCUMENTATION/options list: <https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md#options>
# message-level = 3; #< enable for debug logging. 0-3, default is 2.
# 0.0.0.0 => allow rpc from any host: we gate it via firewall and auth requirement
rpc-bind-address = "0.0.0.0";
# 10.0.1.6 => allow rpc only from the root servo ns. it'll tunnel things to the net, if need be.
rpc-bind-address = "10.0.1.6";
#rpc-host-whitelist = "bt.uninsane.org";
#rpc-whitelist = "*.*.*.*";
rpc-authentication-required = true;
@ -92,6 +116,10 @@ in
rpc-password = "{503fc8928344f495efb8e1f955111ca5c862ce0656SzQnQ5";
rpc-whitelist-enabled = false;
# force behind ovpns in case the NetworkNamespace fails somehow
bind-address-ipv4 = "185.157.162.178";
port-forwarding-enabled = false;
# hopefully, make the downloads world-readable
# umask = 0; #< default is 2: i.e. deny writes from world
@ -131,6 +159,8 @@ in
systemd.services.transmission.serviceConfig = {
# run this behind the OVPN static VPN
NetworkNamespacePath = "/run/netns/ovpns";
ExecStartPre = [ "${lib.getExe pkgs.sane-scripts.ip-check} --no-upnp --expect 185.157.162.178" ]; # abort if public IP is not as expected
Restart = "on-failure";
RestartSec = "30s";
BindPaths = [ "/var/media" ]; #< so it can move completed torrents into the media library

View File

@ -2,19 +2,11 @@
{ config, lib, pkgs, ... }:
let
dyn-dns = config.sane.services.dyn-dns;
nativeAddrs = lib.mapAttrs (_name: builtins.head) config.sane.dns.zones."uninsane.org".inet.A;
bindOvpn = "10.0.1.5";
in lib.mkMerge [
in
{
services.trust-dns.enable = true;
# don't bind to IPv6 until i explicitly test that stack
services.trust-dns.settings.listen_addrs_ipv6 = [];
services.trust-dns.quiet = true;
# FIXME(2023/11/26): services.trust-dns.debug doesn't log requests: use RUST_LOG=debug env for that.
# - see: <https://github.com/hickory-dns/hickory-dns/issues/2082>
# services.trust-dns.debug = true;
sane.ports.ports."53" = {
protocol = [ "udp" "tcp" ];
visibleTo.lan = true;
@ -66,23 +58,6 @@ in lib.mkMerge [
services.trust-dns.settings.zones = [ "uninsane.org" ];
# TODO: can i transform this into some sort of service group?
# have `systemctl restart trust-dns.service` restart all the individual services?
systemd.services.trust-dns.serviceConfig = {
DynamicUser = lib.mkForce false;
User = "trust-dns";
Group = "trust-dns";
wantedBy = lib.mkForce [];
};
systemd.services.trust-dns.enable = false;
users.groups.trust-dns = {};
users.users.trust-dns = {
group = "trust-dns";
isSystemUser = true;
};
# sane.services.dyn-dns.restartOnChange = [ "trust-dns.service" ];
networking.nat.enable = true;
networking.nat.extraCommands = ''
@ -107,98 +82,73 @@ in lib.mkMerge [
visibleTo.lan = true;
description = "colin-redirected-dns-for-lan-namespace";
};
}
{
systemd.services =
let
sed = "${pkgs.gnused}/bin/sed";
stateDir = "/var/lib/trust-dns";
zoneTemplate = pkgs.writeText "uninsane.org.zone.in" config.sane.dns.zones."uninsane.org".rendered;
zoneDirFor = flavor: "${stateDir}/${flavor}";
zoneFor = flavor: "${zoneDirFor flavor}/uninsane.org.zone";
mkTrustDnsService = opts: flavor: let
flags = let baseCfg = config.services.trust-dns; in
(lib.optional baseCfg.debug "--debug") ++ (lib.optional baseCfg.quiet "--quiet");
flagsStr = builtins.concatStringsSep " " flags;
anative = nativeAddrs."servo.${flavor}";
toml = pkgs.formats.toml { };
configTemplate = opts.config or (toml.generate "trust-dns-${flavor}.toml" (
(
lib.filterAttrsRecursive (_: v: v != null) config.services.trust-dns.settings
) // {
listen_addrs_ipv4 = opts.listen or [ anative ];
}
));
configFile = "${stateDir}/${flavor}-config.toml";
port = opts.port or 53;
in {
description = "trust-dns Domain Name Server (serving ${flavor})";
unitConfig.Documentation = "https://trust-dns.org/";
preStart = ''
wan=$(cat '${config.sane.services.dyn-dns.ipPath}')
${sed} s/%AWAN%/$wan/ ${configTemplate} > ${configFile}
'' + lib.optionalString (!opts ? config) ''
mkdir -p ${zoneDirFor flavor}
${sed} \
-e s/%CNAMENATIVE%/servo.${flavor}/ \
-e s/%ANATIVE%/${anative}/ \
-e s/%AWAN%/$wan/ \
-e s/%AOVPNS%/185.157.162.178/ \
${zoneTemplate} > ${zoneFor flavor}
'';
serviceConfig = config.systemd.services.trust-dns.serviceConfig // {
ExecStart = ''
${pkgs.trust-dns}/bin/${pkgs.trust-dns.meta.mainProgram} \
--port ${builtins.toString port} \
--zonedir ${zoneDirFor flavor}/ \
--config ${configFile} ${flagsStr}
'';
};
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
};
in {
trust-dns-wan = mkTrustDnsService { listen = [ nativeAddrs."servo.lan" bindOvpn ]; } "wan";
trust-dns-lan = mkTrustDnsService { port = 1053; } "lan";
trust-dns-hn = mkTrustDnsService { port = 1053; } "hn";
trust-dns-hn-resolver = mkTrustDnsService {
config = pkgs.writeText "hn-resolver-config.toml" ''
# i host a resolver in the wireguard VPN so that clients can resolve DNS through the VPN.
# (that's what this file achieves).
#
# one would expect this resolver could host the authoritative zone for `uninsane.org`, and then forward everything else to the system resolver...
# and while that works for `dig`, it breaks for `nslookup` (and so `ssh`, etc).
#
# DNS responses include a flag for if the responding server is the authority of the zone queried.
# it seems that default Linux stub resolvers either:
# - expect DNSSEC when the response includes that bit, or
# - expect A records to be in the `answer` section instead of `additional` section.
# or perhaps something more nuanced. but for `nslookup` to be reliable, it has to talk to an
# instance of trust-dns which is strictly a resolver, with no authority.
# hence, this config: a resolver which forwards to the actual authority.
listen_addrs_ipv4 = ["${nativeAddrs."servo.hn"}"]
listen_addrs_ipv6 = []
[[zones]]
zone = "uninsane.org"
zone_type = "Forward"
stores = { type = "forward", name_servers = [{ socket_addr = "${nativeAddrs."servo.hn"}:1053", protocol = "udp", trust_nx_responses = true }] }
[[zones]]
# forward the root zone to the local DNS resolver
zone = "."
zone_type = "Forward"
stores = { type = "forward", name_servers = [{ socket_addr = "127.0.0.53:53", protocol = "udp", trust_nx_responses = true }] }
'';
} "hn-resolver";
sane.services.trust-dns.enable = true;
sane.services.trust-dns.instances = let
mkSubstitutions = flavor: {
"%AWAN%" = "$(cat '${dyn-dns.ipPath}')";
"%CNAMENATIVE%" = "servo.${flavor}";
"%ANATIVE%" = nativeAddrs."servo.${flavor}";
"%AOVPNS%" = "185.157.162.178";
};
in
{
wan = {
substitutions = mkSubstitutions "wan";
listenAddrsIpv4 = [
nativeAddrs."servo.lan"
bindOvpn
];
};
lan = {
substitutions = mkSubstitutions "lan";
listenAddrsIpv4 = [ nativeAddrs."servo.lan" ];
port = 1053;
};
hn = {
substitutions = mkSubstitutions "hn";
listenAddrsIpv4 = [ nativeAddrs."servo.hn" ];
port = 1053;
};
# hn-resolver = {
# # don't need %AWAN% here because we forward to the hn instance.
# listenAddrsIpv4 = [ nativeAddrs."servo.hn" ];
# extraConfig = {
# zones = [
# {
# zone = "uninsane.org";
# zone_type = "Forward";
# stores = {
# type = "forward";
# name_servers = [
# {
# socket_addr = "${nativeAddrs."servo.hn"}:1053";
# protocol = "udp";
# trust_nx_responses = true;
# }
# ];
# };
# }
# {
# # forward the root zone to the local DNS resolver
# zone = ".";
# zone_type = "Forward";
# stores = {
# type = "forward";
# name_servers = [
# {
# socket_addr = "127.0.0.53:53";
# protocol = "udp";
# trust_nx_responses = true;
# }
# ];
# };
# }
# ];
# };
# };
};
sane.services.dyn-dns.restartOnChange = [
"trust-dns-wan.service"
@ -207,4 +157,3 @@ in lib.mkMerge [
# "trust-dns-hn-resolver.service" # doesn't need restart because it doesn't know about WAN IP
];
}
]

View File

@ -81,11 +81,14 @@ let
(fromDb "feeds.simplecast.com/xKJ93w_w" // uncat) # Atlas Obscura
(fromDb "feeds.transistor.fm/acquired" // tech)
(fromDb "fulltimenix.com" // tech)
(fromDb "futureofcoding.org/episodes" // tech)
(fromDb "hackerpublicradio.org" // tech)
(fromDb "lexfridman.com/podcast" // rat)
(fromDb "mapspodcast.libsyn.com" // uncat) # Multidisciplinary Association for Psychedelic Studies
(fromDb "microarch.club" // tech)
(fromDb "omegataupodcast.net" // tech) # 3/4 German; 1/4 eps are English
(fromDb "omny.fm/shows/cool-people-who-did-cool-stuff" // pol) # Maggie Killjoy -- referenced by Cory Doctorow
(fromDb "omny.fm/shows/money-stuff-the-podcast") # Matt Levine
(fromDb "omny.fm/shows/the-dollop-with-dave-anthony-and-gareth-reynolds") # The Dollop history/comedy
(fromDb "originstories.libsyn.com" // uncat)
(fromDb "podcast.posttv.com/itunes/post-reports.xml" // pol)
@ -101,6 +104,8 @@ let
(fromDb "sharkbytes.transistor.fm" // tech) # Wireshark Podcast o_0
(fromDb "sscpodcast.libsyn.com" // rat) # Astral Codex Ten
(fromDb "talesfromthebridge.buzzsprout.com" // tech) # Sci-Fi? has Peter Watts; author of No Moods, Ads or Cutesy Fucking Icons (rifters.com)
(fromDb "theamphour.com" // tech)
(fromDb "techtalesshow.com" // tech) # Corbin Davenport
(fromDb "techwontsave.us" // pol) # rec by Cory Doctorow
(fromDb "wakingup.libsyn.com" // pol) # Sam Harris
(fromDb "werenotwrong.fireside.fm" // pol)
@ -124,11 +129,11 @@ let
(fromDb "acoup.blog/feed") # history, states. author: <https://historians.social/@bretdevereaux/following>
(fromDb "amosbbatto.wordpress.com" // tech)
(fromDb "anish.lakhwara.com" // tech)
(fromDb "apenwarr.ca/log/rss.php" // tech) # CEO of tailscale
(fromDb "applieddivinitystudies.com" // rat)
(fromDb "artemis.sh" // tech)
(fromDb "ascii.textfiles.com" // tech) # Jason Scott
(fromDb "austinvernon.site" // tech)
# (fromDb "balajis.com" // pol) # Balaji
(fromDb "ben-evans.com/benedictevans" // pol)
(fromDb "bitbashing.io" // tech)
(fromDb "bitsaboutmoney.com" // uncat)
@ -139,8 +144,6 @@ let
(fromDb "blog.thalheim.io" // tech) # Mic92
(fromDb "bunniestudios.com" // tech) # Bunnie Juang
(fromDb "capitolhillseattle.com" // pol)
# (fromDb "drewdevault.com" // tech)
# (fromDb "econlib.org" // pol)
(fromDb "edwardsnowden.substack.com" // pol // text)
(fromDb "fasterthanli.me" // tech)
(fromDb "gwern.net" // rat)
@ -151,9 +154,9 @@ let
(fromDb "interconnected.org/home/feed" // rat) # Matt Webb -- engineering-ish, but dreamy
(fromDb "jeffgeerling.com" // tech)
(fromDb "jefftk.com" // tech)
(fromDb "jwz.org/blog" // tech // pol) # DNA lounge guy, loooong-time blogger
(fromDb "kill-the-newsletter.com/feeds/joh91bv7am2pnznv.xml" // pol) # Matt Levine - Money Stuff
(fromDb "kosmosghost.github.io/index.xml" // tech)
# (fromDb "lesswrong.com" // rat)
(fromDb "linmob.net" // tech)
(fromDb "lwn.net" // tech)
(fromDb "lynalden.com" // pol)
@ -168,13 +171,13 @@ let
(fromDb "pomeroyb.com" // tech)
(fromDb "postmarketos.org/blog" // tech)
(fromDb "preposterousuniverse.com" // rat) # Sean Carroll
(fromDb "profectusmag.com" // uncat)
(fromDb "project-insanity.org" // tech) # shared blog by a few NixOS devs, notably onny
(fromDb "putanumonit.com" // rat) # mostly dating topics. not advice, or humor, but looking through a social lens
(fromDb "richardcarrier.info" // rat)
(fromDb "rifters.com/crawl" // uncat) # No Moods, Ads or Cutesy Fucking Icons
(fromDb "righto.com" // tech) # Ken Shirriff
(fromDb "rootsofprogress.org" // rat) # Jason Crawford
(fromDb "samuel.dionne-riel.com" // tech) # SamuelDR
(fromDb "sagacioussuricata.com" // tech) # ian (Sanctuary)
(fromDb "semiaccurate.com" // tech)
(fromDb "sideways-view.com" // rat) # Paul Christiano
@ -183,33 +186,40 @@ let
(fromDb "spectrum.ieee.org" // tech)
(fromDb "stpeter.im/atom.xml" // pol)
(fromDb "thediff.co" // pol) # Byrne Hobart
# (fromDb "theregister.com" // tech)
(fromDb "thisweek.gnome.org" // tech)
(fromDb "tuxphones.com" // tech)
(fromDb "uninsane.org" // tech)
(fromDb "unintendedconsequenc.es" // rat)
# (fromDb "vitalik.ca" // tech) # moved to vitalik.eth.limo
(fromDb "vitalik.eth.limo" // tech) # Vitalik Buterin
# (fromDb "webcurious.co.uk" // uncat) # link aggregator; defunct?
(fromDb "willow.phantoma.online") # wizard@xyzzy.link
(fromDb "xn--gckvb8fzb.com" // tech)
(mkSubstack "astralcodexten" // rat // daily) # Scott Alexander
# (mkSubstack "doomberg" // tech // weekly) # articles are all pay-walled
(mkSubstack "eliqian" // rat // weekly)
(mkSubstack "oversharing" // pol // daily)
(mkSubstack "samkriss" // humor // infrequent)
(mkText "http://benjaminrosshoffman.com/feed" // pol // weekly)
(mkText "http://boginjr.com/feed" // tech // infrequent)
(mkText "https://forum.merveilles.town/rss.xml" // pol // infrequent) #quality RSS list here: <https://forum.merveilles.town/thread/57/share-your-rss-feeds%21-6/>
# (mkText "https://github.com/Kaiteki-Fedi/Kaiteki/commits/master.atom" // tech // infrequent)
(mkText "https://jvns.ca/atom.xml" // tech // weekly) # Julia Evans
(mkText "https://linuxphoneapps.org/blog/atom.xml" // tech // infrequent)
(mkText "https://nixos.org/blog/announcements-rss.xml" // tech // infrequent) # more nixos stuff here, but unclear how to subscribe: <https://nixos.org/blog/categories.html>
(mkText "https://nixos.org/blog/stories-rss.xml" // tech // weekly)
(mkText "https://solar.lowtechmagazine.com/posts/index.xml" // tech // weekly)
(mkText "https://www.stratechery.com/rss" // pol // weekly) # Ben Thompson
# (fromDb "balajis.com" // pol) # Balaji
# (fromDb "drewdevault.com" // tech)
# (fromDb "econlib.org" // pol)
# (fromDb "lesswrong.com" // rat)
# (fromDb "profectusmag.com" // pol) # some conservative/libertarian think tank
# (fromDb "thesideview.co" // uncat) # spiritual journal; RSS items are stubs
# (fromDb "theregister.com" // tech)
# (fromDb "vitalik.ca" // tech) # moved to vitalik.eth.limo
# (fromDb "webcurious.co.uk" // uncat) # link aggregator; defunct?
# (mkSubstack "doomberg" // tech // weekly) # articles are all pay-walled
# (mkText "https://github.com/Kaiteki-Fedi/Kaiteki/commits/master.atom" // tech // infrequent)
# (mkText "https://til.simonwillison.net/tils/feed.atom" // tech // weekly)
# (mkText "https://www.bloomberg.com/opinion/authors/ARbTQlRLRjE/matthew-s-levine.rss" // pol // weekly) # Matt Levine (preview/paywalled)
(mkText "https://www.stratechery.com/rss" // pol // weekly) # Ben Thompson
];
videos = [
@ -221,18 +231,20 @@ let
(fromDb "youtube.com/@JackStauber")
(fromDb "youtube.com/@NativLang")
(fromDb "youtube.com/@PolyMatter")
# (fromDb "youtube.com/@rossmanngroup" // pol // tech) # Louis Rossmann
(fromDb "youtube.com/@TechnologyConnections" // tech)
(fromDb "youtube.com/@TheB1M")
(fromDb "youtube.com/@TomScottGo")
(fromDb "youtube.com/@Vihart")
(fromDb "youtube.com/@Vox")
(fromDb "youtube.com/@Vsauce")
# (fromDb "youtube.com/@rossmanngroup" // pol // tech) # Louis Rossmann
];
images = [
(fromDb "catandgirl.com" // img // humor)
(fromDb "davidrevoy.com" // img // art)
(fromDb "grumpy.website" // img // humor)
(fromDb "miniature-calendar.com" // img // art // daily)
(fromDb "pbfcomics.com" // img // humor)
(fromDb "poorlydrawnlines.com/feed" // img // humor)

View File

@ -107,7 +107,8 @@ let
ftp = common ++ fuseColin ++ [
# "ftpfs_debug=2"
"user=colin:ipauth"
"connect_timeout=10"
# connect_timeout=10: casting shows to T.V. fails partway through about half the time
"connect_timeout=20"
];
};
remoteHome = host: {
@ -225,10 +226,10 @@ lib.mkMerge [
(remoteServo "media/Books")
(remoteServo "media/collections")
# (remoteServo "media/datasets")
(remoteServo "media/freeleech")
(remoteServo "media/games")
(remoteServo "media/Music")
(remoteServo "media/Pictures/macros")
(remoteServo "media/torrents")
(remoteServo "media/Videos")
(remoteServo "playground")
]

View File

@ -80,14 +80,12 @@
# - query details with `sudo cpupower frequency-info`
powerManagement.cpuFreqGovernor = "ondemand";
services.logind.extraConfig = ''
# see: `man logind.conf`
# dont shutdown when power button is short-pressed (commonly done an accident, or by cats).
# but do on long-press: useful to gracefully power-off server.
HandlePowerKey=lock
HandlePowerKeyLongPress=poweroff
HandleLidSwitch=lock
'';
# see: `man logind.conf`
# dont shutdown when power button is short-pressed (commonly done an accident, or by cats).
# but do on long-press: useful to gracefully power-off server.
services.logind.powerKey = "lock";
services.logind.powerKeyLongPress = "poweroff";
services.logind.lidSwitch = "lock";
# services.snapper.configs = {
# root = {

View File

@ -3,11 +3,15 @@
{
# XDG defines things like ~/Desktop, ~/Downloads, etc.
# these clutter the home, so i mostly don't use them.
# note that several of these are not actually standardized anywhere.
# some are even non-conventional, like:
# - XDG_PHOTOS_DIR: only works because i patch e.g. megapixels
sane.user.fs.".config/user-dirs.dirs".symlink.text = ''
XDG_DESKTOP_DIR="$HOME/.xdg/Desktop"
XDG_DOCUMENTS_DIR="$HOME/dev"
XDG_DOWNLOAD_DIR="$HOME/tmp"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PHOTOS_DIR="$HOME/Pictures/Photos"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_PUBLICSHARE_DIR="$HOME/.xdg/Public"
XDG_SCREENSHOTS_DIR="$HOME/Pictures/Screenshots"

View File

@ -60,8 +60,5 @@
networking.networkmanager.plugins = lib.mkForce [];
# keyfile.path = where networkmanager should look for connection credentials
networking.networkmanager.extraConfig = ''
[keyfile]
path=/var/lib/NetworkManager/system-connections
'';
networking.networkmanager.settings.keyfile.path = "/var/lib/NetworkManager/system-connections";
}

View File

@ -19,10 +19,15 @@
#
# namespacing:
# - each namespace can use a different /etc/resolv.conf to specify different DNS servers (see `firejail --dns=...`)
# - nscd breaks namespacing: the host nscd is unaware of the guest's /etc/resolv.conf, and so direct's the guest's DNS requests to the host's servers.
# - nscd breaks namespacing: the host nscd is unaware of the guest's /etc/resolv.conf, and so directs the guest's DNS requests to the host's servers.
# - this is fixed by either `firejail --blacklist=/var/run/nscd/socket`, or disabling nscd altogether.
{ lib, ... }:
{ config, lib, ... }:
lib.mkMerge [
{
sane.services.trust-dns.enable = lib.mkDefault config.sane.services.trust-dns.asSystemResolver;
sane.services.trust-dns.asSystemResolver = lib.mkDefault true;
}
(lib.mkIf (!config.sane.services.trust-dns.asSystemResolver) {
# use systemd's stub resolver.
# /etc/resolv.conf isn't sophisticated enough to use different servers per net namespace (or link).
# instead, running the stub resolver on a known address in the root ns lets us rewrite packets
@ -44,7 +49,8 @@
# stub resolver (just forwards upstream) lives on 127.0.0.54
"127.0.0.53"
];
})
{
# nscd -- the Name Service Caching Daemon -- caches DNS query responses
# in a way that's unaware of my VPN routing, so routes are frequently poor against
# services which advertise different IPs based on geolocation.
@ -65,3 +71,4 @@
services.nscd.enable = false;
system.nssModules = lib.mkForce [];
}
]

View File

@ -53,7 +53,7 @@
# allow `nix-shell` (and probably nix-index?) to locate our patched and custom packages.
# this is actually a no-op, and the real action happens in assigning `nix.settings.nix-path`.
nix.nixPath = (lib.optionals config.sane.enableSlowPrograms [
nix.nixPath = (lib.optionals (config.sane.maxBuildCost >= 2) [
"nixpkgs=${pkgs.path}"
]) ++ [
# note the import starts at repo root: this allows `./overlay/default.nix` to access the stuff at the root
@ -65,10 +65,10 @@
# ensure new deployments have a source of this repo with which they can bootstrap.
# this however changes on every commit and can be slow to copy for e.g. `moby`.
environment.etc."nixos" = lib.mkIf config.sane.enableSlowPrograms {
environment.etc."nixos" = lib.mkIf (config.sane.maxBuildCost >= 3) {
source = ../../..;
};
environment.etc."nix/registry.json" = lib.mkIf (!config.sane.enableSlowPrograms) {
environment.etc."nix/registry.json" = lib.mkIf (config.sane.maxBuildCost < 3) {
enable = false;
};

View File

@ -30,6 +30,8 @@
});
};
buildCost = 1;
sandbox.method = "bwrap";
sandbox.whitelistWayland = true;

View File

@ -63,6 +63,7 @@ in
"jq"
"killall"
"less"
"lftp"
# "libcap_ng" # for `netcap`
"lsof"
# "miniupnpc"
@ -89,6 +90,7 @@ in
"tree"
"usbutils" # lsusb
"util-linux" # lsblk, lscpu, etc
"valgrind"
"wget"
"wirelesstools" # iwlist
# "xq" # jq for XML
@ -108,7 +110,6 @@ in
# - debugging?
consoleUtils = declPackageSet [
"alsaUtils" # for aplay, speaker-test
"strings"
# "cdrtools"
# "clinfo"
# "dmidecode"
@ -137,6 +138,7 @@ in
"nmon"
# "node2nix"
# "oathToolkit" # for oathtool
"objdump"
# "ponymix"
"pulsemixer"
"python3-repl"
@ -149,6 +151,7 @@ in
"sops" # for manually viewing secrets; outside `sane-secrets` (TODO: improve sane-secrets!)
"speedtest-cli"
# "ssh-to-age"
"strings"
"sudo"
# "tageditor" # music tagging
# "unar"
@ -173,6 +176,7 @@ in
"ffmpeg"
"go2tv" # cast videos to UPNP/DLNA device (i.e. tv).
"imagemagick"
"sane-cast" # cast videos to UPNP/DLNA, with compatibility
"sox"
"yt-dlp"
];
@ -211,6 +215,7 @@ in
backblaze-b2 = {};
blanket.buildCost = 1;
blanket.sandbox.method = "bwrap";
blanket.sandbox.whitelistAudio = true;
# blanket.sandbox.whitelistDbus = [ "user" ]; # TODO: untested
@ -263,13 +268,14 @@ in
ddrescue.sandbox.method = "landlock"; # TODO:sandbox: untested
ddrescue.sandbox.autodetectCliPaths = "existingOrParent";
# auth token, preferences
delfin.buildCost = 1;
delfin.sandbox.method = "bwrap";
delfin.sandbox.whitelistAudio = true;
delfin.sandbox.whitelistDbus = [ "user" ]; # else `mpris` plugin crashes the player
delfin.sandbox.whitelistDri = true;
delfin.sandbox.whitelistWayland = true;
delfin.sandbox.net = "clearnet";
# auth token, preferences
delfin.persist.byStore.private = [ ".config/delfin" ];
dig.sandbox.method = "bwrap";
@ -298,10 +304,6 @@ in
dtc.sandbox.method = "bwrap";
dtc.sandbox.autodetectCliPaths = true; # TODO:sandbox: untested
dtrx.sandbox.method = "bwrap";
dtrx.sandbox.whitelistPwd = true;
dtrx.sandbox.autodetectCliPaths = "existing"; #< for the archive
duplicity = {};
e2fsprogs.sandbox.method = "landlock";
@ -314,11 +316,13 @@ in
eg25-control = {};
electrum.buildCost = 1;
electrum.sandbox.method = "bwrap"; # TODO:sandbox: untested
electrum.sandbox.net = "all"; # TODO: probably want to make this run behind a VPN, always
electrum.sandbox.whitelistWayland = true;
electrum.persist.byStore.cryptClearOnBoot = [ ".electrum" ]; #< TODO: use XDG dirs!
endless-sky.buildCost = 1;
endless-sky.persist.byStore.plaintext = [ ".local/share/endless-sky" ];
endless-sky.sandbox.method = "bwrap";
endless-sky.sandbox.whitelistAudio = true;
@ -357,6 +361,7 @@ in
".persist/plaintext"
];
ffmpeg.buildCost = 1;
ffmpeg.sandbox.method = "bwrap";
ffmpeg.sandbox.autodetectCliPaths = "existingFileOrParent"; # it outputs uncreated files -> parent dir needs mounting
@ -374,7 +379,9 @@ in
fluffychat-moby.persist.byStore.plaintext = [ ".local/share/chat.fluffy.fluffychat" ];
font-manager.buildCost = 1;
font-manager.sandbox.method = "bwrap";
font-manager.sandbox.whitelistWayland = true;
font-manager.packageUnwrapped = pkgs.rmDbusServicesInPlace (pkgs.font-manager.override {
# build without the "Google Fonts" integration feature, to save closure / avoid webkitgtk_4_0
withWebkit = false;
@ -382,7 +389,7 @@ in
forkstat.sandbox.method = "landlock"; #< doesn't seem to support bwrap
forkstat.sandbox.extraConfig = [
"--sane-sandbox-keep-namespace" "pid"
"--sanebox-keep-namespace" "pid"
];
forkstat.sandbox.extraPaths = [
"/proc"
@ -409,6 +416,7 @@ in
# TODO: we can populate gh's stuff statically; it even lets us use the same oauth across machines
gh.persist.byStore.private = [ ".config/gh" ];
gimp.buildCost = 1;
gimp.sandbox.method = "bwrap";
gimp.sandbox.whitelistX = true;
gimp.sandbox.whitelistWayland = true;
@ -428,32 +436,39 @@ in
"/tmp" # "Cannot open display:" if it can't mount /tmp 👀
];
"gnome.gnome-calculator".buildCost = 1;
"gnome.gnome-calculator".sandbox.method = "bwrap";
"gnome.gnome-calculator".sandbox.whitelistWayland = true;
"gnome.gnome-calendar".buildCost = 1;
# gnome-calendar surely has data to persist, but i use it strictly to do date math, not track events.
"gnome.gnome-calendar".sandbox.method = "bwrap";
"gnome.gnome-calendar".sandbox.whitelistWayland = true;
"gnome.gnome-clocks".sandbox.method = "bwrap";
"gnome.gnome-clocks".sandbox.whitelistWayland = true;
"gnome.gnome-clocks".suggestedPrograms = [ "dconf" ];
# gnome-disks
"gnome.gnome-disk-utility".buildCost = 1;
"gnome.gnome-disk-utility".sandbox.method = "bwrap";
"gnome.gnome-disk-utility".sandbox.whitelistDbus = [ "system" ];
"gnome.gnome-disk-utility".sandbox.whitelistWayland = true;
"gnome.gnome-disk-utility".sandbox.extraHomePaths = [
"tmp"
"use/iso"
# TODO: probably need /dev and such
];
# seahorse: dump gnome-keyring secrets.
"gnome.seahorse".buildCost = 1;
# N.B.: it can also manage ~/.ssh keys, but i explicitly don't add those to the sandbox for now.
"gnome.seahorse".sandbox.method = "bwrap";
"gnome.seahorse".sandbox.whitelistDbus = [ "user" ];
"gnome.seahorse".sandbox.whitelistWayland = true;
gnome-2048.buildCost = 1;
gnome-2048.sandbox.method = "bwrap";
gnome-2048.sandbox.whitelistWayland = true;
gnome-2048.persist.byStore.plaintext = [ ".local/share/gnome-2048/scores" ];
gnome-frog.buildCost = 1;
gnome-frog.sandbox.method = "bwrap";
gnome-frog.sandbox.whitelistWayland = true;
gnome-frog.sandbox.whitelistDbus = [ "user" ];
@ -480,6 +495,7 @@ in
# 1. no number may appear unshaded more than once in the same row/column
# 2. no two shaded tiles can be direct N/S/E/W neighbors
# - win once (1) and (2) are satisfied
"gnome.hitori".buildCost = 1;
"gnome.hitori".sandbox.method = "bwrap";
"gnome.hitori".sandbox.whitelistWayland = true;
@ -509,6 +525,7 @@ in
grim.sandbox.autodetectCliPaths = "existingOrParent";
grim.sandbox.whitelistWayland = true;
hase.buildCost = 1;
hase.sandbox.method = "bwrap";
hase.sandbox.net = "clearnet";
hase.sandbox.whitelistAudio = true;
@ -529,6 +546,7 @@ in
# N.B.: inetutils' `ping` is shadowed by iputils' ping (by nixos, intentionally).
inetutils.sandbox.method = "landlock"; # want to keep the same netns, at least.
inkscape.buildCost = 1;
inkscape.sandbox.method = "bwrap";
inkscape.sandbox.whitelistWayland = true;
inkscape.sandbox.extraHomePaths = [
@ -580,6 +598,7 @@ in
"/proc"
];
krita.buildCost = 1;
krita.sandbox.method = "bwrap";
krita.sandbox.whitelistWayland = true;
krita.sandbox.autodetectCliPaths = "existing";
@ -600,6 +619,7 @@ in
libnotify.sandbox.method = "bwrap";
libnotify.sandbox.whitelistDbus = [ "user" ]; # notify-send
losslesscut-bin.buildCost = 1;
losslesscut-bin.sandbox.method = "bwrap";
losslesscut-bin.sandbox.extraHomePaths = [
"Music"
@ -615,6 +635,7 @@ in
losslesscut-bin.sandbox.whitelistX = true;
lsof.sandbox.method = "capshonly"; # lsof doesn't sandbox under bwrap or even landlock w/ full access to /
lsof.sandbox.capabilities = [ "dac_override" "sys_ptrace" ];
lua = {};
@ -623,6 +644,7 @@ in
mercurial.sandbox.whitelistPwd = true;
# actual monero blockchain (not wallet/etc; safe to delete, just slow to regenerate)
monero-gui.buildCost = 1;
# XXX: is it really safe to persist this? it doesn't have info that could de-anonymize if captured?
monero-gui.persist.byStore.plaintext = [ ".bitmonero" ];
monero-gui.sandbox.method = "bwrap";
@ -631,6 +653,7 @@ in
"records/finance/cryptocurrencies/monero"
];
mumble.buildCost = 1;
mumble.persist.byStore.private = [ ".local/share/Mumble" ];
nano.sandbox.method = "bwrap";
@ -721,7 +744,7 @@ in
# procps: free, pgrep, pidof, pkill, ps, pwait, top, uptime, couple others
procps.sandbox.method = "bwrap";
procps.sandbox.extraConfig = [
"--sane-sandbox-keep-namespace" "pid"
"--sanebox-keep-namespace" "pid"
];
pstree.sandbox.method = "landlock";
@ -734,11 +757,14 @@ in
pulsemixer.sandbox.method = "landlock";
pulsemixer.sandbox.whitelistAudio = true;
pwvucontrol.buildCost = 1;
pwvucontrol.sandbox.method = "bwrap";
pwvucontrol.sandbox.whitelistAudio = true;
pwvucontrol.sandbox.whitelistDri = true; # else perf on moby is unusable
pwvucontrol.sandbox.whitelistWayland = true;
python3-repl.packageUnwrapped = pkgs.python3.withPackages (ps: with ps; [
psutil
requests
]);
python3-repl.sandbox.method = "bwrap";
@ -749,7 +775,7 @@ in
];
qemu.sandbox.enable = false; #< it's a launcher
qemu.slowToBuild = true;
qemu.buildCost = 2;
rsync.sandbox.method = "bwrap";
rsync.sandbox.net = "clearnet";
@ -757,10 +783,9 @@ in
rustc = {};
sane-open-desktop.sandbox.enable = false; #< trivial script, and all our deps are sandboxed
sane-open-desktop.suggestedPrograms = [
"gdbus"
];
sane-cast = {}; #< TODO: sandbox this the same way i sandbox go2tv
sane-die-with-parent.sandbox.enable = false; #< it's a launcher; can't sandbox
screen.sandbox.enable = false; #< tty; needs to run anything
@ -768,6 +793,7 @@ in
sequoia.sandbox.whitelistPwd = true;
sequoia.sandbox.autodetectCliPaths = true;
shattered-pixel-dungeon.buildCost = 1;
shattered-pixel-dungeon.persist.byStore.plaintext = [ ".local/share/.shatteredpixel/shattered-pixel-dungeon" ];
shattered-pixel-dungeon.sandbox.method = "bwrap";
shattered-pixel-dungeon.sandbox.whitelistAudio = true;
@ -775,6 +801,7 @@ in
shattered-pixel-dungeon.sandbox.whitelistWayland = true;
# printer/filament settings
slic3r.buildCost = 1;
slic3r.persist.byStore.plaintext = [ ".Slic3r" ];
slurp.sandbox.method = "bwrap";
@ -789,12 +816,13 @@ in
sops.sandbox.method = "bwrap"; # TODO:sandbox: untested
sops.sandbox.extraHomePaths = [
".config/sops"
"dev/nixos"
"nixos"
# TODO: sops should only need access to knowledge/secrets,
# except that i currently put its .sops.yaml config in the root of ~/knowledge
"knowledge"
];
soundconverter.buildCost = 1;
soundconverter.sandbox.method = "bwrap";
soundconverter.sandbox.whitelistWayland = true;
soundconverter.sandbox.extraHomePaths = [
@ -812,6 +840,7 @@ in
sox.sandbox.autodetectCliPaths = "existingFileOrParent";
sox.sandbox.whitelistAudio = true;
space-cadet-pinball.buildCost = 1;
space-cadet-pinball.persist.byStore.plaintext = [ ".local/share/SpaceCadetPinball" ];
space-cadet-pinball.sandbox.method = "bwrap";
space-cadet-pinball.sandbox.whitelistAudio = true;
@ -832,6 +861,7 @@ in
subversion.sandbox.whitelistPwd = true;
sudo.sandbox.enable = false;
superTux.buildCost = 1;
superTux.sandbox.method = "bwrap";
superTux.sandbox.wrapperType = "inplace"; # package Makefile incorrectly installs to $out/games/superTux instead of $out/share/games
superTux.sandbox.whitelistAudio = true;
@ -850,12 +880,14 @@ in
tdesktop.persist.byStore.private = [ ".local/share/TelegramDesktop" ];
tokodon.buildCost = 1;
tokodon.persist.byStore.private = [ ".cache/KDE/tokodon" ];
tree.sandbox.method = "landlock";
tree.sandbox.autodetectCliPaths = true;
tree.sandbox.whitelistPwd = true;
tumiki-fighters.buildCost = 1;
tumiki-fighters.sandbox.method = "bwrap";
tumiki-fighters.sandbox.whitelistAudio = true;
tumiki-fighters.sandbox.whitelistDri = true; #< not strictly necessary, but triples CPU perf
@ -874,12 +906,16 @@ in
"/sys/bus/usb"
];
valgrind.buildCost = 1;
valgrind.sandbox.enable = false; #< it's a launcher: can't sandbox
visidata.sandbox.method = "bwrap"; # TODO:sandbox: untested
visidata.sandbox.autodetectCliPaths = true;
# `vulkaninfo`, `vkcube`
vulkan-tools.sandbox.method = "landlock";
vvvvvv.buildCost = 1;
vvvvvv.sandbox.method = "bwrap";
vvvvvv.sandbox.whitelistAudio = true;
vvvvvv.sandbox.whitelistDri = true; #< playable without, but burns noticably more CPU
@ -900,6 +936,7 @@ in
wget.sandbox.net = "all";
wget.sandbox.whitelistPwd = true; # saves to pwd by default
whalebird.buildCost = 1;
whalebird.persist.byStore.private = [ ".config/Whalebird" ];
# `wg`, `wg-quick`

View File

@ -14,6 +14,8 @@
};
};
buildCost = 1;
sandbox.method = "bwrap";
sandbox.whitelistAudio = true;
sandbox.whitelistWayland = true;

View File

@ -2,10 +2,7 @@
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p blast-ugjka
# vim: set filetype=python :
import ctypes
import logging
import os
import signal
import socket
import subprocess
@ -16,53 +13,9 @@ logger = logging.getLogger(__name__)
# map from known devices -> required flags
DEVICE_MAP = {
"Theater TV": [],
"[LG] webOS TV OLED55C9PUA": [ "-usewav" ],
"Cuddlevision": [ "-usewav" ],
}
def set_pdeathsig(sig=signal.SIGTERM):
"""
helper function to ensure once parent process exits, its children processes will automatically die.
see: <https://stackoverflow.com/a/43152455>
see: <https://www.man7.org/linux/man-pages/man2/prctl.2.html>
"""
libc = ctypes.CDLL("libc.so.6")
return libc.prctl(1, sig)
MY_PID = None
def reap_children(sig=None, frame=None):
global MY_PID
# reset SIGTERM handler to avoid recursing
signal.signal(signal.SIGTERM, signal.Handlers.SIG_DFL)
logger.info("killing all children (of pid %d)", MY_PID)
os.killpg(MY_PID, signal.SIGTERM)
def reap_on_exit():
"""
catch when the parent exits, and map that to SIGTERM for this process.
when this process receives SIGTERM, also terminate all descendent processes.
this is done because:
1. mpv invokes this, but (potentially) via the sandbox wrapper.
2. when mpv exits, it `SIGKILL`s that sandbox wrapper.
3. bwrap does not pass SIGKILL or SIGTERM to its child.
4. hence, we neither receive that signal NOR can we pass it on simply by killing our immediate children
(since any bwrap'd children wouldn't pass that signal on...)
really, the proper fix would be on mpv's side:
- mpv should create a new process group when it launches a command, and kill that process group on exit.
or fix this in the sandbox wrapper:
- why *doesn't* bwrap forward the signals?
- there's --die-with-parent, but i can't apply that *system wide* and expect reasonably behavior
<https://github.com/containers/bubblewrap/issues/529>
"""
global MY_PID
MY_PID = os.getpid()
# create a new process group, pgid = gid
os.setpgid(MY_PID, MY_PID)
set_pdeathsig(signal.SIGTERM)
signal.signal(signal.SIGTERM, reap_children)
def get_ranked_ip_addrs():
"""
return the IP addresses most likely to be LAN addresses
@ -96,8 +49,6 @@ class BlastDriver:
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
# this pdeathsig isn't necessary; seems it might result in leaked pulse outputs
# preexec_fn=set_pdeathsig
)
self.blast_flags = list(blast_flags)
self.receiver_names = []
@ -202,15 +153,11 @@ def main():
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
reap_on_exit()
blast = try_blast()
if blast is not None:
logger.info("waiting until blast exits")
blast.blast.wait()
reap_children()
if __name__ == "__main__":
main()

View File

@ -42,9 +42,9 @@ in
sandbox.extraConfig = [
# else it fails to reap its children (or, maybe, it fails to hook its parent's death signal?)
# might be possible to remove this, but kinda hard to see a clean way.
"--sane-sandbox-keep-namespace" "pid"
"--sanebox-keep-namespace" "pid"
];
suggestedPrograms = [ "blast-ugjka" ];
suggestedPrograms = [ "blast-ugjka" "sane-die-with-parent" ];
};
networking.firewall.allowedTCPPorts = lib.mkIf cfg.enabled [ 9000 ];

View File

@ -99,18 +99,12 @@ in
type = types.listOf transitionType;
default = [];
};
configFile = mkOption {
type = types.path;
default = pkgs.writeText "bonsai_tree.json" (builtins.toJSON cfg.config.transitions);
description = ''
configuration file to pass to bonsai.
usually auto-generated from the sibling options; exposed mainly for debugging or convenience.
'';
};
};
};
};
fs.".config/bonsai/bonsai_tree.json".symlink.text = builtins.toJSON cfg.config.transitions;
sandbox.method = "bwrap";
sandbox.extraRuntimePaths = [
"/" #< just needs "bonsai", but needs to create it first...
@ -119,7 +113,8 @@ in
services.bonsaid = {
description = "bonsai: programmable input dispatcher";
partOf = [ "graphical-session" ];
command = "bonsaid -t ${cfg.config.configFile}";
# nice -n -11 chosen arbitrarily. i hope this will allow for faster response to inputs, but without audio underruns (pipewire is -21, dino -15-ish)
command = "nice -n -11 bonsaid -t $HOME/.config/bonsai/bonsai_tree.json";
cleanupCommand = "rm -f $XDG_RUNTIME_DIR/bonsai";
};
};

View File

@ -7,7 +7,7 @@
# - message @cheogram.com "reset sip account" (this is not destructive, despite the name)
# - the bot will reply with auto-generated username/password plus a SIP server endpoint.
# just copy those into gnome-calls' GUI configurator
# - now gnome-calls can do outbound calls. inbound calls requires more chatting with the help bot
# - now gnome-calls can do outbound calls. inbound calls can be routed by messaging the bot: "configure calls"
#
# my setup here is still very WIP.
# open questions:
@ -25,7 +25,7 @@ in
type = types.submodule {
options.autostart = mkOption {
type = types.bool;
default = false;
default = true;
};
};
};
@ -36,9 +36,11 @@ in
".local/share/calls" # call "records"
# .local/share/folks # contacts?
];
# this is only the username/endpoint: the actual password appears to be stored in gnome-keyring
secrets.".config/calls/sip-account.cfg" = ../../../secrets/common/gnome_calls_sip-account.cfg.bin;
suggestedPrograms = [
"feedbackd" # needs `phone-incoming-call`, in particular
"gnome-keyring" # to remember the password
];
services.gnome-calls = {

View File

@ -1,6 +1,8 @@
{ ... }:
{
sane.programs.celeste64 = {
buildCost = 1;
sandbox.method = "bwrap";
sandbox.whitelistAudio = true;
sandbox.whitelistDri = true;

View File

@ -13,6 +13,8 @@
'';
});
buildCost = 1;
sandbox.method = "bwrap"; # landlock gives: _multiprocessing.SemLock: Permission Denied
sandbox.whitelistAudio = true;
sandbox.whitelistDbus = [ "user" ]; # mpris

View File

@ -0,0 +1,34 @@
# docs: <https://wiki.nixos.org/wiki/Printing>
# to add a printer:
# 1. <http://localhost:631/admin/>
# 2. click "find new printers" and follow prompts
# - prefer to use the "Generic IPP Everywhere Printer" driver
# alternatively, add/modify printers by running
# - `system-config-printer`
{ config, lib, ... }:
let
cfg = config.sane.programs.cups;
in
{
sane.programs.cups = {
suggestedPrograms = [
"system-config-printer"
];
};
sane.programs.system-config-printer = {};
services.printing = lib.mkIf cfg.enabled {
enable = true;
startWhenNeeded = false; #< a.k.a. socket activated?
# webInterface = false;
# logLevel = "debug"; # default: "info"
# extraConfig = "<lines ... >";
# drivers = [ <cups driver packages...> ]
};
# services.avahi = lib.mkIf cfg.enabled {
# # only needed for wireless printing
# enable = true;
# nssmdns4 = true;
# openFirewall = true;
# };
}

View File

@ -21,5 +21,15 @@
ln -s curlftpfs $out/bin/mount.curlftpfs
'';
});
# TODO: try to sandbox this better? maybe i can have fuse (unsandboxed) invoke curlftpfs (sandboxed)?
# - landlock gives EPERM
# - bwrap just silently doesn't mount it, maybe because of setuid stuff around fuse?
# sandbox.method = "capshonly";
# sandbox.net = "all";
# sandbox.capabilities = [
# "sys_admin"
# "sys_module"
# ];
};
}

View File

@ -21,12 +21,15 @@
./chatty.nix
./conky
./cozy.nix
./cups.nix
./curlftpfs.nix
./dconf.nix
./deadd-notification-center
./dialect.nix
./dino.nix
./dissent.nix
./dtrx.nix
./eg25-control.nix
./element-desktop.nix
./engrampa.nix
./epiphany.nix
@ -45,6 +48,7 @@
./gdbus.nix
./geary.nix
./git.nix
./gnome-clocks.nix
./gnome-feeds.nix
./gnome-keyring
./gnome-maps.nix
@ -53,6 +57,7 @@
./gpodder.nix
./grimshot.nix
./gthumb.nix
./gvfs.nix
./handbrake.nix
./helix.nix
./htop
@ -62,6 +67,7 @@
./komikku.nix
./koreader
./less.nix
./lftp.nix
./libreoffice.nix
./lemoa.nix
./loupe.nix
@ -69,17 +75,20 @@
./megapixels.nix
./mepo.nix
./mimeo
./modemmanager.nix
./mopidy.nix
./mpv
./msmtp.nix
./nautilus.nix
./neovim.nix
./networkmanager.nix
./newsflash.nix
./nheko.nix
./nicotine-plus.nix
./nix-index.nix
./notejot.nix
./ntfy-sh.nix
./objdump.nix
./obsidian.nix
./offlineimap.nix
./open-in-mpv.nix
@ -90,10 +99,13 @@
./rhythmbox.nix
./ripgrep.nix
./rofi
./rtkit.nix
./s6-rc.nix
./sane-input-handler
./sane-open.nix
./sane-screenshot.nix
./sane-scripts.nix
./sanebox.nix
./schlock.nix
./sfeed.nix
./signal-desktop.nix
@ -122,6 +134,7 @@
./wine.nix
./wireplumber.nix
./wireshark.nix
./wpa_supplicant.nix
./wvkbd.nix
./xarchiver.nix
./xdg-desktop-portal.nix
@ -132,6 +145,7 @@
./zathura.nix
./zeal.nix
./zecwallet-lite.nix
./zulip.nix
./zsh
];

View File

@ -1,15 +1,6 @@
{ pkgs, ... }:
{
sane.programs.dialect = {
sandbox.method = "bwrap";
sandbox.wrapperType = "inplace"; # share/search_providers/ calls back into the binary, weird wrap semantics
sandbox.whitelistWayland = true;
sandbox.net = "clearnet";
sandbox.extraHomePaths = [
".config/dconf" # won't start without it
];
suggestedPrograms = [ "dconf" ]; #< to persist settings
packageUnwrapped = pkgs.dialect.overrideAttrs (upstream: {
# TODO: send upstream
# TODO: figure out how to get audio working
@ -18,5 +9,17 @@
pkgs.glib-networking # for TLS
];
});
suggestedPrograms = [ "dconf" ]; #< to persist settings
buildCost = 1;
sandbox.method = "bwrap";
sandbox.wrapperType = "inplace"; # share/search_providers/ calls back into the binary, weird wrap semantics
sandbox.whitelistWayland = true;
sandbox.net = "clearnet";
sandbox.extraHomePaths = [
".config/dconf" # won't start without it
];
};
}

View File

@ -22,17 +22,17 @@
# - mic is sometimes disabled at call start despite presenting as enabled
# - fix is to toggle it off -> on in the Dino UI
# - default mic gain is WAY TOO MUCH (heavily distorted)
# - TODO: dino should have more optimal niceness/priority to ensure it can process its buffers
# - possibly this is solved by enabling RealtimeKit (rtkit)
# - on lappy/desktop, right-clicking the mic button allows to toggle audio devices, but impossible to trigger this on moby/touch screen!
# - TODO: see if Dino calls work better with `echo full > /sys/kernel/debug/sched/preempt`
#
# probably fixed:
# - once per 1-2 minutes dino will temporarily drop mic input:
# - `rtp-WRNING: plugin.vala:148: Warning in pipeline: Can't record audio fast enough
# - `rtp-WARNING: plugin.vala:148: Warning in pipeline: Can't record audio fast enough
# - this was *partially* fixed by bumping the pipewire mic buffer to 2048 samples (from ~512)
# - this was further fixed by setting PULSE_LATENCY_MSEC=20.
# - possibly Dino should be updated internally: `info.rate / 100` -> `info.rate / 50`.
# - i think that affects the batching for echo cancellation, adaptive gain control, etc.
# - dino *should* be able to use Pipewire directly for calls instead of going through pulse, but had trouble achieving that in actuality
#
{ config, lib, pkgs, ... }:
let
@ -50,16 +50,25 @@ in
};
};
packageUnwrapped = pkgs.dino.overrideAttrs (upstream: {
packageUnwrapped = (pkgs.dino.override {
# XXX(2024/04/24): build without echo cancelation (i.e. force WITH_VOICE_PROCESSOR to be undefined).
# this means that if the other end of the call is on speaker phone, i'm liable to hear my own voice
# leave their speaker, enter their mic, and then return to me.
# the benefit is a >50% reduction in CPU use. insignificant on any modern PC; make-or-break on a low-power Pinephone.
webrtc-audio-processing = null;
}).overrideAttrs (upstream: {
# i'm updating experimentally to see if it improves call performance.
# i don't *think* this is actually necessary; i don't notice any difference.
version = "0.4.3-unstable-2024-04-01";
version = "0.4.3-unstable-2024-04-28";
src = lib.warnIf (lib.versionOlder "0.4.3" upstream.version) "dino update: safe to remove sane patches" pkgs.fetchFromGitHub {
owner = "dino";
repo = "dino";
rev = "d9fa4daa6a7d16f5f0e2183a77ee2d07849dd9f3";
hash = "sha256-vJBIMsMLlK8Aw19fD2aFNtegXkjOqEgb3m1hi3fE5DE=";
rev = "657502955567dd538e56f300e075c7db52e25d74";
hash = "sha256-SApJy9FgxxLOB5A/zGtpdFZtSqSiS03vggRrCte1tFE=";
};
# avoid double-application of upstreamed patches
# https://github.com/NixOS/nixpkgs/pull/309265
patches = [];
checkPhase = ''
runHook preCheck
./xmpp-vala-test
@ -96,17 +105,29 @@ in
# audio buffering; see: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#pipewire-buffering-explained>
# dino defaults to 10ms mic buffer, which causes underruns, which Dino handles *very* poorly
# as in, the other end of the call will just not receive sound from us for a couple seconds.
# pipewire uses power-of-two buffering for the mic itself. that would put us at 21.33 ms, but this env var supports only whole numbers (21ms ends up not power-of-two).
# also, Dino's likely still doing things in 10ms batches internally anyway.
# pipewire uses power-of-two buffering for the mic itself (by default), but this env var supports only whole numbers, which isn't quite reconcilable:
# - 1024/48000 = 21.33ms
# - 2048/48000 = 42.67ms
# - 4096/48000 = 85.33ms
# also, Dino's likely still doing things in 10ms batches internally.
#
# note that this number supposedly is just the buffer size which Dino asks Pulse (pipewire) to share with it.
# in theory, it's equivalent to adjusting pipewire's quanta setting, and so isn't additive to the existing pipewire buffers.
# (and would also be overriden by pipewire's quanta.min setting).
# but in practice, setting this seems to have some more effect beyond just the buffer sizes visible in `pw-top`.
#
# further: decrease the "niceness" of dino, so that it can take precedence over anything else.
# ideally this would target just the audio processing, rather than the whole program.
# pipewire is the equivalent of `nice -n -21`, so probably don't want to go any more extreme than that.
# nice -n -15 chosen arbitrarily; not optimized
# nice -n -15 chosen arbitrarily; not optimized (and seems to have very little impact in practice anyway).
# buffer size:
# - 1024 (PULSE_LATENCY_MSEC=20): `pw-top` shows several underruns per second.
# - 2048 (PULSE_LATENCY_MSEC=50): `pw-top` shows very few underruns: maybe 1-5 per minute. with voice processor disabled, this works well. with it enabled, i still get gaps in which the mic "disappears".
# - 4096 (PULSE_LATENCY_MSEC=100): `pw-top` shows 0 underruns. with voice processor disabled, i seem to be permanently muted. with it enabled, this works well.
#
# note that debug logging during calls produces so much journal spam that it pegs the CPU and causes dropped audio
# env G_MESSAGES_DEBUG = "all";
command = "env PULSE_LATENCY_MSEC=20 nice -n -15 dino";
command = "env PULSE_LATENCY_MSEC=50 nice -n -15 dino";
};
};
}

View File

@ -0,0 +1,16 @@
{ pkgs, ... }:
{
sane.programs.dtrx = {
packageUnwrapped = pkgs.dtrx.override {
# `binutils` is the nix wrapper, which reads nix-related env vars
# before passing on to e.g. `ld`.
# dtrx probably only needs `ar` at runtime, not even `ld`.
binutils = pkgs.binutils-unwrapped;
# build without rpm support, since `rpm` package doesn't cross-compile.
rpm = null;
};
sandbox.method = "bwrap";
sandbox.whitelistPwd = true;
sandbox.autodetectCliPaths = "existing"; #< for the archive
};
}

View File

@ -0,0 +1,74 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.eg25-control;
in
{
sane.programs.eg25-control = {
suggestedPrograms = [ "modemmanager" ];
services.eg25-control-powered = {
description = "eg25-control-powered: power to the Qualcomm eg25 modem used by PinePhone";
startCommand = "eg25-control --power-on --verbose";
cleanupCommand = "eg25-control --power-off --verbose";
# depends = [ "ModemManager" ]
};
services.eg25-control-gps = {
# TODO: separate almanac upload from GPS enablement
# - don't want to re-upload the almanac everytime the GPS is toggled
# - want to upload almanac even when GPS *isn't* enabled, if we have internet connection.
description = "eg25-control-gps: background GPS tracking";
startCommand = "eg25-control --enable-gps --dump-debug-info --verbose";
cleanupCommand = "eg25-control --disable-gps --dump-debug-info --verbose";
depends = [ "eg25-control-powered" ];
};
};
# TODO: port to s6
systemd.services.eg25-control-freshen-agps = lib.mkIf cfg.enabled {
description = "keep assisted-GPS data fresh";
serviceConfig = {
# XXX: this can have a race condition with eg25-control-gps
# - eg25-control-gps initiates DL of new/<agps>
# - eg25-control-gps tests new/<agps>: it works
# - eg25-control-freshen-agps initiates DL of new/<agps>
# - eg25-control-gps: moves new/<agps> into cache/
# - but it moved the result (possibly incomplete) of eg25-control-freshen-agps, incorrectly
# in practice, i don't expect much issue from this.
ExecStart = "${cfg.package}/bin/eg25-control --ensure-agps-cache --verbose";
Restart = "no";
User = "eg25-control";
WorkingDirectory = "/var/lib/eg25-control";
StateDirectory = "eg25-control";
};
startAt = "hourly"; # this is a bit more than necessary, but idk systemd calendar syntax
after = [ "network-online.target" "nss-lookup.target" ];
requires = [ "network-online.target" ];
# wantedBy = [ "network-online.target" ]; # auto-start immediately after boot
};
users = lib.mkIf cfg.enabled {
groups.eg25-control = {};
users.eg25-control = {
group = "eg25-control";
isSystemUser = true;
home = "/var/lib/eg25-control";
extraGroups = [
"dialout" # required to read /dev/ttyUSB1
"networkmanager" # required to authenticate with mmcli
];
};
};
sane.persist.sys.byStore.plaintext = lib.mkIf cfg.enabled [
# to persist agps data, i think.
{ user = "eg25-control"; group = "eg25-control"; path = "/var/lib/eg25-control"; }
];
services.udev.extraRules = let
chmod = "${pkgs.coreutils}/bin/chmod";
chown = "${pkgs.coreutils}/bin/chown";
in ''
# make Modem controllable by user
DRIVER=="modem-power", RUN+="${chmod} g+w /sys%p/powered", RUN+="${chown} :networkmanager /sys%p/powered"
'';
}

View File

@ -9,7 +9,7 @@
sane.programs.element-desktop = {
packageUnwrapped = (pkgs.element-desktop.override {
# use pre-built electron because otherwise it takes 4 hrs to build from source.
electron = pkgs.electron_28-bin;
electron = pkgs.electron-bin;
}).overrideAttrs (upstream: {
# fix to use wayland instead of Xwayland:
# - replace `NIXOS_OZONE_WL` non-empty check with `WAYLAND_DISPLAY`
@ -25,6 +25,8 @@
"gnome-keyring"
];
buildCost = 1;
sandbox.method = "bwrap";
sandbox.net = "clearnet";
sandbox.whitelistAudio = true;

View File

@ -23,6 +23,8 @@
"tmp"
];
buildCost = 2;
# XXX(2023/07/08): running on moby without `WEBKIT_DISABLE_SANDBOX...` fails, with:
# - `bwrap: Can't make symlink at /var/run: File exists`
# this could be due to:

View File

@ -1,6 +1,8 @@
{ ... }:
{
sane.programs.evince = {
buildCost = 1;
sandbox.method = "bwrap";
sandbox.autodetectCliPaths = true;
sandbox.whitelistWayland = true;

View File

@ -207,6 +207,10 @@ in
package = pkgs.firefox-extensions.i2p-in-private-browsing;
enable = lib.mkDefault config.services.i2p.enable;
};
i-still-dont-care-about-cookies = {
package = pkgs.firefox-extensions.i-still-dont-care-about-cookies;
enable = lib.mkDefault true;
};
open-in-mpv = {
# test: `open-in-mpv 'mpv:///open?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ'`
package = pkgs.firefox-extensions.open-in-mpv;
@ -310,8 +314,8 @@ in
// scrollbar configuration, see: <https://artemis.sh/2023/10/12/scrollbars.html>
// style=4 gives rectangular scrollbars
// could also enable "always show scrollbars" in about:preferences -- not sure what the actual pref name for that is
// note that too-large scrollbars (like 50px wide) tend to obscure content (and make buttons unclickable)
defaultPref("widget.non-native-theme.scrollbar.size.override", 20);
// note that too-large scrollbars (like 50px wide, even 20px) tend to obscure content (and make buttons unclickable)
defaultPref("widget.non-native-theme.scrollbar.size.override", 14);
defaultPref("widget.non-native-theme.scrollbar.style", 4);
// disable inertial/kinetic/momentum scrolling because it just gets in the way on touchpads

View File

@ -30,6 +30,30 @@ let
nerdfontPkgs = builtins.map
(f: pkgs.nerdfonts.override { fonts = [ f ]; })
wantedNerdfonts;
# see: <repo:nixos/nixpkgs:nixos/modules/config/fonts/fontconfig.nix>
# and: <repo:nixos/nixpkgs:pkgs/development/libraries/fontconfig/make-fonts-cache.nix>
# nixpkgs creates a fontconfig cache, but only when *not* cross compiling.
# but the alternative is that fonts are cached purely at runtime, in ~/.cache/fontconfig,
# and that needs to either be added to the sandbox of *every* app,
# or font-heavy apps are several *seconds* slower to launch.
#
# TODO: upstream this into `make-fonts-cache.nix`?
cache = (pkgs.makeFontsCache { fontDirectories = config.fonts.packages; }).overrideAttrs (upstream: {
buildCommand = lib.replaceStrings
[ "fc-cache" ]
[ "${pkgs.stdenv.hostPlatform.emulator pkgs.buildPackages} ${pkgs.fontconfig.bin}/bin/fc-cache" ]
upstream.buildCommand
;
});
cacheConf = pkgs.writeTextDir "etc/fonts/conf.d/01-nixos-cache-cross.conf" ''
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
<fontconfig>
<!-- Pre-generated font caches -->
<cachedir>${cache}</cachedir>
</fontconfig>
'';
in
{
sane.programs.fontconfig = {
@ -64,6 +88,8 @@ in
"DejaVu Sans"
];
};
# nixpkgs builds a cache file, but only for non-cross. i want it always, so add my own cache -- but ONLY for cross.
fontconfig.confPackages = lib.mkIf (pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform) [ cacheConf ];
#vvv enables dejavu_fonts, freefont_ttf, gyre-fonts, liberation_ttf, unifont, noto-fonts-emoji
enableDefaultPackages = false;
packages = with pkgs; [

View File

@ -2,11 +2,6 @@
{ pkgs, ... }:
{
sane.programs.frozen-bubble = {
sandbox.method = "bwrap";
sandbox.net = "clearnet"; # net play
sandbox.whitelistAudio = true;
sandbox.whitelistWayland = true;
packageUnwrapped = pkgs.frozen-bubble.overrideAttrs (upstream: {
# patch so it stores its dot-files not in root ~.
postPatch = (upstream.postPatch or "") + ''
@ -14,6 +9,12 @@
--replace-fail '$FBHOME = "$ENV{HOME}/.frozen-bubble"' '$FBHOME = "$ENV{HOME}/.local/share/frozen-bubble"'
'';
});
buildCost = 1;
sandbox.method = "bwrap";
sandbox.net = "clearnet"; # net play
sandbox.whitelistAudio = true;
sandbox.whitelistWayland = true;
persist.byStore.plaintext = [
".local/share/frozen-bubble" # preferences, high scores

View File

@ -8,6 +8,8 @@
{ ... }:
{
sane.programs.g4music = {
buildCost = 1;
sandbox.method = "bwrap";
sandbox.whitelistAudio = true;
sandbox.whitelistDbus = [ "user" ]; # mpris

View File

@ -37,7 +37,7 @@ in
# fs.".config/geary".dir = {};
# fs.".local/share/folks".dir = {};
slowToBuild = true; # uses webkitgtk 4.1
buildCost = 3; # uses webkitgtk 4.1
persist.byStore.private = [
# attachments, and email -- contained in a sqlite db
".local/share/geary"

View File

@ -0,0 +1,24 @@
{ pkgs, ... }: {
sane.programs."gnome.gnome-clocks" = {
packageUnwrapped = pkgs.gnome.gnome-clocks.overrideAttrs (upstream: {
# TODO: upstream this
buildInputs = upstream.buildInputs ++ (with pkgs; [
# gnome-clocks needs `playbin` (gst-plugins-base) and `scaletempo` (gst-plugins-good)
# to play the alarm when a timer expires
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
]);
});
buildCost = 1;
sandbox.method = "bwrap";
sandbox.whitelistAudio = true;
sandbox.whitelistDbus = [ "user" ]; #< required (alongside .config/dconf) to remember timers
sandbox.whitelistWayland = true;
sandbox.extraPaths = [
".config/dconf" # required (alongside dbus) to remember timers
];
suggestedPrograms = [ "dconf" ];
};
}

View File

@ -3,6 +3,8 @@
{ ... }:
{
sane.programs."gnome.gnome-weather" = {
buildCost = 1;
sandbox.method = "bwrap";
sandbox.wrapperType = "inplace"; #< /share/org.gnome.Weather/org.gnome.Weather file refers to bins by full path
sandbox.whitelistWayland = true;

View File

@ -2,8 +2,20 @@
# - turn the tv off and on again (no, really...)
#
# SANITY CHECKS:
# - `go2tv -u 'https://uninsane.org/share/AmenBreak.mp4'`
# - `go2tv -u 'https://uninsane.org/share/Milkbags/AmenBreak.mp4'`
# - LGTV: works, but not seekable
# - Samsung: "Cannot play video."
# - `go2tv -v /mnt/servo/media/Videos/Milkbags/AmenBreak.mp4`
# - Samsung: works
# - `go2tv -v /mnt/servo/media/Videos/Milkbags/COLIN.webm`
# - Samsung: works
# - `go2tv -v /mnt/servo/media/Videos/Shows/Lucky.Star/S01/S01E01-The.Girl.who.Dashes.Off.mkv`
# - Samsung: error 500
# - `go2tv -tc -v /mnt/servo/media/Videos/Shows/Lucky.Star/S01/S01E01-The.Girl.who.Dashes.Off.mkv`
# - Samsung: error 500
# - note that it still advertized .mkv to the TV
# - `cp /mnt/servo/media/Videos/Shows/Lucky.Star/S01/S01E01-The.Girl.who.Dashes.Off.mkv S01E01-The.Girl.who.Dashes.Off.mp4 && go2tv -v S01E01-The.Girl.who.Dashes.Off.mp4`
# - Samsung: WORKS
# - `go2tv -u 'https://youtu.be/p3G5IXn0K7A'`
# - LGTV: FAILS ("this file cannot be recognized")
# - no fix via transcoding, altering the URI, etc.
@ -17,6 +29,8 @@
# - LGTV: works
#
# WHEN TO TRANSCODE:
# - mkv container + *:
# - Samsung: rename to .mp4 and cast that: no need to transcode
# - mkv container + mpeg-2 video + AC-3/48k stereo audio:
# - LGTV: no transcoding needed
# - mkv container + H.264 video + AAC/48k 5.1 audio:
@ -27,6 +41,7 @@
# - LGTV: no transcoding needed
# - mkv container + H.265 video + E-AC-3/48k stereo audio:
# - LGTV: no transcoding needed
#
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.go2tv;

View File

@ -0,0 +1,20 @@
# gvfs is used by e.g. nautilus to mount remote filesystems (ftp://, etc)
# TODO: gvfs depends on udisks, depends on gnupg,
# and as part of this `keyboxd` gpg daemon gets started and does background work every minute even though i totally don't use it.
{ config, pkgs, ... }:
let
cfg = config.sane.programs.gvfs;
in
{
sane.programs.gvfs = {
packageUnwrapped = pkgs.gvfs.override {
# i don't need to mount samba shares, and samba build is expensive/flaky (mostly for cross, but even problematic on native)
samba = null;
};
};
services.gvfs = {
inherit (cfg) package;
enable = cfg.enabled;
};
}

View File

@ -1,6 +1,8 @@
{ pkgs, ... }:
{
sane.programs.handbrake = {
buildCost = 1;
sandbox.method = "landlock"; #< also supports bwrap, but landlock ensures we don't write to non-mounted tmpfs dir
sandbox.whitelistDbus = [ "user" ]; # notifications
sandbox.whitelistWayland = true;

View File

@ -45,7 +45,7 @@ sort_direction=-1
tree_sort_direction=1
tree_view_always_by_pid=0
all_branches_collapsed=0
screen:Main=PID USER TTY NICE M_RESIDENT M_PRIV STATE PERCENT_CPU PERCENT_MEM TIME Command
screen:Main=PID USER TTY PRIORITY NICE M_RESIDENT M_PRIV STATE PERCENT_CPU PERCENT_MEM TIME Command
.sort_key=PERCENT_CPU
.tree_sort_key=PID
.tree_view_always_by_pid=0

View File

@ -1,6 +1,8 @@
{ pkgs, ... }:
{
sane.programs.imagemagick = {
buildCost = 1;
sandbox.method = "bwrap";
sandbox.wrapperType = "inplace"; # /etc/ImageMagick-7/delegates.xml refers to bins by absolute path
sandbox.whitelistPwd = true;

View File

@ -1,6 +1,15 @@
{ pkgs, ... }:
{
sane.programs.kdenlive = {
packageUnwrapped = pkgs.kdenlive.override {
ffmpeg-full = pkgs.ffmpeg-full.override {
# avoid expensive samba build for a feature i don't use
withSamba = false;
};
};
buildCost = 1;
sandbox.method = "bwrap";
sandbox.extraHomePaths = [
"Music"
@ -14,12 +23,5 @@
sandbox.whitelistDbus = [ "user" ]; # notifications
sandbox.whitelistDri = true;
sandbox.whitelistWayland = true;
packageUnwrapped = pkgs.kdenlive.override {
ffmpeg-full = pkgs.ffmpeg-full.override {
# avoid expensive samba build for a feature i don't use
withSamba = false;
};
};
};
}

View File

@ -16,6 +16,8 @@
sandbox.whitelistDri = true; #< required
sandbox.whitelistWayland = true;
buildCost = 2;
secrets.".local/share/komikku/keyrings/plaintext.keyring" = ../../../secrets/common/komikku_accounts.json.bin;
# downloads end up here, and without the toplevel database komikku doesn't know they exist.
persist.byStore.plaintext = [

View File

@ -47,6 +47,7 @@ in {
packageUnwrapped = pkgs.koreader-from-src;
sandbox.method = "bwrap"; # sandboxes fine under landlock too, except for FTP
sandbox.net = "clearnet";
sandbox.whitelistDbus = [ "user" ]; # for opening the web browser via portal
sandbox.whitelistDri = true; # reduces startup time and subjective page flip time
sandbox.whitelistWayland = true;
sandbox.extraHomePaths = [

View File

@ -1,6 +1,7 @@
{ ... }:
{
sane.programs.lemoa = {
buildCost = 1;
sandbox.method = "bwrap";
sandbox.net = "clearnet";
sandbox.whitelistDbus = [ "user" ]; # for clicking links

View File

@ -0,0 +1,13 @@
{ ... }:
{
sane.programs.lftp = {
sandbox.method = "bwrap";
sandbox.net = "all";
sandbox.extraPaths = [
"Music"
"Videos/local"
"Videos/servo"
"tmp"
];
};
}

View File

@ -16,7 +16,7 @@
"tmp"
];
slowToBuild = true;
buildCost = 3;
# disable first-run stuff
fs.".config/libreoffice/4/user/registrymodifications.xcu".symlink.text = ''

View File

@ -30,6 +30,7 @@
];
mime.associations = {
"image/avif" = "org.gnome.Loupe.desktop";
"image/gif" = "org.gnome.Loupe.desktop";
"image/heif" = "org.gnome.Loupe.desktop"; # apple codec
"image/png" = "org.gnome.Loupe.desktop";

View File

@ -1,6 +1,16 @@
{ ... }:
{ pkgs, ... }:
{
sane.programs.megapixels = {
packageUnwrapped = pkgs.megapixels.overrideAttrs (upstream: {
postPatch = (upstream.postPatch or "") + ''
# 2024/04/21: patch it to save photos in a more specific directory
substituteInPlace src/process_pipeline.c \
--replace-fail 'XDG_PICTURES_DIR' 'XDG_PHOTOS_DIR'
# 2024/04/21: patch it so the folder button works
substituteInPlace src/main.c \
--replace-fail 'g_get_user_special_dir(G_USER_DIRECTORY_PICTURES)' 'getenv("XDG_PHOTOS_DIR")'
'';
});
# megapixels sandboxing is tough:
# if misconfigured, preview will alternately be OK, black, or only 1/4 of it will be rendered -- with no obvious pattern.
# adding all of ~ to the sandbox will sometimes (?) fix the flakiness, even when `strace` doesn't show it accessing any files...
@ -16,10 +26,8 @@
sandbox.extraHomePaths = [
".config/dconf" #< else it segfaults during post-process
# ".config/megapixels"
".local/share/applications" #< needed for viewing photos, until i can sort out the portal stuff
".cache/mesa_shader_cache" # loads way faster
"tmp"
"Pictures" #< TODO: make this Pictures/Photos and save photos there
"Pictures/Photos"
# also it addresses a lot via relative path.
];
sandbox.extraPaths = [
@ -37,6 +45,12 @@
sandbox.extraRuntimePaths = [
"dconf" #< else it's very spammy, and slow
];
sandbox.extraConfig = [
# XXX(2024/04/21): without this it fails to convert .dng -> .jpg.
# "bwrap: open /proc/34/ns/ns failed: No such file or directory"
"--sanebox-keep-namespace" "pid"
];
suggestedPrograms = [ "dconf" ]; #< not sure if necessary
};
}

View File

@ -57,6 +57,7 @@ in
desktopName = "Mimeo";
exec = "mimeo %U";
comment = "Open files by MIME-type or file name using regular expressions.";
noDisplay = true;
})
];

View File

@ -0,0 +1,38 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.modemmanager;
in
{
sane.programs.modemmanager = {
# mmcli needs /run/current-system/sw/share/dbus-1 files to function
enableFor.system = lib.mkIf (builtins.any (en: en) (builtins.attrValues cfg.enableFor.user)) true;
};
systemd.services.ModemManager = lib.mkIf cfg.enabled {
aliases = [ "dbus-org.freedesktop.ModemManager1.service" ];
after = [ "polkit.service" ];
requires = [ "polkit.service" ];
wantedBy = [ "network.target" ];
serviceConfig = {
Type = "dbus";
BusName = "org.freedesktop.ModemManager1";
# only if started with `--debug` does mmcli let us issue AT commands like
# `mmcli --modem any --command=<AT_CMD>`
ExecStart = "${cfg.package}/bin/ModemManager --debug";
# --debug sets DEBUG level logging: so reset
ExecStartPost = "${cfg.package}/bin/mmcli --set-logging=INFO";
Restart = "on-abort";
StandardError = "null";
CapabilityBoundingSet = "CAP_SYS_ADMIN CAP_NET_ADMIN";
ProtectSystem = true;
ProtectHome = true;
PrivateTmp = true;
RestrictAddressFamilies = "AF_NETLINK AF_UNIX AF_QIPCRTR";
NoNewPrivileges = true;
};
};
# so that ModemManager can discover when the modem appears
services.udev.packages = lib.mkIf cfg.enabled [ cfg.package ];
}

View File

@ -91,48 +91,37 @@ let
local last_up = cursor.last_event['primary_up'] or { time = 0 }
if cursor.hover_raw or last_down.time >= last_up.time then cursor:move(mouse.x, mouse.y) end"
### patch so that the volume control corresponds to `ao-volume`, i.e. the system-wide volume.
### patch so that uosc volume control is routed to sane_sysvol.
### this is particularly nice for moby, because it avoids the awkwardness that system volume
### is hard to adjust while screen is on.
### note that only under alsa (`-ao=alsa`) does `ao-volume` actually correspond to system volume.
### previously i used ao-volume instead of sane_sysvol: but that forced `ao=alsa`
### and came with heavy perf penalties (especially when adjusting the volume)
substituteInPlace src/uosc/main.lua \
--replace-fail \
"mp.observe_property('volume', 'number', create_state_setter('volume'))" \
"mp.observe_property('volume', 'number', update_ao_volume)"
"mp.observe_property('volume'" \
"mp.observe_property('user-data/sane_sysvol/volume'" \
--replace-fail \
"mp.observe_property('mute'" \
"mp.observe_property('user-data/sane_sysvol/mute'"
substituteInPlace src/uosc/elements/Volume.lua \
--replace-fail "mp.commandv('set', 'volume'" "mp.commandv('set', 'ao-volume'" \
--replace-fail "mp.set_property_native('volume'" "mp.set_property('ao-volume'"
--replace-fail \
"mp.commandv('set', 'volume'" \
"mp.set_property_number('user-data/sane_sysvol/volume'" \
--replace-fail \
"mp.set_property_native('volume'" \
"mp.set_property_number('user-data/sane_sysvol/volume'" \
--replace-fail \
"mp.set_property_native('mute'" \
"mp.set_property_bool('user-data/sane_sysvol/mute'" \
--replace-fail \
"mp.commandv('cycle', 'mute')" \
"mp.set_property_bool('user-data/sane_sysvol/mute', not mp.get_property_bool('user-data/sane_sysvol/mute'))"
# `ao-volume` isn't actually an observable property.
# as of 2024/03/02, they *may* be working on that:
# - <https://github.com/mpv-player/mpv/pull/13604#issuecomment-1971665736>
# in the meantime, just query the volume every tick (i.e. frame).
# alternative is mpv's JSON IPC feature, where i could notify its socket whenever pipewire volume changes.
cat <<EOF >> src/uosc/main.lua
function update_ao_volume(_, vol)
if vol == nil then
-- vol will be nil if called manually, instead of via observe_property
vol = mp.get_property('ao-volume')
end
if vol == nil then
vol = 0
else
vol = tonumber(vol)
end
if vol ~= state.volume then
set_state('volume', vol)
request_render()
end
end
-- tick seems to occur on every redraw (even when volume is hidden).
-- in practice: for every new frame of the source, or whenever the cursor is moved.
mp.register_event('tick', update_ao_volume)
-- if paused and cursor isn't moving, then `tick` isn't called. fallback to a timer.
mp.add_periodic_timer(2, update_ao_volume)
-- invoke immediately to ensure state.volume is non-nil
update_ao_volume()
EOF
# tweak the top-bar "maximize" button to actually act as a "fullscreen" button.
substituteInPlace src/uosc/elements/TopBar.lua \
--replace-fail \
'get_maximized_command,' \
'"cycle fullscreen",'
'';
});
mpv-unwrapped = pkgs.mpv-unwrapped.overrideAttrs (upstream: {
@ -148,47 +137,55 @@ let
in
{
sane.programs.mpv = {
packageUnwrapped = pkgs.wrapMpv mpv-unwrapped {
scripts = [
pkgs.mpvScripts.mpris
pkgs.mpvScripts.mpv-playlistmanager
uosc
# pkgs.mpv-uosc-latest
];
# extraMakeWrapperArgs = lib.optionals (cfg.config.vo != null) [
# # 2023/08/29: fixes an error where mpv on moby launches with the message
# # "DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory"
# # audio still works, and controls, screenshotting, etc -- just not the actual rendering
# #
# # this is likely a regression for mpv 0.36.0.
# # the actual error message *appears* to come from the mesa library, but it's tough to trace.
# #
# # 2024/03/02: no longer necessary, with mesa 23.3.1: <https://github.com/NixOS/nixpkgs/pull/265740>
# #
# # backend compatibility (2023/10/22):
# # run with `--vo=help` to see a list of all output options.
# # non-exhaustive (W=works, F=fails, A=audio-only, U=audio+ui only (no video))
# # ? null Null video output
# # A (default)
# # A dmabuf-wayland Wayland dmabuf video output
# # A libmpv render API for libmpv (mpv plays the audio, but doesn't even render a window)
# # A vdpau VDPAU with X11
# # F drm Direct Rendering Manager (software scaling)
# # F gpu-next Video output based on libplacebo
# # F vaapi VA API with X11
# # F x11 X11 (software scaling)
# # F xv X11/Xv
# # U gpu Shader-based GPU Renderer
# # W caca libcaca (terminal rendering)
# # W sdl SDL 2.0 Renderer
# # W wlshm Wayland SHM video output (software scaling)
# "--add-flags" "--vo=${cfg.config.vo}"
# ];
};
packageUnwrapped = pkgs.wrapMpv
(mpv-unwrapped.override rec {
# N.B.: populating `self` to `luajit` is necessary for the resulting `lua.withPackages` function to preserve my override.
# i use enable52Compat in order to get `table.unpack`.
# i think using `luajit` here instead of `lua` is optional, just i get better perf with it :)
lua = pkgs.luajit.override { enable52Compat = true; self = lua; };
})
{
scripts = [
pkgs.mpvScripts.mpris
pkgs.mpvScripts.mpv-playlistmanager
uosc
# pkgs.mpv-uosc-latest
];
# extraMakeWrapperArgs = lib.optionals (cfg.config.vo != null) [
# # 2023/08/29: fixes an error where mpv on moby launches with the message
# # "DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory"
# # audio still works, and controls, screenshotting, etc -- just not the actual rendering
# #
# # this is likely a regression for mpv 0.36.0.
# # the actual error message *appears* to come from the mesa library, but it's tough to trace.
# #
# # 2024/03/02: no longer necessary, with mesa 23.3.1: <https://github.com/NixOS/nixpkgs/pull/265740>
# #
# # backend compatibility (2023/10/22):
# # run with `--vo=help` to see a list of all output options.
# # non-exhaustive (W=works, F=fails, A=audio-only, U=audio+ui only (no video))
# # ? null Null video output
# # A (default)
# # A dmabuf-wayland Wayland dmabuf video output
# # A libmpv render API for libmpv (mpv plays the audio, but doesn't even render a window)
# # A vdpau VDPAU with X11
# # F drm Direct Rendering Manager (software scaling)
# # F gpu-next Video output based on libplacebo
# # F vaapi VA API with X11
# # F x11 X11 (software scaling)
# # F xv X11/Xv
# # U gpu Shader-based GPU Renderer
# # W caca libcaca (terminal rendering)
# # W sdl SDL 2.0 Renderer
# # W wlshm Wayland SHM video output (software scaling)
# "--add-flags" "--vo=${cfg.config.vo}"
# ];
};
suggestedPrograms = [
"blast-to-default"
"go2tv"
"sane-cast"
"sane-die-with-parent"
"xdg-terminal-exec"
];
@ -201,7 +198,7 @@ in
sandbox.whitelistWayland = true;
sandbox.extraHomePaths = [
".config/mpv" #< else mpris plugin crashes on launch
".local/share/applications" #< for xdg-terminal-exec (go2tv)
".local/share/applications" #< for xdg-terminal-exec (sane-cast)
# it's common for album (or audiobook, podcast) images/lyrics/metadata to live adjacent to the primary file.
# CLI detection is too poor to pick those up, so expose the common media dirs to the sandbox to make that *mostly* work.
"Books/local"
@ -216,7 +213,9 @@ in
# for `watch_later`
".local/state/mpv"
];
fs.".config/mpv/scripts/sane/main.lua".symlink.target = ./sane-main.lua;
fs.".config/mpv/scripts/sane_cast/main.lua".symlink.target = ./sane_cast/main.lua;
fs.".config/mpv/scripts/sane_sysvol/main.lua".symlink.target = ./sane_sysvol/main.lua;
fs.".config/mpv/scripts/sane_sysvol/non_blocking_popen.lua".symlink.target = ./sane_sysvol/non_blocking_popen.lua;
fs.".config/mpv/input.conf".symlink.target = ./input.conf;
fs.".config/mpv/mpv.conf".symlink.target = ./mpv.conf;
fs.".config/mpv/script-opts/osc.conf".symlink.target = ./osc.conf;

View File

@ -9,6 +9,8 @@
POWER ignore
VOLUME_UP ignore
VOLUME_DOWN ignore
# disable "double-click to toggle fullscreen", else that limits the rate at which i can seek
MBTN_LEFT_DBL ignore
# uosc menu
# text after the shebang is parsed by uosc to construct the menu and names
@ -31,7 +33,5 @@ ctrl+s async screenshot #! Utils > Screenshot
alt+i script-binding uosc/keybinds #! Utils > Key bindings
O script-binding uosc/show-in-directory #! Utils > Show in directory
# script-binding uosc/open-config-directory #! Utils > Open config directory
ctrl+r script-binding sane/blast #! Audiocast
ctrl+t script-binding sane/go2tv-video #! Cast
# script-binding sane/go2tv-stream #! Cast (...) > Stream
# script-binding sane/go2tv-gui #! Cast (...) > GUI
ctrl+r script-binding sane_cast/blast #! Audiocast
ctrl+t script-binding sane_cast/sane-cast #! Cast

View File

@ -10,7 +10,9 @@ keep-open-pause=no
# force GUI, even for tracks w/o album art
# see: <https://www.reddit.com/r/mpv/comments/rvrrpt/oscosdgui_and_arch_linux/>
player-operation-mode=pseudo-gui
# player-operation-mode=pseudo-gui
# actually, prefer just a subset of what's enabled by pseudo-gui, else logging breaks
force-window=yes
# use uosc instead (for On Screen Controls)
osc=no
@ -19,8 +21,8 @@ osd-bar=no
# uosc will draw its own window controls if you disable window border
border=no
# ao=alsa so that uosc can work with ao-volume (see my uosc patch)
ao=alsa
# with `ao-volume`, the max actually is 100.
# to go higher you'll have to use the system's native controls.
volume-max=100
# # ao=alsa so that uosc can work with ao-volume (see my uosc patch)
# ao=alsa
# # with `ao-volume`, the max actually is 100.
# # to go higher you'll have to use the system's native controls.
# volume-max=100

View File

@ -1,34 +0,0 @@
function subprocess(in_terminal, args)
if in_terminal then
args = { "xdg-terminal-exec", table.unpack(args) }
end
mp.command_native({
name = "subprocess",
args = args,
detach = false,
capture_stdout = false,
capture_stderr = false,
-- capture_size=0,
passthrough_stdin = false,
playback_only = false,
})
end
function invoke_go2tv(in_terminal, args)
mp.commandv("set", "pause", "yes")
subprocess(in_terminal, { "go2tv", table.unpack(args) })
end
function invoke_go2tv_on_open_file(mode)
local path = mp.get_property("stream-open-filename");
return invoke_go2tv(true, { mode, path })
end
mp.add_key_binding(nil, "blast", function() subprocess(false, { "blast-to-default" }) end)
mp.add_key_binding(nil, 'go2tv-gui', function() invoke_go2tv(false, {}) end)
mp.add_key_binding(nil, 'go2tv-video', function() invoke_go2tv_on_open_file("-v") end)
mp.add_key_binding(nil, 'go2tv-stream', function() invoke_go2tv_on_open_file("-s") end)
-- uncomment for debugging:
-- if mpv fails to eval this script (e.g. syntax error), then it will fail to quit on launch
-- mp.command('quit')

View File

@ -0,0 +1,40 @@
msg = require("mp.msg")
msg.trace("load: begin")
function subprocess(in_terminal, args)
if in_terminal then
args = { "xdg-terminal-exec", table.unpack(args) }
end
msg.info(table.concat(args, " "))
mp.command_native({
name = "subprocess",
args = args,
detach = false,
capture_stdout = false,
capture_stderr = false,
-- capture_size=0,
passthrough_stdin = false,
playback_only = false,
})
end
function invoke_paused(in_terminal, args)
mp.commandv("set", "pause", "yes")
for k, v in ipairs(args) do
if v == "@FILE@" then
args[k] = mp.get_property("stream-open-filename")
end
end
subprocess(in_terminal, args)
end
-- invoke blast in a way where it dies when we die, because:
-- 1. when mpv exits, it `SIGKILL`s this toplevel subprocess.
-- 2. `blast-to-default` could be a sandbox wrapper.
-- 3. bwrap does not pass SIGKILL or SIGTERM to its child.
-- 4. hence, to properly kill blast, we have to kill all the descendants.
mp.add_key_binding(nil, "blast", function() subprocess(false, { "sane-die-with-parent", "--descendants", "--use-pgroup", "--catch-sigkill", "blast-to-default" }) end)
mp.add_key_binding(nil, "sane-cast", function() invoke_paused(true, { "sane-cast", "--verbose", "@FILE@" }) end)
msg.trace("load: complete")

View File

@ -0,0 +1,281 @@
msg = require("mp.msg")
msg.trace("load: begin")
non_blocking_popen = require("non_blocking_popen")
RD_SIZE = 65536
function startswith(superstring, substring)
return superstring:sub(1, substring:len()) == substring
end
function strip_prefix(superstring, substring)
assert(startswith(superstring, substring))
return superstring:sub(1 + substring:len())
end
function ltrim(s)
-- remove all leading whitespace from `s`
local i = 1
while s:sub(i, i) == " " or s:sub(i, i) == "\t" do
i = i + 1
end
return s:sub(i)
end
function subprocess(args)
mp.command_native({
name = "subprocess",
args = args,
-- these arguments below probably don't matter: copied from sane_cast
detach = false,
capture_stdout = false,
capture_stderr = false,
passthrough_stdin = false,
playback_only = false,
})
end
function sysvol_new()
return {
-- sysvol is pipewire-native volume
-- it's the cube of the equivalent 0-100% value represented inside mpv
sysvol = nil,
sysmute = nil,
change_sysvol = function(self, mpv_vol)
-- called when mpv wants to set the system-wide volume
if mpv_vol == nil then
return
end
local old_mpv_vol = nil
if self.sysvol ~= nil then
old_mpv_vol = 100 * self.sysvol^(1/3)
end
if old_mpv_vol ~= nil and math.abs(mpv_vol - old_mpv_vol) < 1.0 then
-- avoid near-infinite loop where we react to our own volume change.
-- consider that we might be a couple messages behind in parsing pipewire when we issue this command,
-- hence a check on only the pipewire -> mpv side wouldn't prevent oscillation
msg.debug("NOT setting system-wide volume:", old_mpv_vol, volstr)
return
end
local volstr = tostring(mpv_vol) .. "%"
msg.debug("setting system-wide volume:", old_mpv_vol, volstr)
self.sysvol = (0.01*mpv_vol)^3
subprocess({
"wpctl",
"set-volume",
"@DEFAULT_AUDIO_SINK@",
volstr
})
end,
on_sysvol_change = function(self, sysvol)
-- called when the pipewire system volume is changed (either by us, or an external application)
if sysvol == nil then
return
end
local new_mpv_vol = 100 * sysvol^(1/3)
local old_mpv_vol = nil
if self.sysvol ~= nil then
old_mpv_vol = 100 * self.sysvol^(1/3)
end
if old_mpv_vol ~= nil and math.abs(new_mpv_vol - old_mpv_vol) < 1.0 then
-- avoid an infinite loop where we react to our own volume change
msg.debug("NOT announcing volume change to mpv (because it was what triggered the change):", old_mpv_vol, new_mpv_vol)
return
end
msg.debug("announcing volume change to mpv:", old_mpv_vol, new_mpv_vol)
self.sysvol = sysvol
mp.set_property_number("user-data/sane_sysvol/volume", new_mpv_vol)
end,
change_sysmute = function(self, mute)
if mute == nil then
return
end
if mute == self.sysmute then
msg.debug("NOT setting system-wide mute (because it didn't change)", mute)
return
end
local mutestr
if mute then
mutestr = "1"
else
mutestr = "0"
end
msg.debug("setting system-wide mute:", mutestr)
self.sysmute = mute
subprocess({
"wpctl",
"set-mute",
"@DEFAULT_AUDIO_SINK@",
mutestr
})
end,
on_sysmute_change = function(self, mute)
if mute == nil then
return
end
msg.debug("announcing mute to mpv:", mute)
self.sysmute = mute
mp.set_property_bool("user-data/sane_sysvol/mute", mute)
end
}
end
function pwmon_parser_new()
return {
-- volume: pipewire-native volume. usually 0.0 - 1.0, but can go higher (e.g. 3.25)
-- `wpctl get-volume` and this volume are related, in that the volume reported by
-- wpctl is the cube-root of this one.
volume = nil, -- number
mute = nil, -- bool
-- parser state:
in_device = false,
in_direction = false,
in_output = false,
in_vol = false,
in_mute = false,
feed_line = function(self, line)
msg.trace("pw-mon:", line)
line = ltrim(line)
if startswith(line, "changed:") or startswith(line, "added:") or startswith(line, "removed:") then
self.in_device = false
self.in_direction = false
self.in_output = false
self.in_vol = false
self.in_mute = false
self.in_properties = false
elseif startswith(line, "type: ") then
self.in_device = startswith(line, "type: PipeWire:Interface:Device")
msg.trace("parsed type:", line, self.in_device)
elseif startswith(line, "Prop: ") and self.in_device then
self.in_direction = startswith(line, "Prop: key Spa:Pod:Object:Param:Route:direction")
if self.in_direction then
self.in_output = false
end
-- which of the *Volumes params we read is unclear.
-- alternative to this is to just detect the change, and then cal wpctl get-volume @DEFAULT_AUDIO_SINK@
self.in_vol = startswith(line, "Prop: key Spa:Pod:Object:Param:Props:channelVolumes")
self.in_mute = startswith(line, "Prop: key Spa:Pod:Object:Param:Props:mute")
msg.trace("parsed `Prop:`", line, self.in_vol)
elseif line:find("Spa:Enum:Direction:Output", 1, true) and self.in_direction then
self.in_output = true
elseif startswith(line, "Float ") and self.in_device and self.in_output and self.in_vol then
value = tonumber(strip_prefix(line, "Float "))
self:feed_volume(value)
elseif startswith(line, "Bool ") and self.in_device and self.in_output and self.in_mute then
value = strip_prefix(line, "Bool ") == "true"
self:feed_mute(value)
elseif startswith(line, "properties:") and self.in_device then
self.in_properties = true
end
end,
feed_volume = function(self, vol)
msg.debug("volume:", vol)
self.volume = vol
end,
feed_mute = function(self, mute)
msg.debug("mute:", mute)
self.mute = mute
end,
-- get_effective_volume = function(self)
-- if self.mute then
-- return 0
-- else
-- return self.volume
-- end
-- end
}
end
function pwmon_new()
return {
-- non_blocking_popen handle for the pw-mon process
-- which can be periodically read and parsed to detect volume changes.
-- we have to use `sane-die-with-parent` otherwise `pw-mon` will still be active even after mpv exits.
handle = non_blocking_popen.non_blocking_popen("sane-die-with-parent --descendants pw-mon", RD_SIZE),
stdout_unparsed = "",
pwmon_parser = pwmon_parser_new(),
service = function(self)
-- do a single non-blocking read, and parse the result
-- in the *rare* case in which more than RD_SIZE data is ready, we service that remaining data on the next call
local buf, res = self.handle:read(RD_SIZE)
if res == "closed" then
msg.debug("pw-mon unexpectedly closed!")
end
if buf ~= nil then
local old_vol = self.pwmon_parser.volume
local old_mute = self.pwmon_parser.mute
self.stdout_unparsed = self.stdout_unparsed .. buf
self:consume_stdout()
local new_vol = self.pwmon_parser.volume
local new_mute = self.pwmon_parser.mute
if new_vol ~= old_vol then
msg.debug("pipewire volume change:", old_vol, new_vol)
mp.set_property_number("user-data/sane_sysvol/pw-mon-volume", new_vol)
end
if new_mute ~= old_mute then
msg.debug("pipewire mute change:", old_mute, new_mute)
mp.set_property_bool("user-data/sane_sysvol/pw-mon-mute", new_mute)
end
end
end,
consume_stdout = function(self)
local idx_newline, next_newline = 0, 0
while next_newline ~= nil do
next_newline = self.stdout_unparsed:find("\n", idx_newline + 1, true)
if next_newline ~= nil then
self.pwmon_parser:feed_line(self.stdout_unparsed:sub(idx_newline + 1, next_newline - 1))
idx_newline = next_newline
end
end
self.stdout_unparsed = self.stdout_unparsed:sub(idx_newline + 1)
end,
}
end
mp.set_property_number("user-data/sane_sysvol/volume", 0)
mp.set_property_bool("user-data/sane_sysvol/mute", true)
local sysvol = sysvol_new()
local first_sysvol_announcement = true
mp.observe_property("user-data/sane_sysvol/volume", "native", function(_, val)
-- we must set the volume property early -- before we actually know the volume
-- else other modules will think it's `nil` and error.
-- but we DON'T want the value we set to actually impact the system volume
if not first_sysvol_announcement then
sysvol:change_sysvol(val)
end
first_sysvol_announcement = false
end)
mp.observe_property("user-data/sane_sysvol/pw-mon-volume", "native", function(_, val)
sysvol:on_sysvol_change(val)
end)
local first_sysmute_announcement = true
mp.observe_property("user-data/sane_sysvol/mute", "native", function(_, val)
-- we must set the mute property early -- before we actually know the mute
-- else other modules will think it's `nil` and error.
-- but we DON'T want the value we set to actually impact the system mute
if not first_sysmute_announcement then
sysvol:change_sysmute(val)
end
first_sysmute_announcement = false
end)
mp.observe_property("user-data/sane_sysvol/pw-mon-mute", "native", function(_, val)
sysvol:on_sysmute_change(val)
end)
local pwmon = pwmon_new()
mp.register_event("tick", function() pwmon:service() end)
msg.trace("load: complete")

View File

@ -0,0 +1,91 @@
-- source: <https://gist.github.com/max1220/c19ccd4d90ed32d41b879eba727cbcbd>
-- requires: luajit
--
-- Implements a basic binding for popen that allows non-blocking reads
-- returned "file" table only supports :read(with an optional size argument, no mode etc.) and :close
ffi = require("ffi")
-- C functions that we need
ffi.cdef([[
void* popen(const char* cmd, const char* mode);
int pclose(void* stream);
int fileno(void* stream);
int fcntl(int fd, int cmd, int arg);
int *__errno_location ();
ssize_t read(int fd, void* buf, size_t count);
]])
-- you can compile a simple C programm to find these values(Or look in the headers)
F_SETFL = 4
O_NONBLOCK = 2048
EAGAIN = 11
-- this "array" holds the errno variable
_errno = ffi.C.__errno_location()
popen_meta = {
__index = {
-- close the process, prevent reading, allow garbage colletion
close = function(self)
if self._file ~= nil then
local _file = self._file
self._file = nil
self._fd = nil
self._read_buffer = nil
ffi.C.pclose(_file)
end
end,
-- read up to size bytes from the process. Returns data(string) and number of bytes read if successfull,
-- nil, "EAGAIN" if there is no data aviable, and
-- nil, "closed" if the process has ended
read = function(self, size)
if self._fd == nil then
return nil, "closed"
end
size = math.min(self._read_buffer_size, size)
local nbytes = ffi.C.read(self._fd, self._read_buffer, size)
if nbytes > 0 then
local data = ffi.string(self._read_buffer, nbytes)
return data, nbytes
elseif (nbytes == -1) and (_errno[0] == EAGAIN) then
return nil, "EAGAIN"
else
self:close()
return nil, "closed"
end
end
}
-- __gc = function(self) self:close() end
-- __close = function(self) p:close() end
}
local function non_blocking_popen(cmd, read_buffer_size)
-- the buffer for reading from the process
local read_buffer_size = tonumber(read_buffer_size) or 2048
local read_buffer = ffi.new('uint8_t[?]',read_buffer_size)
-- get a FILE* for our command
local file = assert(ffi.C.popen(cmd, "r"))
-- turn the FILE* to a fd (int) for fcntl
local fd = ffi.C.fileno(file)
-- set non-blocking mode for read
assert(ffi.C.fcntl(fd, F_SETFL, O_NONBLOCK)==0, "fcntl failed")
local p = {
_fd = fd,
_file = file,
_read_buffer = read_buffer,
_read_buffer_size = read_buffer_size,
}
setmetatable(p, popen_meta)
return p
end
return {
non_blocking_popen = non_blocking_popen
}

View File

@ -24,7 +24,7 @@ font_scale=1.5
font_bold=yes
# refine=text_width: slightly better text rendering
refine=text_width
color=foreground=ff8080,background_text=ff8080
color=foreground=ff968b,background_text=ff968b
# N.B.: if `opacity=` is set non-empty, then ALL items must be specified (else they get 0 opacity).
# opacity values *must* be a multiple of 0.1
opacity=timeline=0.8,position=1,chapters=0.8,slider=0.8,slider_gauge=0.8,controls=0,speed=0.8,menu=1,submenu=0.4,border=1,title=0.8,tooltip=1,thumbnail=1,curtain=0.8,idle_indicator=0.8,audio_indicator=0.5,buffering_indicator=0.3,playlist_position=0.8

View File

@ -10,6 +10,10 @@
]);
}));
suggestedPrograms = [
"gvfs" # browse ftp://, etc
];
sandbox.method = "bwrap";
sandbox.whitelistDbus = [ "user" ]; # for portals launching apps
sandbox.whitelistWayland = true;

View File

@ -103,54 +103,61 @@ in
# "use"
];
# packageUnwrapped = config.programs.neovim.finalPackage;
packageUnwrapped = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (pkgs.neovimUtils.makeNeovimConfig {
withRuby = false; #< doesn't cross-compile w/o binfmt
viAlias = true;
vimAlias = true;
plugins = plugin-packages;
customRC = ''
" let the terminal handle mouse events, that way i get OS-level ctrl+shift+c/etc
" this used to be default, until <https://github.com/neovim/neovim/pull/19290>
set mouse=
packageUnwrapped = let
configArgs = {
withRuby = false; #< doesn't cross-compile w/o binfmt
viAlias = true;
vimAlias = true;
plugins = plugin-packages;
customRC = ''
" let the terminal handle mouse events, that way i get OS-level ctrl+shift+c/etc
" this used to be default, until <https://github.com/neovim/neovim/pull/19290>
set mouse=
" copy/paste to system clipboard
set clipboard=unnamedplus
" copy/paste to system clipboard
set clipboard=unnamedplus
" screw tabs; always expand them into spaces
set expandtab
" screw tabs; always expand them into spaces
set expandtab
" at least don't open files with sections folded by default
set nofoldenable
" at least don't open files with sections folded by default
set nofoldenable
" allow text substitutions for certain glyphs.
" higher number = more aggressive substitution (0, 1, 2, 3)
" i only make use of this for tex, but it's unclear how to
" apply that *just* to tex and retain the SyntaxRange stuff.
set conceallevel=2
" allow text substitutions for certain glyphs.
" higher number = more aggressive substitution (0, 1, 2, 3)
" i only make use of this for tex, but it's unclear how to
" apply that *just* to tex and retain the SyntaxRange stuff.
set conceallevel=2
" horizontal rule under the active line
" set cursorline
" horizontal rule under the active line
" set cursorline
" highlight trailing space & related syntax errors (doesn't seem to work??)
" let c_space_errors=1
" let python_space_errors=1
" highlight trailing space & related syntax errors (doesn't seem to work??)
" let c_space_errors=1
" let python_space_errors=1
" enable highlighting of leading/trailing spaces,
" and especially tabs
" source: https://www.reddit.com/r/neovim/comments/chlmfk/highlight_trailing_whitespaces_in_neovim/
set list
set listchars=tab:\·,trail:·,extends:,precedes:,nbsp:
" enable highlighting of leading/trailing spaces,
" and especially tabs
" source: https://www.reddit.com/r/neovim/comments/chlmfk/highlight_trailing_whitespaces_in_neovim/
set list
set listchars=tab:\·,trail:·,extends:,precedes:,nbsp:
""""" PLUGIN CONFIG (vim)
${plugin-config-viml}
""""" PLUGIN CONFIG (vim)
${plugin-config-viml}
""""" PLUGIN CONFIG (lua)
lua <<EOF
${plugin-config-lua}
EOF
'';
});
""""" PLUGIN CONFIG (lua)
lua <<EOF
${plugin-config-lua}
EOF
'';
};
in pkgs.wrapNeovimUnstable
pkgs.neovim-unwrapped
# XXX(2024/05/13): manifestRc must be null for cross-compilation to work.
# wrapper invokes `neovim` with all plugins enabled at build time i guess to generate caches and stuff?
# alternative is to emulate `nvim-wrapper` during build.
((pkgs.neovimUtils.makeNeovimConfig configArgs) // { manifestRc = null; })
;
# private because there could be sensitive things in the swap
persist.byStore.private = [ ".cache/vim-swap" ];

View File

@ -0,0 +1,107 @@
# Network Manager:
# i manage this myself because the nixos service is not flexible enough.
# - it unconditionally puts modemmanager onto the system path, preventing me from patching modemmanager's service file (without an overlay).
#
# XXX: it's normal to see error messages on an ethernet-only host, even when using nixos' official networkmanager service:
# - `Couldn't initialize supplicant interface: Failed to D-Bus activate wpa_supplicant service`
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.networkmanager;
in
{
sane.programs.networkmanager = {
suggestedPrograms = [ "wpa_supplicant" ];
enableFor.system = lib.mkIf (builtins.any (en: en) (builtins.attrValues cfg.enableFor.user)) true;
};
# add to systemd.packages so we get the service file it ships, then override what we need to customize (taken from nixpkgs)
systemd.packages = lib.mkIf cfg.enabled [ cfg.package ];
systemd.services.NetworkManager = lib.mkIf cfg.enabled {
wantedBy = [ "network.target" ];
aliases = [ "dbus-org.freedesktop.NetworkManager.service" ];
serviceConfig = {
StateDirectory = "NetworkManager";
StateDirectoryMode = 755; # not sure if this really needs to be 755
};
};
systemd.services.NetworkManager-wait-online = lib.mkIf cfg.enabled {
wantedBy = [ "network-online.target" ];
};
systemd.services.NetworkManager-dispatcher = lib.mkIf cfg.enabled {
wantedBy = [ "NetworkManager.service" ];
# to debug, add NM_DISPATCHER_DEBUG_LOG=1
serviceConfig.ExecStart = [
"" # first blank line is to clear the upstream `ExecStart` field.
"${cfg.package}/libexec/nm-dispatcher --persist" # --persist is needed for it to actually run as a daemon
];
serviceConfig.Restart = "always";
serviceConfig.RestartSec = "1s";
};
environment.etc = lib.mkIf cfg.enabled {
"NetworkManager/system-connections".source = "/var/lib/NetworkManager/system-connections";
"NetworkManager/NetworkManager.conf".text = ''
[device]
# wifi.backend: wpa_supplicant or iwd
wifi.backend=wpa_supplicant
wifi.scan-rand-mac-address=true
[logging]
audit=false
# level: TRACE, DEBUG, INFO, WARN, ERR, OFF
level=INFO
# domain=...
[main]
# dhcp:
# - `internal` (default)
# - `dhclient` (requires dhclient to be installed)
# - `dhcpcd` (requires dhcpcd to be installed)
dhcp=internal
# dns:
# - `default`: update /etc/resolv.conf with nameservers provided by the active connection
# - `none`: NM won't update /etc/resolv.conf
# - `systemd-resolved`: push DNS config to systemd-resolved
# - `dnsmasq`: run a local caching nameserver
dns=${if config.services.resolved.enable then
"systemd-resolved"
else if config.sane.services.trust-dns.enable && config.sane.services.trust-dns.asSystemResolver then
"none"
else
"internal"
}
plugins=keyfile
# rc-manager: how NM should write to /etc/resolv.conf
# - regardless of this setting, NM will write /var/lib/NetworkManager/resolv.conf
rc-manager=unmanaged
# systemd-resolved: send DNS config to systemd-resolved?
# this setting has no effect if dns="systemd-resolved"; it's supplementary, not absolute.
systemd-resolved=false
# debug=... (see also: NM_DEBUG env var)
'';
};
hardware.wirelessRegulatoryDatabase = lib.mkIf cfg.enabled true;
networking.useDHCP = lib.mkIf cfg.enabled false;
users.groups = lib.mkIf cfg.enabled {
networkmanager.gid = config.ids.gids.networkmanager;
};
services.udev.packages = lib.mkIf cfg.enabled [ cfg.package ];
security.polkit.enable = lib.mkIf cfg.enabled true;
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
if (
subject.isInGroup("networkmanager")
&& (action.id.indexOf("org.freedesktop.NetworkManager.") == 0
|| action.id.indexOf("org.freedesktop.ModemManager") == 0
))
{ return polkit.Result.YES; }
});
'';
boot.kernelModules = [ "ctr" ]; #< TODO: needed (what even is this)?
# TODO: polkit?
# TODO: NetworkManager-ensure-profiles?
}

View File

@ -13,7 +13,7 @@ let
wanted-feeds = feeds.filterByFormat [ "text" "image" "podcast" "video" ] all-feeds;
in {
sane.programs.newsflash = {
slowToBuild = true; # mainly for desktop: webkitgtk-6.0
buildCost = 2; # mainly for desktop: webkitgtk-6.0
persist.byStore.plaintext = [ ".local/share/news-flash" ];
fs.".config/newsflashFeeds.opml".symlink.text =
feeds.feedsToOpml wanted-feeds

View File

@ -3,6 +3,7 @@
sane.programs.notejot = {
sandbox.method = "bwrap";
sandbox.whitelistWayland = true;
sandbox.extraPaths = [ ".config/dconf" ]; #< for legacy notes (moby), loaded via dconf
suggestedPrograms = [ "dconf" ]; #< else it can't persist notes
persist.byStore.private = [

View File

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
sane.programs.objdump = {
# binutils-unwrapped is like 80 MiB, just for this one binary;
# dynamic linking means copying the binary doesn't reduce the closure much at all compared to just symlinking it.
packageUnwrapped = pkgs.linkIntoOwnPackage pkgs.binutils-unwrapped "bin/objdump";
};
}

View File

@ -1,33 +1,74 @@
# administer with pw-cli, pw-mon, pw-top commands
#
# performance tuning: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Performance-tuning>
#
# HAZARDS FOR MOBY:
# - high-priority threads are liable to stall the lima GPU driver, and leave a half-functional OS state.
# - symptom is messages like this (with stack traces) in dmesg or journalctl:
# - "[drm:lima_sched_timedout_job] *ERROR* lima job timeout"
# - and the UI locks up for a couple seconds, and then pipewire + wireplumber crash (but not pipewire-pulse)
# - related, unconfirmed symptoms:
# - "sched: RT throttling activated"
# - "BUG: KFENCE: use-after-free read in vchan_complete"
# - this one seems to be recoverable
# - likely to be triggered when using a small pipewire buffer (512 samples), by simple tasks like opening pavucontrol.
# - but a lengthier buffer is no sure way to dodge it: it will happen (less frequently) even for buffers of 2048 samples.
# - seems ANY priority < 0 triggers this, independent of the `nice` setting.
# - i only tried SCHED_FIFO, not SCHED_RR (round robin) for the realtime threads.
# - solution is some combination of:
# - DON'T USE RTKIT. rtkit only supports SCHED_FIFO and SCHED_RR: there's no way to use it only for adjusting `nice` values.
# - in pipewire.conf, remove all reference to libpipewire-module-rt.
# - it's loaded by default. i can either provide a custom pipewire.conf which doesn't load it, or adjust its config so that it intentionally fails.
# - without rtkit working, pipewire's module-rt doesn't allow niceness < -11. adjusting `nice`ness here seems to have little effect anyway.
# - longer term, rtkit (or just rlimit based pipewire module-rt) would be cool to enable: it *does* reduce underruns.
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.pipewire;
in
{
sane.programs.pipewire = {
suggestedPrograms = [ "wireplumber" ];
configOption = with lib; mkOption {
default = {};
type = types.submodule {
options.min-quantum = mkOption {
type = types.int;
default = 16;
};
options.max-quantum = mkOption {
type = types.int;
default = 2048;
};
};
};
# sandbox.method = "landlock"; #< also works
sandbox.method = "bwrap";
sandbox.whitelistDbus = [
# dbus is used for rtkit integration
# rtkit runs on the system bus.
# xdg-desktop-portal then exposes this to the user bus.
# therefore, user bus should be all that's needed, but...
# xdg-desktop-portal-wlr depends on pipewire, hence pipewire has to start before xdg-desktop-portal.
# then, pipewire has to talk specifically to rtkit (system) and not go through xdp.
# "user"
"system"
suggestedPrograms = [
# "rtkit"
"wireplumber"
];
# sandbox.method = "landlock"; #< works, including without rtkit
sandbox.method = "bwrap"; #< also works, but can't claim the full scheduling priority it wants
sandbox.whitelistAudio = true;
# sandbox.whitelistDbus = [
# # dbus is used for rtkit integration
# # rtkit runs on the system bus.
# # xdg-desktop-portal then exposes this to the user bus.
# # therefore, user bus should be all that's needed, but...
# # xdg-desktop-portal-wlr depends on pipewire, hence pipewire has to start before xdg-desktop-portal.
# # then, pipewire has to talk specifically to rtkit (system) and not go through xdp.
# # "user"
# "system"
# ];
sandbox.wrapperType = "inplace"; #< its config files refer to its binaries by full path
sandbox.extraConfig = [
"--sane-sandbox-keep-namespace" "pid"
"--sanebox-keep-namespace" "pid"
];
sandbox.capabilities = [
# if rtkit isn't present, and sandboxing is via landlock, these capabilities allow pipewire to claim higher scheduling priority
"ipc_lock"
"sys_nice"
];
sandbox.usePortal = false;
# needs to *create* the various device files, so needs write access to the /run/user/$uid directory itself
sandbox.extraRuntimePaths = [ "/" ];
sandbox.extraPaths = [
"/dev/snd"
# desko/lappy don't need these, but moby complains if not present
@ -38,8 +79,69 @@ in
sandbox.extraHomePaths = [
# pulseaudio cookie
".config/pulse"
".config/pipewire"
];
# note the .conf.d approach: using ~/.config/pipewire/pipewire.conf directly breaks all audio,
# presumably because that deletes the defaults entirely whereas the .conf.d approach selectively overrides defaults
fs.".config/pipewire/pipewire.conf.d/10-sane-config.conf".symlink.text = ''
# config docs: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Config-PipeWire#properties>
# - <repo:pipewire/pipewire:src/daemon/pipewire.conf.in>
# useful to run `pw-top` to see that these settings are actually having effect,
# and `pw-metadata` to see if any settings conflict (e.g. max-quantum < min-quantum)
#
# restart pipewire after editing these files:
# - `systemctl --user restart pipewire`
# - pipewire users will likely stop outputting audio until they are also restarted
#
# there's seemingly two buffers for the mic (see: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#pipewire-buffering-explained>)
# 1. Pipewire buffering out of the driver and into its own member.
# 2. Pipewire buffering into each specific app (e.g. Dino).
# note that pipewire default config includes `clock.power-of-two-quantum = true`
context.properties = {
default.clock.min-quantum = ${builtins.toString cfg.config.min-quantum}
default.clock.max-quantum = ${builtins.toString cfg.config.max-quantum}
}
'';
# reduce realtime scheduling priority to prevent GPU instability,
# but see the top of this file for other solutions.
# fs.".config/pipewire/pipewire.conf.d/20-sane-rtkit.conf".symlink.text = ''
# # documented inside <repo:pipewire/pipewire:/src/modules/module-rt.c>
# context.modules = [{
# name = libpipewire-module-rt
# args = {
# nice.level = 0
# rt.prio = 0
# #rt.time.soft = -1
# #rt.time.hard = -1
# rlimits.enabled = false
# rtportal.enabled = false
# rtkit.enabled = true
# #uclamp.min = 0
# #uclamp.max = 1024
# }
# flags = [ ifexists nofail ]
# }]
# '';
# fs.".config/pipewire/pipewire-pulse.conf.d/20-sane-rtkit.conf".symlink.text = ''
# # documented: <repo:pipewire/pipewire:src/daemon/pipewire-pulse.conf.in>
# context.modules = [{
# name = libpipewire-module-rt
# args = {
# nice.level = 0
# rt.prio = 0
# #rt.time.soft = -1
# #rt.time.hard = -1
# rlimits.enabled = false
# rtportal.enabled = false
# rtkit.enabled = true
# #uclamp.min = 0
# #uclamp.max = 1024
# }
# flags = [ ifexists nofail ]
# }]
# '';
# see: <https://docs.pipewire.org/page_module_protocol_native.html>
# defaults to placing the socket in /run/user/$id/{pipewire-0,pipewire-0-manager,...}
# but that's trickier to sandbox
@ -48,12 +150,14 @@ in
services.pipewire = {
description = "pipewire: multimedia service";
partOf = [ "sound" ];
# depends = [ "rtkit" ];
# depends = [ "xdg-desktop-portal" ]; # for Realtime portal (dependency cycle)
# env PIPEWIRE_LOG_SYSTEMD=false"
# env PIPEWIRE_DEBUG"*:3,mod.raop*:5,pw.rtsp-client*:5"
# env PIPEWIRE_DEBUG="*:3,mod.raop*:5,pw.rtsp-client*:5"
command = pkgs.writeShellScript "pipewire-start" ''
mkdir -p $PIPEWIRE_RUNTIME_DIR
exec pipewire
# nice -n -21 comes from pipewire defaults (niceness: -11)
exec nice -n -21 pipewire
'';
readiness.waitExists = [
"$PIPEWIRE_RUNTIME_DIR/pipewire-0"
@ -65,7 +169,10 @@ in
description = "pipewire-pulse: Pipewire compatibility layer for PulseAudio clients";
depends = [ "pipewire" ];
partOf = [ "sound" ];
command = "pipewire-pulse";
command = pkgs.writeShellScript "pipewire-pulse-start" ''
mkdir -p $XDG_RUNTIME_DIR/pulse
exec nice -n -21 pipewire-pulse
'';
readiness.waitExists = [
"$XDG_RUNTIME_DIR/pulse/native"
"$XDG_RUNTIME_DIR/pulse/pid"
@ -93,12 +200,4 @@ in
services.udev.packages = lib.mkIf cfg.enabled [
cfg.package
];
# rtkit/RealtimeKit: allow applications which want realtime audio (e.g. Dino? Pulseaudio server?) to request it.
# this might require more configuration (e.g. polkit-related) to work exactly as desired.
# - readme outlines requirements: <https://github.com/heftig/rtkit>
# XXX(2023/10/12): rtkit does not play well on moby. any application sending audio out dies after 10s.
# - note that `rtkit-daemon` can be launched with a lot of config: pipewire docs (top of this file)
# suggest using a much less aggressive canary. maybe try that?
security.rtkit.enable = lib.mkIf cfg.enabled true;
}

View File

@ -10,6 +10,6 @@
".local/share/io.github.alainm23.planify"
];
slowToBuild = true; # webkitgtk-6.0; slow for desktop
buildCost = 2; # webkitgtk-6.0; slow for desktop
};
}

View File

@ -2,11 +2,13 @@
* to show keybindings: `rofi -show keys`
* to show theme config: `rofi -dump-theme`
* - for live theme switching: `rofi-theme-selector`
*
* to see <span ...> markup: <https://docs.gtk.org/Pango/pango_markup.html>
*/
configuration {
modes: "combi";
font: "mono 20";
font: "sans 19";
show-icons: true;
kb-accept-entry: "Return,KP_Enter,XF86PowerOff";
kb-row-up: "Up,XF86AudioRaiseVolume";
@ -22,11 +24,14 @@ configuration {
}
/* combi-display-format: "{mode} {text}"; */
/* combi-display-format: "{text}"; */
combi-display-format: "{mode}{text}";
/* HACK: combi-display-format: "{mode}...</span>" expects `{mode}` to include <span>, allowing each mode to use custom styling */
combi-display-format: "{mode}{text}</span>";
combi-modes: "filebrowser,drun";
drun {
display-name: " ";
display-name: "<span>";
/* icons in /run/current-system/sw/share/icons/Adwaita/16x16/mimetypes */
fallback-icon: "application-x-executable";
}
drun-use-desktop-cache: true;
@ -35,17 +40,19 @@ configuration {
/* directory: "/home"; */
/* display-name: text to prepend in combi mode */
display-name: "/";
display-name: "<span stretch='semicondensed' size='90%'>";
/* `command` is the prefix to prepend (along with a space) *before* passing it off to `run-command` */
command: "xdg-open";
directories-first: true;
/* sorting-method: name/atime/ctime/mtime */
sorting-method: "name";
show-hidden: false;
fallback-icon: "application-x-generic";
}
run {
display-name: "run ";
fallback-icon: "application-x-executable";
}
/* launch applications via my own launcher, which directs them through to xdg-desktop-portal */
run-command: "rofi-run-command '{app_id}.desktop' {cmd}";
@ -107,11 +114,27 @@ window {
/* 482px @ font size 20 gives 12 rows + filter */
/* 446px @ font size 20 gives 11 rows + filter */
/* 90.5% @ font size 20, sway scale 2.0, moby in landscape mode: gives 7 rows + filter */
height: calc(446 min 90.5%);
/* 94% @ font size 19, sway scale 2.0, moby in landscape mode: gives 7 rows + filter */
/* 465 @ font size 19, sway scale 2.0 gives 11 rows + filter */
/* 427 @ font size 19, sway scale 2.0 gives 10 rows + filter */
height: calc(429 min 94.0%);
/* anchor the *north* edge of the window at the *north* location of the screen */
anchor: north;
location: north;
/* 11.2% lines up nicely with Firefox */
y-offset: 11.2%;
/* 8.2% lines up nicely with Firefox */
y-offset: 8.2%;
/* padding: top right bottom left */
padding: 4px 0px 1px 0px;
}
element {
border: 0;
margin: 0.5px;
/* padding: top right bottom left */
padding: 0 0 0 4px;
spacing: 6px; /* spacing between icon and text */
}
element-icon {
size: 0.8em;
}

View File

@ -37,6 +37,25 @@ let
hash = "sha256-gz3N4uo7IWzzqaPHHVhby/e9NbtzcFJRQwgdNYxO/Yw=";
})
];
nativeBuildInputs = (upstream.nativeBuildInputs or []) ++ [
pkgs.copyDesktopItems
];
desktopItems = (upstream.desktopItems or []) ++ [
(pkgs.makeDesktopItem {
name = "rofi-filebrowser";
# alternatively: `rofi -modes filebrowser -show`, however this would require theme tweaking to look good
exec = "rofi -combi-modes filebrowser -show";
desktopName = "rofi filebrowser";
})
(pkgs.makeDesktopItem {
name = "rofi-applications";
exec = "rofi -combi-modes drun -show";
desktopName = "rofi applications";
mimeTypes = [ "application/x-desktop" ];
noDisplay = true;
})
];
});
# rofi-emoji = pkgs.rofi-emoji.override {
# # plugins must be compiled against the same rofi they're loaded by
@ -73,6 +92,7 @@ in
sandbox.whitelistWayland = true;
sandbox.extraHomePaths = [
".local/share/applications" #< to locate .desktop files
"Apps" #< provide a means to transition from the filebrowser to the app launcher
"Books/local"
"Books/servo"
"Music"
@ -92,8 +112,12 @@ in
"/mnt/servo/media"
"/mnt/servo/playground"
];
sandbox.extraConfig = [
"--sanebox-keep-namespace" "pid" # for sane-open to toggle keyboard
];
fs.".config/rofi/config.rasi".symlink.target = ./config.rasi;
fs."Apps".symlink.target = ".local/share/applications/rofi-applications.desktop";
persist.byStore.cryptClearOnBoot = [
# this gets us a few things:
# - file browser remembers its last directory
@ -106,12 +130,12 @@ in
packageUnwrapped = pkgs.static-nix-shell.mkBash {
pname = "rofi-run-command";
srcRoot = ./.;
pkgs = [ "sane-open-desktop" "xdg-utils" ];
pkgs = [ "sane-open" ];
};
sandbox.enable = false; #< trivial script, and all our deps are sandboxed
suggestedPrograms = [
"sane-open-desktop"
"sane-open"
"xdg-utils"
];
};

View File

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p sane-open-desktop -p xdg-utils
#!nix-shell -i bash -p sane-open
# use:
# rofi-run-command <handler>.desktop [cmd [args ...]]
@ -14,16 +14,10 @@ shift
binArgs=("$@")
if [ "$desktop" != .desktop ]; then
# launching an app; the file browser position is no longer interesting: clear it so it opens in ~ next time.
# better UX would be to manage this in the other branch:
# - open in ~ by default, regardless of last directory
# - after launching a *file*, when that file is closed, re-open rofi in that file's directory.
# however, `xdg-open` and the `OpenFile` xdg-desktop-portal API don't give any obvious way to block for the app to close.
rm -f ~/.cache/rofi/rofi3.filebrowsercache
exec sane-open-desktop "$desktop"
exec sane-open --auto-keyboard --application "$desktop"
elif [ "$binary" = "xdg-open" ]; then
exec xdg-open "$@"
exec sane-open --auto-keyboard --file "${binArgs[@]}"
fi
printf "no .desktop file, and unexpected binary; not invoking: %s %s" "$binary" "${binArgs[*]}" > /dev/null
printf "no .desktop file, and unexpected binary; not invoking: %s %s\n" "$binary" "${binArgs[*]}" >&2
exit 1

View File

@ -0,0 +1,67 @@
# rtkit/RealtimeKit: allow applications which want realtime audio (e.g. Dino? Pulseaudio server?) to request it.
# this might require more configuration (e.g. polkit-related) to work exactly as desired.
# - readme outlines requirements: <https://github.com/heftig/rtkit>
# XXX(2023/10/12): rtkit does not play well on moby. any application sending audio out dies after 10s.
# - note that `rtkit-daemon` can be launched with a lot of config
# - suggest using a much less aggressive canary. maybe try that?
# - see: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/Performance-tuning>
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.rtkit;
in
{
sane.programs.rtkit = {
packageUnwrapped = pkgs.rmDbusServices pkgs.rtkit;
# services.rtkit = {
# description = "rtkit: grant realtime scheduling privileges to select processes";
# command = "${cfg.package}/libexec/rtkit-daemon";
# };
};
systemd.services.rtkit-daemon = lib.mkIf cfg.enabled {
description = "rtkit: grant realtime scheduling privileges to select processes";
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = lib.escapeShellArgs [
"${cfg.package}/libexec/rtkit-daemon"
"--scheduling-policy=FIFO"
"--our-realtime-priority=79"
"--max-realtime-priority=78" # N.B.: setting this too aggressively can hang weak devices!
"--min-nice-level=-19"
"--rttime-usec-max=2000000"
"--users-max=100"
"--processes-per-user-max=1000"
"--threads-per-user-max=10000"
"--actions-burst-sec=10"
"--actions-per-burst-max=1000"
"--canary-cheep-msec=30000"
"--canary-watchdog-msec=60000"
];
Type = "simple";
# Type = "dbus";
# BusName = "org.freedesktop.RealtimeKit1";
Restart = "on-failure";
# User = "rtkit"; # it wants starts as root
# Group = "rtkit";
# wantedBy = [ "default.target" ];
# TODO: harden
CapabilityBoundingSet = "CAP_SYS_NICE CAP_DAC_READ_SEARCH CAP_SYS_CHROOT CAP_SETGID CAP_SETUID";
};
};
users.users.rtkit = lib.mkIf cfg.enabled {
isSystemUser = true;
group = "rtkit";
description = "RealtimeKit daemon";
};
users.groups.rtkit = lib.mkIf cfg.enabled {};
environment.systemPackages = lib.mkIf cfg.enabled [
# for /share/polkit-1, but unclear if actually needed
cfg.package
];
security.polkit = lib.mkIf cfg.enabled {
enable = true;
};
}

View File

@ -16,7 +16,7 @@
'';
});
persist.private = [
persist.byStore.private = [
".local/share/s6/logs"
];

View File

@ -88,18 +88,24 @@ in
pname = "sane-input-handler";
srcRoot = ./.;
pkgs = {
inherit (pkgs) coreutils killall playerctl procps sane-open-desktop util-linux wireplumber;
inherit (pkgs) coreutils jq killall playerctl procps sane-open util-linux wireplumber;
sway = config.sane.programs.sway.package.sway-unwrapped;
};
};
suggestedPrograms = [
"bonsai"
# dependencies which get pulled in unconditionally:
"jq"
"killall"
"playerctl"
"procps"
"sane-open-desktop"
"sane-open"
"sway"
"wireplumber"
# optional integrations:
"megapixels"
"rofi"
"xdg-terminal-exec"
"wvkbd"
];
sandbox.method = "bwrap";
@ -107,7 +113,7 @@ in
sandbox.whitelistDbus = [ "user" ]; #< to launch applications
sandbox.extraRuntimePaths = [ "sway" ];
sandbox.extraConfig = [
"--sane-sandbox-keep-namespace" "pid"
"--sanebox-keep-namespace" "pid"
];
};
@ -138,32 +144,27 @@ in
sane.programs.bonsai.config.transitions = lib.mkIf cfg.enabled (friendlyToBonsai {
# map sequences of "events" to an argument to pass to sane-input-handler
# map: power (short), power (short) x2, power (long)
power_pressed.timeout.ms = 900; # press w/o release. this is a long timeout because it's tied to the "kill window" action.
power_pressed.timeout.trigger = "powerhold";
power_pressed.power_released.timeout.trigger = "powerbutton_one";
power_pressed.power_released.timeout.ms = 300;
power_pressed.power_released.power_pressed.trigger = "powerbutton_two";
# map power (short) -> volup/voldown
power_pressed.power_released.volup_pressed.trigger = "powerbutton_volup";
power_pressed.power_released.voldown_pressed.trigger = "powerbutton_voldown";
# map: power (tap), power (tap) x2
power_pressed.power_released.trigger = "power_tap_1";
power_pressed.power_released.timeout.ms = 600; # max time within which a second power press will be recognized
power_pressed.power_released.power_pressed.power_released.trigger = "power_tap_2";
# map power (hold), power tap -> hold:
power_pressed.timeout.trigger = "power_hold";
power_pressed.timeout.ms = 600;
power_pressed.power_released.power_pressed.timeout.trigger = "power_tap_1_hold";
power_pressed.power_released.power_pressed.timeout.ms = 750; # this is a long timeout because it's tied to the "kill window" action.
# map: power (tap) -> volup/voldown
power_pressed.power_released.volup_pressed.trigger = "power_then_volup";
power_pressed.power_released.voldown_pressed.trigger = "power_then_voldown";
# map: power + volup/voldown
power_pressed.volup_pressed.trigger = "power_and_volup";
power_pressed.voldown_pressed.trigger = "power_and_voldown";
# map: volume taps and holds
volup_pressed = (recurseHold "volup" {}) // {
# this either becomes volup_hold_* (via recurseHold, above) or:
# - a short volup_tap_1 followed by:
# - a *finalized* volup_1 (i.e. end of action)
# - more taps/holds, in which case we prefix it with `modal_<action>`
# to denote that we very explicitly entered this state.
#
# it's clunky: i do it this way so that voldown can map to keyboard/terminal in unlock mode
# but trigger media controls in screenoff
# in a way which *still* allows media controls if explicitly entered into via a tap on volup first
volup_released = (volumeActions { prefix = "modal_"; }) // {
trigger = "volup_tap_1";
timeout.ms = 300;
timeout.trigger = "volup_1";
};
volup_pressed = (volumeActions {}).volup_pressed // {
trigger = "volup_start";
};
voldown_pressed = (volumeActions {}).voldown_pressed // {
trigger = "voldown_start";

View File

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils -p killall -p playerctl -p procps -p sane-open-desktop -p sway -p util-linux -p wireplumber
#!nix-shell -i bash -p coreutils -p jq -p killall -p playerctl -p procps -p sane-open -p sway -p util-linux -p wireplumber
# input map considerations
# - using compound actions causes delays.
@ -12,27 +12,46 @@
#
# example of a design which considers these things:
# - when unlocked:
# - volup toggle -> app menu
# - voldown press -> keyboard
# - voldown hold -> terminal
# - power x2 -> screenoff
# - hold power -> kill app
# - volup tap -> file browser
# - volup hold -> app menu
# - voldown press -> keyboard
# - voldown hold -> terminal
# - power x2 -> screenoff
# - power tap->hold -> kill app
# - power,volup -> screen rotate CCW
# - power,voldown -> screen rotate CW
# - power+volup -> screenshot
# - power+voldown -> camera
# - when locked:
# - volup tap -> volume up
# - volup hold -> media seek forward
# - voldown tap -> volume down
# - voldown hold -> media seek backward
# - power x1 -> screen on
# - power x2 -> play/pause media
# some trickiness allows for media controls in unlocked mode:
# - volup tap -> enter media mode
# - i.e. in this state, vol tap/hold is mapped to volume/seek
# - if, after entering media mode, no more taps occur, then we trigger the default app-menu action
# - volup tap -> volume up
# - volup hold -> media seek forward
# - voldown tap -> volume down
# - voldown hold -> media seek backward
# - power tap -> screen on
# - power hold -> play/pause media
# limitations/downsides:
# - power mappings means phone is artificially slow to unlock.
# - media controls when unlocked have quirks:
# - mashing voldown to decrease the volume will leave you with a toggled keyboard.
# - seeking backward isn't possible except by first tapping volup.
# - voldown hold is over eager: easy to open terminals when phone is slow.
# - remap to voldown tap->hold ?
#
# EXAMPLE EVENT FIRINGS:
# - double-tap voldown:
# - voldown_start
# - voldown_tap_1
# - voldown_tap_2
# - hold voldown:
# - voldown_start
# - voldown_hold_1
# - voldown_hold_2
# - voldown_hold_3
# - hold power:
# - power_hold (notice: it doesn't fire power_start)
# - double-tap power:
# - power_tap_1
# - power_tap_2
# - power tap-then-hold:
# - power_tap_1
# - power_tap_1_hold
# increments to use for volume adjustment (in %)
@ -41,6 +60,12 @@ KEYBOARD="${KEYBOARD:-wvkbd-mobintl}"
action="$1"
log() {
printf "sane-input-handler: %s\n" "$1"
}
## HELPERS
isTouchOn() {
# success if all touch inputs have their events enabled
swaymsg -t get_inputs --raw \
@ -62,7 +87,23 @@ isInhibited() {
pidof rofi
}
handleWith() {
local state=
if [ -n "$_isInhibited" ]; then
state="inhibited+"
fi
if [ -n "$_isAllOn" ]; then
state="${state}on"
else
state="${state}off"
fi
log "state=$state action=$action: handleWith: $*"
"$@"
exit $?
}
## HANDLERS
ignore() {
true
}
@ -83,106 +124,98 @@ allOff() {
}
toggleKeyboard() {
local kbpid=$(pidof "$KEYBOARD")
if [ -z "$kbpid" ] || ! ( env kill -s RTMIN+0 "$kbpid" ); then
echo "sane-input-handler: failed to toggle keyboard: $KEYBOARD"
local keyboardPid=$(pidof "$KEYBOARD")
if [ -z "$keyboardPid" ]; then
log "cannot find $KEYBOARD"
return
fi
# `env` so that we get the right `kill` binary instead of bash's builtin
env kill -s RTMIN+0 "$keyboardPid"
}
handleWith() {
state=
if [ -n "$_isInhibited" ]; then
state="inhibited+"
fi
if [ -n "$_isAllOn" ]; then
state="${state}on"
else
state="${state}off"
fi
echo "sane-input-handler: state=$state action=$action: handleWith: $@"
"$@"
exit 0
}
## DISPATCHERS
dispatchDefault() {
case "$action" in
"powerbutton_one")
# power once => unlock
handleWith allOn
;;
"powerbutton_two")
"power_tap_2")
# power twice => screenoff
handleWith allOff
;;
# powerbutton_three: intentional no-op because overloading the kill-window handler is risky
"power_hold")
# power twice => toggle media player
handleWith playerctl play-pause
;;
volup_tap*|modal_volup_tap*)
volup_tap*)
handleWith wpctl set-volume @DEFAULT_AUDIO_SINK@ "$VOL_INCR"%+
;;
voldown_tap*|modal_voldown_tap*)
voldown_tap*)
handleWith wpctl set-volume @DEFAULT_AUDIO_SINK@ "$VOL_INCR"%-
;;
volup_hold*|modal_volup_hold*)
handleWith playerctl position 30+
;;
voldown_hold*|modal_voldown_hold*)
handleWith playerctl position 10-
;;
esac
}
dispatchOff() {
case "$action" in
"powerbutton_two")
# power twice => toggle media player
handleWith playerctl play-pause
;;
"powerhold")
# power toggle during deep sleep often gets misread as power hold, so treat same
"power_tap_1")
# power once => unlock
handleWith allOn
;;
volup_hold*)
handleWith playerctl position 30+
;;
voldown_hold*)
handleWith playerctl position 10-
;;
esac
}
dispatchOn() {
case "$action" in
# powerbutton_one: intentional default to no-op
# powerbutton_two: intentional default to screenoff
"powerhold")
# power thrice: kill active window
# power_tap_1: intentional default to no-op (it's important this be unmapped, because events can be misordered with power_tap_1 arriving *after* power_tap_2)
# power_tap_2: intentional default to screenoff
"power_tap_1_hold")
# power tap->hold: kill active window
# TODO: disable this if locked (with e.g. schlock, swaylock, etc)
handleWith swaymsg kill
;;
"powerbutton_volup")
"power_and_volup")
# power (hold) -> volup: take screenshot
handleWith sane-open --application sane-screenshot.desktop
;;
"power_and_voldown")
# power (hold) -> voldown: open camera
handleWith sane-open --auto-keyboard --application org.postmarketos.Megapixels.desktop
;;
"power_then_volup")
# power (tap) -> volup: rotate CCW
handleWith swaymsg -- output '-' transform 90 anticlockwise
;;
"powerbutton_voldown")
"power_then_voldown")
# power (tap) -> voldown: rotate CW
handleWith swaymsg -- output '-' transform 90 clockwise
;;
"volup_tap_1")
# swallow: this could be the start to a media control (multi taps / holds),
# or it could be just a single tap -> release, handled next/below
handleWith ignore
# volume up once: filesystem browser
handleWith sane-open --auto-keyboard --application rofi-filebrowser.desktop
;;
"volup_1")
# volume up once: system menu
handleWith sane-open-desktop rofi.desktop
"volup_hold_1")
# volume up hold: browse files and apps
# reset fs directory: useful in case you get stuck in broken directory (e.g. one which lacks a `..` entry)
rm -f ~/.cache/rofi/rofi3.filebrowsercache
handleWith sane-open --auto-keyboard --application rofi.desktop
;;
"voldown_start")
# volume down once: toggle keyboard
handleWith toggleKeyboard
;;
"voldown_hold_2")
"voldown_hold_1")
# hold voldown to launch terminal
# note we already triggered the keyboard; that's fine: usually keyboard + terminal go together :)
# voldown_hold_1 frequently triggers during short taps meant only to reveal the keyboard,
# so prefer a longer hold duration
handleWith sane-open-desktop xdg-terminal-exec.desktop
handleWith sane-open --auto-keyboard --application xdg-terminal-exec.desktop
;;
"voldown_tap_1")
# swallow, to prevent keyboard from also triggering media controls
@ -197,8 +230,8 @@ dispatchOn() {
dispatchInhibited() {
case "$action" in
"powerhold")
# power thrice: escape hatch in case rofi has hung
"power_tap_1_hold")
# power hold: escape hatch in case rofi has hung
handleWith killall -9 rofi
;;
*)

View File

@ -0,0 +1,21 @@
{ ... }:
{
sane.programs.sane-open = {
sandbox.method = "bwrap";
sandbox.autodetectCliPaths = "existing"; # for when opening a file
sandbox.whitelistDbus = [ "user" ];
sandbox.extraConfig = [
"--sanebox-keep-namespace" "pid" # to toggle keyboard
];
sandbox.extraHomePaths = [
".local/share/applications"
];
sandbox.extraRuntimePaths = [ "sway" ];
suggestedPrograms = [
"gdbus"
"xdg-utils"
];
mime.associations."application/x-desktop" = "sane-open-desktop.desktop";
};
}

View File

@ -0,0 +1,67 @@
{ config, lib, pkgs, sane-lib, ... }:
let
cfg = config.sane.programs;
# create an AttrSet[String -> String]
# which maps symlink path -> symlink content
# for every symlink known to nix
fsSymlinksAsAttrs = lib.concatMapAttrs
(path: value: lib.optionalAttrs
((value.symlink or null) != null)
{
"${path}" = value.symlink.target;
}
)
config.sane.fs
;
in
{
sane.programs.sanebox = {
packageUnwrapped = pkgs.sanebox.override {
bubblewrap = cfg.bubblewrap.package;
firejail = cfg.firejail.package;
landlock-sandboxer = pkgs.landlock-sandboxer.override {
# not strictly necessary (landlock ABI is versioned), however when sandboxer version != kernel version,
# the sandboxer may nag about one or the other wanting to be updated.
linux = config.boot.kernelPackages.kernel;
};
};
sandbox.enable = false;
};
environment.etc = lib.mkIf cfg.sanebox.enabled {
"sanebox/symlink-cache".text = lib.concatStringsSep "\n" (
lib.mapAttrsToList
(k: v: "${k}\t${v}")
({
"/bin/sh" = config.environment.binsh;
"${builtins.unsafeDiscardStringContext config.environment.binsh}" = "bash";
"/usr/bin/env" = config.environment.usrbinenv;
"${builtins.unsafeDiscardStringContext config.environment.usrbinenv}" = "coreutils";
# "/run/current-system" = "${config.system.build.toplevel}";
# XXX: /run/current-system symlink can't be cached without forcing regular mass rebuilds:
# mount it as if it were a directory instead.
"/run/current-system" = "";
} // lib.optionalAttrs config.hardware.opengl.enable {
"/run/opengl-driver" = let
gl = config.hardware.opengl;
# from: <repo:nixos/nixpkgs:nixos/modules/hardware/opengl.nix>
package = pkgs.buildEnv {
name = "opengl-drivers";
paths = [ gl.package ] ++ gl.extraPackages;
};
in "${package}";
} // lib.optionalAttrs (config.hardware.opengl.enable && config.hardware.opengl.driSupport32Bit) {
"/run/opengl-driver-32" = let
gl = config.hardware.opengl;
# from: <repo:nixos/nixpkgs:nixos/modules/hardware/opengl.nix>
package = pkgs.buildEnv {
name = "opengl-drivers-32bit";
paths = [ gl.package32 ] ++ gl.extraPackages32;
};
in "${package}";
} // fsSymlinksAsAttrs)
);
};
}

Some files were not shown because too many files have changed in this diff Show More