Compare commits

...

1246 Commits

Author SHA1 Message Date
7a047702d5 cross: flatpak: fix via nixpkgs patch instead of overlay 2024-08-13 06:04:43 +00:00
467283989f todo.md: fix Epiphany to persist cookies 2024-08-13 03:41:08 +00:00
db39dc209f xdg-desktop-portal-gnome: sandbox 2024-08-13 03:34:09 +00:00
7cf860a071 nixpkgs: update passt hash 2024-08-13 03:33:48 +00:00
77a753b0d6 gnome-maps: todo: better portal integration 2024-08-13 02:50:59 +00:00
e2a4f4d63e todo.md: newsflash and gnome-maps bugs to tackle 2024-08-13 02:48:08 +00:00
31fc072bce nixpkgs-overlays: try to be a little more pure 2024-08-12 21:56:30 +00:00
144afd8171 sway: fix wlroots drmSync bug via upstream patch 2024-08-12 21:52:44 +00:00
7d97355d2a overlays/cross: remove no-longer-necessary overrides 2024-08-12 21:20:16 +00:00
7827f6c584 sway: note that the activation patch is still necessary 2024-08-12 18:28:16 +00:00
e1899495a0 nixpkgs-wayland: 0-unstable-2024-08-06 -> 0-unstable-2024-08-12 2024-08-12 18:05:32 +00:00
a56ad56a4f refactor: move ~/.cache/nix persistence to hosts/common/programs/nix.nix 2024-08-12 16:06:26 +00:00
da551b8b97 geary: grant access to more files 2024-08-12 16:04:20 +00:00
ca412d08bd nautilus: grant access to more files 2024-08-12 16:04:11 +00:00
e7a1bb6ec0 nixpkgs: 2024-08-11 -> 2024-08-12 2024-08-12 10:30:04 +00:00
74acfeadd5 programs/assorted: clarify sandbox.enable = false situation 2024-08-12 10:27:41 +00:00
e7d5a61014 libcap: split into separate capsh and captree programs, and sandbox the latter 2024-08-12 10:13:50 +00:00
6f47708624 nixpkgs patches: send a few upstream; dont apply ffado patch here because my system doesnt use it 2024-08-12 10:10:06 +00:00
fc826a3503 libcap: patch in captree locally rather than via a nixpkgs patch that would force mass rebuilds 2024-08-12 09:39:43 +00:00
ccb2b7b8b6 nixpkgs: update libcap patch to grab from the PR 2024-08-12 09:18:50 +00:00
78169d50f2 overlays/cross: remove upstreamed patches; simplify rust things 2024-08-12 09:14:42 +00:00
33a7d3536d nixpkgs: update patches 2024-08-12 09:14:00 +00:00
7899c8d033 syshud: 0-unstable-2024-07-29 -> 0-unstable-2024-08-10 2024-08-12 02:37:03 +00:00
82b662a733 nixpkgs: remove dead (upstreamed) patches 2024-08-12 02:13:07 +00:00
d4290588bf rename: trust-dns -> hickory-dns 2024-08-12 01:23:39 +00:00
bd97fb9ec9 nixpkgs: 24.05-unstable-2024-08-09 -> 24.05-unstable-2024-08-11 2024-08-12 01:08:03 +00:00
4dbff9c18f scripts/deploy: shorten "--action copy" to just "--copy" 2024-08-12 01:07:50 +00:00
bfe278c17a feeds: subscribe to Weird Little Guys 2024-08-12 00:35:34 +00:00
295e07d535 sane-tag-media: fix lingering crashes around --derive behavior 2024-08-12 00:13:42 +00:00
d39459d8b5 NetworkManager: tighten the systemd sandboxing 2024-08-11 22:54:47 +00:00
4d5e60756b modemmanager: make its capabilities more obvious 2024-08-11 22:54:41 +00:00
119afcf393 firefox: remove open-in-mpv (obsoleted by firefox-xdg-open) 2024-08-11 22:37:12 +00:00
d3d970eb3e firefox: dont require approval to open xdg-open: URIs 2024-08-11 22:32:26 +00:00
c0d5004926 firefox: add a right-click context menu to open any URI with the system handler
it still prompts the user to allow it, but i'll fix that later i guess
2024-08-11 22:26:23 +00:00
d9a876e49a fractal: association with https://matrix.to links 2024-08-11 21:45:51 +00:00
5a9dd89475 sane-vpn: fix global up/down action 2024-08-11 21:01:11 +00:00
5e71e5a067 moby: enable bluetooth 2024-08-11 06:27:07 +00:00
f0b0d15ad7 evtest: ship 2024-08-11 06:26:58 +00:00
8aebc1fe87 feeds: subscribe to Oyez supreme court oral arguments 2024-08-10 11:16:54 +00:00
764c2a3276 Revert "nixpkgs-wayland: 0-unstable-2024-08-06 -> 0-unstable-2024-08-09"
This reverts commit ce1c3ec804.

while the nixpkgs-wayland bump works fine on lappy/desko,
it causes moby to be stuck on the white screen after unlocking.
2024-08-10 04:16:31 +00:00
a2f34be9d6 avahi: fix so the dbus policy files get installed system wide, again 2024-08-10 02:59:20 +00:00
bda172bc2d avahi: harden systemd service
N.B.: i haven't tested this on moby yet (which advertizes the gps-share service) nor on servo (which maybe uses it for jellyfin, idk)
2024-08-10 02:04:57 +00:00
a91a2d8a7f gps-share: fix sandboxing 2024-08-10 01:10:31 +00:00
875d919fa8 systemd-rfkill: harden 2024-08-10 00:34:13 +00:00
a323f321b5 snapper: disable
it wasn't working to begin with
2024-08-10 00:09:58 +00:00
f986936bbd wg-home-refresh: use the sandboxed wireguard-tools 2024-08-09 23:52:31 +00:00
3d773fe375 sanebox: improve the capsh stuff a bit more 2024-08-09 23:52:16 +00:00
055ad222e3 wg-home-refresh: harden systemd service 2024-08-09 23:05:58 +00:00
3aafcb0aa8 sanebox: capshonly: be more precise about preserving e/i/p capabilities
with this, gocryptfs works AND wg works
2024-08-09 22:55:02 +00:00
c85f02ca68 scripts/sync: dont rely on /mnt/$self existing 2024-08-09 21:41:56 +00:00
eeafc34ccf hare-ev: 2024-07-11 -> 2024-08-06 2024-08-09 21:41:56 +00:00
039ffcdcd4 newsflash: sandbox 2024-08-09 21:35:33 +00:00
2a35cb5379 mime.urlAssociations: clarify regexes by using $ terminator 2024-08-09 20:57:13 +00:00
3db009bc98 mpv: associate with all web audio/video resources 2024-08-09 20:55:00 +00:00
1e840e72b3 nixpkgs: 24.05-unstable-2024-08-06 -> 24.05-unstable-2024-08-09 2024-08-09 10:34:20 +00:00
ce1c3ec804 nixpkgs-wayland: 0-unstable-2024-08-06 -> 0-unstable-2024-08-09 2024-08-09 10:34:02 +00:00
09dd69a855 uassets: 0-unstable-2024-08-06 -> 0-unstable-2024-08-09 2024-08-09 10:33:29 +00:00
cbe71868ef newsflash: deploy 2024-08-09 10:25:53 +00:00
7b043d0c87 newsflash: simplify cross compilation 2024-08-09 10:14:59 +00:00
fd0188025d newsflash: fix cross compilation 2024-08-09 09:46:40 +00:00
1c57ffa798 newsflash-nixified: init at 3.3.4 (doesn't build!)
it's doing complicated things with glib macros that i can't get to work.
2024-08-09 03:50:36 +00:00
1d205a89bc sway: fix gnome-calls to always be on workspace 1 2024-08-08 23:59:19 +00:00
5ff643aa2f foliate: fix sandboxing 2024-08-08 23:58:02 +00:00
bfdf63e641 calls: 46.3 -> 47.0-beta 2024-08-08 23:57:47 +00:00
c695f7a979 foliate: ship 2024-08-08 21:08:51 +00:00
b3b38451b5 koreader-from-src: add an update script (only updates the toplevel, at the moment) 2024-08-08 18:47:03 +00:00
1ee81db537 switch xdg-desktop-portal-gtk -> xdg-desktop-portal-gnome
the gnome file chooser is far more responsive, on moby

though thumbnailing doesnt work, which may degrade the desktop experience :-(
2024-08-08 09:43:47 +00:00
b9947c05ca xdg-desktop-portal-gnome: fix cross compilation 2024-08-08 09:05:26 +00:00
2de6491583 xdg-desktop-portal-gnome: get working as a xdp backend, on lappy
probably needs some porting to moby before it works there
2024-08-08 08:52:24 +00:00
4525df58e0 rsyslog: disable 2024-08-08 07:40:59 +00:00
9d1ffc7c43 todo.md: document some connectivity issues 2024-08-08 03:41:52 +00:00
a69af91b7b add /mnt/servo/home to my hosts 2024-08-08 00:45:33 +00:00
7b5d655c91 scripts/check-backups: show how to view the host's last-completed 2024-08-07 23:00:44 +00:00
de6ffe6b75 flare-signal: update compatibility notes 2024-08-07 22:07:56 +00:00
f8aea34e96 sanebox: bwrap: make user namespace unsharing more obvious 2024-08-07 21:23:21 +00:00
49efb94a0a seatd: restrict capabilities 2024-08-07 20:30:29 +00:00
9b1e053ead seatd: place the socket in a place that lends itself to better sandboxing 2024-08-07 19:37:20 +00:00
235dc86155 todo.md: delete completed sandboxing items 2024-08-07 01:33:31 +00:00
6dad290cd5 duplicity: purge 2024-08-07 01:33:31 +00:00
cc6ed6c0ec flare-signal: annotate my notes on it with datestamps 2024-08-07 01:23:43 +00:00
cc3aba3cc2 servo: fix postfix: dont start until after the mail dir has been mounted 2024-08-07 00:17:17 +00:00
41f08125bb scripts/check-backups: convert timestamps to hours 2024-08-06 21:50:49 +00:00
27487fe870 scripts/check-admin: script to show which (if any) services require tending to registration attempts 2024-08-06 21:40:48 +00:00
d45ea622d1 servo: disable email-based registration gating 2024-08-06 21:39:32 +00:00
247fd3f807 less: tune flags, especially for systemd/journalctl 2024-08-06 19:25:10 +00:00
816e2a7065 nixpkgs: 24.05-unstable-2024-08-04 -> 24.05-unstable-2024-08-06 2024-08-06 19:08:39 +00:00
be842d5c5e nixpkgs-wayland: 0-unstable-2024-08-03 -> 0-unstable-2024-08-06 2024-08-06 19:08:30 +00:00
fa6ec981e0 sops-nix: assets-unstable-2024-07-27 -> assets-unstable-2024-08-05 2024-08-06 19:08:16 +00:00
52b4c1542a uassets: 0-unstable-2024-08-03 -> 0-unstable-2024-08-06 2024-08-06 19:08:00 +00:00
3ff59247da uninsane-dot-org: ? -> 2024-08-06 2024-08-06 19:07:44 +00:00
d9c0855c4e fractal-nixified: 7 -> 8 2024-08-06 08:26:50 +00:00
1a67a05238 transmission/torrent-done: make files readable (speculative) 2024-08-06 08:26:16 +00:00
1cdeedd9ec servo: partially ship ollama 2024-08-06 08:24:29 +00:00
6830bb7097 servo: transmission: simplify the rsync call
i'm having perms issues _somewhere_
2024-08-06 08:14:45 +00:00
316b0bee3a landlock-sandboxer: disable the ABI mismatch warnings 2024-08-06 07:20:00 +00:00
638655ff83 mnt-servo-*-reachable.service: harden systemd service 2024-08-06 06:43:10 +00:00
5e57e78411 /mnt/servo/*: fix to not hang the mount when fs is offline
this is an unfortunate effect of the drop_privileges part of fuse3,
that the mount is active as soon as the fs implementation is launched,
instead of when it enters `fuse_main`.
2024-08-06 05:54:31 +00:00
3859619ae0 curlftpfs-sane: implement "-o exit_after_connect" 2024-08-06 05:53:45 +00:00
646c2dd85a common/fs: mount curlftpfs using fuse3 2024-08-06 04:48:47 +00:00
0655b6906c curlftpfs: implement readdir
i think now all the stuff you'd expect of a basic fs now actually works
2024-08-06 04:11:32 +00:00
3019f90f5d curlftpfs-sane: upgrade to fuse3 2024-08-06 03:00:11 +00:00
020e5f8c6e /mnt/persist/private: split waiting on the keyfile out of the mount process 2024-08-06 02:03:55 +00:00
809c3af7fa /mnt/persist/private: minor improvements to file permissions 2024-08-06 01:26:53 +00:00
93cb1bc546 /mnt/persist/private: sandbox in a way that the actual gocryptfs instance doesn't get CAP_SYS_ADMIN 2024-08-06 00:52:48 +00:00
53acab834c refactor: persist/stores/ephemeral: move to its own source directory 2024-08-05 23:05:02 +00:00
3a0610b029 /mnt/persist/ephemeral: sandbox in a way that the actual gocryptfs instance doesn't get CAP_SYS_ADMIN
instead, only fuse does, and the capability is lost during the handoff between fuse and gocryptfs
2024-08-05 23:04:14 +00:00
9cee460d7e gocryptfs: sandbox with landlock
now /mnt/persist/ephemeral implementation can't access /mnt/persist/private; /mnt/persist/private can't access /mnt/desko/home, and so on
2024-08-05 23:01:38 +00:00
e657507a76 libfuse-sane: search for mount helpers on /run/current-system/sw/bin 2024-08-05 23:00:05 +00:00
c706a19836 landlock-sandboxer: rename the binary, so that it can be included on PATH without collisions 2024-08-05 22:59:14 +00:00
566e15286b sanebox: don't assume 'readlink' is available in the environment 2024-08-05 22:56:18 +00:00
d1b4e9c923 sanebox: allow /dev/fd in the sandbox by default 2024-08-05 22:55:12 +00:00
5eca45891b sanebox: fix landlock sandboxing IAB edgecases
i don't fully understand it. but adjusting the Inh capability set breaks things like gocryptfs. i think it isn't necessary: if we set E alone, and no-new-privs, then that gets us the same guarantees.
2024-08-05 22:54:20 +00:00
722fe8f368 libcap: ship the optional 'captree' component 2024-08-05 05:30:14 +00:00
e25dd98f6c spot/spotify: disable
i don't use spotify atm
2024-08-05 00:47:59 +00:00
54e9d4a0ae sane-vpn: switch back to bwrap instead of pasta 2024-08-04 18:56:17 +00:00
9f3a13eeb8 nixpkgs: 24.05-unstable-2024-08-02 -> 24.05-unstable-2024-08-04 2024-08-04 02:19:14 +00:00
5605ffda4b nixpkgs-wayland: 0-unstable-2024-08-02 -> 0-unstable-2024-08-03 2024-08-04 02:18:57 +00:00
9165925469 syshud: 0-unstable-2024-07-29 -> 0-unstable-2024-08-03 2024-08-04 02:18:37 +00:00
f65bf2b433 uassets: 0-unstable-2024-08-02 -> 0-unstable-2024-08-03 2024-08-04 02:18:14 +00:00
0f60a86ed4 hare-ev: 0-unstable-2024-07-07 -> 0-unstable-2024-07-11 2024-08-04 01:08:37 +00:00
b488b6748d nixos/pam: replace apparmor warnings with assertions 2024-08-04 00:50:41 +00:00
ef6b7cf175 syshud: 0-unstable-2024-07-16 -> 0-unstable-2024-07-29 2024-08-04 00:39:04 +00:00
0906d76f83 libcap_ng: ship 2024-08-03 23:27:53 +00:00
90c495e74c libfuse-sane: ship 2024-08-03 22:59:34 +00:00
74662df720 persist/{private,ephemeral}: mount via fuse
gocryptfs is compatible with --drop-permissions style of mount.fuse3. only, i can't actually use that today because i need to keep permissions :o

but maybe i'll enable that in the future
2024-08-03 18:51:58 +00:00
2b3278eb7f /mnt/$host/home: layer bwrap sandboxing after the drop-privileges passoff 2024-08-03 17:11:11 +00:00
9b4e91fbd9 /mnt/$host/home: harden systemd settings 2024-08-03 16:27:42 +00:00
734627232a /mnt/$host/home: mount with drop_privileges 2024-08-03 15:13:04 +00:00
3adbbe5fa7 /mnt/$host/home: run as user instead of as root 2024-08-03 15:13:04 +00:00
b4a244df7a rsync-net: fix /nix/persist/private path 2024-08-03 14:32:44 +00:00
97268e9b26 curlftpfs-sane: rename from curlftpfs
i already patched it significantly; i plan to port to fuse3 shortly
2024-08-03 14:32:01 +00:00
bebf6bdaeb rsync-net: hardcode fewer paths 2024-08-03 11:38:43 +00:00
04fc601c9c rsync-net: fix sandboxing (dont set PrivateUsers: we lose perms in the root ns doing that) 2024-08-03 11:25:50 +00:00
ee062d61d0 sane-tag-media: rework the tag extrapolation to be less intrusive 2024-08-03 07:58:43 +00:00
0dba9987c5 sane-tag-media: remove unused "confirm" function 2024-08-03 07:19:53 +00:00
4761690b6d sane-tag-media: have --derive + --override-existing NOT override the existing tags when the derived ones apear to be simply lower-quality versions of the same on-disk data 2024-08-03 07:19:08 +00:00
604782c3a6 sane-tag-media: refactor (simplify) 2024-08-03 03:57:09 +00:00
365d33c357 sane-tag-media: empty manual tags always overwrite tags, regardless of --override-existing flag 2024-08-03 03:38:22 +00:00
a39ad8a508 sane-tag-media: rename --force flag to --override-existing 2024-08-03 03:31:16 +00:00
c49e9a4c2b sane-tag-media: implement the --ignore-existing flag 2024-08-03 03:18:07 +00:00
36491842cc sanebox: bwrap: micro-optimize to not require env 2024-08-02 22:44:27 +00:00
81ea2210c9 sanebox: allow keeping the net namespace 2024-08-02 22:44:27 +00:00
f678508b33 sanebox: add --sanebox-capsh-arg flag 2024-08-02 22:44:27 +00:00
6135be5f72 sanebox: refactor: bwrapFlags -> bwrapArgs 2024-08-02 22:44:27 +00:00
c8989ca1a8 pasta: allow running as root 2024-08-02 22:44:26 +00:00
1d665f8ecc sanebox: support "--sanebox-cap all" special case 2024-08-02 22:43:52 +00:00
7c284ad8da sane-vpn: use pasta instead of full bwrap for net namespacing 2024-08-02 22:42:56 +00:00
1c26674da7 rsync-net: temporarily use only RestrictNetworkInterfaces option and disable the internal sane-vpn logic
this is temporary, until i can fix sane-vpn to preserve linux capabilities
2024-08-02 22:10:44 +00:00
dae8481176 firefox: ship a "stub DNS" desktop file variant
though note that my stub-dns seems to be broken recently...
2024-08-02 21:41:07 +00:00
42b27f0433 sane-vpn: fix broken doc on --verbose flag 2024-08-02 21:39:29 +00:00
84be0cae5a todo.md: note another website which doesnt resolve with trust-dns 2024-08-02 21:20:31 +00:00
fbfd0afca4 common/fs: only desclare /mnt/$host mounts for hosts this machine is authorized to access 2024-08-02 20:29:22 +00:00
e586b7b449 signal-desktop-from-src: 7.16.0 -> 7.18.0 2024-08-02 10:52:44 +00:00
222c37b056 uassets: 2024-07-29 -> 2024-08-02 2024-08-02 10:52:25 +00:00
53b17ec230 nixpkgs-wayland: 2024-07-28 -> 2024-08-02 2024-08-02 10:52:07 +00:00
7697704aff nixpkgs: 2024-07-31 -> 2024-08-02 2024-08-02 10:51:44 +00:00
c490b6e6ad common/polyunfill: simplify my config by using the new security.pam.package option 2024-08-02 10:04:20 +00:00
89d678c729 nixpkgs: 2024-07-29 -> 2024-07-31 2024-08-02 10:03:48 +00:00
c64163290c gocryptfs: return to running mainline
i don't need the bug fix anymore, since i don't use pam_mount anymore
2024-08-02 09:52:20 +00:00
eaeb8380dc fs: enable @basic-api everywhere, since its required by systemd restart logic 2024-08-02 09:13:55 +00:00
05a9e8e819 common: /mnt/servo: fix systemd mount files to be aware of the timeout, again 2024-08-02 08:16:13 +00:00
cf20230d96 sane.fs: cleanup
plumb systemd.{mounts,services} instead of the less detailed 'systemd'
2024-08-02 08:01:38 +00:00
9dbb2a6266 sane.fs: take in the role of generating systemd.mounts files 2024-08-02 07:33:21 +00:00
113b107d73 persist: fix ordering so stores arent required by local-fs.target
maybe they should be, but then there's weird stuff about getty depending on sysinit.target, and that being blocked by the private store...
2024-08-02 06:20:39 +00:00
96dfe79a8c fs: persist/private: harden systemd mount file 2024-08-02 05:17:44 +00:00
6e5bde17aa cleanup: persist/private: simplify 2024-08-02 05:00:55 +00:00
3eb66c098b trust-dns: make it a dependency of "network-online.target" 2024-08-02 04:54:58 +00:00
515aab5370 cleanup: persist/private: encode the dependencies more precisely, rather than just having it all depend on default.target 2024-08-02 04:50:33 +00:00
f925dd9a20 fs: isolate /mnt/servo/* and /mnt/persist/ephemeral a bit more 2024-08-02 04:45:14 +00:00
cbe6bdf158 hosts: fs: sandbox /mnt/servo/* mounts 2024-08-02 03:17:53 +00:00
949a52dee1 activationScripts.notifyActive: be quiet about sane-deadlines/sane-sysload 2024-08-02 01:11:19 +00:00
2ee1fb17c4 sane-deadlines, sane-sysload: fix ordering to not run before the environment is configured 2024-08-02 01:04:07 +00:00
48cc718700 login: remove systemd-user-sessions integration so that we dont block on remote-fs
tested on lappy. will it work on servo, with gitea?
2024-08-02 00:52:51 +00:00
6a7dd31755 vpn: fix warning about missing /32 syntax 2024-08-02 00:37:58 +00:00
2197951e12 NetworkManager-dispatcher: cleanup an ordering cycle between it and trust-dns-localhost 2024-08-02 00:36:54 +00:00
883db3e9ba todo.md: sync 2024-08-02 00:33:35 +00:00
312b0a5554 todo.md: sandbox the remaining filesystems 2024-08-01 22:50:03 +00:00
07de46c616 todo.md: remove completed items 2024-08-01 22:48:49 +00:00
efc16a9e80 persist: harden the "ephemeral" store mount environment
there's only so much this can actually achieve. it's still quite possible for someone who knows what they're doing to do large amounts of damage
2024-08-01 22:40:55 +00:00
161f272f41 gpodder-adaptive: track youtube-dl upstreaming 2024-08-01 20:02:47 +00:00
6aa6c0020c lightning-cli: fix sandboxing 2024-08-01 19:59:23 +00:00
acd46940e4 clightning: lift the build fix into pkgs/default.nix
this lets me apply it outside the context of a nixos module
2024-08-01 19:53:05 +00:00
00a25f1533 feeds: fix complex systems URL 2024-08-01 19:52:22 +00:00
bc0a1eb1b3 feeds: sub to Complex Systems Podcast 2024-08-01 18:58:39 +00:00
cd3f483df0 sway: add "Super+B" shortcut to open the Web Browser 2024-08-01 18:55:25 +00:00
38a183cf3b sane-open: backfill missing configureKeyboardFor_uri method 2024-08-01 18:54:50 +00:00
5ed6e84cc7 sane-open: refactor 2024-08-01 18:54:04 +00:00
7c1a0fc323 sane-open: add --debug flag 2024-08-01 18:52:55 +00:00
f16066549f sane-open: fallback to URI instead of file when we cant do anything more specialized 2024-08-01 18:52:06 +00:00
659da66106 sane-open: add the ability to open URIs 2024-08-01 18:50:17 +00:00
c07eaba873 tor-browser: associate with .onion URLs 2024-08-01 18:34:38 +00:00
bb420bd45d firefox: add a desktop item for launching inside a VPN 2024-08-01 18:10:32 +00:00
3902432864 where-am-i: fix bin linking 2024-08-01 17:57:45 +00:00
33efbeda8a link manpages into all linkIntoOwnPackage users 2024-08-01 17:43:58 +00:00
8206fb0519 linkIntoOwnPackage: place man/doc into separate outputs 2024-08-01 17:11:24 +00:00
2687286489 servo: nginx: switch to mainline zlib to silence syslog warnings 2024-08-01 01:25:16 +00:00
d5e52e21f7 sane-stop-all-servo: stop ntfy and trust-dns-doof services 2024-07-31 23:40:51 +00:00
367fc24aa8 nixpkgs: full_index=1: actually apply to all PR urls -- not just nixpkgs commits 2024-07-31 20:59:07 +00:00
bf45206d1a nixpkgs: use full_index=1 when fetching patches, for stable hashes 2024-07-31 20:52:38 +00:00
397b2ae2ea nixpkgs: update hashes 2024-07-30 22:05:01 +00:00
f0ebb305ec nixpkgs: update hashes
though it's probably fetchpatch2 just being stupid again and i'll revert
2024-07-30 21:58:01 +00:00
e629d2d999 rsync-net: harden systemd service, and dodge the "pasta doesnt support root" bug 2024-07-30 21:54:25 +00:00
9b2601e450 cross: fix texinfo (used for info command) 2024-07-30 16:23:06 +00:00
a20c13fffe firefox-extensions.ublacklist: 8.9.1 -> 8.9.2 2024-07-30 15:50:04 +00:00
20a2d8dc1c uassets: 2024-07-28 -> 2024-07-29 2024-07-30 15:50:04 +00:00
297bf7e090 syshud: 2024-07-21 -> 2024-07-29 2024-07-30 15:50:04 +00:00
ed024d081e nixpkgs-wayland: 2024-07-27 -> 2024-07-28 2024-07-30 15:50:04 +00:00
4ddd4191bc nixpkgs: 2024-07-28 -> 2024-07-29 2024-07-30 15:50:04 +00:00
32ef63028b sane-reclaim-disk-space: fix quote typo 2024-07-30 15:32:35 +00:00
70bd001171 servo: bitcoind: harden systemd service 2024-07-30 13:12:27 +00:00
b53f376d70 servo: clightning: tighten sandboxing for bitcoin-cli interaction 2024-07-30 12:41:33 +00:00
621c147483 clightning: remove /var/lib/bitcond-mainnet from the service paths -- again 2024-07-30 11:17:10 +00:00
841076fd9e clightning: move /var/lib/bitcoind-mainnet from ReadWritePaths -> ReadOnlyPaths
i think i can go further, remote it altogether
2024-07-29 23:19:26 +00:00
80492e902b inotify watches: bump 1M -> 4M
i'm hoping this will reduce errors on servo seen in system services,
about exhausing "disk space" (file handle space)
2024-07-29 23:19:26 +00:00
f058fe0be6 servo: lemmy: sandbox 2024-07-29 23:19:26 +00:00
8fde3dea77 servo: pleroma: fix service hardening 2024-07-29 23:19:26 +00:00
ac9238a7f0 servo: assorted: plead with shitty AI companies to not bring my server to its knees by scraping all of the Linux source code
i thought AI was supposed to be smart
2024-07-29 19:19:32 +00:00
45412e5042 common/fs: ftp auto-remounting in a way which doesnt use .service files 2024-07-29 15:44:54 +00:00
d76d50f1c4 common/fs: /mnt/servo/* ftp auto/re-mounting in a way which does better rate limiting 2024-07-29 07:11:52 +00:00
f1c76ada43 WIP: common/fs: simpler /mnt/servo/* ftp auto/re-mounting 2024-07-29 03:44:10 +00:00
9dbd85ba08 servo: slskd: remove the hardening options until i can debug 2024-07-29 03:42:52 +00:00
2c707c3acd servo: lemmy/lemmy-ui: harden the service with a syscall filter 2024-07-29 03:42:52 +00:00
0fae963d90 servo: lemmy: harden the backend systemd service 2024-07-29 03:42:52 +00:00
90df178c35 servo: slskd: harden (partially) 2024-07-29 03:42:52 +00:00
dc053149d0 servo: lemmy/lemmy-ui: harden 2024-07-29 03:42:52 +00:00
bce81d0487 servo: pleroma: harden 2024-07-29 03:42:52 +00:00
a8eba4df4d servo: jackett: harden further 2024-07-29 03:42:52 +00:00
1bb36b74c2 scripts/check-uninsane: check that servo bitcoind is online 2024-07-29 03:42:52 +00:00
e21910a1f7 servo: disable unused i2p, monero services 2024-07-29 03:42:52 +00:00
4b30036973 servo: bitcoind: harden 2024-07-29 03:42:52 +00:00
ea5919ab6b servo: jackett: harden 2024-07-29 03:42:52 +00:00
43232ff569 kiwix-serve: harden 2024-07-29 03:42:52 +00:00
6a9fd04437 bitcoin-cli: split into own file, and fix broken path to config file when running as user 2024-07-29 03:42:52 +00:00
dc2d46b9c0 servo: cryptocurrencies: get clightning back into a state where i can see its working 2024-07-29 03:42:52 +00:00
666744bda3 bitcoin-cli,lightning-cli: ship as own package instead of shipping the whole daemon 2024-07-29 03:42:52 +00:00
ba09fbeec9 bitcoind: fix sandboxing 2024-07-29 03:42:52 +00:00
916ecc30d1 scripts/deploy: fix --reboot flag 2024-07-29 03:42:52 +00:00
1536a60a3d firefox-extensions.ether-metamask: attributions-v11.16.15 -> 11.16.16 2024-07-29 03:42:52 +00:00
b7418afede uassets: 2024-07-22 -> 2024-07-28 2024-07-29 03:42:52 +00:00
82a0bf3212 sops-nix: 2024-07-21 -> 2024-07-27 2024-07-29 03:42:52 +00:00
cb79224c7a nixpkgs-wayland: 2024-07-22 -> 2024-07-27 2024-07-29 03:42:52 +00:00
b850e25f5b nixpkgs: 2024-07-24 -> 2024-07-28 2024-07-29 03:42:52 +00:00
8f0f7ef333 cross: fix rsyslog compilation 2024-07-29 03:42:52 +00:00
0bfaead177 sane-deadlines: only show on physical login, not ssh 2024-07-29 03:42:52 +00:00
1b93dbe12c sane-sysload: show on remote login 2024-07-29 03:42:52 +00:00
72d286fbba sane-sysload: add an "{all}" formatter, and show that by default 2024-07-29 03:42:52 +00:00
033faf6f6b clightning-sane: fix --help formatting 2024-07-28 19:24:38 +00:00
eb3651ce59 refactor: assorted: python: logger.warn -> logger.warning
the former is deprecated
2024-07-28 03:41:30 +00:00
bf1f843306 doc: rsyslog: note that this isnt the traditional setup
also, may want to tune the burst settings in the future. i definitely got rate-limited
2024-07-28 03:40:53 +00:00
6cc5669772 servo: remove the root auto-login, so that my s6-rc entrypoint works
i'm sure there's a better way to do this... meh
2024-07-28 03:40:07 +00:00
cb1fbdcaf0 sane-ip-check: add a delay in the retry path 2024-07-28 03:24:02 +00:00
c83dc4d601 servo: assorted: decrease logging verbosity of matrix, lemmy, dovecot, ntfy-sh 2024-07-28 03:15:27 +00:00
36bbac539f nginx: port /var/www/sites data to private store 2024-07-28 02:38:36 +00:00
9a1cd9341f feeds: note some more podcast discovery places 2024-07-28 01:54:14 +00:00
3a6a5ffe01 rsyslog: persist logs 2024-07-28 01:54:14 +00:00
971de060d5 WIP: port /var/log persistence to private store 2024-07-28 01:54:14 +00:00
3ea57f1d6a users: disable pam mount
this was needed for the old way of mounting ~/private, but no longer
2024-07-28 01:54:14 +00:00
fa05e59863 servo: ipfs: port data to private store 2024-07-28 01:54:14 +00:00
de7ff360dc servo: postfix: port data to private store 2024-07-27 17:43:18 +00:00
7f1f9a082d flare-signal-nixified: simplify 2024-07-27 17:30:18 +00:00
6553cdc068 flare-signal-nixified: 0.10.1 -> 0.15.0 2024-07-27 16:54:12 +00:00
e44771f67d servo: postgresql: port data to private store 2024-07-27 16:51:23 +00:00
cbe17c03e4 scripts/deploy: fix usage message about --reboot flag 2024-07-27 14:48:44 +00:00
4c4d841038 servo: slskd: dont persist any data, actually (it still works) 2024-07-27 14:48:31 +00:00
060ae113a1 servo: transmission: port data to private store 2024-07-27 14:14:27 +00:00
540124d2f7 servo: slskd: port data to private store 2024-07-27 13:54:01 +00:00
9df947aa74 servo: ejabberd: port data to private store 2024-07-27 13:40:08 +00:00
66333cbbe7 servo: prosody: port data to private store 2024-07-27 13:38:34 +00:00
3353ed3b66 linux-postmarketos-allwinner: 6.9.0 -> 6.9.10 2024-07-27 13:26:18 +00:00
447923a231 servo: matrix: port data to private store 2024-07-27 12:44:49 +00:00
3179a6834b servo: gitea: port data to private store 2024-07-27 11:49:47 +00:00
70a470b81e servo: ntfy: port data to private store 2024-07-27 02:10:43 +00:00
fff7848cd6 servo: clightning: port data to private store 2024-07-27 02:07:39 +00:00
1fb6cb483b servo: tor: port to private share 2024-07-27 02:04:08 +00:00
33e72c8d34 pleroma: port to private share 2024-07-27 02:00:28 +00:00
8629e2600a jackett: port to private store 2024-07-27 01:49:12 +00:00
2e644dc020 persist/private: remove the "prefix", to allow the store to hold files not just in /home/colin
this will require a one-time manual migration on all devices
2024-07-27 00:26:57 +00:00
f4a6bc1991 pam_cap: fix ordering so that my sessions have correct capabilities again 2024-07-26 23:58:57 +00:00
19fd45211f sane-secrets-unlock: remove from ~/.profile and make it an s6 service
more reliable, in practice
2024-07-26 22:18:32 +00:00
ace03bb0e9 persist/private: actually do enable "auto", for servo where i dont auto-tty-login as colin
this doesn't seem to block the boot
2024-07-26 22:02:57 +00:00
8819142128 modules/users: use = instead of -eq for comparison to fix warning which XDG_VTNR is unset 2024-07-26 20:57:23 +00:00
d905af6cd1 ship sane-private-unlock-remote as a cron job to lappy/desko 2024-07-26 20:54:27 +00:00
0f084b19f1 sane-scripts.private-unlock-remote: init 2024-07-26 20:16:12 +00:00
91263b9dcf sane-secrets-dump: allow specifying the secret by name instead of full path 2024-07-26 20:05:51 +00:00
40e4d0f39c sane-secrets-dump: allow dumping specific fields, and in multiple formats 2024-07-26 19:56:18 +00:00
06a17e4425 moby: remove dead autologin code 2024-07-26 16:04:38 +00:00
cbca403158 hosts/common: downgrade the auto-login to lib.mkDefault
servo uses autologin as root, for the purpose of recovery. let it keep that for now
2024-07-26 16:04:13 +00:00
3b8d6c8587 refactor: s6/unl0kr/profile: put more shell init stuff directly in modules/users/default.nix when it doesnt benefit from being pluggable 2024-07-26 15:58:59 +00:00
d59380b4dd unl0kr: ensure it runs on the same tty the session was initialized on 2024-07-26 14:50:28 +00:00
f4df121e3d persist/private: s6: use systemd to explicitly start the mount, rather than assume it's already been initiated 2024-07-26 14:01:31 +00:00
3d91fa2475 systemd.networkd: disable the wait-online service
it blocks boot like a idiot
2024-07-26 14:01:31 +00:00
96f786de20 persist/private: fix so systemd actually knows when the mount has completed 2024-07-26 12:44:32 +00:00
fcbbfc4a65 fix s6 service ordering: unl0kr -> (wait for mount) -> sway
note that the systemd-aware mount never completes -- it's stuck in 'activating' forever. that's the next challenge
2024-07-26 12:18:14 +00:00
b93e9e75e6 unl0kr: use inotify in the retry logic 2024-07-26 11:31:53 +00:00
4daf5452e8 unl0kr: dont echo password to terminal 2024-07-26 09:36:06 +00:00
af905a2f58 unl0kr: split the gocryptfs unlocking into its own separate service
/mnt/persist/private can be depended on by both s6 user services and systemd system services (which will become useful for servo)

/mnt/persist/private can be unlocked by dropping the key in remotely, however that won't kill unl0kr

TODO: fix unl0kr to not also output text to the tty

TODO: ensure gocryptfs mount can handle being fed a wrong password
2024-07-26 08:08:21 +00:00
8ef5920d84 unl0kr: port to an s6 service
this has some drawbacks in its current form and will be tidied

it writes the password also to the consold. it requires 'sudo'.
2024-07-25 18:45:01 +00:00
b554d32133 fix permissions of /nix/persist/private, to be user-writable
this is important for my rsync-net backup scripts, which need to record timestamps in there
2024-07-25 18:42:45 +00:00
2203d6db59 cleanup: remove XDG_SESSION_TYPE, XDG_VTNR from global environment 2024-07-25 15:26:24 +00:00
07b55bb3ec unl0kr: dont run atop getty -- just a bare /dev/tty1
i'm not sure what agetty was ever doing here.
unl0kr itself runs fine, it launches ~/.profile, and if i interrupt ~/.profile to use a console, that works too.

the console does regularly get interrupted by systemd output,
but i've checked and the agetty method had that same program.
2024-07-25 14:48:15 +00:00
874b7aecfa persist: rename "cryptClearOnBoot" to "ephemeral" 2024-07-25 12:11:46 +00:00
cf8e9f798d persist/crypt: simplify the fileSystems definitions
turns out you can just declare your own fs type, that's cool
2024-07-25 12:11:46 +00:00
800945d951 sway: disable touchpad middle-click (i hope?) 2024-07-25 12:11:46 +00:00
4c3b0f820b feeds: unsubscribe from Vox, Post Reports (politics) 2024-07-25 08:41:13 +00:00
0756349c86 polyunfill: fix missing lvm2 2024-07-24 13:11:59 +00:00
490c587737 swaync-service-dispatcher: add up/down options 2024-07-24 11:49:15 +00:00
15df9edca1 swaync-service-dispatcher: add a usage command 2024-07-24 11:46:52 +00:00
2d73b85f92 gps-share: fix sandboxing
it's possible that the Avahi sandboxing isn't right. idk
2024-07-24 11:43:24 +00:00
70d4925483 gps-share: dont launch until after the modem is actually powered on 2024-07-24 11:15:44 +00:00
dda2ea6fcb nixpkgs: update patch hash 2024-07-24 10:00:30 +00:00
a165e568a8 mpv: tune controls for mobile (speculative) 2024-07-24 09:05:15 +00:00
a539e52abe mpv: disable visualizer; it breaks UI 2024-07-24 09:05:05 +00:00
e62df51258 todo.md: remove completed items 2024-07-24 08:29:16 +00:00
17e7c7d48b nixpkgs: update hashes 2024-07-24 08:29:08 +00:00
6f1173e45a sops-gpg-adapter: port to nix-shell 2024-07-24 08:28:13 +00:00
225c8de7a2 trust-dns: fix dyn-dns reactor (trust-dns-lan does not exist) 2024-07-24 07:18:29 +00:00
05f8dad425 nixpkgs-wayland: 2024-07-21 -> 2024-07-22 2024-07-24 06:46:27 +00:00
8b6971a164 nixpkgs: 2024-07-21 -> 2024-07-24 2024-07-24 06:38:40 +00:00
91359174f6 scripts/check-backups: be slightly more verbose -- at least until im more confident in this setup 2024-07-24 03:33:07 +00:00
b012b93d89 sane-vpn: port from bash -> python 2024-07-24 03:32:38 +00:00
34e770c5f5 sanebox: fix missing dependency on iptables/iproute2 2024-07-24 03:32:12 +00:00
0460a419c5 sane-vpn: use DHCP DNS servers when use specifies none -- instead of 1.1.1.1 2024-07-24 03:05:37 +00:00
79834aedf3 scripts/check-backups: init 2024-07-23 22:09:32 +00:00
2ca8bcda56 bonsai: 1.1.0 -> 1.2.0 2024-07-23 21:39:07 +00:00
8ced778def rsync.net backups: generate stamp files that let me verify that a backup has been attempted 2024-07-23 21:05:43 +00:00
d91ca22587 scripts/sync: add --verbose flag and support syncing multiple machines 2024-07-23 18:49:05 +00:00
a47b9d580a sane-tag-media: fix type-based filtering 2024-07-23 18:24:41 +00:00
fc8a54f39b sane-tag-media: leave a note to implement epub support in the future 2024-07-23 18:14:37 +00:00
3ae25fbe31 sane-tag-media: understand Adobe Acrobat publisher tag 2024-07-23 17:59:00 +00:00
36acc87f30 sane-tag-media: rename print-missing subcommand to show-missing, for consistency with show subcommand 2024-07-23 17:53:48 +00:00
5b7244d339 sane-tag-media: understand LibreOffice/OpenOffice publisher tag 2024-07-23 17:52:34 +00:00
9efa5bb209 sane-tag-music -> sane-tag-media, and formally support pdf 2024-07-23 17:42:25 +00:00
211486f60e pleroma: use sandboxed gawk instead of unsandboxed 2024-07-23 17:19:50 +00:00
b21002207a programs: ship exiftool 2024-07-23 17:19:50 +00:00
1fc0ae3066 nixpkgs: update contourpy patch hash 2024-07-23 17:19:50 +00:00
712cff2867 sane-tag-music: fix path-based tag derivation when path contains "." or ".." 2024-07-23 16:46:32 +00:00
a103cd819f sane-sync-music: fix flac -> opus conversion for surround sound media 2024-07-22 23:12:02 +00:00
553a2724a4 youtube-tui: docs: mention more invidious instances 2024-07-22 16:14:44 +00:00
bf0583cbda youtube-tui: update to a more reliable invidious instance 2024-07-22 16:00:51 +00:00
5a5842d26c nicotine-plus: fix so it can read its config file on first run 2024-07-22 15:51:40 +00:00
3f8f3f4e54 mpv: sponsorblock: also skip intros 2024-07-22 14:20:34 +00:00
4ad6c84d31 mpv: integrate with sponsorblock 2024-07-22 14:09:56 +00:00
8e215cba69 jackett: remove obsoleted patch
seems to work without? i guess i just didn't want to patch the service?
2024-07-22 12:10:21 +00:00
1e3b71def3 gpodder: enable yt-dlp 2024-07-22 11:36:32 +00:00
90b057af95 servo: jackett: remove unnecessary doCheck patch
i don't run jackett on arm anymore
2024-07-22 11:14:12 +00:00
4e35c09a85 jackett: apply patches only to the package as used by the service -- not all of nixpkgs 2024-07-22 11:10:30 +00:00
1e0034c66f sxmo-utils: remove 2024-07-22 11:02:58 +00:00
ae91b825e6 feeds: unsubscribe from The Daily
maybe check back in 2 years from now and see if it'll be more worthwhile news and less politics
2024-07-22 10:48:57 +00:00
3c8b3f2d04 programs: add "nix"
this allows me to get it to shup up about so-called 'non-free' packages
2024-07-22 10:46:31 +00:00
79fbdc4e15 scripts/sync: add a "sync all" option 2024-07-22 07:52:31 +00:00
284ea45648 mpv: tune the OSC menu controls 2024-07-22 07:34:56 +00:00
9c33cb44e2 nixpkgs: 2d155950622fbf78b85e7fa36e337f35316b6c39 -> b841e48094d6eaad953f36dc0831434966dc7719 2024-07-22 06:19:52 +00:00
77a9f47352 nixpkgs-wayland: 2024-07-20 -> 2024-07-21 2024-07-22 06:19:39 +00:00
04a5d38f79 syshud: 2024-07-16 -> 2024-07-21 2024-07-22 06:19:25 +00:00
452950d80b uassets: 2024-07-21 -> 2024-07-22 2024-07-22 06:19:06 +00:00
a79d9b1823 firefox-extensions.ublacklist: 8.9.0 -> 8.9.1 2024-07-22 06:18:49 +00:00
6e3a790a46 moby: enable rsync.net backups 2024-07-21 23:58:41 +00:00
7be997f597 moby: update password 2024-07-21 23:58:41 +00:00
ef1ee6c1c9 moby: document secrets 2024-07-21 23:58:41 +00:00
e196cea667 todo.md: not another trust-dns failure 2024-07-21 23:57:23 +00:00
105416990a 'sane-vpn do unmetered': route DNS to the host resolver 2024-07-21 23:56:56 +00:00
c0d1f7711a sanebox: pasta/bwrap: route DNS to the host's server if asked (via --sanebox-dns host) 2024-07-21 23:56:15 +00:00
f123be98b2 sane-vpn: specify missing sanebox dependency 2024-07-21 22:49:46 +00:00
15b0bba329 sanebox: implement --sanebox-pasta-arg, useful for debugging 2024-07-21 22:49:00 +00:00
734a4c7c31 todo.md: remove completed compass item 2024-07-21 21:51:41 +00:00
3ce2b44b7d sane-private-change-passwd: remove
use `gocrypt --passwd /nix/persist/private` instead
2024-07-21 21:48:31 +00:00
5f0eaa9771 sane-private-lock: fix mount point 2024-07-21 21:47:00 +00:00
cd7b36b761 sane-sync-music: target opus instead of mp3 when transcoding
opus supports surround sound
2024-07-21 21:46:18 +00:00
b72acef8ed pipewire: default to PIPEWIRE_DEBUG=3 2024-07-21 17:38:10 +00:00
74f2d4d174 pipewire: lift the surround sound functionality out of mpv 2024-07-21 16:54:26 +00:00
bedc9d4b2c signal-desktop-from-src: remove unnecessary --linux build flag 2024-07-21 15:02:03 +00:00
70b36fd79f signal-desktop-from-src: cleanup even more 2024-07-21 15:02:03 +00:00
7baed78b65 signal-desktop-from-src: remove extranous better-sqlite3 rebuild 2024-07-21 15:02:03 +00:00
7cca126efc signal-desktop-from-src: remove extraneous rebuild 2024-07-21 15:02:03 +00:00
433e8b8736 signal-desktop-from-src: simplify packaging -- just patch the dns fallback out 2024-07-21 15:02:03 +00:00
c026b8c40d signal-desktop-from-src: simplify build:release step 2024-07-21 15:02:03 +00:00
88df6b30ce signal-destop-from-src: 7.14.0 -> 7.16.0
upstream switched from yarn to npm, and for this kind of a package i'll seize the opportunity to use builNpmPackage instead of doing so much manually :-)
2024-07-21 15:02:03 +00:00
d324a57f06 uassets: 2024-07-19 -> 2024-07-21 2024-07-21 15:02:03 +00:00
55bed1926c sops-nix: 2024-07-14 -> 2024-07-21 2024-07-21 15:02:03 +00:00
8c9dcdb90f nipkgs-wayland: 2024-07-18 -> 2024-07-20 2024-07-21 15:02:03 +00:00
0ebcbe0ad5 nixpkgs: 2024-07-19 -> 2024-07-21 2024-07-21 15:02:03 +00:00
a9cbb2c092 servo: transmission/torrent-done: fix noisy file regexes 2024-07-21 11:25:54 +00:00
c5227c52c4 sane-sync-music: update file extensions list 2024-07-21 09:44:39 +00:00
0af5e43944 scripts/update: support gitUpdater-style updateScripts 2024-07-21 07:26:39 +00:00
cd16f8c3b6 sxmo-utils: disable auto-update via updateWithSuper attribute 2024-07-21 06:39:19 +00:00
0f7ec33dac scripts/update: cleanup 2024-07-21 06:36:21 +00:00
993c3df09e scripts/update: dont update sofacoustics package by default 2024-07-21 05:49:22 +00:00
fccb48cc2d mpv: ship the libmysofa HRTF file via $XDG_CONFIG_DIRS/share/libmysofa/default.sofa 2024-07-20 19:15:39 +00:00
64ddf15620 sofacoustics.ari: init 2024-07-20 19:13:55 +00:00
68ef56b572 mpv/ffmpeg: consolidate the different ffmpeg configs into overlays/preferences 2024-07-20 19:13:32 +00:00
99c19ceac0 nicotine-plus: use a different login than for slskd, to avoid having one kick the other off the net 2024-07-20 15:21:03 +00:00
f95f9a35fc nicotine: ship creds statically, as secrets 2024-07-20 15:16:31 +00:00
5f1ac2afac mpv: downmix surround sound to stereo using a HRTF-aware filter (sofa) 2024-07-20 13:44:33 +00:00
2ee53fd5be sofacoustics: prefix the .sofa file with the database from which it comes 2024-07-20 13:44:08 +00:00
9fb2cf4d42 sofacoustics.listen: init 2024-07-20 13:21:02 +00:00
612fa0cae8 sofacoustics.widespread: init 2024-07-20 12:39:22 +00:00
875e85c646 uassets: 2024-07-17 -> 2024-07-19 2024-07-20 03:28:38 +00:00
94ecca2967 nixpkgs-wayland: 2024-07-15 -> 2024-07-18 2024-07-20 03:28:29 +00:00
1fea424052 nixpkgs: 2024-07-17 -> 2024-07-19 2024-07-20 03:28:13 +00:00
4abd782b62 hosts/common: migrate most ~/ directories to the "private" persistence store 2024-07-19 20:16:04 +00:00
13b04d50b0 sane-backup-rsync-net: dont try to backup device files
the remote doesn't seem to support them (or maybe it's the protocol)
2024-07-19 20:14:33 +00:00
36b1178fc0 mpv: associate with imgur URLs 2024-07-19 20:13:55 +00:00
527e7029b9 hosts: migrate ~/Videos/local from plaintext -> private storage 2024-07-19 13:47:30 +00:00
18c07721d9 servo: enable rsync.net backups 2024-07-19 12:49:47 +00:00
6ac700811a lappy: enable rsync.net backups 2024-07-19 12:49:40 +00:00
cd62aa2f38 opencellid: update hashes 2024-07-19 12:44:09 +00:00
72a78c5f3e nicotine-plus: re-enable 2024-07-19 12:44:09 +00:00
db292850b0 modules/programs: fix sandbox.net = "vpn" option 2024-07-19 12:44:09 +00:00
8e6272bafd static-nix-shell: better enforce that all nix-shell deps are specified 2024-07-19 12:21:10 +00:00
90e1f4a447 desko: automated backups to rsync.net 2024-07-19 11:42:04 +00:00
31c32b9636 sane-vpn: add a way to route traffic specifically through unmetered connections 2024-07-19 07:31:54 +00:00
d6aef04a77 element-desktop: fix sandboxing of embedded audio files (esp flac files) 2024-07-19 07:27:33 +00:00
0f08f14dc0 todo.md: note another site that doesnt work for trust-dns recursive resolver 2024-07-19 04:17:29 +00:00
6d9806613c nixpkgs/patches: send contourpy fix upstream 2024-07-19 01:15:19 +00:00
c0c2aa00f3 lgtrombetta-compass: ship 2024-07-18 16:40:17 +00:00
6d5cd7b604 lgtrombetta-compass: fix cross compilation and enable strictDeps = true 2024-07-18 15:51:13 +00:00
98860ccf46 todo.md: make a note that newly-patched trust-dns still doesnt support abs.twimg.com 2024-07-18 13:54:43 +00:00
bc5805b341 lgtrombetta-compass: fix cross compilation 2024-07-18 13:54:14 +00:00
3a4d27c3bf templates: python: fix broken setup-hooks refs 2024-07-18 13:24:40 +00:00
c88ef43310 lgtrombetta-compass: init at 0.4.0
it doesn't cross compile yet, because of its dependencies (matplotlib -> contourpy)
2024-07-18 13:24:13 +00:00
326e71f7b1 sanebox: landlock: restrict net access where applicable 2024-07-18 11:54:10 +00:00
532d3c13f6 eza: sandbox with landlock instead of bwrap 2024-07-18 11:43:58 +00:00
9f26ad40f9 mimetype: sandbox (and remove unneeded mimeopen) 2024-07-18 11:43:45 +00:00
c8a99317bc syshud: 0-unstable-2024-07-15 -> 0-unstable-2024-07-16
this fixes the crash-on-start issue
2024-07-18 09:51:44 +00:00
2296e10f15 assorted: remove obsolete GSK_RENDERER=cairo patch 2024-07-18 08:45:44 +00:00
ca68434f18 komikku: fix sandboxing (missing ~/.cache.komikku) 2024-07-18 08:42:45 +00:00
a1de7a4afd users: configure XDG_SESSION_TYPE during shell setup 2024-07-18 00:15:29 +00:00
b692c0b6ce 2024-07-16 -> 2024-07-17 2024-07-17 23:57:29 +00:00
8ba1e35b9d nixpkgs: 2024-07-16 -> 2024-07-17 2024-07-17 23:57:16 +00:00
765ec610c9 schlock: update pin/hash 2024-07-17 16:24:29 +00:00
43c33fef21 schlock: patch for faster unlock (less intense password hashing) 2024-07-17 16:24:00 +00:00
9bcc7cd30b todo.md: sync 2024-07-17 16:16:23 +00:00
0b7d8310df trust-dns: patch resolver to handle more edge-case domains (api.mangadex.org., m.wikipedia.org., ...) 2024-07-17 15:28:41 +00:00
c6f07d4f55 sane-vpn: fix none option 2024-07-17 13:13:14 +00:00
94a0e77fcc sane-vpn: set the retry duration for sane-ip-check 2024-07-17 02:01:50 +00:00
91d5c20a56 sane-ip-check: make the retry loop configurable 2024-07-17 02:00:27 +00:00
9b898ce597 sane-ip-check: implement a retry loop 2024-07-17 02:00:27 +00:00
a49411c02d lftp: fix sandboxing 2024-07-17 02:00:05 +00:00
fcd13d4f6f sane-vpn: cleanup the CLI ergonomics 2024-07-17 02:00:05 +00:00
ef1be364e7 docs: sane-vpn: more usage 2024-07-17 02:00:05 +00:00
8472320629 sane-vpn: route DNS through the VPN's server 2024-07-17 02:00:05 +00:00
19acab1363 scripts/check-uninsane: remove outdated ovpns DNS test 2024-07-16 22:57:48 +00:00
98e1ae53e2 syshud: 2024-07-02 -> 2024-07-15 2024-07-16 22:55:39 +00:00
eb2321aa79 uassets: 2024-07-14 -> 2024-07-16 2024-07-16 22:55:26 +00:00
8febe70665 firefox-extensions.uassets: 8.8.3 -> 8.9.0 2024-07-16 22:55:08 +00:00
ee4ab3b40c nixpkgs-wayland: 2024-07-14 -> 2024-07-15 2024-07-16 22:54:49 +00:00
281643afb0 nixpkgs: 2024-07-15 -> 2024-07-16 2024-07-16 22:54:34 +00:00
86f1e36035 scripts/deploy: fix "exho" typo 2024-07-16 07:42:24 +00:00
929a8eadbc syshud: update config files/locations to match upstream 2024-07-16 07:38:49 +00:00
e355a4b2eb assorted: remove no-longer-needed sanebox PATH fixes 2024-07-16 07:24:56 +00:00
132798be23 sanebox: ensure sanebox is always on the PATH of sandboxed binaries 2024-07-16 07:24:42 +00:00
c72e66a901 curl: sandbox 2024-07-16 07:23:32 +00:00
40d32ec1d5 polyunfill: remove cpupower and kbd 2024-07-16 07:18:06 +00:00
1377f5c7bc servo: fix DNS; although it's getting DHCP routes via DHCP, it doesn't seem to be getting DNS?? 2024-07-16 05:16:07 +00:00
bee714311b servo: remove dead systemd networking code for the WAN IP 2024-07-16 04:13:08 +00:00
b368d4624e servo: configure so that LAN peers can reach me at my WAN IP
on the router side this requires either (a) telling the router to use the doof IP as a gateway and also declaring that route or (b) using DHCP option 121. really, one should do both -- the first for the router, and the second for peers connected via switches
2024-07-16 04:13:06 +00:00
583f7217fc docs: rofi: mention rofi-calc 2024-07-16 00:46:19 +00:00
e8b0979de6 sane-sync-from-iphone: fix perms
without fusermount3 wrapper, i have to use sudo
2024-07-15 23:40:48 +00:00
c4b4ac48fd nixpkgs: 2024-07-14 -> 2024-07-15 2024-07-15 10:53:00 +00:00
8436ba3e02 todo.md: item for fixing transmission torrent-done paths 2024-07-15 02:02:05 +00:00
8b1f91ca86 servo: transmission: fix service config so my torrent-done script doesnt crash 2024-07-15 01:35:45 +00:00
73f6907e9a nixpkgs: fix unl0kr patch
maybe i'll push the PR through just so i don't have to deal with unstable patch hashes, wtf
2024-07-15 00:30:02 +00:00
d6bfef7657 linux-megous: add missing patch to git 2024-07-15 00:22:48 +00:00
0fafd81b79 scripts/sync: sanity check that source directory exists before doing a sync (else we would delete everything in the target) 2024-07-15 00:22:29 +00:00
2ac9c2cb68 fix NUR integration (hopefully) 2024-07-15 00:17:59 +00:00
e8547cc849 nixpkgs: fix unl0kr hash ... AGAIN (i'm beginning to think it's unstable) 2024-07-15 00:17:43 +00:00
3495f04810 preferences: remove unnecessary miniupnpc patch 2024-07-14 22:35:32 +00:00
68a891f6de firefox-extensions.{metamask,i2p-in-private-browsing,ublacklist} -> latest 2024-07-14 22:10:58 +00:00
b8dbc0c1c0 uassets: 2024-07-06 -> 2024-07-14 2024-07-14 22:10:31 +00:00
6964cf8d46 nixpkgs-wayland: 2024-07-05 -> 2024-07-14 2024-07-14 22:10:18 +00:00
c959c0a74a sops-nix: 2024-07-05 -> 2024-07-14 2024-07-14 22:10:01 +00:00
7b0a4c11ec nixpkgs: 2024-07-10 -> 2024-07-14 2024-07-14 22:09:44 +00:00
a926cbee46 scripts/update: build required nix binary before updating packages 2024-07-14 22:09:19 +00:00
23d8990596 todo.md: todo: install a compass app 2024-07-14 22:08:43 +00:00
76ae404827 scripts/sync: fix moby Photos dir 2024-07-14 09:19:17 +00:00
e868e28ed9 sc-im: ship 2024-07-14 03:45:18 +00:00
2283a5b167 mpv: associate with youtube playlist URLs 2024-07-14 03:13:15 +00:00
8d0b7c5855 nixpkgs: fix unl0kr patch hash (... didnt i just do this?) 2024-07-14 03:09:53 +00:00
3fb7fe34c4 rofi: fix so apps with "Terminal=true" can launch via xdg portal 2024-07-14 02:59:26 +00:00
10687a80e4 FIXUP: add missing youtube-tui.nix file to git 2024-07-14 02:59:05 +00:00
a8bcfaed53 youtube-tui: ship 2024-07-14 02:39:38 +00:00
ab200f8988 mpv: associate with youtube embed URLs 2024-07-14 01:33:52 +00:00
b443fd46d8 sway: map caps -> esc 2024-07-13 23:53:50 +00:00
0473822172 nixpkgs: fix patch hashes 2024-07-13 23:53:43 +00:00
d0b5f586c4 nwg-panel: fix multiple instances on display change 2024-07-13 21:01:06 +00:00
f6895393d9 zsh: alias "quit" to "exit" 2024-07-13 20:37:02 +00:00
f78b49f075 scripts/sync: moby: dont compress music (i have enough space for that now) 2024-07-13 18:58:02 +00:00
aa3115d2ca sane-sync-music: limit jobs to just 1 by default 2024-07-13 08:40:19 +00:00
924a6c812c all/net: disable "predictable" interface names 2024-07-13 08:29:48 +00:00
fd50bf6422 desko: disable wifi again
specifically, ethernet DHCP renewals break because the wlan interface advertises the eth MAC (?)
2024-07-13 08:29:14 +00:00
7c0e7cbb71 wg-home: rewrite forwarding rules to avoid naming any interface 2024-07-13 08:28:02 +00:00
26004da704 wg-home: iptables: use extended switch names 2024-07-13 08:07:21 +00:00
7013b09715 scripts/sync: fix nix-shell shebang 2024-07-13 07:43:16 +00:00
3969fd484b networkmanager: 1.48.0 -> 1.48.2 (unpin) 2024-07-13 05:00:43 +00:00
eeab1d9fda sane-tag-music: strip non-breaking spaces from metadata 2024-07-13 05:00:03 +00:00
deb355d960 sane-tag-music: better romanization 2024-07-13 04:50:32 +00:00
1d4df82bde sane-tag-music: improve idempotency 2024-07-13 04:20:37 +00:00
f49e87cf99 sane-tag-music: allow clearing *any* tag manually 2024-07-13 03:43:45 +00:00
e38c2f20e8 sane-tag-music: include the artist in the filename for compilation albums 2024-07-13 02:47:09 +00:00
0e5f01f240 sane-tag-music: refactor: remove extraneous "Various Artists" check 2024-07-13 01:53:05 +00:00
e04dd6cb7d sane-tag-music: better log formatting when moving a file 2024-07-13 01:44:28 +00:00
f4b6bbfbd5 sane-tag-music: ignore "Xerox" when found in the producer field 2024-07-13 00:55:33 +00:00
2e8c58a53d sane-tag-music: allow "info.txt" as an artist-associated item 2024-07-12 20:12:27 +00:00
f6e326869f sane-tag-music: tag derivation logic is recursive/hierarchical
so Artist/Album/Track.flac will draw from Artist/Album/* and then Artist/*
2024-07-12 08:48:51 +00:00
c16f2473e5 sane-tag-music: handle multiple CLI paths by iterating a layer above 2024-07-12 08:48:51 +00:00
d85ffa8539 sane-tag-music: refactor: separate the file walking into its own abstraction
i hope this will allow more sophisticated tag derivation
2024-07-12 08:48:51 +00:00
987cd93ce3 sane-tag-music: allow deriving tags for all operations, not just fix-tags 2024-07-12 08:48:51 +00:00
e82faa5961 sane-tag-music: add a method which generalizes tags to one file from the rest of the album (e.g. the album name) 2024-07-12 08:48:51 +00:00
514cfe7b0b feeds: subscribe to "Better Offline" podcast 2024-07-12 01:20:00 +00:00
dd2eb66875 sane-tag-music: fix "producer" handling for aac files 2024-07-12 00:04:24 +00:00
6ccdbf50cd sane-tag-music: print results in real-time 2024-07-11 23:59:31 +00:00
e2cca54e08 sane-tag-music: support PDFs 2024-07-11 23:58:58 +00:00
721f45f7d4 sane-tag-music: dont abort if metadata fails to load 2024-07-11 23:33:02 +00:00
774ebd23f9 sane-tag-music: jpg/png: use XMP tags for album/producer instead of weird exif tags 2024-07-11 21:39:47 +00:00
bfdacb1941 sane-tag-music: gif: support album, albumartist, producer tags 2024-07-11 21:38:55 +00:00
beeb5d34b0 sane-tag-music: refactor: introduce a generic tag name mapping layer 2024-07-11 21:22:44 +00:00
3d3faba263 sane-tag-music: support mp4/m4a; support "producer" tag (grouping) for mp3/mp4 2024-07-11 20:05:53 +00:00
a56795ff79 sane-tag-music: fix sandboxing to support renaming 2024-07-11 19:12:55 +00:00
00d644ef07 sane-tag-music: support "artist.png" artist images 2024-07-11 03:30:42 +00:00
672de68e56 sane-tag-music: allow clearing any tag 2024-07-11 02:53:00 +00:00
e47bc4c04d sane-tag-music: dont set the VA producer tag if the VA album tag is also set 2024-07-10 17:56:10 +00:00
0b6a8eecce sane-tag-music: handle more "Various Artists" formats 2024-07-10 17:30:41 +00:00
eaaea26603 sane-tag-music: allow deleting producer by setting it empty 2024-07-10 08:31:03 +00:00
e1c80c9abc sane-tag-music: remove special-casing for Singles 2024-07-10 08:10:29 +00:00
50add19b14 sane-tag-music: use pykakasi for better romanization 2024-07-10 04:42:51 +00:00
56032bc040 python-repl: include pykakasi, unidecode 2024-07-10 04:42:11 +00:00
6ee33240d7 nixpkgs: 2024-07-07 -> 2024-07-10 2024-07-10 04:41:43 +00:00
4aaeb42cab servo: bitcoid: allow using sane.programs package 2024-07-10 04:40:38 +00:00
2697d068ce sane-tag-music: fix ImageFile to actually support tag deletion 2024-07-10 00:48:22 +00:00
3ae650bcae sane-tag-music: use "Producer" tag to group albums by artists who use multiple pseudonyms 2024-07-09 23:51:08 +00:00
ddce650bc5 sane-tag-music: handle titles with "/" 2024-07-09 21:35:09 +00:00
96bf9d594f sane-tag-music: fix duplicated tags and wrong mode for image files 2024-07-09 21:35:09 +00:00
c2185f44b1 sane-tag-music: fix so i can load titles from PNG files 2024-07-09 21:35:09 +00:00
549fa8e5cd sane-tag-music: allow filtering paths by type (image v.s. audio) 2024-07-09 21:35:09 +00:00
afc31dfc2f sane-tag-music: prefer existing artist/albumartist tags over path-based ones 2024-07-09 21:35:09 +00:00
2011065497 sane-tag-music: parse album artist - album - track notation 2024-07-09 21:35:09 +00:00
ca6bb7518a sane-tag-music: force tracknumber empty for Singles 2024-07-09 21:35:09 +00:00
612274d0b2 sane-tag-music: improve fix-tags behavior so that manual tags tag precedence over existing tags 2024-07-09 21:35:09 +00:00
b801ed07d6 sane-tag-music: docs: link to metadata tag conventions (pseudo-standards) 2024-07-09 21:35:09 +00:00
53fd4ee42f sane-tag-music: refactor to_path 2024-07-09 21:35:09 +00:00
0b610a6683 nixpkgs: python3 fix: update hash (its merged upstream) 2024-07-09 21:35:09 +00:00
3696953ba0 sane-tag-music: enforce two-digit trackno prefixes everywhere
probably better to make this conditional on the total number of tracks, but that's a bit more difficult
2024-07-09 21:35:09 +00:00
da8b3fc188 sane-tag-music: special-case some romanizations 2024-07-09 21:35:09 +00:00
91db9fef82 sane-tag-music: use unidecode for romanization/transliteration 2024-07-09 21:35:09 +00:00
682e9c0c68 sane-tag-music: fix missing dep 2024-07-09 21:35:09 +00:00
cd9f1cc95e signal-desktop: fix sandboxing to allow for URLOpen dbus calls 2024-07-09 19:09:44 +00:00
607845d495 sane-tag-music: support tagging album art 2024-07-09 02:14:54 +00:00
79c8521f38 sane-tag-music: handle edge-cases in tag -> path logic 2024-07-09 00:01:41 +00:00
fa284c3dec sane-tag-music: docs: mention all subcommands in docstring 2024-07-08 21:10:32 +00:00
3fe5e57c3c sane-vpn: allow sane-vpn dns-fix $CMD 2024-07-08 21:05:15 +00:00
05c212a227 nwg-panel: fix double-bar problem on crash 2024-07-08 21:05:00 +00:00
ea2da626d1 signal-desktop-from-src: add missing file to git 2024-07-08 18:43:37 +00:00
f8d0c9ce3b scripts/deploy: deploy crappy latter than all the others 2024-07-08 05:38:44 +00:00
46bf7c5ac9 nixpkgs: 2024-07-06 -> 2024-07-07 2024-07-08 05:38:44 +00:00
d12120d53c gnome-maps: fix .desktop file so it can actually launch 2024-07-07 12:12:54 +00:00
22e3f58ab3 todo.md: sync 2024-07-07 10:02:26 +00:00
9f483541a4 sane-wipe: fractal: provide instructions for what to do after wiping 2024-07-07 08:51:40 +00:00
8d8f19752f fix missing clightning-sane/default.nix file 2024-07-07 08:24:56 +00:00
49c3bf0f34 zfs: split into zfs-tools program
this lets me sandbox it without building an entire extra copy of zfs
2024-07-07 02:54:33 +00:00
065aba0996 zfs: fix sandboxed build 2024-07-07 02:39:49 +00:00
c7425e792b todo.md: done sandboxing all programs except for the fuse stuff 2024-07-07 02:33:24 +00:00
74b7e90a34 check-uninsane: check zfs pool for errors 2024-07-07 02:32:44 +00:00
9f642980fd zfs: sandbox 2024-07-07 02:31:33 +00:00
c638218c07 servo: matrix-synapse: dont ship unused admin package 2024-07-07 02:23:18 +00:00
1ad933ad9c bitcoind: sandbox 2024-07-07 02:21:14 +00:00
3dc007448c wally-cli: sandbox 2024-07-07 02:10:53 +00:00
3487303216 clightning: sandbox 2024-07-07 01:18:55 +00:00
b74e797b13 clightning-sane: sandbox 2024-07-07 01:15:04 +00:00
bb3f148c32 scripts/check-uninsane: add a liveness test for my Bitcoing Lightning node 2024-07-07 01:00:50 +00:00
e235e09cf1 servo: ship clightning-sane 2024-07-07 00:58:29 +00:00
64610a5806 clightning-sane: define as sane.programs 2024-07-07 00:57:51 +00:00
15ca5fbfa4 clightning-sane: make it an actual package 2024-07-07 00:56:58 +00:00
997b841777 servo: clightning: fix deprecated config 2024-07-07 00:53:29 +00:00
9ced7bd3b5 sane-secrets-unlock: fix sandboxing (create directory before entering the sandbox) 2024-07-07 00:53:08 +00:00
2710f2b2ca docs: gnome-maps: mention some quirks 2024-07-07 00:50:29 +00:00
572a340c8a todo.md: make a list of the programs i've procrastinated on sandboxing 2024-07-06 19:31:19 +00:00
b844a9ef5d servo: disable unused CLI tools for freshrss/signald 2024-07-06 19:29:55 +00:00
d41d067405 servo: clightning: decrease logging from debug -> info 2024-07-06 19:22:06 +00:00
f8349a646b servo: lemmy: decrease logging from default -> warn 2024-07-06 19:21:53 +00:00
706667f403 servo: matrix-appservice-irc: decrease logging debug -> warn 2024-07-06 19:20:18 +00:00
99e0d5f03b servo: matrix-synapse: simplify logging config 2024-07-06 19:19:51 +00:00
3d82bc8c87 gitea: migrate away from deprecated email options 2024-07-06 18:56:34 +00:00
a3212f6955 gitea: bump registration timeout 4 -> 7 days 2024-07-06 18:56:09 +00:00
0d3e89a431 gitea: fix broken UI theme 2024-07-06 18:55:47 +00:00
b7c86d5867 mmcli: sandbox 2024-07-06 18:49:18 +00:00
5db8372b24 nixpkgs-wayland: 0-unstable-2024-07-03 -> 0-unstable-2024-07-05 2024-07-06 18:29:01 +00:00
da09ab3617 sops-nix: assets-unstable-2024-07-01 -> assets-unstable-2024-07-05 2024-07-06 18:28:44 +00:00
133744fa4b nixpkgs: 24.05-unstable-2024-07-03 -> 24.05-unstable-2024-07-06 2024-07-06 18:28:27 +00:00
bfd272b2c9 uassets: 0-unstable-2024-07-03 -> 0-unstable-2024-07-06 2024-07-06 18:28:10 +00:00
3edc8d87f4 firefox-extensions.ublock-origin: 1.58.1b11 -> 1.58.1b12 2024-07-06 18:27:16 +00:00
6824080f6b avahi: fix broken sandboxing 2024-07-06 03:08:36 +00:00
0786475c63 doc: mmcli: show how to sandbox... almost 2024-07-06 03:08:23 +00:00
ae082b1654 nwg-panel: fix the sandbox to allow Shutdown action 2024-07-06 03:07:58 +00:00
a77816e9de refactor: sane-scripts: use whitelistDbus where available 2024-07-06 03:07:21 +00:00
f50b10682f eg25-control: sandbox 2024-07-06 03:06:58 +00:00
b062610866 gps-share: sandbox 2024-07-06 03:06:33 +00:00
bce8a0d91f geoclue: dont place unsandboxed files on PATH 2024-07-06 03:05:49 +00:00
3c53bca156 vpn: log a message whenever the endpoint is updated
only as i'm actively working in this area. hopefully this log message can be less noisy in the future
2024-07-06 03:03:38 +00:00
46806e36f0 stop shipping some unused programs 2024-07-06 03:02:17 +00:00
4a8a5b309e satellite: sandbox 2024-07-05 23:27:51 +00:00
8f46bd5497 hping: sandbox 2024-07-05 23:13:40 +00:00
2c3239da8b mesa-demos (glxgears): sandbox 2024-07-05 23:12:46 +00:00
a08394edf1 callaudiod: sandbox 2024-07-05 23:12:16 +00:00
5e5ecfe81e nwg-panel: add a button to toggle the flashlight on moby 2024-07-05 23:11:55 +00:00
5048bd8d70 sanebox: fix that pasta-sandboxed programs would fail compile-time sandboxing test 2024-07-05 20:41:28 +00:00
c7d8d9ee86 nwg-panel: add the backlight back into the sandbox 2024-07-05 20:32:34 +00:00
2e49946c65 gnome-calls: tunnel traffic through my home ISP 2024-07-05 20:18:47 +00:00
a12aa02655 sane.programs: provide sandbox.net = "vpn.wg-home" to tunnel through my home ISP 2024-07-05 20:18:34 +00:00
6d66a5dbf8 vpn: add a service to auto-refresh wireguard endpoints 2024-07-05 20:06:16 +00:00
a31f67b793 wg-home: remove dead code 2024-07-05 20:05:25 +00:00
5d80e298b5 wg-home: deploy so as to be compatible with sane-vpn (e.g., route *WAN* traffic through it) 2024-07-05 18:45:26 +00:00
56e488b130 sane-stop-all-servo: remove extraneous call to sudo 2024-07-05 14:12:48 +00:00
5ebaaf46a2 hping: ship
it's a handy net debugging tool
2024-07-05 00:51:06 +00:00
bee3ec1fa0 wireshark: fix sandboxing when reading pcaps 2024-07-04 22:28:02 +00:00
46eab8f4e2 gst-device-monitor: sandbox 2024-07-04 19:49:28 +00:00
828d4fcc9c iio-sensor-proxy: sandbox 2024-07-04 19:27:16 +00:00
ca2ac89cec avahi-browse: sandbox 2024-07-04 19:15:33 +00:00
1ae1d94d53 ols: sandbox 2024-07-04 19:11:16 +00:00
c68f333bc9 sanebox: document --sanebox-net-dev all 2024-07-04 19:11:06 +00:00
9a09faa9e4 objdump: sandbox 2024-07-04 19:00:14 +00:00
ae2eaa786c sanebox: pasta: fix to never forward ports INTO the namespace
i thought this was OK, but i think it changes the *return route* as well, allowing for VPN escape -- specifically within gnome-calls (UPnP stuff?)
2024-07-04 18:48:14 +00:00
9c523b3ddd geoclue-demo-agent: sandbox 2024-07-04 16:21:30 +00:00
44c4e88b90 gnome-calls: dont ship dbus files 2024-07-04 15:29:59 +00:00
5ca0ca4f47 servo: freshrss: disable (unused service) 2024-07-04 15:29:39 +00:00
00ea7e17c5 servo: remove unused calibre service 2024-07-04 14:00:40 +00:00
823f8f2be3 feeds: subscribe to FLOSS Weekly 2024-07-04 13:34:48 +00:00
13bec790cb feeds: link to Wikipedia podcasts lists 2024-07-04 13:29:39 +00:00
e72f9be1bf feeds: subscribe to Sharp Tech 2024-07-04 13:23:36 +00:00
0fd8dc2a01 sane-scripts.stop-all-servo: sandbox (correctly, i hope) 2024-07-04 12:44:28 +00:00
24ed242bac servo: fix warning for getExe and iptables 2024-07-04 12:43:02 +00:00
f290b16f12 sane-bt: transmission -> transmission_4 2024-07-04 12:40:09 +00:00
b4cb3decff s6-rc: fix wrapper to expand XDG_RUNTIME_DIR again 2024-07-04 12:38:06 +00:00
7084bf95fa where-am-i: sandbox 2024-07-04 12:35:09 +00:00
acd0926d1f nwg-panel: sandbox 2024-07-04 12:34:35 +00:00
2dba46da6b pactl: sandbox 2024-07-04 11:18:06 +00:00
110c440697 programs: soundconverter: fix sandboxing 2024-07-04 10:33:51 +00:00
f4047bfbea koreader: docs: increase default font size 28 -> 30
am i getting old?
2024-07-04 08:49:49 +00:00
c573ac4e7e overlays/preferences: fix evolution-data-server to build w/o webkit, again (missed this in a recent rename) 2024-07-04 08:12:29 +00:00
cc15be54d4 uassets: 2024-07-02 -> 2024-07-03 2024-07-04 06:59:46 +00:00
8b95a5fa37 nixpkgs: 2024-07-02 -> 2024-07-03 2024-07-04 06:59:46 +00:00
b596f88ccc nixpkgs-wayland: 2024-07-02 -> 2024-07-03 2024-07-04 06:59:36 +00:00
e82feb9f71 make-sandboxed: migrate to binary wrapper 2024-07-03 19:35:56 +00:00
4839a40205 make-sandboxed: use makeWrapper proper, rather than rolling my own
i can't use the _binary_ wrapper unless i use a fully-qualified path to 'sanebox' or hide it behind something like /usr/bin/env
2024-07-03 17:54:38 +00:00
631c47c9bc programs/assorted: prefer makeBinaryWrapper over makeWrapper 2024-07-03 16:35:45 +00:00
b2f36e4ef6 rofi: add a "Close Menu" item to the app/file launcher 2024-07-03 14:05:24 +00:00
9a210b4a63 rofi/sane-open: fix so "Apps" menu item reveals keyboard 2024-07-03 13:43:28 +00:00
181ebfc627 moby: launch Signal by default (it seems to be less crashy than before) 2024-07-03 12:43:12 +00:00
ddb904ae19 iio-sensor-proxy: implement partial magnetometer support 2024-07-03 12:34:34 +00:00
a234e57d89 nixpkgs: 2024-07-01 -> 2024-07-02 2024-07-03 09:08:53 +00:00
a75a8f8425 sops-nix: 2024-06-30 -> 2024-07-01 2024-07-03 09:06:44 +00:00
9cbe74b20b 2024-06-29 -> 2024-07-02 2024-07-03 09:05:46 +00:00
6b06062cc9 uassets: 2024-07-01 -> 2024-07-02 2024-07-03 09:05:08 +00:00
b009b2c836 nixpkgs-wayland: 2024-07-01 -> 2024-07-02 2024-07-03 09:04:43 +00:00
d46239f2ad docs: iio-sensor-proxy: document current state of compass in Pinephone 2024-07-02 22:25:41 +00:00
47f474fecd moby: fix the magnetometer (compass)
it's not immediately viewable by geoclue, but it's viewable (and
working) from the CLI:
```
SANEBOX_DISABLE=1 watch cat /sys/devices/platform/soc/1c2b000.i2c/i2c-1/1-001c/iio:device2/in_magn_x_raw
```

the longer-term fix requires u-boot integration, but this hack is
actually entirely contained to linux. u-boot gives linux a
mostly-unmodified dtb from the linux package, and i just modify the
linux dtb to use the specific magnetometer my hardware has.
2024-07-02 20:29:49 +00:00
828ef00b61 servo: transmission: torrent-done: print call args at start to aid debugging 2024-07-02 16:07:46 +00:00
5d14a39d52 qmk: ergodox: make braces easier to type and clean up layers 2024-07-02 14:09:42 +00:00
58f89aadf3 scripts: add a way to flash my ergodox-ez firmware 2024-07-02 12:18:58 +00:00
d9a03ee64a signal-desktop-from-src: 7.11.1 -> 7.14.0 2024-07-02 09:53:55 +00:00
697543a675 u-boot-pinephone: use "extraPatches" instead of "patches", to future-proof 2024-07-01 17:44:53 +00:00
ff235f5806 dino: run mainline again, as Dino has released 0.4.4 (which doesnt contain eeevery commit i was running before, but most 2024-07-01 17:25:40 +00:00
39fe0ce43a syshud: 2024-06-20 -> 2024-06-29 2024-07-01 16:57:03 +00:00
98fde86ff6 uassets: 2024-06-26 -> 2024-07-01 2024-07-01 16:57:03 +00:00
5c6a5b01c4 sops-nix: 2024-06-24 -> 2024-07-01 2024-07-01 16:57:03 +00:00
bb4f963c9c nixpkgs-wayland: 2024-06-26 -> 2024-07-01 2024-07-01 16:57:03 +00:00
9eb0b3fc86 nixpkgs: 2024-06-30 -> 2024-07-01 2024-07-01 16:57:03 +00:00
5b7f15b278 moby: upgrade Tow-Boot -> u-boot
i'm trying to get the compass to work, but looks as though it didnt try to probe the 1.2b AF8133J
2024-07-01 16:56:46 +00:00
5176d6a3bc moby: enable iio sensor access (rotation, light; compass is not yet working) 2024-07-01 11:57:06 +00:00
84ba7e3d68 mepo: fix sandboxed geoclue interactions 2024-07-01 08:19:21 +00:00
6d16d83aab geoclue-ols: fix that lru_cache was applied to an async function, even though futures can only be run once 2024-07-01 08:18:22 +00:00
e9c51eddb3 feeds: subscribe to Matt Stoller 2024-07-01 07:33:41 +00:00
75473c7123 nixpkgs: 2024-06-26 -> 2024-06-30 2024-07-01 06:15:42 +00:00
10f7714cfd firefox-extensions.ether-metamask: 11.16.14 -> 11.16.15 2024-07-01 06:13:25 +00:00
fe78f8bc45 geoclue-ols: 2024-06-21 -> 2024-06-30 (cache cellid lookup results) 2024-06-30 18:43:07 +00:00
6bbe3a8e23 qmk/ergodox/udev: cleanup 2024-06-30 16:52:36 +00:00
98c4a5ec87 qmkPackages.all: document how to flash 2024-06-30 16:18:43 +00:00
bf3a894d38 sane-scripts.wipe: fix missing procps dep 2024-06-30 16:13:56 +00:00
c973f2e03b qmkPackages.ergodox_ez_glow_sane: tune keymap 2024-06-30 16:13:05 +00:00
9f76469b5c qmkPackages: add my own layout (copied from base ergodox_ez keymap) 2024-06-30 14:06:45 +00:00
52231f2adc qmk-firmware: init at 0.25.9 2024-06-30 13:24:27 +00:00
8c5d9d79d7 todo.md: sync 2024-06-30 07:39:21 +00:00
961c38e79b scripts/check-uninsane: fix doofnet ftp test to actually route over doofnet 2024-06-30 06:35:04 +00:00
fc5068f4d4 pc: add tools to make using the ZSA Ergodox easier 2024-06-28 10:25:02 +00:00
e641f5c93a mpv: associate with m.youtube.com mobile URLs as well 2024-06-28 04:39:39 +00:00
870e766966 nixpkgs: remove listparser patch (PR closed; not upstreaming it) 2024-06-28 04:39:39 +00:00
a75a341b56 sane-wipe: fix so pkill is available 2024-06-28 04:39:39 +00:00
8b7ed2cdd4 avahi: fix NSS integrations
now moby can access its own gps-share instance at moby.local, from geoclue.service. lappy can access that too.
2024-06-27 23:57:36 +00:00
b3a685aa31 python3Packages -> python3.pkgs, to fix cross-compilation errors (especially around geoclue-ols) 2024-06-27 15:46:04 +00:00
9b8c461ce9 dont treat python packages specially: lift all python packages out of python-packages/ subdir; remove pyPkgs arg from static-nix-shell.mkPython3 2024-06-27 11:28:17 +00:00
27de05a751 python-packages: fix cross compilation errors introduced during the move away from buildPythonPackage 2024-06-27 09:02:30 +00:00
f54f1c57bc avahi: integrate with nss
now i can resolve .local hosts, via glibc, e.g. 'getent hosts <host>.local'
2024-06-27 06:18:48 +00:00
98d6439f2a modules/warnings: add a way to bypass module-level assertions as well 2024-06-27 06:17:53 +00:00
fbcf2aed41 python packages: port away from buildPythonPackage -> stdenv.mkDerivation
in a future refactoring, maybe i can remove them from the special 'pkgs/python-packages' directory altogether
2024-06-26 23:37:27 +00:00
fb7701027e nixpkgs: 2024-06-24 -> 2024-06-26 2024-06-26 21:02:07 +00:00
0bc228c07b nixpkgs-wayland: 2024-06-23 -> 2024-06-26 2024-06-26 21:01:49 +00:00
943ebba7fb sops-nix: 2024-06-23 -> 2024-06-24 2024-06-26 21:01:30 +00:00
e41bf78db6 uassets: 0-unstable-2024-06-23 -> 0-unstable-2024-06-26 2024-06-26 21:01:12 +00:00
8588230f80 firefox-extensions.ublock: 1.58.1b10 -> 1.58.1b11 2024-06-26 21:00:53 +00:00
8ef1af7e22 firefox-extensions.ether-metamask: 11.16.13 -> 11.16.14 2024-06-26 21:00:27 +00:00
989344f87e geoclue: integrate with gps-share, via avahi
N.B.: this doesn't actually work on moby -- yet. need to fix avahi DNS lookups
2024-06-26 11:22:04 +00:00
90f8d1e042 gps-share: specify /dev path to GPS device 2024-06-26 11:22:04 +00:00
d8ca5f91c3 sane-sysload: add an option to query battery *percent* charged 2024-06-26 10:56:08 +00:00
167bb4d8de servo: transmission: torrent-done: fix typo 2024-06-26 09:21:51 +00:00
6b117fa9bf servo: transmission: torrent-done: implement a TR_NO_HARDLINK option 2024-06-26 09:05:51 +00:00
4b9dcd50fb WIP: ship gps-share on moby 2024-06-26 09:05:27 +00:00
84e6d536d6 gps-share: init at 0.3.1 2024-06-26 08:43:37 +00:00
4c74e53052 servo: transmission: torrent-done: log destructive ops when TR_DEBUG=1 2024-06-26 08:27:16 +00:00
5def8f30ad servo: transmission: torrent-done: fix typos and add a TR_DEBUG option 2024-06-26 08:20:03 +00:00
45dd144b24 servo: transmission: torrent-done: fix dry-run; ensure all destructive ops are actually marked as destructive 2024-06-26 08:09:57 +00:00
66d4b380da servo: transmission: torrent-done: remove more noisy files 2024-06-26 08:01:58 +00:00
8e7da2c956 servo: transmission: split torrent-done script into own file 2024-06-26 07:59:20 +00:00
0f11b9a7b7 mpv: associate with YouTube Shorts videos 2024-06-25 21:17:27 +00:00
d9437bf4aa listparser: switch from buildPythonPackage -> stdenv.mkDerivation 2024-06-24 21:12:38 +00:00
5d1c52d0bc feeds: add buttondown.email 2024-06-24 17:05:10 +00:00
a0dfdb5125 init-feed: lift out of pkgs/ and into scripts/ where its easier to invoke 2024-06-24 17:04:23 +00:00
cbc2ba02a4 python3Packages.listparser: grab from nixpkgs patch instead 2024-06-24 15:07:19 +00:00
ef0adb5689 nixpkgs-wayland: 2024-06-21 -> 2024-06-23 2024-06-24 14:21:48 +00:00
b1bd4399f1 nixpkgs: 2024-06-21 -> 2024-06-24 2024-06-24 14:21:19 +00:00
2b252e3ede sops-nix: 2024-06-16 -> 2024-06-23 2024-06-24 14:20:58 +00:00
9aaf89408a uassets: 2024-06-21 -> 2024-06-23 2024-06-24 14:20:37 +00:00
283ca45c5d sponsorblock: 5.6.1 -> 5.6 ; ublacklist: 8.8.1 -> 8.8.2 2024-06-24 14:19:14 +00:00
7955d90f8d python3Packages.listparser: 0.18 -> 0.20 2024-06-24 12:48:43 +00:00
a06481fbef python3Packages.listparser: fetch from GitHub instead of PyPi" 2024-06-24 12:40:09 +00:00
5db4d73ad6 gpodder: lift listparser out of gnome-feeds
it's being removed in https://github.com/NixOS/nixpkgs/pull/320801 i.e. when i next update nixpkgs
2024-06-24 12:35:52 +00:00
304c8f8e3e docs: eg25-control: elaborate on Almanac v.s. Ephemeris 2024-06-24 00:25:54 +00:00
5a09a2665b secrets: net: add new home wifi creds 2024-06-23 18:16:10 +00:00
209545fc41 refactor: split satellite program into own file
mainly so i have a place to document its GUI :)
2024-06-23 12:44:50 +00:00
1e12566207 moby: disable gpsd
1. i wasn't actually relying on it for anything. 2. it's 100k LoC which runs as root (?), in a totally un-secured systemd service.

i may be enabling something similar like this in the future, to prevent geoclue from deciding to disable the GPS. i'll probably be going with the simpler gps-share or gnss-share for that
2024-06-23 03:53:24 +00:00
9a53cbc833 docs: geoclue: link to forums, git, API docs 2024-06-23 03:53:07 +00:00
439bb5263f switchboard: sandbox 2024-06-22 03:43:23 +00:00
845dba3ca5 modules/vpn: fix deprecation warnings 2024-06-22 03:35:41 +00:00
5e7fe850ec blast-ugjka: 0.6.2 -> 0.7.0 2024-06-22 01:25:26 +00:00
832338488d firefox-extensions.ether-metamask: 11.16.12 -> 11.16.13 2024-06-22 01:24:58 +00:00
86ee95f607 uassets: intra-day bump 2024-06-22 01:24:46 +00:00
5f5e55c98b nixpkgs-wayland: 2024-06-20 -> 2024-06-21 2024-06-22 01:24:26 +00:00
7d59782005 nixpkgs: intra-day bump 2024-06-22 01:24:09 +00:00
62b541012b blast-ugjka: add an updateScript 2024-06-21 19:14:47 +00:00
514197a17f docs: mmcli: include notes for how to enable the gps 2024-06-21 19:11:07 +00:00
143bdf672b ship satellite program
really this only belongs on devices which have a gps unit (i.e. moby).
maybe i'll tune that in the future.
2024-06-21 19:09:43 +00:00
a6c48eda71 geoclue2: remove extraneous appConfig where-am-i whitelisting
it's included by the default nixos service (which whitelists 'geoclue-demo-agent'
2024-06-21 17:49:15 +00:00
a603c3e6bc ols: synthesize cell tower data when no exact match is found 2024-06-21 16:24:13 +00:00
1f48f41927 ols: ship static cell tower position database from opencellid.org 2024-06-21 13:48:28 +00:00
c0d9f05575 python3Packages.ols: point to my own repo, 2023-06-15 -> 2024-06-21 2024-06-21 13:42:02 +00:00
7f46b034f9 opencellid: init at 0-unstable-2024-06-20 2024-06-21 12:55:38 +00:00
ba66378bc0 docs: ols: point to wigle docs and api limits 2024-06-21 11:54:38 +00:00
dcc8168aa0 nixpkgs: update sysvol patch 2024-06-07 -> 2024-06-20 2024-06-21 11:54:07 +00:00
f7d3c26d12 servo: irc: add wigle.net 2024-06-21 11:48:47 +00:00
3d871e8d7c scripts/check-nur: fix (linux-exynos5-mainline was invalid in default eval) 2024-06-21 07:43:33 +00:00
78f4cd9be2 sysvol: 2024-06-13 -> 2024-06-20 2024-06-21 07:25:15 +00:00
f83bac3c2b firefox-extensions -> latest 2024-06-21 07:25:15 +00:00
58de5d661f uassets: 2024-06-15 -> 2024-06-21 2024-06-21 07:25:15 +00:00
599832d59c 2024-06-11 -> 2024-06-16 2024-06-21 07:25:15 +00:00
625cb0992b nixpkgs-wayland: 2024-06-14 -> 2024-06-20 2024-06-21 07:25:15 +00:00
a02f221628 nixpkgs: 2024-06-19 -> 2024-06-21 2024-06-21 07:25:15 +00:00
ad8bcfc09e scripts/deploy: build all hosts before building all variants 2024-06-21 07:25:15 +00:00
815ce6287f scripts/update: fix that the script wasnt building the update scripts before trying to invoke them 2024-06-21 07:25:15 +00:00
0d1d56870f default.nix: copy everything to the nix store before evaluating any of my config 2024-06-21 07:25:15 +00:00
2445b882c2 scripts/update: more debug logging 2024-06-20 22:54:16 +00:00
12465e111e nixpkgs: update xsimd patch 2024-06-20 21:54:06 +00:00
65a0914828 fastcluster/ols: fix cross compilation to moby 2024-06-20 13:33:18 +00:00
dab60e79c1 moby: remove gps.nix 2024-06-20 12:01:10 +00:00
fe57f186cd gpsd: deploy via sane.programs interface 2024-06-20 11:57:09 +00:00
78d66a8b09 ols: pipe stderr > stdout 2024-06-20 11:52:35 +00:00
b2955c9c9d geoclue2: use nixpkgs' service 2024-06-20 11:52:13 +00:00
b0e184b0f0 geoclue: integrate ols/wigle as backend
the wigle API limits are *strict*. probably too strict to actually be useful
2024-06-20 11:35:26 +00:00
3cd97b522c ols: enable
still some more work to do to really integrate this with geoclue
2024-06-20 11:05:15 +00:00
c91681c77c python3Packages.ols: init at at 0.1.0-unstable-2023-06-15 2024-06-20 11:05:15 +00:00
d0d623da15 programs: ship geoclue2 as an actual program
moby probably needs its gps.nix file removed. also this is incomplete due to Mozilla terminating their location services API
2024-06-20 08:40:36 +00:00
0db86d8c86 moby: sway: use Alt as the modifier key 2024-06-20 05:55:12 +00:00
b74dfe7578 crappy: sway: use Alt as the mod key 2024-06-20 05:55:12 +00:00
d1843b6b3d refactor: sway-config -> config, to match its installed name 2024-06-20 05:55:12 +00:00
b482a1dfd6 swaync: disable debug, to un-break DND mode
i'm sick of G_MESSAGES_DEBUG breaking stuff. i must be parsing cli output that gets broken by that, somewhere
2024-06-20 05:24:53 +00:00
5ba74a4055 doc: swaync: fix typo in notify-send example 2024-06-20 05:17:51 +00:00
b3b77e3e62 nwg-panel: stylize with the goal that it uses a bit less space on moby 2024-06-20 02:39:45 +00:00
63bc58a56f playerctl: patch missing refcount tracking to avoid a crash in nwg-panel 2024-06-20 00:46:31 +00:00
efcf8639dc gdb: ship a python-capable gdbinit 2024-06-19 23:03:17 +00:00
90b86dc7fc servo: re-enable transmission and jackett 2024-06-19 21:29:32 +00:00
8bf8d31c5f nwg-panel: record the URL to the upstream PR 2024-06-19 21:28:18 +00:00
2e44abc55d scripts/deploy: fix off-by-one in runOnTarget 2024-06-19 21:05:37 +00:00
9e92069ba3 nwg-panel: migrate the mediaPrevNext patch to something suitable for upstream 2024-06-19 21:04:15 +00:00
2a592a4a15 nwg-panel: disable the music-note icon in playerctl 2024-06-19 20:35:50 +00:00
8ca357ea7f scripts/deploy: add a --reboot option 2024-06-19 20:31:43 +00:00
4f4c05a922 nwg-panel: fix playerctl patch for newest nwg-panel, and also hide the label
hopefully the label is the part which includes the music note icon
2024-06-19 19:40:23 +00:00
7c4be0f4e9 hosts: fix that -min and -light variants were actually identical to the full versions 2024-06-19 11:25:30 +00:00
afea7fe5e7 scripts/deploy: implement a dry-run mode 2024-06-19 11:24:33 +00:00
294f0061bd sxmo-utils: add a deprecation warning 2024-06-19 11:20:49 +00:00
4efe159933 nixpkgs: 2024-06-15 -> 2024-06-19 2024-06-19 10:35:58 +00:00
b7f99c022b nwg-panel: enable sysload by default 2024-06-19 02:04:33 +00:00
b3c5e53156 sane-sysload: implement CPU measurement 2024-06-19 01:58:21 +00:00
91c2b04ab4 sane-sysload: make the format CLI args friendlier 2024-06-19 01:20:36 +00:00
27efb10a27 refactor: rename sane-sysinfo -> sane-sysload 2024-06-19 01:04:06 +00:00
e4e32f46fe nwg-panel: integrate optional sysload executor (WIP; disabled by default) 2024-06-19 01:01:03 +00:00
64b169069a nwg-panel: fix issue that playerctl was being pushed off the bar 2024-06-19 00:47:43 +00:00
c2c15e1ac3 networkmanager_dmenu: sandbox 2024-06-19 00:44:35 +00:00
0b3156c4c7 nmcli: sandbox 2024-06-19 00:44:24 +00:00
1c8551c842 rofi: add a shortcut for configuring WiFi 2024-06-18 23:44:21 +00:00
2755d98b99 sane-open: make sure networkmanager_dmenu shows the keyboard when activated 2024-06-18 23:44:21 +00:00
543108a5dd networkmanager_dmenu: ship 2024-06-18 23:44:21 +00:00
b32d02dc3f programs: add pidof from procps
used by things like networkmanager-dmenu, which i plan to add soon
2024-06-18 23:44:20 +00:00
0bd92ef77e swaync: make the backlight/mpris items configurable 2024-06-18 21:41:15 +00:00
a7df4cc125 lint: swaync: sort config properties 2024-06-18 21:34:04 +00:00
09a615ee62 netns: factor the netns setup/teardown into distinct services, rather than trying to piggyback network-local-commands
idk what network-local-commands is about, nor network-pre.target.
network-pre.target doesn't seem to actually be wanted by anything (?)
2024-06-18 10:36:08 +00:00
8523b406ad todo.md: note that swaync brightness slider does not work 2024-06-18 09:48:35 +00:00
6021da072c replace builtins.toJSON with writers.writeJSON where possible
it gives pretty-printed JSON that's easier to work with
2024-06-18 09:33:17 +00:00
a49abbd123 hosts: add pubkeys for $host-hn 2024-06-18 09:33:17 +00:00
f9091c0b0c netns: ensure that network.target depends on network-pre.target (why doesnt it by default?)
this should fix that servo tries to start wg-ovpns before the netns is configured
2024-06-18 09:07:40 +00:00
bbf8fd5b20 servo: disable almost all WAN stuff (leave only wireguard, as a fallback) 2024-06-18 09:04:13 +00:00
be84747ffc check-uninsane: test FTP over doof (and simplify) 2024-06-18 08:09:06 +00:00
478b443430 doc: sftpgo: note that "/README.md" doesnt work 2024-06-18 07:56:26 +00:00
ded5f6560d check-uninsane: fix ftp test to work when invoked from the wan 2024-06-18 07:55:11 +00:00
c1b3629dcf swaync: fix segfault under load 2024-06-18 07:52:02 +00:00
5879499924 swaync-service-dispatcher: simplify quoting 2024-06-18 06:40:44 +00:00
5a63f294c0 servo: sftpgo: allow fully-anonymous www read access to /pub
this will help me write automated tests for its availability
2024-06-18 05:44:20 +00:00
891a29feeb nwg-panel: fix commands (like lock, shutdown) to not run through swaymsg 2024-06-18 02:51:58 +00:00
0863505877 wifi: add new network 2024-06-18 02:34:27 +00:00
0c922bd63a nwg-panel: fix reboot/shutdown commands to not assume systemd 2024-06-18 02:32:04 +00:00
e04ec4c706 nwg-panel: fix the "lock" button to use the correct screen locker 2024-06-18 02:31:46 +00:00
b0f9733ac8 sway: fix that Super+L didnt have sandbox access to start the screen locker 2024-06-18 02:26:57 +00:00
e2babfc076 nwg-panel: fix clock to always be centered, even if that means overlapped rendering 2024-06-18 01:08:02 +00:00
ef29b569e5 nwg-panel: fix clock size to actually be larger on lappy/desko 2024-06-18 01:07:43 +00:00
6f0a455d0b scripts/check-uninsane: implement --verbose flag 2024-06-17 23:36:52 +00:00
7d6a420c52 sane-vpn: allow sane-vpn do -- [COMMAND] 2024-06-17 23:26:28 +00:00
259143b87e scripts/check-uninsane: fix so ssh servo systemctl --failed actually works on servo, even when ssh key is locked 2024-06-17 23:24:34 +00:00
fce426c318 servo: trust-dns: expose the hn DNS server on port 53
nothing i had was *expecting* it to be on port 1053, and it was just never working (?)
2024-06-17 23:16:00 +00:00
9b794777b5 servo: trust-dns: have the ovpns DNS provider return doof-based addresses instead of WAN-based addresses 2024-06-17 23:14:21 +00:00
3ada668366 servo: expose all wan services also to the doof tunnel 2024-06-17 23:08:08 +00:00
39a39e763d trust-dns: hack to substitute ANATIVE before anything else 2024-06-17 22:44:43 +00:00
50353280d3 servo: port ANATIVE over the doof interface to return the doof IP address 2024-06-17 22:37:50 +00:00
72b8211029 servo: switch ns2.uninsane.org from ovpns -> doof 2024-06-17 22:19:36 +00:00
dbf719b59b scripts/check-uninsane: fix the git.uninsane.org check to work even w/o access to SSH keys 2024-06-17 22:16:23 +00:00
57d7d3821f scripts/check-uninsane: dont rely on ovpns.uninsane.org bootstrap DNS: directly test the known IPv4 address 2024-06-17 22:12:34 +00:00
e86e9fc079 scripts/check-uninsane: add a check for DNS via doofnet 2024-06-17 22:11:02 +00:00
d708b78ebe scripts/check-uninsane: fix ftp check, to not error if README.md exists in the current directory 2024-06-17 22:10:47 +00:00
075418eda1 git: add alias git com to commit 2024-06-17 22:01:58 +00:00
9fc5b83b61 refactor: servo: hardcode OVPN-related IP addresses in far fewer places 2024-06-17 22:00:39 +00:00
4b99607f7b scripts/check-uninsane: annotate the OVPNS/DOOF checks 2024-06-17 09:25:10 +00:00
0d99293b2f servo: split the doof/ovpns netns config into its own module
a big thing this gets me is that the attributes (like IP addresses) are now accessible via 'config' an i won't have to hardcode them so much
2024-06-17 09:25:10 +00:00
b3890b82dc servo: http/https: expose to doof 2024-06-17 07:55:53 +00:00
3fc96a3e32 check-uninsane: also test http://uninsane.org, over OVPN connection 2024-06-17 07:50:15 +00:00
1af7b613bd servo: doof: respond to DNS queries 2024-06-17 07:39:52 +00:00
4c8695aae8 servo: fix missing route table for doof 2024-06-17 07:31:28 +00:00
d45e3fda5e servo: trust-dns: enable on doof-net 2024-06-17 07:20:23 +00:00
456e0de872 servo: doof net: add the capability to forward ports 2024-06-17 07:20:23 +00:00
7825ddc123 servo: split out a "bridgedWireguardNamespace" helper for configuring ovpns VPN
i can re-use this to forward traffic over doof
2024-06-17 07:20:23 +00:00
dd47a5083c servo: only forward ports to OVPN which are actually marked for visiblity 2024-06-17 06:29:09 +00:00
14d5d9eb5a servo: net: remove dead Hurricane Electric code 2024-06-17 06:04:29 +00:00
1f6f2399d6 nwg-panel: fix swaync icon 2024-06-16 06:35:32 +00:00
b0ee12ba7b modules/users: export HOME in environment.d because some services (nwg-panel) need it 2024-06-16 06:01:20 +00:00
a6d268ca72 nwg-panel: disable the brightness indicator 2024-06-16 05:42:58 +00:00
1ecc033ff5 nwg-panel: re-add missing style.css 2024-06-16 05:27:32 +00:00
c87dab93b3 scripts/deploy: allow specifying multiple hosts or multiple variants 2024-06-16 05:15:12 +00:00
53139a7cdf nwg-panel: address some TODOs 2024-06-16 04:59:23 +00:00
f37014a856 nwg-panel: minor tweaks & simplifications 2024-06-15 22:52:52 +00:00
0237d3a144 nwg-panel: fix broken JSON generation
heh, whoops
2024-06-15 22:24:41 +00:00
656ad76f25 nwg-panel/config: sort keys 2024-06-15 22:04:08 +00:00
b7c71dc67b nwg-panel: add a few comments/TODOs to the config 2024-06-15 21:56:41 +00:00
aaa40eae04 nwg-panel: port config to Nix
this makes it easier to plumb config into it, and also to comment it
2024-06-15 21:52:38 +00:00
d8ed82cfdf cross: remove upstreamed libvpx patch 2024-06-15 11:37:20 +00:00
0e73f95ab1 nixpkgs: 2024-06-14 -> 2024-06-15 2024-06-15 11:16:40 +00:00
b1ba0cad03 nixpkgs-wayland: minor bump 2024-06-15 11:16:32 +00:00
4bcbfbc8aa uassets: 2024-06-14 -> 2024-06-15 2024-06-15 11:16:16 +00:00
0f6c9f3cde sane-sysinfo: add a way to render memory use 2024-06-15 11:12:45 +00:00
f4d806c0c2 sane-sysinfo: handle the case of no battery 2024-06-15 10:35:32 +00:00
6963998519 refactor: sane-sysinfo: more cleanups 2024-06-15 10:34:39 +00:00
a63f6281c5 refactor: sane-sysinfo: clean up a bit more 2024-06-15 10:26:22 +00:00
df0a8cf900 refactor: sane-sysinfo: split out a BatteryInfo class 2024-06-15 09:46:58 +00:00
a4f5343fb5 sane-sysinfo: port to Python
it's a pretty literal port; probably has some bugs
2024-06-15 08:59:50 +00:00
c50a4d1d71 static-nix-shell: fix mkBash scripts to actually be invokable from the CLI
they need the `bash` package! how did this work before?
2024-06-15 07:42:04 +00:00
aadbeab3ac doc: nwg-panel: point out that it really is ok to build w/o wlr-randr 2024-06-15 06:53:38 +00:00
aafcf7b478 lift sane-battery-estimate out of conky, rename to sane-sysinfo 2024-06-15 06:52:54 +00:00
a78b840215 nwg-panel: enable per-app volume controls 2024-06-15 03:59:36 +00:00
3c2347faba nwg-panel: fixup the formatting
especially, make it fit on moby
2024-06-15 03:49:01 +00:00
ebff35a378 add missing sane-nix-files
hmm. not great that i could deploy even without this being checked into git....
2024-06-15 03:37:19 +00:00
1515f01384 zsh: add alias: :fg -> fg 2024-06-15 03:26:36 +00:00
60a5c61500 default.nix: pass through host config and fs 2024-06-15 03:18:16 +00:00
417b85450c tod.md: notes about nwg-panel cleanup 2024-06-15 00:54:01 +00:00
2e0a3dc8ef nwg-panel: fix cross-compiled result to not ship build-time dependencies 2024-06-15 00:52:31 +00:00
3165c95d0f sysvol: 2024-06-09 -> 2024-06-13 2024-06-15 00:28:03 +00:00
6dd4d9da3e uassets: 2024-06-12 -> 2024-06-14 2024-06-15 00:19:40 +00:00
5a086b359d nixpkgs-wayland: 2024-06-12 -> 2024-06-14 2024-06-15 00:19:25 +00:00
a204f0a987 nixpkgs: 2024-06-12 -> 2024-06-14 2024-06-15 00:18:41 +00:00
317251338c todo.md: note that s6 is not re-entrant 2024-06-14 20:26:30 +00:00
01cfed2438 scripts/deploy: swap the iteration order: build all hosts at -min variant, then -light, etc; then also do the -next variants 2024-06-14 20:24:50 +00:00
ba0524d193 scripts/update: dont update feeds by default 2024-06-14 18:29:06 +00:00
26a4f20f6c scripts/deploy: factor out a deployHelper to make variant=all usable *without* host=all 2024-06-14 18:28:52 +00:00
46f5a7e37d nwg-panel: patch it to cross compile (by purging bluetooth/randr) 2024-06-14 09:34:17 +00:00
88a487f565 /etc/nixos: link in such a way that i dont pick up a whole bunch of garbage
it seemed to also be causing some non-determinism when deploying to crappy

ideally i would seal the whole nix build, by only evaluating all this config *after* building 'sane-nix-files'
2024-06-14 09:18:15 +00:00
d037afd75c sane-nix-files: define this repo as a package
setup as a dirty git repo, intentionally
2024-06-14 09:18:15 +00:00
654858f8ff nwg-panel: theme the calendar 2024-06-14 09:17:46 +00:00
5abcc7d399 nwg-panel: fix @workspaceNumbers typo 2024-06-14 08:50:28 +00:00
65823507ad nwg-panel: make workspace numbers/hiding configurable 2024-06-14 08:47:24 +00:00
63a88da3b4 moby: switch from waybar -> nwg-panel 2024-06-14 08:47:24 +00:00
734da36639 nwg-panel: make configurable through nix 2024-06-14 08:47:24 +00:00
49ccf95fb3 nwg-panel: style.css: fix line endings?
idk, i just copied + pasted the contents back, and now the file is 200B smaller and i dont see ^M in git
2024-06-14 08:47:24 +00:00
e70d0f3c8e nwg-panel: style.css: fix indentation 2024-06-14 08:47:24 +00:00
c00cccd429 nwg-panel: disable the green border hover for *all* items 2024-06-14 08:47:24 +00:00
02fdc91237 sway: switch from waybar -> nwg-panel (except for moby) 2024-06-14 08:47:24 +00:00
14616f9b61 nwg-panel: stylize 2024-06-14 08:47:24 +00:00
f9d856b3bb waybar: fix typo 2024-06-14 08:47:24 +00:00
d52db06ffe nwg-panel: implement, but dont ship by default 2024-06-14 08:47:24 +00:00
Shelvacu
dc2c31f220 gitea: keep login session alive for 30 days 2024-06-14 03:34:42 +00:00
52322e3207 switchboard: fix cross compilation 2024-06-14 03:29:02 +00:00
26f1f2b581 remove unused flake.lock file 2024-06-14 03:08:07 +00:00
74c188012a todo.md: install folio 2024-06-13 20:53:16 +00:00
e0c741427e ship "switchboard" program, for configuring bluetooth/network/sound 2024-06-13 19:51:19 +00:00
999a173001 sane-tag-music: --trackno "" fix-tags FOO can be used to clear FOOs track number field 2024-06-13 08:22:57 +00:00
330a64d820 feeds: add xorvoid.com 2024-06-13 04:46:12 +00:00
2e2f5dd373 scripts/sync: remove unnecessary sudo calls when mounting 2024-06-13 03:15:58 +00:00
5561dde31d readme: update for a flake-free world 2024-06-13 03:14:27 +00:00
c3ae60d71b flake.nix: remove (no longer used) 2024-06-13 03:09:45 +00:00
1c79209e23 scripts/sync: lift out of flake 2024-06-13 03:09:02 +00:00
6d1db1ee67 feeds: update metadata 2024-06-13 03:03:15 +00:00
88d462764f feeds: fix to work with scripts/update 2024-06-13 02:18:30 +00:00
8f634d9bb0 todo.md: address the sudo-related items 2024-06-13 01:30:44 +00:00
3e35210e4b systemd: allow wheel users to start/stop any service 2024-06-13 01:30:18 +00:00
04f4d330a8 programs: enable free 2024-06-13 01:09:48 +00:00
ce60e53b9a programs: add ps 2024-06-13 01:04:24 +00:00
3ff9f974a6 programs: enable watch 2024-06-13 00:59:34 +00:00
11e9ad5eca unl0kr.conf: fix formatting 2024-06-13 00:13:33 +00:00
bf99a64b89 unl0kr: fix that unl0kr wasnt always visible (so, wait for /dev/fb0 to appear before launch) 2024-06-13 00:13:19 +00:00
3b43562841 todo.md: address completed moby input-still-enabled-when-screen-off issue 2024-06-13 00:12:26 +00:00
131e43e975 scripts/deploy: avoid ssh-based copies to self 2024-06-13 00:12:00 +00:00
e34a9957e3 hosts/common/nix: migrate the nixpkgs-overlay integration point (part 2) 2024-06-12 23:32:18 +00:00
ea1a0b72b5 hosts/common/nix: migrate the nixpkgs-overlay integration point (part 1)
this has to be done in two steps to avoid nix-daemon bugs
2024-06-12 23:20:37 +00:00
aab9ed0d35 zsh: switch: pass through args 2024-06-12 23:09:35 +00:00
f477370e4c scripts/deploy: add more logging 2024-06-12 23:09:32 +00:00
b5fc8cfd4e scripts/deploy: when deploying all machines, dont let one failed deployment abort the whole job 2024-06-12 23:09:27 +00:00
4fdaacf8ad nit: use pkg.extend in place of pkgs.appendOverlays where applicable 2024-06-12 23:09:16 +00:00
f1705686b8 fix: dont double-apply overlays
previous behavior was that overlays were *implicitly* applied when i
imported nixpkgs, and then explicitly applied again later in the config.

for some reason i can't remove (or adjust?) the implicit application
without causing evals to hang w/o so much as any error message.
2024-06-12 23:08:04 +00:00
0d0fa8b37f nixpkgs: 2024-06-11 -> 2024-06-12 2024-06-12 09:42:55 +00:00
b5b39d1500 scripts/deploy: add the equivalent of my "pre-deploy" functionality 2024-06-12 09:04:17 +00:00
86482e922c scripts/update: add a --dry-run option 2024-06-12 08:44:02 +00:00
111c69b368 firefox.extensions.metamask: 11.16.8 -> 11.16.9 2024-06-12 08:37:59 +00:00
60c13d34a7 nixpkgs-wayland: 2024-06-08 -> 2024-06-12 2024-06-12 08:37:35 +00:00
823d064ab0 sops-nix: 2024-06-03 -> 2024-06-11 2024-06-12 08:35:54 +00:00
3f88d750c6 uassets: 2024-06-08 -> 2024-06-12 2024-06-12 08:35:34 +00:00
05f29ba01e sysvol: 2024-06-07 -> 2024-06-09 2024-06-12 08:35:22 +00:00
2b11bac1eb scripts: add an "update" script to update all my packages
it probably doesnt update feeds yet, though
2024-06-12 08:29:45 +00:00
86adc38537 zsh: fix switch alias for a post-flake world 2024-06-12 08:29:08 +00:00
b787289b39 scripts/deploy: if no host is specified, then deploy to the current host 2024-06-12 07:44:21 +00:00
63f3b8e89b handbrake: disable until i fix the build 2024-06-12 07:40:29 +00:00
448b8007ca scripts: remove outdated flake update script 2024-06-12 07:11:41 +00:00
9fc4119275 mesa-demos: deploy 2024-06-12 07:11:41 +00:00
8f1332797d crappy: dont auto-start messengers 2024-06-12 07:11:41 +00:00
368184e24f flake: add a crappy-min-next deploy target 2024-06-12 07:11:41 +00:00
c8e73d3f76 crappy: add user to "render" group 2024-06-12 07:11:41 +00:00
43da4955b7 crappy: deploy linux-exynos5-mainline kernel 2024-06-12 07:11:41 +00:00
46e9d5f758 programs: fix s6 deps when dbus isnt enabled 2024-06-12 07:11:41 +00:00
66a012b555 nixpkgs: 2024-06-08 -> 2024-06-11
i haven't actually deployed this yet: i'm pulling it for crappy-staging, but had to update all branches because the trust-dns patch didn't apply cleanly
2024-06-12 07:11:41 +00:00
fff965ab9b linux-postmarketos-exynos5: build with LIMA/MALI enabled as well (experimental) 2024-06-12 07:11:41 +00:00
406adde549 scripts/deploy: skip the signing step if we have no signing key 2024-06-12 07:11:14 +00:00
c9b2699c9f nixpkgs: fix sysvol patch hash 2024-06-12 07:03:23 +00:00
f91d3e35f3 flake: port deploy script to its own thing 2024-06-12 05:48:03 +00:00
4712ba9f2d check-nur: extract from the flake 2024-06-12 02:50:51 +00:00
03b2f2a433 rename health-check -> check-uninsane so i can expand the checks 2024-06-12 02:35:07 +00:00
51b1a6e679 default.nix: define attributes necessary to build any of my hosts or their packages 2024-06-12 02:21:50 +00:00
f148e5a580 pkgs: fix infinite recursion when evaluating nix-build -A MY_PKG 2024-06-12 01:18:17 +00:00
079f945f38 unl0kr: 2.0.0 -> 3.2.0 2024-06-12 00:49:26 +00:00
29cc7e4676 flake: add targets to deploy to crappy 2024-06-12 00:49:14 +00:00
11c97fd4c0 crappy: actually enable landlock 2024-06-11 00:47:30 +00:00
a5cb989c59 hosts/common: add remote /mnt/crappy/home mount 2024-06-11 00:36:18 +00:00
3d77a7cbc9 secrets/common: allow crappy to access these secrets 2024-06-11 00:27:37 +00:00
8e7401955f hosts/common: add crappy's pubkey/lan IP 2024-06-11 00:27:14 +00:00
fa605768e7 hosts/common: enable ALL firmware -- not just the "redistributable" stuff 2024-06-11 00:26:52 +00:00
3c279edd31 feeds: unsubscribe from Vsauce 2024-06-11 00:26:17 +00:00
a736d6d77b crappy: get it to load the firmware required for its wifi chipset (mwifiex_sdio) 2024-06-11 00:26:02 +00:00
8ad118162e doc: how to recover or add new hosts 2024-06-11 00:25:00 +00:00
5c13bb20d7 crappy: test (but dont deploy) a linux_latest kernel w/ panel patch
it doesn't boot, not sure why
2024-06-10 21:26:59 +00:00
170d36fc05 crappy: fix u-boot boot order to include usb 2024-06-10 06:07:53 +00:00
b828edf3c7 hal/samsung: remove some dead code 2024-06-10 03:49:43 +00:00
e10dfaefe9 hal/samsung: test a bunch of different kernels; enable linux_latest which works if i patch it 2024-06-10 03:48:31 +00:00
49e1a85afb linux-postmarketos-exynos5: test some patches for enabling graphics output on later kernels 2024-06-10 03:47:35 +00:00
56dfe8baa8 linux-exynos5-mainline: init
it builds, but is not bootable on samsung chromebook
2024-06-09 20:35:13 +00:00
95685fe91f linux-postmarketos-*: factor out a sane-kernel-tools helper set 2024-06-09 19:34:07 +00:00
8f6b4cc551 refactor/rename: linux-postmarketos -> linux-postmarketos-allwinner 2024-06-09 18:43:38 +00:00
89c9733ed2 linux-postmarketos-exynos5: add "optimizeForSize" option 2024-06-09 18:40:38 +00:00
ec29ec76f0 swayidle: fix that input events werent suppressed during screen-off 2024-06-09 18:36:57 +00:00
0f97e3d7ed sane-input-handler: fix that input events werent suppressed during screen-off
note that this doesn't fix input gating during the
screenoff-after-inactivity case.
2024-06-09 18:28:31 +00:00
6fb5cedd69 linux-postmarketos-exynos5: allow overriding the linux version 2024-06-09 17:48:46 +00:00
0382af1fae linux-postmarketos-exynos5: actually, i dont need to build with CC_OPTIMIZE_FOR_SIZE=y 2024-06-09 07:00:26 +00:00
b24b68a6bd mpv: switch to mainline mpv 2024-06-09 06:48:43 +00:00
952da0f314 sysvol: build via the package as it will appear in nixpkgs 2024-06-09 06:34:09 +00:00
cb32dc99cd sysvol: fix background transparency 2024-06-09 01:50:39 +00:00
5e7a05c183 sysvol: remove unused finalAttrs 2024-06-09 01:11:54 +00:00
656b478cc0 nixpkgs: remove ancient commented-out patches 2024-06-09 00:55:28 +00:00
fbbc0eb294 nixpkgs: cleanup patching implementation 2024-06-09 00:52:01 +00:00
502c9d1db3 nixpkgs: 24.05-unstable-2024-06-xx -> 24.05-unstable-2024-06-08 2024-06-09 00:48:52 +00:00
36934eedfd nixpkgs-wayland: 0-unstable-2024-06-xx -> 0-unstable-2024-06-08 2024-06-09 00:48:26 +00:00
56f982e214 delfin: remove
it's in nixpkgs now, and the co-maintainer is doing a very good job with it
2024-06-09 00:17:04 +00:00
54c4cd53b3 firefox-extensions: ether-metamask, sponsorblock, ublacklist -> latest 2024-06-09 00:01:12 +00:00
1c4fc335b3 uassets: 0-unstable-2024-05-27 -> 0-unstable-2024-06-08 2024-06-09 00:00:44 +00:00
21d3f41b38 signal-desktop-from-src: 7.8.0 -> 7.11.1 2024-06-09 00:00:27 +00:00
031ce236f3 firefox-extensions: fix the update script to not grab betas for u-block 2024-06-08 23:43:35 +00:00
a4eb073918 signal-desktop-from-src: fix the update script to ignore betas 2024-06-08 23:13:56 +00:00
75ae868bde nixpkgs: don't fail build if a patch has already been applied 2024-06-08 22:49:55 +00:00
b6d9d58a14 firefox-extensions.bypass-paywalls-clean: disable updateScript 2024-06-08 22:08:25 +00:00
14a5b8d9f2 nixpkgs: get the updateScripts to be populated into me update.pkgs.* attrs 2024-06-08 22:01:33 +00:00
ede68b563e nixpkgs-{staging,next}: add an update script 2024-06-08 21:15:47 +00:00
33f4db254d nixpkgs: add an update script
this only updates the master branch -- for now
2024-06-08 20:44:23 +00:00
6e8cb1bbb2 nixpkgs-wayland: add an update script 2024-06-08 20:24:56 +00:00
b00fb22137 sops-nix: add an update script 2024-06-08 20:22:04 +00:00
4d74c2ede6 sysvol: 0-unstable-2024-04-11 -> 0-unstable-2024-06-07 2024-06-08 20:11:07 +00:00
c4c5a640ce sysvol: add an update script 2024-06-08 19:58:29 +00:00
514fbca3f1 gitea: enable push-to-create for new repositories 2024-06-08 03:46:52 +00:00
71a19e247f fix check.nur (dont use builtin fetchers when stdenv ones are available) 2024-06-08 03:28:47 +00:00
Shelvacu
bcab89dbfb gitea: enable push-to-create for new repositories 2024-06-07 20:27:43 -07:00
f219c59ad5 nixpkgs: acquire via builtins.fetchGit instead of flake
i'll probably delete this toplevel flake at some point as well
2024-06-08 01:37:47 +00:00
197df696be uninsane-dot-org: acquire by fetchFromGitea instead of flake 2024-06-07 22:52:07 +00:00
c9b7f58f3d sops-nix: acquire via fetchFromGitHub instead of flake
i don't like the hacks i have to do to mix `fetchFromGitHub` and nixos
modules though.
2024-06-07 22:40:53 +00:00
6b8371c32b nixpkgs-wayland: import by fetchFromGitHub instead of via flake 2024-06-07 21:29:45 +00:00
11cdac0357 mobile-nixos: import by fetchFromGitHub instead of via flake 2024-06-07 21:15:54 +00:00
8b607ddefd nixpkgs: 2024-06-05 ->2024-06-07; nixpkgs-wayland
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/f1f4d07f9015e5da5fe416e87c6bbd9f569a5c60' (2024-06-05)
  → 'github:nixos/nixpkgs/5aa86ae5585cd46299ee46682fda8a9b76baf2ae' (2024-06-07)
• Updated input 'nixpkgs-staging-unpatched':
    'github:nixos/nixpkgs/d7993cebbcd4f9f3a07a8d418853b586d301be56' (2024-06-05)
  → 'github:nixos/nixpkgs/da9d22446697971278edcd4af92f63221f7d21f6' (2024-06-07)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/c3759101288ea92aec42ab7b8aed4e967cfb8eb3' (2024-06-04)
  → 'github:nixos/nixpkgs/716a7056386dcc67eb3b813289499d6329d4befc' (2024-06-07)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/93b225ddba91179248b378913a91defbc6aeb899' (2024-05-31)
  → 'github:nix-community/nixpkgs-wayland/8e2d180329f4009ac06042b50ca0a356722aea19' (2024-06-07)
• Updated input 'nixpkgs-wayland/flake-compat':
    'github:nix-community/flake-compat/8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c' (2023-06-29)
  → 'github:nix-community/flake-compat/38fd3954cf65ce6faf3d0d45cd26059e059f07ea' (2024-06-02)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/dbc9130fe1455e0f6ee4d8f5f799f9be551f866b' (2024-05-26)
  → 'github:nix-community/lib-aggregate/64d43e2bbc6eab8d1cbdfba96d90a71e15a847d7' (2024-06-02)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/d0d27192931680482081aa1c38389da2af84a651' (2024-05-26)
  → 'github:nix-community/nixpkgs.lib/e090cb30ae82f4b4461aafdb808847c6c97b08c2' (2024-06-02)
• Updated input 'nixpkgs-wayland/nix-eval-jobs':
    'github:nix-community/nix-eval-jobs/bb95091f6c6f38f6cfc215a1797a2dd466312c8b' (2024-05-15)
  → 'github:nix-community/nix-eval-jobs/b6169e08e76e10b673d1b54f944cddb1e7cbea97' (2024-06-06)
```
2024-06-07 09:08:24 +00:00
10158bb444 rename snowy -> crappy
get it? it's the crappy version of lappy
2024-06-07 08:04:57 +00:00
1dd10450f2 modules/image: remove extraneous sane.image.enable option 2024-06-07 07:42:47 +00:00
e104499636 modules/hal/samsung: cleanup 2024-06-07 07:39:30 +00:00
56cd1f211c scripts/update: expand 2024-06-07 07:34:51 +00:00
14f4f1e80d hosts: add snowy
the Samsung Chromebook thing
2024-06-07 07:34:35 +00:00
52a0e8cf53 modules/hal/samsung: init
this can be used to get baseline support for samsung exynos5 chromebook

i should probably rename it, in time
2024-06-07 07:33:46 +00:00
50450fe7fe brave: fix eval error on armv7l 2024-06-07 07:32:24 +00:00
4a4ffadc64 fractal-nixified: fix cross to armv7l 2024-06-07 07:32:08 +00:00
8807140c83 neovim: fix cross to armv7l 2024-06-07 07:31:44 +00:00
adc811efa1 libvpx: fix cross to armv7l 2024-06-07 07:31:27 +00:00
d8fed884d0 programs: steam: move from pcGuiApps -> pcGameApps 2024-06-07 07:30:56 +00:00
d75f59ba06 modules/image: increase the default boot partition size from 512 MiB -> 1024 MiB 2024-06-07 07:29:50 +00:00
aa0a395353 nit: fix image output to be a file, not an item inside a folder 2024-06-07 07:28:56 +00:00
56d84dea4d hosts: remove unused (defaulted) option: boot.loader.efi.canTouchEfiVariables 2024-06-07 07:27:34 +00:00
3aa2ece59b modules/programs: convert lib.optionalAttrs to mkIf
this allows stuff to be lazier
2024-06-07 07:26:07 +00:00
07239d2a75 nixpatches: link to outstanding libvpx fix 2024-06-07 07:25:36 +00:00
3fd5e15e93 linux-postmarketos-exynos5: init
i'll need this for a default chromebook install
2024-06-07 07:24:48 +00:00
97d56b0314 flake: add a pkgs.python template 2024-06-07 07:23:35 +00:00
c18554dfbd depthcharge-tools: init at 0.6.2 2024-06-07 07:22:18 +00:00
8105e00b39 refactor: make system.stateVersion common across all hosts.
otherwise it's hairy to share nixos configs/modules between them

note that this alters the stateVersion for desko/lappy/rescue, but unlikely to matter
2024-06-04 15:58:53 +00:00
7e32fab5d4 refactor: moby: split more stuff out of the toplevel config and hide behind roles/etc 2024-06-04 15:58:51 +00:00
25298c9be6 lappy: remove unused xkb_mobile_normal_buttons 2024-06-04 14:40:03 +00:00
e61549d917 moby: split remaining polyfill into roles.handheld 2024-06-04 14:38:32 +00:00
eca14a644b refactor: moby: lift some of the polyfill out to pine64 hal 2024-06-04 14:36:46 +00:00
3937121522 refactor: moby: split pinephone-specific stuff into sane.hal.pine64 2024-06-04 14:35:34 +00:00
b334db28c6 refactor: hide x86_64-specific host config in a module 2024-06-04 14:26:24 +00:00
b52057e317 refactor: split "quirks.nix" out of hosts/common/hardware/default.nix 2024-06-04 14:14:22 +00:00
414ab85e20 refactor: move hosts/common/hardware/default.nix into hosts/common/boot.nix 2024-06-04 14:12:28 +00:00
82133a8f16 refactor: move logind config into systemd.nix 2024-06-04 14:09:58 +00:00
43a63d4f6e hosts/modules: remove unused yggdrasil 2024-06-04 13:58:49 +00:00
9f9fc7d65b moby: also sync books from servo 2024-06-04 10:08:25 +00:00
79d395e01c nixpkgs: 2024-06-03 -> 2024-06-04, sops-nix
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/c987c730bbf2121264ebd68921b443db5bb28543' (2024-06-03)
  → 'github:nixos/nixpkgs/6a56765581a4dcf961a90faf54d32edb991bd315' (2024-06-04)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/77a51024c0f953d503eb3ed364aa4bff378649f8' (2024-06-03)
  → 'github:nixos/nixpkgs/c3759101288ea92aec42ab7b8aed4e967cfb8eb3' (2024-06-04)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/ab2a43b0d21d1d37d4d5726a892f714eaeb4b075' (2024-06-02)
  → 'github:Mic92/sops-nix/d4555e80d80d2fa77f0a44201ca299f9602492a0' (2024-06-03)
```
2024-06-04 06:35:29 +00:00
394259fe21 modemmanager: harden systemd service 2024-06-03 16:41:51 +00:00
8c256c629b networkmanager: harden further with NoNewPrivileges and PrivateTmp 2024-06-03 16:23:22 +00:00
0e2d86ac96 NetworkManager-dispatcher: note why we cant use DynamicUser 2024-06-03 15:57:41 +00:00
e2a1e6730d NetworkManager-dispatcher: harden systemd service 2024-06-03 15:44:22 +00:00
a1e923f999 networkmanager: tighten ProtectSystem to "strict" 2024-06-03 15:10:14 +00:00
09333c992c wpa_supplicant: harden systemd service 2024-06-03 15:09:32 +00:00
80eb385c64 networkmanager: restrict service (using systemd options) 2024-06-03 14:27:00 +00:00
f6725f60b9 networkmanager: re-introduce my polkit patches 2024-06-03 13:04:48 +00:00
2f1592376d document more sandbox limitations 2024-06-03 11:59:44 +00:00
42fed64b75 NetworkManager: split specific config options out of my main net/default.nix file 2024-06-03 11:24:38 +00:00
682143d47f NetworkManager: 1.46.0 -> 1.48.0
mostly so i can review the PR and get this update mainlined sooner :)
2024-06-03 11:23:33 +00:00
1448cb4444 sane-reboot: fix operation on servo 2024-06-03 09:33:35 +00:00
2d07ff966b health-check: mention failed systemd services 2024-06-03 09:30:02 +00:00
83404f6769 nixos/networkmanager patch: grab via PR 2024-06-03 07:49:53 +00:00
c6bb6e2e3c megapixels-next: fix broken eval of metadata 2024-06-03 05:35:09 +00:00
9d109644b7 nixpkgs: 2024-06-01 -> 2024-06-03; sops-nix -> 2024-06-02
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/f7de25c01e4c073c06e0525226a0c2311d530cee' (2024-06-01)
  → 'github:nixos/nixpkgs/c987c730bbf2121264ebd68921b443db5bb28543' (2024-06-03)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/61c1d282153dbfcb5fe413c228d172d0fe7c2a7e' (2024-06-01)
  → 'github:nixos/nixpkgs/77a51024c0f953d503eb3ed364aa4bff378649f8' (2024-06-03)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/962797a8d7f15ed7033031731d0bb77244839960' (2024-05-26)
  → 'github:Mic92/sops-nix/ab2a43b0d21d1d37d4d5726a892f714eaeb4b075' (2024-06-02)
• Updated input 'sops-nix/nixpkgs-stable':
    'github:NixOS/nixpkgs/59a450646ec8ee0397f5fa54a08573e8240eb91f' (2024-05-25)
  → 'github:NixOS/nixpkgs/3b1b4895b2c5f9f5544d02132896aeb9ceea77bc' (2024-06-01)
```
2024-06-03 05:31:28 +00:00
0050403b31 scripts: add an update helper
someday i can extend this for updating packages and feeds too
2024-06-03 05:30:03 +00:00
e4bcbab224 hosts: networking: switch to using nixos NetworkManager/ModemManager/etc, just patched for hardening 2024-06-02 11:22:03 +00:00
1b85aa0441 networkmanager/modemmanager: get closer to nixpkgs upstream
i've seen enough, that there's a path toward getting nixos proper to sandbox this in a way i'm happy with -- in time
2024-06-02 08:56:38 +00:00
f5e5d1bcc4 networkmanager: fix polkit integrations when running not as root
now nmcli/etc work
2024-06-02 05:10:11 +00:00
30d41f82f2 refactor: networkmanager: use substitute instead of sed when patching 2024-06-01 22:16:18 +00:00
62dbad3486 polyunfill: remove a few more default systemPackages 2024-06-01 21:06:40 +00:00
4287ecf0ed polyfill: don't ship unused mtools package 2024-06-01 20:15:04 +00:00
b13ca92b72 polyfill: remove boot.{enableContainers,bcache} 2024-06-01 20:14:49 +00:00
45e121eb1c make-sandboxed: preserve meta.mainProgram 2024-06-01 20:01:24 +00:00
53bbd611da nixpkgs-review: persist the ~/.cache/nixpkgs-review directory 2024-06-01 17:15:54 +00:00
f0128b9496 apply patch for when trust-dns is renamed to hickory-dns 2024-06-01 17:07:44 +00:00
368169d48d todo.md: start documenting sudo issues 2024-06-01 17:06:36 +00:00
cb1d5d53c6 feeds: add mintcast podcast 2024-06-01 16:28:42 +00:00
a5a635f00b sftpgo: simplify my package override now that sftpgo 2.6.0 is merged 2024-06-01 16:22:22 +00:00
6fe3d26b30 modemmanager: fix missing mmcli binary in service definition 2024-06-01 15:41:14 +00:00
8340cf059f nixpkgs-review: fix sandboxing 2024-06-01 15:26:23 +00:00
e0da3ece60 errno: simplify 2024-06-01 14:48:55 +00:00
8ea379d53b errno: ship on all platforms 2024-06-01 14:04:45 +00:00
c7dd49af91 errno: fix cross compilation by not building *all* of moreutils 2024-06-01 14:03:59 +00:00
e8b900c722 todo.md: add media looping controls 2024-06-01 13:37:51 +00:00
36f4fa3018 checkSandboxed: fix so that cross-built scripts can be checked again
how did this work earlier? does lappy have binfmt enabled??
2024-06-01 13:24:41 +00:00
d8d11de9bc sftpgo: replace deprecated "crypt" with "passlib" 2024-06-01 13:01:19 +00:00
07194d062a servo: nfs: disable 2024-06-01 12:45:10 +00:00
24c49df75f health-check: add a check that ftp://uninsane.org is operational 2024-06-01 12:42:53 +00:00
9f7e143d5e todo.md: add some kernel work to be done 2024-06-01 12:38:28 +00:00
0a382ae8a3 todo.md: remove completed "landlock sandboxer prints garbage" item 2024-06-01 12:35:46 +00:00
96f177ceb2 docs: overlays/cross: slightly tidy up the "outstanding issues" part 2024-06-01 12:24:00 +00:00
2aa3fa35b8 nixpkgs: 2024-05-31 -> 2024-06-01; nixpkgs-wayland -> 2024-05-31
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/8a0a33b56d6279fec4827da602882561ef00f2fb' (2024-05-31)
  → 'github:nixos/nixpkgs/f7de25c01e4c073c06e0525226a0c2311d530cee' (2024-06-01)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/7ccd1516effbc5510391d3b498a7a3bef92a090b' (2024-05-31)
  → 'github:nixos/nixpkgs/61c1d282153dbfcb5fe413c228d172d0fe7c2a7e' (2024-06-01)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/1db9b79a45c8e346e03480767e6d9749fabfaf10' (2024-05-31)
  → 'github:nix-community/nixpkgs-wayland/93b225ddba91179248b378913a91defbc6aeb899' (2024-05-31)
```
2024-06-01 12:20:45 +00:00
8657cf1fcf ship ausyscall binary 2024-06-01 12:17:08 +00:00
f875db916d sandboxing: fix checkSandboxed to handle packages with multiple outputs 2024-06-01 12:12:46 +00:00
e3e86a43a9 brightnessctl: disable unused dbus access 2024-06-01 12:09:51 +00:00
05986d363d brightnessctl: fix udev rules so i can run it again 2024-06-01 12:02:24 +00:00
539d9e45a2 networkmanager/modemmanager: ship separate packages for the daemon and CLI tools
they require fundamentally different sandboxing approaches. the daemon *can't* always use bwrap if it wants to run as non-root. meanwhile the CLI tools would mostly *prefer* to run under bwrap.

in the long term i'll maybe upstream the systemd sandboxing into nixpkgs, where there looks to be desire for it
2024-05-31 23:26:16 +00:00
a380bd04c4 trivial-builders: init deepLinkIntoOwnPackage 2024-05-31 23:26:16 +00:00
f296d8df93 make-sandboxed: fix multi-output packages and sandbox *all* their outputs
this mostly applies to the wrapperType = 'inplace' users
2024-05-31 23:26:16 +00:00
326bf045b0 networkmanager/wpa_supplicant: switch user back to "networkmanager"
root gives too much power, even with bwrap/namespaces
2024-05-31 23:26:16 +00:00
a1181a10ea networkmanager: install parallel dbus .conf files to allow the services to be run as *either* networkmanager or root user (hopefully!) 2024-05-31 23:26:16 +00:00
9bb6a903bb wpa_supplicant: get it to run under bwrap 2024-05-31 23:26:16 +00:00
214f963d89 networkmanager: run all services as root instead of networkmanager user
i believe this may allow using bwrap instead of landlock
2024-05-31 23:26:16 +00:00
c7eb4b66a5 polyunfill: remove unused su and sg security wrappers 2024-05-31 14:59:23 +00:00
452543e6f3 fix rescue host build 2024-05-31 10:37:03 +00:00
d692ac9851 overlays/cross: remove broken cdrtools fix (that project is INSANE) 2024-05-31 09:40:44 +00:00
5cba283859 overlays/cross: update upstreaming status
my part of the gnome2.GConf fix was actually upstreamed a year ago; the package fails for a different reason
2024-05-31 09:04:16 +00:00
7a701f92eb nixpkgs: bump
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/d3d81af60c22e9e93a3930a9630b210362341ab9' (2024-05-31)
  → 'github:nixos/nixpkgs/8a0a33b56d6279fec4827da602882561ef00f2fb' (2024-05-31)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/4e60a4d94bdc1abafeefc1928aa3cda6ce6c4210' (2024-05-31)
  → 'github:nixos/nixpkgs/7ccd1516effbc5510391d3b498a7a3bef92a090b' (2024-05-31)
```
2024-05-31 08:44:53 +00:00
3c3a32e436 nixpatches: grab libphonenumber cross patch from PR 2024-05-31 08:43:27 +00:00
07aec3ca3c apps: explain why i ship both engrampa and xarchiver archive managers 2024-05-31 08:39:23 +00:00
58d5f11c7a overlays/cross: disable patches which im not actively using 2024-05-31 08:21:23 +00:00
ed2d4ef488 overlays/cross: update upstreaming status 2024-05-31 08:02:25 +00:00
e8f8866032 overlays/cross: remove old emulated package set and buildInQemu, etc 2024-05-31 06:59:32 +00:00
a2dfd8f08e libphonenumber: use a better patch for cross (CMAKE_CROSSCOMPILING_EMULATOR) 2024-05-31 06:27:10 +00:00
c7fd3d2217 nixpkgs: 2024-05-26 -> 2024-05-31, nixpkgs-wayland -> 2024-05-31
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/2baa940f86e1fc54757fd7d1ed551c0a38904bf2' (2024-05-26)
  → 'github:nixos/nixpkgs/d3d81af60c22e9e93a3930a9630b210362341ab9' (2024-05-31)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/7780e5160e011b39019797a4c4b1a4babc80d1bf' (2024-05-26)
  → 'github:nixos/nixpkgs/4e60a4d94bdc1abafeefc1928aa3cda6ce6c4210' (2024-05-31)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/397c85d463aef789a8dd24c4db467e9ad787907b' (2024-05-26)
  → 'github:nix-community/nixpkgs-wayland/1db9b79a45c8e346e03480767e6d9749fabfaf10' (2024-05-31)
```
2024-05-31 06:09:03 +00:00
0fcc3f8d5d ModemManager: make the sandbox more strict 2024-05-30 21:32:35 +00:00
0bb887158b implement a dropbear SSH module 2024-05-30 20:58:01 +00:00
6570c5ed84 modemmanager: sandbox with bwrap instead of landlock 2024-05-30 18:47:09 +00:00
820fdecfd5 modemmanager: minimal (working) sandbox 2024-05-30 18:27:34 +00:00
8d43565f31 sane-theme: disable sandbox 2024-05-30 16:54:10 +00:00
18364761dd wireplumber: undo the enableSystemd=false patch 2024-05-30 16:50:53 +00:00
d3937487e6 moby: cleanup bonsai <-> sway circular dependency (slightly) 2024-05-30 12:43:09 +00:00
3fdeacc336 sane-input-handler: add a --help command 2024-05-30 12:30:41 +00:00
847414ac1f health-check: add a test that git is online 2024-05-30 12:18:57 +00:00
84f2006115 servo: fix gitea 2024-05-30 12:12:06 +00:00
7f5e12da8d dbus: dont consider the service "up" until the unix pipe actually appears 2024-05-30 11:04:02 +00:00
afa8a3c52e activationScripts.notifyActive: future-proof for if ever DBUS_SESSION_BUS_ADDRESS changes 2024-05-30 11:03:35 +00:00
bfbcb4789b activationScripts.notifyActive: fix forrenamed XDG_RUNTIME_DIR 2024-05-30 10:56:17 +00:00
2531cc1cf6 bonsai: place the socket in a subdirectory to improve sandboxing 2024-05-30 09:54:28 +00:00
e55b75c333 wireplumber: build without systemd 2024-05-30 09:46:29 +00:00
adb54657d4 sway: fix bonsai to be visible in the sandbox 2024-05-30 09:46:04 +00:00
6eefb9ce20 wireplumber: build against the same pipewire i deploy 2024-05-30 09:06:41 +00:00
2233622bb7 landlock-sandboxer: remove startup messages for 6.9 2024-05-30 08:55:13 +00:00
274a7821a7 wireplumber: remove no-longer-needed /run/systemd directory
not necessary when using seatd/when a member of the 'audio' group
2024-05-30 08:54:41 +00:00
4c84d1a727 doc: modules/users: show what XDG_SESSION_{ID,CLASS,TYPE} could look like if set 2024-05-30 08:44:26 +00:00
175acf6442 pipewire: build without systemd 2024-05-30 08:44:11 +00:00
0761b6135a users/colin: add myself to "audio" group so that wireplumber can access audio devices w/o systemd/logind 2024-05-30 08:44:11 +00:00
66c899d099 callaudiod: fix to not start before dbus/pipewire are up (avoids coredump on boot) 2024-05-30 06:07:08 +00:00
4aeb3360d3 cleanup: programs: dont assume sway is always the wayland/x11 provider 2024-05-30 06:00:32 +00:00
0c456d11d8 programs: ensure things which depend on sound or wayland are ordered after it 2024-05-30 04:55:05 +00:00
3b73773169 programs: ensure things which depend on dbus are ordered after it 2024-05-30 03:48:45 +00:00
9ba8ff738b refactor: sane.programs.$foo.service: specify type concretely 2024-05-30 03:39:32 +00:00
f1d397940f seatd: patch sandboxing for desko 2024-05-29 19:42:45 +00:00
fa94fa8e6c seatd: sandbox with bwrap
it always surprises my that you can sandbox something with cap_sys_admin like this...

i think this works *only* because the user is root
2024-05-29 19:09:57 +00:00
4b9c125c8c seatd: sandbox 2024-05-29 18:58:38 +00:00
0f7d25d8a5 doc: sway: say why i wrapperType = "inplace" 2024-05-29 18:58:05 +00:00
140641729e gvfs: disable (it was broken) 2024-05-29 18:39:31 +00:00
32124d76bf cups: disable (not currently used, and not sandboxed) 2024-05-29 18:33:17 +00:00
c5c174f988 sway: patch to use a narrower sandbox 2024-05-29 18:24:59 +00:00
29bc1608aa sway: remove sandbox input which are no longer necessary 2024-05-29 17:07:18 +00:00
635ca1e5d8 seatd: pull the service definition into my own repo
this will allow me to configure the package
2024-05-29 16:34:32 +00:00
2789868703 seatd: split out of sway conf 2024-05-29 16:22:52 +00:00
c40ec1990a sshd: disable systemd integration 2024-05-29 15:57:19 +00:00
d4dfcd6510 login: remove systemd pam integration (so it doesnt try, and fail, to start the user manager) 2024-05-29 15:42:39 +00:00
d865be952a refactor: sandboxing: replace manual --sanebox-keep-namespace pid config with isolatePids = false 2024-05-29 12:56:46 +00:00
7c8a18ecbd systemd: remove no-longer-used user@1000 override 2024-05-29 12:56:19 +00:00
35ff7de06e dbus: manage it ourselves instead of having systemd do it 2024-05-29 12:55:51 +00:00
00d06db66a make-sandboxed: handle more systemd service files 2024-05-29 12:54:44 +00:00
c570b7bf5d dbus: manage it ourselves instead of having systemd do it 2024-05-29 11:30:33 +00:00
770fc2e574 systemd: fix typod IgnoreOnIsolate option 2024-05-29 11:30:33 +00:00
0ed7eb24fb programs: assorted: remove legacy programs.feedback setting 2024-05-29 11:30:33 +00:00
ad8e75b6a3 programs: assorted: remove /var/lib/alsa persistence; doesnt seem to be needed 2024-05-29 11:30:33 +00:00
e8dbe0750d networkmanager: fix sandbox to actually work with systemd-resolved 2024-05-29 10:34:24 +00:00
1378988f21 desko: *really* disable wpa_supplicant 2024-05-29 10:34:03 +00:00
b88467771e doc: trust-dns: fix wan.txt example path 2024-05-29 09:33:59 +00:00
4309d887da wpa_supplicant: remove unused services 2024-05-29 09:33:25 +00:00
1ee21c4795 NetworkManager: run as user instead of root 2024-05-29 09:16:30 +00:00
fb7bcbb5f5 NetworkManager-wait-online: fix missing sanebox path 2024-05-29 01:37:15 +00:00
0013e8305e networkmanager: cleanup 2024-05-29 01:35:38 +00:00
7dedfcebb9 networkmanager: sandbox 2024-05-29 01:33:15 +00:00
753b97ffb4 todo.md: mark hosts/modules/gui cleanup as complete 2024-05-28 16:51:29 +00:00
247fc1f887 hosts/modules/gui: fold into hosts/common/programs 2024-05-28 16:51:02 +00:00
3c2ca46ef9 hosts/modules/gui/gtk: hoist to sane.programs.sane-theme 2024-05-28 16:44:27 +00:00
95dc395925 hosts/modules/gui/theme: lift my sway background up into its own package 2024-05-28 15:48:37 +00:00
cefd6c0534 documentation improvements 2024-05-28 13:36:01 +00:00
05efec8fd7 wg-home: decrease the refresh timeout 2024-05-28 13:36:01 +00:00
e8846b2d6b wpa_supplicant: sandbox 2024-05-28 13:36:01 +00:00
be38d56717 make-sandboxed: handle more systemd/dbus service file locations 2024-05-28 13:36:01 +00:00
7d242ab02c sane-battery-estimate: sandbox 2024-05-28 09:41:04 +00:00
47611eaa26 sane-weather: sandbox 2024-05-28 09:38:04 +00:00
9719f0f785 mpv: relax sandboxing for the sake of subtitle downloading 2024-05-28 09:37:57 +00:00
8042ea76e6 assorted programs: specify sandbox.autodetectCliPaths variant more precisely than just true 2024-05-28 07:14:27 +00:00
c59236509b sane-cast: sandbox 2024-05-28 07:07:11 +00:00
50e5206b0e todo.md: document that moby touchscreen stays on even when the screen is disabled 2024-05-28 05:27:37 +00:00
4ba0343315 networkmanager: hoist some lib.mkIfs up a few levels
would you believe one of these attributes was being set without a mkIf cfg.enabled guard :)
2024-05-28 05:27:23 +00:00
cbe6072c03 polyunfill: remove policykit suid wrappers 2024-05-28 05:24:37 +00:00
bea1fd95e5 polyunfill: disable dbus-daemon-launch-helper suid wrapper 2024-05-28 05:14:06 +00:00
ae544c0649 polyunfill: disable mount/umount suid wrappers 2024-05-28 05:02:26 +00:00
b571f70988 polyunfill: remove fusermount suid wrapper 2024-05-28 04:56:14 +00:00
e6498ad152 notejot: fix sandboxing 2024-05-28 03:59:31 +00:00
976b8ae45e rofi-snippets: make the filtering case insensitive, and improve ellipsis placement come 1.7.6 2024-05-28 03:38:36 +00:00
ab7c4d7410 rofi-snippets: remove the subshell and just use a pipe
i expect that this is faster, particularly because bash should stand up each section of the pipeline in parallel, right?
2024-05-28 03:23:04 +00:00
d2c3bec98e rofi-snippets: remove an extraneous layer of sandbox 2024-05-28 03:04:57 +00:00
3c5e5632ee wtype: sandbox 2024-05-28 03:04:26 +00:00
dcedb8d3f0 sanebox: handle --flag=path style of autodetected paths 2024-05-28 03:04:02 +00:00
8586db59f1 todo.md: sync 2024-05-28 02:14:10 +00:00
1f4d500b02 snippets: update 2024-05-28 02:11:49 +00:00
56b846023b update snippets 2024-05-28 01:27:59 +00:00
747d6c876d sane-vpn: add a "dns-fix" subcommand to open a shell using an external DNS resolver
this is hopefully temporary, until i can cleanup my trust-dns recursive resolver
2024-05-28 01:23:22 +00:00
f38d2d52d2 alsa-ucm-pinephone-pmos: prefer the earpiece over the "internal speaker" 2024-05-27 14:13:56 +00:00
04bbf54385 alsa-ucm-conf: switch to postmarketos version 2024-05-27 13:41:03 +00:00
f2271180dd alsa-ucm-conf: split the patched alsa confs out into their own package 2024-05-27 12:53:33 +00:00
60b1ab1429 conky: split sane-battery-estimate out into its own program 2024-05-27 11:33:40 +00:00
db3636641d sxmo-utils: disable update script 2024-05-27 07:51:56 +00:00
54a891504d delfin: 0.4.2 -> 0.4.4 2024-05-27 07:51:56 +00:00
8ea5061bef firefox-extensions: update to latest 2024-05-27 07:51:56 +00:00
b6d19a7a09 firefox-extensions.ctrl-shift-c-should-copy: update version field to use unstable idioms 2024-05-27 07:51:56 +00:00
439be20be7 lemmy-lemonade: 2024.03.20 -> 2024.04.22 2024-05-27 07:51:56 +00:00
a024f685c3 firefox: replace i-still-dont-care-about-cookies extension with a uBlock filter list
simpler that way; fewer extensions to trust
2024-05-27 07:43:55 +00:00
9c20cef6ea firefox: ublacklist: disable (i wasnt using any rules; it wasnt blocking anything from google search results) 2024-05-27 07:22:47 +00:00
abb65e55c6 uassets: fix updateScript 2024-05-27 07:16:50 +00:00
a2d385708f flake: echo the update command before running it 2024-05-27 07:16:42 +00:00
f6f1a6e136 firefox: uBlock Origin: ship filter lists statically 2024-05-27 06:54:52 +00:00
7941a8b1ed refactor: firefox: fix uBlock json indentation 2024-05-27 04:46:38 +00:00
bbcf8841ea todo.md: sync 2024-05-27 00:49:51 +00:00
063b0be5b6 hosts/modules/gui/greetd: remove 2024-05-27 00:44:01 +00:00
7e490f5c07 remove lingering references to sxmo 2024-05-27 00:38:30 +00:00
10a985e7f9 hosts/modules/gui/sxmo: remove 2024-05-27 00:27:53 +00:00
f3c3df2ca7 sxmo_suspend.sh: lift out of hosts/modules/gui/sxmo/hooks
i want to preserve this script for the future, while deleting the rest of my (unused) SXMO config
2024-05-27 00:23:50 +00:00
f477604063 hosts/modules/gui: remove gnome 2024-05-27 00:13:19 +00:00
d46fa8a242 swaync-fbcli: sandbox (experimental) 2024-05-27 00:11:20 +00:00
62b2eb874c swaync-service-dispatcher: sandbox 2024-05-27 00:07:30 +00:00
133c1b3699 swaync: remove unused systemd integrations
it's all s6 now
2024-05-27 00:06:03 +00:00
1b4300dbeb swaync: remove unused vpn button 2024-05-27 00:00:44 +00:00
a1c1a87dd8 nixpkgs: 2024-05-24 -> 2024-05-26; nixpkgs-wayland, sops-nix
```
• Updated input 'nixpkgs-next-unpatched':
    'github:nixos/nixpkgs/cc5c0d369b5e8f49705e2a2d7464e4b162804805' (2024-05-24)
  → 'github:nixos/nixpkgs/2baa940f86e1fc54757fd7d1ed551c0a38904bf2' (2024-05-26)
• Updated input 'nixpkgs-unpatched':
    'github:nixos/nixpkgs/2baa58d3488bd9cc4d53d6812509edc34a1c7e2a' (2024-05-24)
  → 'github:nixos/nixpkgs/7780e5160e011b39019797a4c4b1a4babc80d1bf' (2024-05-26)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/8746004cd97164c89f0997ea06642b819e5bc3fb' (2024-05-24)
  → 'github:nix-community/nixpkgs-wayland/397c85d463aef789a8dd24c4db467e9ad787907b' (2024-05-26)
• Updated input 'nixpkgs-wayland/lib-aggregate':
    'github:nix-community/lib-aggregate/5fa64b174daa22fe0d20ebbcc0ec2c7905b503f1' (2024-05-19)
  → 'github:nix-community/lib-aggregate/dbc9130fe1455e0f6ee4d8f5f799f9be551f866b' (2024-05-26)
• Updated input 'nixpkgs-wayland/lib-aggregate/nixpkgs-lib':
    'github:nix-community/nixpkgs.lib/0df131b5ee4d928a4b664b6d0cd99cf134d6ab6b' (2024-05-19)
  → 'github:nix-community/nixpkgs.lib/d0d27192931680482081aa1c38389da2af84a651' (2024-05-26)
• Updated input 'sops-nix':
    'github:Mic92/sops-nix/b549832718b8946e875c016a4785d204fcfc2e53' (2024-05-22)
  → 'github:Mic92/sops-nix/962797a8d7f15ed7033031731d0bb77244839960' (2024-05-26)
• Updated input 'sops-nix/nixpkgs-stable':
    'github:NixOS/nixpkgs/e7cc61784ddf51c81487637b3031a6dd2d6673a2' (2024-05-18)
  → 'github:NixOS/nixpkgs/59a450646ec8ee0397f5fa54a08573e8240eb91f' (2024-05-25)
```
2024-05-26 15:07:25 +00:00
92b9a56894 cleanup: remove unused secrets/common/wg/* 2024-05-26 14:37:33 +00:00
b159240b7f servo: import ovpn privkey 2024-05-26 14:37:33 +00:00
8a9f96eefc moby: import own OVPN privkey 2024-05-26 14:31:08 +00:00
af5aa15c23 cross: get passt to cross compile 2024-05-26 14:26:56 +00:00
a03099569c sanebox: fix bwrap+pasta DNS forwarding for hosts not using trust-dns 2024-05-26 14:26:56 +00:00
b1c7061b21 vpn: fix typos from previous 2 commits 2024-05-26 14:26:47 +00:00
c528bb3ec9 desko: add to OVPN 2024-05-26 14:07:32 +00:00
002639cc76 ovpn: use a single key per-device
this should fix the traffic collisions i'm seeing with the existing setup
2024-05-26 14:04:52 +00:00
45967fde7b brave: fix sandboxing under pasta/netns 2024-05-26 13:05:44 +00:00
ed97a81ef3 sane-vpn: use bwrap instead of just pasta so that the uids get mapped and programs can be happy 2024-05-26 13:04:13 +00:00
f158842c70 sanebox: fix uid mapping when bwrap uses the pasta backend 2024-05-26 13:03:50 +00:00
90d428be7f sane-vpn: allow sane-vpn do to work with no additional arguments 2024-05-26 11:33:12 +00:00
9d7b68eeb4 sane-tag-music: rewrite empty tracknumber tag to delete the tracknumber tag 2024-05-26 10:44:25 +00:00
8951df2e2c sane-scripts: set vim tags for python scripts 2024-05-26 10:42:12 +00:00
3a045f4d88 doc: polyunfill: point to https://github.com/NixOS/nixpkgs/pull/314791 2024-05-26 08:00:18 +00:00
57d6a9a4c3 polyunfill: simplify pam hacks 2024-05-26 07:04:12 +00:00
2ee39ca0cc poly_unfill: remove /run/wrappers/bin/unix_chkpwd
non-privileged users don't need to check passwords

well, maybe they do (for desktop unlockers), but i've already solved that :)
2024-05-26 06:37:59 +00:00
9d9211c5fa polyunfill: distribute /run/wrappers/bin/unix_chkpwd without suid bit 2024-05-26 01:18:30 +00:00
9ce7dcd57a /run/wrappers: remove unused newgidmap,newuidmap,newgrp binaries 2024-05-26 01:18:30 +00:00
af72f312d3 sandbox: remove /run/wrappers: SUID wrappers dont really accomplish much inside a namespace 2024-05-26 01:18:30 +00:00
efa1ee6c69 iproute2: disable sandbox and fix ip commands 2024-05-26 01:18:30 +00:00
6a15434cc6 net/vpn: remove the bridge devices from my VPN setup 2024-05-26 01:18:30 +00:00
59e4256dd8 sane-vpn: lint 2024-05-26 01:18:30 +00:00
6365bb7594 desko: disable wpa_supplicant/wireless networking again 2024-05-26 01:18:17 +00:00
8cb73687ce unl0kr: don't add extra deps to user's PATH 2024-05-26 01:17:42 +00:00
563 changed files with 43021 additions and 20114 deletions

View File

@@ -3,6 +3,7 @@ keys:
- &user_lappy_colin age1j2pqnl8j0krdzk6npe93s4nnqrzwx978qrc0u570gzlamqpnje9sc8le2g - &user_lappy_colin age1j2pqnl8j0krdzk6npe93s4nnqrzwx978qrc0u570gzlamqpnje9sc8le2g
- &user_servo_colin age1z8fauff34cdecr6sjkre260luzxcca05kpcwvhx988d306tpcejsp63znu - &user_servo_colin age1z8fauff34cdecr6sjkre260luzxcca05kpcwvhx988d306tpcejsp63znu
- &user_moby_colin age1zsrsvd7j6l62fjxpfd2qnhqlk8wk4p8r0dtxpe4sdgnh2474095qdu7xj9 - &user_moby_colin age1zsrsvd7j6l62fjxpfd2qnhqlk8wk4p8r0dtxpe4sdgnh2474095qdu7xj9
- &host_crappy age1hl50ufuxnqy0jnk8fqeu4tclh4vte2xn2d59pxff0gun20vsmv5sp78chj
- &host_desko age1vnw7lnfpdpjn62l3u5nyv5xt2c965k96p98kc43mcnyzpetrts9q54mc9v - &host_desko age1vnw7lnfpdpjn62l3u5nyv5xt2c965k96p98kc43mcnyzpetrts9q54mc9v
- &host_lappy age1w7mectcjku6x3sd8plm8wkn2qfrhv9n6zhzlf329e2r2uycgke8qkf9dyn - &host_lappy age1w7mectcjku6x3sd8plm8wkn2qfrhv9n6zhzlf329e2r2uycgke8qkf9dyn
- &host_servo age1tzlyex2z6t88tg9h82943e39shxhmqeyr7ywhlwpdjmyqsndv3qq27x0rf - &host_servo age1tzlyex2z6t88tg9h82943e39shxhmqeyr7ywhlwpdjmyqsndv3qq27x0rf
@@ -15,6 +16,7 @@ creation_rules:
- *user_lappy_colin - *user_lappy_colin
- *user_servo_colin - *user_servo_colin
- *user_moby_colin - *user_moby_colin
- *host_crappy
- *host_desko - *host_desko
- *host_lappy - *host_lappy
- *host_servo - *host_servo

View File

@@ -2,6 +2,8 @@
# .❄≡We|_c0m3 7o m`/ f14k≡❄. # .❄≡We|_c0m3 7o m`/ f14k≡❄.
(er, it's not a flake anymore. welcome to my nix files.)
## What's Here ## What's Here
this is the top-level repo from which i configure/deploy all my NixOS machines: this is the top-level repo from which i configure/deploy all my NixOS machines:
@@ -16,7 +18,6 @@ building [hosts/](./hosts/) will require [sops][sops].
you might specifically be interested in these files (elaborated further in #key-points-of-interest): you might specifically be interested in these files (elaborated further in #key-points-of-interest):
- ~~[`sxmo-utils`](./pkgs/additional/sxmo-utils/default.nix)~~ - ~~[`sxmo-utils`](./pkgs/additional/sxmo-utils/default.nix)~~
- ~~[example SXMO deployment](./hosts/modules/gui/sxmo/default.nix)~~
- these files will remain until my config settles down, but i no longer use or maintain SXMO. - these files will remain until my config settles down, but i no longer use or maintain SXMO.
- [my implementation of impermanence](./modules/persist/default.nix) - [my implementation of impermanence](./modules/persist/default.nix)
- my way of deploying dotfiles/configuring programs per-user: - my way of deploying dotfiles/configuring programs per-user:
@@ -30,11 +31,7 @@ you might specifically be interested in these files (elaborated further in #key-
## Using This Repo In Your Own Config ## Using This Repo In Your Own Config
this should be a pretty "standard" flake. just reference it, and import either follow the instructions [here][NUR] to access my packages through the Nix User Repositories.
- `nixosModules.sane` (for the modules)
- `overlays.pkgs` (for the packages)
or follow the instructions [here][NUR] to use it via the Nix User Repositories.
[NUR]: https://nur.nix-community.org/ [NUR]: https://nur.nix-community.org/
@@ -42,19 +39,15 @@ or follow the instructions [here][NUR] to use it via the Nix User Repositories.
- `doc/` - `doc/`
- instructions for tasks i find myself doing semi-occasionally in this repo. - instructions for tasks i find myself doing semi-occasionally in this repo.
- `hosts/` - `hosts/`
- the bulk of config which isn't factored with external use in mind. - configs which aren't factored with external use in mind.
- that is, if you were to add this repo to a flake.nix for your own use, - that is, if you were to add this repo to a flake.nix for your own use,
you won't likely be depending on anything in this directory. you won't likely be depending on anything in this directory.
- `integrations/` - `integrations/`
- code intended for consumption by external tools (e.g. the Nix User Repos) - code intended for consumption by external tools (e.g. the Nix User Repos).
- `modules/` - `modules/`
- config which is gated behind `enable` flags, in similar style to nixpkgs' - config which is gated behind `enable` flags, in similar style to nixpkgs' `nixos/` directory.
`nixos/` directory. - if you depend on this repo for anything besides packages, it's most likely for something in this directory.
- if you depend on this repo, it's most likely for something in this directory.
- `nixpatches/`
- literally, diffs i apply atop upstream nixpkgs before performing further eval.
- `overlays/` - `overlays/`
- exposed via the `overlays` output in `flake.nix`.
- predominantly a list of `callPackage` directives. - predominantly a list of `callPackage` directives.
- `pkgs/` - `pkgs/`
- derivations for things not yet packaged in nixpkgs. - derivations for things not yet packaged in nixpkgs.
@@ -62,13 +55,12 @@ or follow the instructions [here][NUR] to use it via the Nix User Repositories.
- inline code for wholly custom packages (e.g. `pkgs/additional/sane-scripts/` for CLI tools - inline code for wholly custom packages (e.g. `pkgs/additional/sane-scripts/` for CLI tools
that are highly specific to my setup). that are highly specific to my setup).
- `scripts/` - `scripts/`
- scripts which aren't reachable on a deployed system, but may aid manual deployments - scripts which aren't reachable on a deployed system, but may aid manual deployments.
- `secrets/` - `secrets/`
- encrypted keys, API tokens, anything which one or more of my machines needs - encrypted keys, API tokens, anything which one or more of my machines needs
read access to but shouldn't be world-readable. read access to but shouldn't be world-readable.
- not much to see here - not much to see here.
- `templates/` - `templates/`
- exposed via the `templates` output in `flake.nix`.
- used to instantiate short-lived environments. - used to instantiate short-lived environments.
- used to auto-fill the boiler-plate portions of new packages. - used to auto-fill the boiler-plate portions of new packages.

101
TODO.md
View File

@@ -1,23 +1,23 @@
## BUGS ## BUGS
- moby: megapixels doesn't load in sandbox - `rmDbusServices` may break sandboxing
- when moby wlan is explicitly set down (via ip link set wlan0 down), /var/lib/trust-dns/dhcp-configs doesn't get reset - e.g. if the package ships a systemd unit which references $out, then make-sandboxed won't properly update that unit.
- `rmDbusServicesInPlace` is not affected
- when moby wlan is explicitly set down (via ip link set wlan0 down), /var/lib/hickory-dns/dhcp-configs doesn't get reset
- `ip monitor` can detect those manual link state changes (NM-dispatcher it seems cannot) - `ip monitor` can detect those manual link state changes (NM-dispatcher it seems cannot)
- or try dnsmasq? - or try dnsmasq?
- trust-dns: can't recursively resolve api.mangadex.org - hickory-dns can't resolve `abs.twimg.com`
- and *sometimes* apple.com fails - hickory-dns can't resolve `social.kernel.org`
- wg-ovpnd-* interfaces don't work, because i use the same keys across all hosts... - hickory-dns can't resolve `pe.usps.com`
- and if i had them differ and simultaneously online, then i'd exceed the OVPN machine count. - hickory-dns can't resolve `social.seattle.wa.us`
- i should at least have them be up'd only on-demand. - hickory-dns can't resolve `support.mozilla.org`
- sandbox: link cache means that if i update ~/.config/... files inline, sandboxed programs still see the old version - sandbox: link cache means that if i update ~/.config/... files inline, sandboxed programs still see the old version
- mpv: continues to play past the end of some audio files
- mpv: audiocast has mpv sending its output to the builtin speakers unless manually changed - mpv: audiocast has mpv sending its output to the builtin speakers unless manually changed
- 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 - `ssh` access doesn't grant same linux capabilities as login
- ringer (i.e. dino incoming call) doesn't prevent moby from sleeping - syshud (volume overlay): when casting with `blast`, syshud doesn't react to volume changes
- sway mouse/kb hotplug doesn't work - moby: after bringing the modem up, powering it down loses *complete* net connectivity (i.e. wlan is gone as well)
- sysvol (volume overlay): when casting with `blast`, sysvol doesn't react to volume changes - dissent: if i launch it without net connectivity, it gets stuck at the login, and never tries again
- calls: seems that it starts before net access, and then is forever disconnected (until i manually restart it)
- moby: kaslr is effectively disabled - moby: kaslr is effectively disabled
- `dmesg | grep "KASLR disabled due to lack of seed"` - `dmesg | grep "KASLR disabled due to lack of seed"`
- fix by adding `kaslrseed` to uboot script before `booti` - fix by adding `kaslrseed` to uboot script before `booti`
@@ -26,12 +26,23 @@
- moby: bpf is effectively disabled? - moby: bpf is effectively disabled?
- `dmesg | grep 'systemd[1]: bpf-lsm: Failed to load BPF object: No such process'` - `dmesg | grep 'systemd[1]: bpf-lsm: Failed to load BPF object: No such process'`
- `dmesg | grep 'hid_bpf: error while preloading HID BPF dispatcher: -22'` - `dmesg | grep 'hid_bpf: error while preloading HID BPF dispatcher: -22'`
- `s6` is not re-entrant
- so if the desktop crashes, the login process from `unl0kr` fails to re-launch the GUI
- newflash on moby can't play videos
- "open in browser" works though -- in mpv
- gnome-maps can't use geoclue *and* openstreetmap at the same time
- get gnome-maps to speak xdg-desktop-portal, and this will be fixed
- epiphany can't save cookies
- see under "preferences", cookies are disabled
- prevents logging into websites (OpenStreetMap)
- works when sandbox is disabled
## REFACTORING: ## REFACTORING:
- REMOVE DEPRECATED `crypt` from sftpgo_auth_hook - add import checks to my Python nix-shell scripts
- consolidate ~/dev and ~/ref - consolidate ~/dev and ~/ref
- ~/dev becomes a link to ~/ref/cat/mine - ~/dev becomes a link to ~/ref/cat/mine
- fold hosts/common/home/ssh.nix -> hosts/common/users/colin.nix - fold hosts/common/home/ssh.nix -> hosts/common/users/colin.nix
- don't hardcode IP addresses so much in servo
### sops/secrets ### sops/secrets
- rework secrets to leverage `sane.fs` - rework secrets to leverage `sane.fs`
@@ -51,16 +62,26 @@
## IMPROVEMENTS: ## IMPROVEMENTS:
- systemd/journalctl: use a less shit pager - kernels: ship the same kernel on every machine
- there's an env var for it: SYSTEMD_PAGER? and a flag for journalctl - then i can tune the kernels for hardening, without duplicating that work 4 times
- zfs: replace this with something which doesn't require a custom kernel build
- mpv: add media looping controls (e.g. loop song, loop playlist)
- curlftpfs: replace with something better
- safer (rust? actively maintained? sandboxable?)
- handles spaces/symbols in filenames
- has better multi-stream perf (e.g. `sane-sync-music` should be able to copy N items in parallel)
- firefox: open *all* links (http, https, ...) with system handler
- removes the need for open-in-mpv, firefox-xdg-open, etc.
- matrix room links *just work*.
- `network.protocol-handler.external.https = true` in about:config *seems* to do this,
but breaks some webpages (e.g. Pleroma)
### security/resilience ### security/resilience
- validate duplicity backups! - enable `snapper` btrfs snapshots (`services.snapper`)
- encrypt more ~ dirs (~/archives, ~/records, ..?)
- best to do this after i know for sure i have good backups
- /mnt/desko/home, etc, shouldn't include secrets (~/private) - /mnt/desko/home, etc, shouldn't include secrets (~/private)
- 95% of its use is for remote media access and stuff which isn't in VCS (~/records) - 95% of its use is for remote media access and stuff which isn't in VCS (~/records)
- port all sane.programs to be sandboxed - port all sane.programs to be sandboxed
- sandbox `nix`
- enforce that all `environment.packages` has a sandbox profile (or explicitly opts out) - enforce that all `environment.packages` has a sandbox profile (or explicitly opts out)
- revisit "non-sandboxable" apps and check that i'm not actually just missing mountpoints - revisit "non-sandboxable" apps and check that i'm not actually just missing mountpoints
- LL_FS_RW=/ isn't enough -- need all mount points like `=/:/proc:/sys:...`. - LL_FS_RW=/ isn't enough -- need all mount points like `=/:/proc:/sys:...`.
@@ -69,25 +90,18 @@
- lock down dbus calls within the sandbox - lock down dbus calls within the sandbox
- otherwise anyone can `systemd-run --user ...` to potentially escape a sandbox - otherwise anyone can `systemd-run --user ...` to potentially escape a sandbox
- <https://github.com/flatpak/xdg-dbus-proxy> - <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 sanebox 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. - 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
- make dconf stuff less monolithic - make dconf stuff less monolithic
- i.e. per-app dconf profiles for those which need it. possible static config. - i.e. per-app dconf profiles for those which need it. possible static config.
- canaries for important services - flatpak/spectrum has some stuff to proxy dconf per-app
- e.g. daily email checks; daily backup checks
- integrate `nix check` into Gitea actions?
### user experience ### user experience
- rofi: sort items case-insensitively - 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 - replace starship prompt with something more efficient
- watch `forkstat`: it does way too much - watch `forkstat`: it does way too much
- cleanup waybar so that it's not invoking playerctl every 2 seconds - cleanup waybar/nwg-panel so that it's not invoking playerctl every 2 seconds
- nwg-panel: doesn't know that virtual-desktop 10/TV exists
- install apps: - install apps:
- display QR codes for WiFi endpoints: <https://linuxphoneapps.org/apps/noappid.wisperwind.wifi2qr/> - display QR codes for WiFi endpoints: <https://linuxphoneapps.org/apps/noappid.wisperwind.wifi2qr/>
- shopping list (not in nixpkgs): <https://linuxphoneapps.org/apps/ro.hume.cosmin.shoppinglist/> - shopping list (not in nixpkgs): <https://linuxphoneapps.org/apps/ro.hume.cosmin.shoppinglist/>
@@ -95,8 +109,9 @@
- offline docs viewer (gtk): <https://github.com/workbenchdev/Biblioteca> - offline docs viewer (gtk): <https://github.com/workbenchdev/Biblioteca>
- some type of games manager/launcher - some type of games manager/launcher
- Gnome Highscore (retro games)?: <https://gitlab.gnome.org/World/highscore> - Gnome Highscore (retro games)?: <https://gitlab.gnome.org/World/highscore>
- better maps for mobile (Osmin (QtQuick)? Pure Maps (Qt/Kirigami)? Gnome Maps is improved in 45) - better maps for mobile (Osmin (QtQuick)? Pure Maps (Qt/Kirigami)?)
- note-taking app: <https://linuxphoneapps.org/categories/note-taking/> - note-taking app: <https://linuxphoneapps.org/categories/note-taking/>
- Folio is nice, uses standard markdown, though it only supports flat repos
- OSK overlay specifically for mobile gaming - OSK overlay specifically for mobile gaming
- i.e. mock joysticks, for use with SuperTux and SuperTuxKart - i.e. mock joysticks, for use with SuperTux and SuperTuxKart
- install mobile-friendly games: - install mobile-friendly games:
@@ -112,29 +127,27 @@
#### moby #### moby
- fix cpuidle (gets better power consumption): <https://xnux.eu/log/077.html> - fix cpuidle (gets better power consumption): <https://xnux.eu/log/077.html>
- fix cpupower for better power/perf
- `journalctl -u cpupower --boot` (problem is present on lappy, at least)
- moby: tune keyboard layout - moby: tune keyboard layout
- SwayNC: - SwayNC: add option to change audio output
- don't show MPRIS if no players detected
- this is a problem of playerctld, i guess
- add option to change audio output
- fix colors (red alert) to match overall theme
- moby: tune GPS - moby: tune GPS
- run only geoclue, and not gpsd, to save power? - fix iio-sensor-proxy magnetometer scaling
- tune QGPS setting in eg25-control, for less jitter? - tune QGPS setting in eg25-control, for less jitter?
- direct mepo to prefer gpsd, with fallback to geoclue, for better accuracy?
- configure geoclue to do some smoothing? - configure geoclue to do some smoothing?
- manually do smoothing, as some layer between mepo and geoclue/gpsd? - manually do smoothing, as some layer between mepo and geoclue?
- moby: show battery state on ssh login - email wigle.net people to unlock API access
- moby: port `freshen-agps` timer service to s6 (maybe i want some `s6-cron` or something)
- moby: improve gPodder launch time - moby: improve gPodder launch time
- moby: theme GTK apps (i.e. non-adwaita styles) - moby: theme GTK apps (i.e. non-adwaita styles)
- especially, make the menubar collapsible - especially, make the menubar collapsible
- try Gradience tool specifically for theming adwaita? <https://linuxphoneapps.org/apps/com.github.gradienceteam.gradience/> - try Gradience tool specifically for theming adwaita? <https://linuxphoneapps.org/apps/com.github.gradienceteam.gradience/>
#### non-moby #### non-moby
- sane-tag-music: integrate `beets`/<https://beets.io/>
- this should be able to auto-tag a large part of my library
- RSS: integrate a paywall bypass - RSS: integrate a paywall bypass
- e.g. self-hosted [ladder](https://github.com/everywall/ladder) (like 12ft.io) - e.g. self-hosted [ladder](https://github.com/everywall/ladder) (like 12ft.io)
- RSS: have podcasts get downloaded straight into ~/Videos/...
- and strip the ads out using Whisper transcription + asking a LLM where the ad breaks are
- neovim: set up language server (lsp; rnix-lsp; nvim-lspconfig) - neovim: set up language server (lsp; rnix-lsp; nvim-lspconfig)
- neovim: integrate LLMs - neovim: integrate LLMs
- Helix: make copy-to-system clipboard be the default - Helix: make copy-to-system clipboard be the default
@@ -147,13 +160,15 @@
- have xdg-open parse `<repo:...> URIs (or adjust them so that it _can_ parse) - have xdg-open parse `<repo:...> URIs (or adjust them so that it _can_ parse)
- sane-bt-search: show details like 5.1 vs stereo, h264 vs h265 - sane-bt-search: show details like 5.1 vs stereo, h264 vs h265
- maybe just color these "keywords" in all search results? - maybe just color these "keywords" in all search results?
- transmission: apply `sane-tag-media` path fix in `torrent-done` script
- many .mkv files do appear to be tagged: i'd just need to add support in my own tooling
- uninsane.org: make URLs relative to allow local use (and as offline homepage) - uninsane.org: make URLs relative to allow local use (and as offline homepage)
- email: fix so that local mail doesn't go to junk - email: fix so that local mail doesn't go to junk
- git sendmail flow adds the DKIM signatures, but gets delivered locally w/o having the sig checked, so goes into Junk - git sendmail flow adds the DKIM signatures, but gets delivered locally w/o having the sig checked, so goes into Junk
- could change junk filter from "no DKIM success" to explicit "DKIM failed" - could change junk filter from "no DKIM success" to explicit "DKIM failed"
- add an auto-reply address (e.g. `reply-test@uninsane.org`) which reflects all incoming mail; use this (or a friend running this) for liveness checks
### perf ### perf
- debug nixos-rebuild times
- add `pkgs.impure-cached.<foo>` package set to build things with ccache enabled - add `pkgs.impure-cached.<foo>` package set to build things with ccache enabled
- every package here can be auto-generated, and marked with some env var so that it doesn't pollute the pure package set - every package here can be auto-generated, and marked with some env var so that it doesn't pollute the pure package set
- would be super handy for package prototyping! - would be super handy for package prototyping!

View File

@@ -1,9 +1,5 @@
# limited, non-flake interface to this repo. { ... }@args:
# this file exposes the same view into `pkgs` which the flake would see when evaluated. let
# sane-nix-files = import ./pkgs/additional/sane-nix-files { };
# the primary purpose of this file is so i can run `updateScript`s which expect in
# the root to be `default.nix` import "${sane-nix-files}/impure.nix" args
{ pkgs ? import <nixpkgs> {} }:
pkgs.appendOverlays [
(import ./overlays/all.nix)
]

25
doc/adding-a-host.md Normal file
View File

@@ -0,0 +1,25 @@
to add a host:
- create the new nix targets
- hosts/by-name/HOST
- let the toplevel (flake.nix) know about HOST
- build and flash an image
- optionally expand the rootfs
- `cfdisk /dev/sda2` -> resize partition
- `mount /dev/sda2 boot`
- `btrfs filesystem resize max root`
- setup required persistent directories
- `mkdir -p root/persist/private`
- `gocryptfs -init root/persist/private`
- then boot the device, and for every dangling symlink in ~/.local/share, ~/.cache, do `mkdir -p` on it
- setup host ssh
- `mkdir -p root/persist/plaintext/etc/ssh/host_keys`
- boot the machine and let it create its own ssh keys
- add the pubkey to `hosts/common/hosts.nix`
- setup user ssh
- `ssh-keygen`. don't enter any password; it's stored in a password-encrypted fs.
- add the pubkey to `hosts/common/hosts.nix`
- allow the new host to view secrets
- instructions in hosts/common/secrets.nix
- run `ssh-to-age` on user/host pubkeys
- add age key to .sops.yaml
- update encrypted secrets: `sops updatekeys path/to/secret.yaml`

12
doc/recovery.md Normal file
View File

@@ -0,0 +1,12 @@
## deploying to SD card
- build a toplevel config: `nix build '.#hostSystems.moby'`
- mount a system:
- `mkdir -p root/{nix,boot}`
- `mount /dev/sdX1 root/boot`
- `mount /dev/sdX2 root/nix`
- copy the config:
- `sudo nix copy --no-check-sigs --to root/ $(readlink result)`
- nix will copy stuff to `root/nix/store`
- install the boot files:
- `sudo /nix/store/sbwpwngjlgw4f736ay9hgi69pj3fdwk5-extlinux-conf-builder.sh -d ./root/boot -t 5 -c $(readlink ./result)`
- extlinux-conf-builder can be found in `/run/current-system/bin/switch-to-configuration`

330
flake.lock generated
View File

@@ -1,330 +0,0 @@
{
"nodes": {
"flake-compat": {
"locked": {
"lastModified": 1688025799,
"narHash": "sha256-ktpB4dRtnksm9F5WawoIkEneh1nrEvuxb5lJFt1iOyw=",
"owner": "nix-community",
"repo": "flake-compat",
"rev": "8bf105319d44f6b9f0d764efa4fdef9f1cc9ba1c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs-wayland",
"nix-eval-jobs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1712014858,
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"lib-aggregate": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1716120557,
"narHash": "sha256-rvNq9YolMY1DRMgwdAti8qwNDjkhTsotSWa15/Ch7+A=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "5fa64b174daa22fe0d20ebbcc0ec2c7905b503f1",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "lib-aggregate",
"type": "github"
}
},
"mobile-nixos": {
"flake": false,
"locked": {
"lastModified": 1694749521,
"narHash": "sha256-MiVokKlpcJmfoGuWAMeW1En7gZ5hk0rCQArYm6P9XCc=",
"owner": "nixos",
"repo": "mobile-nixos",
"rev": "d25d3b87e7f300d8066e31d792337d9cd7ecd23b",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "d25d3b87e7f300d8066e31d792337d9cd7ecd23b",
"repo": "mobile-nixos",
"type": "github"
}
},
"nix-eval-jobs": {
"inputs": {
"flake-parts": "flake-parts",
"nix-github-actions": "nix-github-actions",
"nixpkgs": "nixpkgs",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1715804156,
"narHash": "sha256-GtIHP86Cz1kD9xZO/cKbNQACHKdoT9WFbLJAq6W2EDY=",
"owner": "nix-community",
"repo": "nix-eval-jobs",
"rev": "bb95091f6c6f38f6cfc215a1797a2dd466312c8b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-eval-jobs",
"type": "github"
}
},
"nix-github-actions": {
"inputs": {
"nixpkgs": [
"nixpkgs-wayland",
"nix-eval-jobs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1703863825,
"narHash": "sha256-rXwqjtwiGKJheXB43ybM8NwWB8rO2dSRrEqes0S7F5Y=",
"owner": "nix-community",
"repo": "nix-github-actions",
"rev": "5163432afc817cf8bd1f031418d1869e4c9d5547",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-github-actions",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1715037484,
"narHash": "sha256-OUt8xQFmBU96Hmm4T9tOWTu4oCswCzoVl+pxSq/kiFc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ad7efee13e0d216bf29992311536fce1d3eefbef",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1716079763,
"narHash": "sha256-DGRfb7fO7c3XDS3twmuaV5NAGPPdU3W7Q35fjIZc8iY=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "0df131b5ee4d928a4b664b6d0cd99cf134d6ab6b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-next-unpatched": {
"locked": {
"lastModified": 1716573668,
"narHash": "sha256-K+8vYJtu7X+qQ1Q66kYTheq0IKKVyPMOMclY9oJYnS8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cc5c0d369b5e8f49705e2a2d7464e4b162804805",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "staging-next",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1716061101,
"narHash": "sha256-H0eCta7ahEgloGIwE/ihkyGstOGu+kQwAiHvwVoXaA0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e7cc61784ddf51c81487637b3031a6dd2d6673a2",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-unpatched": {
"locked": {
"lastModified": 1716592782,
"narHash": "sha256-aGafFFAkQwkiBXo+ocx4sCco+L233JqlUZhVfXceaQY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2baa58d3488bd9cc4d53d6812509edc34a1c7e2a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "master",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-wayland": {
"inputs": {
"flake-compat": "flake-compat",
"lib-aggregate": "lib-aggregate",
"nix-eval-jobs": "nix-eval-jobs",
"nixpkgs": [
"nixpkgs-unpatched"
]
},
"locked": {
"lastModified": 1716589021,
"narHash": "sha256-m7+ogvgw6tCk5P1H9OqS2yTFlZOus9I+Genv3PUWkno=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "8746004cd97164c89f0997ea06642b819e5bc3fb",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"type": "github"
}
},
"root": {
"inputs": {
"mobile-nixos": "mobile-nixos",
"nixpkgs-next-unpatched": "nixpkgs-next-unpatched",
"nixpkgs-unpatched": "nixpkgs-unpatched",
"nixpkgs-wayland": "nixpkgs-wayland",
"sops-nix": "sops-nix",
"uninsane-dot-org": "uninsane-dot-org"
}
},
"sops-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs-unpatched"
],
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1716400300,
"narHash": "sha256-0lMkIk9h3AzOHs1dCL9RXvvN4PM8VBKb+cyGsqOKa4c=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "b549832718b8946e875c016a4785d204fcfc2e53",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "sops-nix",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs-wayland",
"nix-eval-jobs",
"nixpkgs"
]
},
"locked": {
"lastModified": 1711963903,
"narHash": "sha256-N3QDhoaX+paWXHbEXZapqd1r95mdshxToGowtjtYkGI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "49dc4a92b02b8e68798abd99184f228243b6e3ac",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"uninsane-dot-org": {
"inputs": {
"nixpkgs": [
"nixpkgs-unpatched"
]
},
"locked": {
"lastModified": 1715894399,
"narHash": "sha256-h1EdA/h74zgNPNEYbH+0mgOMlJgLVcxuZ8/ewsZlgEc=",
"ref": "refs/heads/master",
"rev": "e6f88f563bdd1700c04018951de4f69862646dd1",
"revCount": 240,
"type": "git",
"url": "https://git.uninsane.org/colin/uninsane"
},
"original": {
"type": "git",
"url": "https://git.uninsane.org/colin/uninsane"
}
}
},
"root": "root",
"version": 7
}

658
flake.nix
View File

@@ -1,658 +0,0 @@
# FLAKE FEEDBACK:
# - if flake inputs are meant to be human-readable, a human should be able to easily track them down given the URL.
# - this is not the case with registry URLs, like `nixpkgs/nixos-22.11`.
# - this is marginally the case with schemes like `github:nixos/nixpkgs`.
# - given the *existing* `git+https://` scheme, i propose expressing github URLs similarly:
# - `github+https://github.com/nixos/nixpkgs/tree/nixos-22.11`
# - this would allow for the same optimizations as today's `github:nixos/nixpkgs`, but without obscuring the source.
# a code reader could view the source being referenced simply by clicking the https:// portion of that URI.
# - need some way to apply local patches to inputs.
#
#
# DEVELOPMENT DOCS:
# - Flake docs: <https://nixos.wiki/wiki/Flakes>
# - Flake RFC: <https://github.com/tweag/rfcs/blob/flakes/rfcs/0049-flakes.md>
# - Discussion: <https://github.com/NixOS/rfcs/pull/49>
# - <https://serokell.io/blog/practical-nix-flakes>
#
#
# COMMON OPERATIONS:
# - update a specific flake input:
# - `nix flake lock --update-input nixpkgs`
{
# XXX: use the `github:` scheme instead of the more readable git+https: because it's *way* more efficient
# preferably, i would rewrite the human-readable https URLs to nix-specific github: URLs with a helper,
# but `inputs` is required to be a strict attrset: not an expression.
inputs = {
# branch workflow:
# - daily:
# - nixos-unstable cut from master after enough packages have been built in caches.
# - every 6 hours:
# - master auto-merged into staging and staging-next
# - staging-next auto-merged into staging.
# - manually, approximately once per month:
# - staging-next is cut from staging.
# - staging-next merged into master.
#
# which branch to source from?
# - nixos-unstable: for everyday development; it provides good caching
# - master: temporarily if i'm otherwise cherry-picking lots of already-applied patches
# - staging-next: if testing stuff that's been PR'd into staging, i.e. base library updates.
# - staging: maybe if no staging-next -> master PR has been cut yet?
#
# <https://github.com/nixos/nixpkgs/tree/nixos-unstable>
# nixpkgs-unpatched.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nixpkgs-unpatched.url = "github:nixos/nixpkgs?ref=master";
# nixpkgs-unpatched.url = "github:nixos/nixpkgs?ref=nixos-staging";
# nixpkgs-unpatched.url = "github:nixos/nixpkgs?ref=nixos-staging-next";
nixpkgs-next-unpatched.url = "github:nixos/nixpkgs?ref=staging-next";
nixpkgs-wayland = {
url = "github:nix-community/nixpkgs-wayland";
inputs.nixpkgs.follows = "nixpkgs-unpatched";
};
mobile-nixos = {
# <https://github.com/nixos/mobile-nixos>
# only used for building disk images, not relevant after deployment
# TODO: replace with something else. commit `0f3ac0bef1aea70254a3bae35e3cc2561623f4c1`
# replaces the imageBuilder with a "new implementation from celun" and wildly breaks my use.
# pinning to d25d3b... is equivalent to holding at 2023-09-15
url = "github:nixos/mobile-nixos?ref=d25d3b87e7f300d8066e31d792337d9cd7ecd23b";
flake = false;
};
sops-nix = {
# <https://github.com/Mic92/sops-nix>
# used to distribute secrets to my hosts
url = "github:Mic92/sops-nix";
# inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs-unpatched";
};
uninsane-dot-org = {
# provides the package to deploy <https://uninsane.org>, used only when building the servo host
url = "git+https://git.uninsane.org/colin/uninsane";
# inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs-unpatched";
};
};
outputs = {
self,
nixpkgs-unpatched,
nixpkgs-next-unpatched ? nixpkgs-unpatched,
nixpkgs-wayland,
mobile-nixos,
sops-nix,
uninsane-dot-org,
...
}@inputs:
let
inherit (builtins) attrNames elem listToAttrs map mapAttrs;
# redefine some nixpkgs `lib` functions to avoid the infinite recursion
# of if we tried to use patched `nixpkgs.lib` as part of the patching process.
mapAttrs' = f: set:
listToAttrs (map (attr: f attr set.${attr}) (attrNames set));
optionalAttrs = cond: attrs: if cond then attrs else {};
# mapAttrs but without the `name` argument
mapAttrValues = f: mapAttrs (_: f);
# rather than apply our nixpkgs patches as a flake input, do that here instead.
# this (temporarily?) resolves the bad UX wherein a subflake residing in the same git
# repo as the main flake causes the main flake to have an unstable hash.
patchNixpkgs = variant: nixpkgs: (import ./nixpatches/flake.nix).outputs {
inherit variant nixpkgs;
self = patchNixpkgs variant nixpkgs;
};
nixpkgs' = patchNixpkgs "master" nixpkgs-unpatched;
nixpkgsCompiledBy = system: nixpkgs'.legacyPackages."${system}";
evalHost = { name, local, target, variant ? null, nixpkgs ? nixpkgs' }: nixpkgs.lib.nixosSystem {
system = target;
modules = [
{
nixpkgs.buildPlatform.system = local;
}
(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 (variant == "light") {
sane.maxBuildCost = 2;
})
(optionalAttrs (variant == "min") {
sane.maxBuildCost = 0;
})
(import ./hosts/instantiate.nix { hostName = name; })
self.nixosModules.default
self.nixosModules.passthru
{
nixpkgs.overlays = [
self.overlays.passthru
self.overlays.sane-all
];
}
];
};
in {
nixosConfigurations = let
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"; 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"; 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"; 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: {
name = "${h}-next";
value = v // { nixpkgs = patchNixpkgs "staging-next" nixpkgs-next-unpatched; };
}) hosts;
in mapAttrValues evalHost (
hosts // hostsNext
);
# unofficial output
# this produces a EFI-bootable .img file (GPT with a /boot partition and a system (/ or /nix) partition).
# after building this:
# - flash it to a bootable medium (SD card, flash drive, HDD)
# - resize the root partition (use cfdisk)
# - mount the part
# - chown root:nixbld <part>/nix/store
# - chown root:root -R <part>/nix/store/*
# - chown root:root -R <part>/persist # if using impermanence
# - populate any important things (persist/, home/colin/.ssh, etc)
# - boot
# - if fs wasn't resized automatically, then `sudo btrfs filesystem resize max /`
# - checkout this flake into /etc/nixos AND UPDATE THE FS UUIDS.
# - `nixos-rebuild --flake './#<host>' switch`
imgs = mapAttrValues (host: host.config.system.build.img) self.nixosConfigurations;
# unofficial output
hostConfigs = mapAttrValues (host: host.config) self.nixosConfigurations;
hostSystems = mapAttrValues (host: host.config.system.build.toplevel) self.nixosConfigurations;
hostPkgs = mapAttrValues (host: host.config.system.build.pkgs) self.nixosConfigurations;
hostPrograms = mapAttrValues (host: mapAttrValues (p: p.package) host.config.sane.programs) self.nixosConfigurations;
patched.nixpkgs = nixpkgs';
overlays = {
# N.B.: `nix flake check` requires every overlay to take `final: prev:` at defn site,
# hence the weird redundancy.
default = final: prev: self.overlays.pkgs final prev;
sane-all = final: prev: import ./overlays/all.nix final prev;
pkgs = final: prev: import ./overlays/pkgs.nix final prev;
pins = final: prev: import ./overlays/pins.nix final prev;
preferences = final: prev: import ./overlays/preferences.nix final prev;
passthru = final: prev:
let
mobile = (import "${mobile-nixos}/overlay/overlay.nix");
uninsane = uninsane-dot-org.overlays.default;
wayland = final: prev: {
# default is to dump the packages into `waylandPkgs` *and* the toplevel.
# but i just want the `waylandPkgs` set
inherit (nixpkgs-wayland.overlays.default final prev)
waylandPkgs
new-wayland-protocols #< 2024/03/10: nixpkgs-wayland assumes this will be in the toplevel
;
};
in
(mobile final prev)
// (uninsane final prev)
// (wayland final prev)
;
};
nixosModules = rec {
default = sane;
sane = import ./modules;
passthru = { ... }: {
imports = [
sops-nix.nixosModules.sops
];
};
};
# this includes both our native packages and all the nixpkgs packages.
legacyPackages =
let
allPkgsFor = sys: (nixpkgsCompiledBy sys).appendOverlays [
self.overlays.passthru self.overlays.pkgs
];
in {
x86_64-linux = allPkgsFor "x86_64-linux";
aarch64-linux = allPkgsFor "aarch64-linux";
};
# extract only our own packages from the full set.
# because of `nix flake check`, we flatten the package set and only surface x86_64-linux packages.
packages = mapAttrs
(system: passthruPkgs: passthruPkgs.lib.filterAttrs
(name: pkg:
# keep only packages which will pass `nix flake check`, i.e. keep only:
# - derivations (not package sets)
# - packages that build for the given platform
(! elem name [ "feeds" "pythonPackagesExtensions" ])
&& (passthruPkgs.lib.meta.availableOn passthruPkgs.stdenv.hostPlatform pkg)
)
(
# expose sane packages and chosen inputs (uninsane.org)
(import ./pkgs { pkgs = passthruPkgs; }) // {
inherit (passthruPkgs) uninsane-dot-org;
}
)
)
# self.legacyPackages;
{
x86_64-linux = (nixpkgsCompiledBy "x86_64-linux").appendOverlays [
self.overlays.passthru
];
}
;
apps."x86_64-linux" =
let
pkgs = self.legacyPackages."x86_64-linux";
sanePkgs = import ./pkgs { inherit pkgs; };
deployScript = host: addr: action: pkgs.writeShellScript "deploy-${host}" ''
set -e
host="${host}"
addr="${addr}"
action="${if action != null then action else ""}"
runOnTarget() {
# run the command ($@) on the machine we're deploying to.
# if that's a remote machine, then do it via ssh, else local shell.
if [ -n "$addr" ]; then
ssh "$addr" "$@"
else
"$@"
fi
}
nix build ".#nixosConfigurations.$host.config.system.build.toplevel" --out-link "./build/result-$host" "$@"
storePath="$(readlink ./build/result-$host)"
# mimic `nixos-rebuild --target-host`, in effect:
# - nix-copy-closure ...
# - nix-env --set ...
# - switch-to-configuration <boot|dry-activate|switch|test|>
# avoid the actual `nixos-rebuild` for a few reasons:
# - fewer nix evals
# - more introspectability and debuggability
# - 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_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.
nix copy -vv --option builders-use-substitutes false --to "ssh-ng://$addr" "$storePath"
fi
if [ -n "$action" ]; then
runOnTarget sudo nix-env -p /nix/var/nix/profiles/system --set "$storePath"
runOnTarget sudo "$storePath/bin/switch-to-configuration" "$action"
fi
'';
deployApp = host: addr: action: {
type = "app";
program = ''${deployScript host addr action}'';
};
# pkg updating.
# a cleaner alternative lives here: <https://discourse.nixos.org/t/how-can-i-run-the-updatescript-of-personal-packages/25274/2>
# mkUpdater :: [ String ] -> { type = "app"; program = path; }
mkUpdater = attrPath: {
type = "app";
program = let
pkg = pkgs.lib.getAttrFromPath attrPath sanePkgs;
strAttrPath = pkgs.lib.concatStringsSep "." attrPath;
commandArgv = pkg.updateScript.command or pkg.updateScript;
command = pkgs.lib.escapeShellArgs commandArgv;
in builtins.toString (pkgs.writeShellScript "update-${strAttrPath}" ''
export UPDATE_NIX_NAME=${pkg.name}
export UPDATE_NIX_PNAME=${pkg.pname}
export UPDATE_NIX_OLD_VERSION=${pkg.version}
export UPDATE_NIX_ATTR_PATH=${strAttrPath}
${command}
'');
};
mkUpdatersNoAliases = opts: basePath: pkgs.lib.concatMapAttrs
(name: pkg:
if pkg.recurseForDerivations or false then {
"${name}" = mkUpdaters opts (basePath ++ [ name ]);
} else if pkg.updateScript or null != null then {
"${name}" = mkUpdater (basePath ++ [ name ]);
} else {}
)
(pkgs.lib.getAttrFromPath basePath sanePkgs);
mkUpdaters = { ignore ? [], flakePrefix ? [] }@opts: basePath:
let
updaters = mkUpdatersNoAliases opts basePath;
invokeUpdater = name: pkg:
let
fullPath = basePath ++ [ name ];
doUpdateByDefault = !builtins.elem fullPath ignore;
# in case `name` has a `.` in it, we have to quote it
escapedPath = builtins.map (p: ''"${p}"'') fullPath;
updatePath = builtins.concatStringsSep "." (flakePrefix ++ escapedPath);
in pkgs.lib.optionalString doUpdateByDefault (
pkgs.lib.escapeShellArgs [
"nix" "run" ".#${updatePath}"
]
);
in {
type = "app";
# top-level app just invokes the updater of everything one layer below it
program = builtins.toString (pkgs.writeShellScript
(builtins.concatStringsSep "-" (flakePrefix ++ basePath))
(builtins.concatStringsSep
"\n"
(pkgs.lib.mapAttrsToList invokeUpdater updaters)
)
);
} // updaters;
in {
help = {
type = "app";
program = let
helpMsg = builtins.toFile "nixos-config-help-message" ''
commands:
- `nix run '.#help'`
- show this message
- `nix run '.#update.pkgs'`
- updates every package
- `nix run '.#update.feeds'`
- updates metadata for all feeds
- `nix run '.#init-feed' <url>`
- `nix run '.#deploy.{desko,lappy,moby,servo}[-light|-test]' [nix args ...]`
- build and deploy the host
- `nix run '.#preDeploy.{desko,lappy,moby,servo}[-light]' [nix args ...]`
- copy closures to a host, but don't activate it
- or `nix run '.#preDeploy'` to target all hosts
- `nix run '.#check'`
- make sure all systems build; NUR evaluates
- `nix run '.#bench'`
- benchmark the eval time of common targets this flake provides
specific build targets of interest:
- `nix build '.#imgs.rescue'`
'';
in builtins.toString (pkgs.writeShellScript "nixos-config-help" ''
cat ${helpMsg}
echo ""
echo "complete flake structure:"
nix flake show --option allow-import-from-derivation true
'');
};
# wrangle some names to get package updaters which refer back into the flake, but also conditionally ignore certain paths (e.g. sane.feeds).
# TODO: better design
update = rec {
_impl.pkgs.sane = mkUpdaters { flakePrefix = [ "update" "_impl" "pkgs" ]; ignore = [ [ "sane" "feeds" ] ]; } [ "sane" ];
pkgs = _impl.pkgs.sane;
_impl.feeds.sane.feeds = mkUpdaters { flakePrefix = [ "update" "_impl" "feeds" ]; } [ "sane" "feeds" ];
feeds = _impl.feeds.sane.feeds;
};
init-feed = {
type = "app";
program = "${pkgs.feeds.init-feed}";
};
deploy = {
desko = deployApp "desko" "desko" "switch";
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-min = deployApp "$(hostname)-min" "" "switch";
type = "app";
program = builtins.toString (pkgs.writeShellScript "deploy-all" ''
nix run '.#deploy.lappy'
nix run '.#deploy.moby'
nix run '.#deploy.desko'
nix run '.#deploy.servo'
'');
};
preDeploy = {
# build the host and copy the runtime closure to that host, but don't activate it.
desko = deployApp "desko" "desko" null;
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 -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' -- "$@"
nix run '.#preDeploy.lappy' -- "$@"
nix run '.#preDeploy.servo' -- "$@"
nix run '.#preDeploy.moby' -- "$@"
nix run '.#preDeploy.desko' -- "$@"
'');
};
sync = {
type = "app";
program = builtins.toString (pkgs.writeShellScript "sync-all" ''
RC_lappy=$(nix run '.#sync.lappy' -- "$@")
RC_moby=$(nix run '.#sync.moby' -- "$@")
RC_desko=$(nix run '.#sync.desko' -- "$@")
echo "lappy: $RC_lappy"
echo "moby: $RC_moby"
echo "desko: $RC_desko"
'');
};
sync.desko = {
# copy music from servo to desko
# can run this from any device that has ssh access to desko and servo
type = "app";
program = builtins.toString (pkgs.writeShellScript "sync-to-desko" ''
sudo mount /mnt/desko/home
${pkgs.sane-scripts.sync-music}/bin/sane-sync-music --compat /mnt/servo/media/Music /mnt/desko/home/Music "$@"
'');
};
sync.lappy = {
# copy music from servo to lappy
# can run this from any device that has ssh access to lappy and servo
type = "app";
program = builtins.toString (pkgs.writeShellScript "sync-to-lappy" ''
sudo mount /mnt/lappy/home
${pkgs.sane-scripts.sync-music}/bin/sane-sync-music --compress --compat /mnt/servo/media/Music /mnt/lappy/home/Music "$@"
'');
};
sync.moby = {
# copy music from servo to moby
# can run this from any device that has ssh access to moby and servo
type = "app";
program = builtins.toString (pkgs.writeShellScript "sync-to-moby" ''
sudo mount /mnt/moby/home
sudo mount /mnt/desko/home
${pkgs.rsync}/bin/rsync -arv --exclude servo-macros /mnt/moby/home/Pictures/ /mnt/desko/home/Pictures/moby/
# N.B.: limited by network/disk -> reduce job count to improve pause/resume behavior
${pkgs.sane-scripts.sync-music}/bin/sane-sync-music --compress --compat --jobs 4 /mnt/servo/media/Music /mnt/moby/home/Music "$@"
'');
};
check = {
type = "app";
program = builtins.toString (pkgs.writeShellScript "check-all" ''
nix run '.#check.nur'
RC0=$?
nix run '.#check.hostConfigs'
RC1=$?
nix run '.#check.rescue'
RC2=$?
echo "nur: $RC0"
echo "hostConfigs: $RC1"
echo "rescue: $RC2"
exit $(($RC0 | $RC1 | $RC2))
'');
};
check.nur = {
# `nix run '.#check-nur'`
# validates that my repo can be included in the Nix User Repository
type = "app";
program = builtins.toString (pkgs.writeShellScript "check-nur" ''
cd ${./.}/integrations/nur
NIX_PATH= NIXPKGS_ALLOW_UNSUPPORTED_SYSTEM=1 nix-env -f . -qa \* --meta --xml \
--allowed-uris https://static.rust-lang.org \
--option restrict-eval true \
--option allow-import-from-derivation true \
--drv-path --show-trace \
-I nixpkgs=${nixpkgs-unpatched} \
-I nixpkgs-overlays=${./.}/hosts/common/nix/overlay \
-I ../../ \
| tee # tee to prevent interactive mode
'');
};
check.hostConfigs = {
type = "app";
program = let
checkHost = host: let
shellHost = pkgs.lib.replaceStrings [ "-" ] [ "_" ] host;
in ''
nix build -v '.#nixosConfigurations.${host}.config.system.build.toplevel' --out-link ./build/result-${host} -j2 "$@"
RC_${shellHost}=$?
'';
in builtins.toString (pkgs.writeShellScript
"check-host-configs"
''
# 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"}
${checkHost "desko"}
${checkHost "lappy"}
${checkHost "servo"}
${checkHost "moby"}
${checkHost "rescue"}
# still want to build the -light variants first so as to avoid multiple simultaneous webkitgtk builds
${checkHost "desko-light-next"}
${checkHost "moby-light-next"}
${checkHost "desko-next"}
${checkHost "lappy-next"}
${checkHost "servo-next"}
${checkHost "moby-next"}
${checkHost "rescue-next"}
echo "desko: $RC_desko"
echo "lappy: $RC_lappy"
echo "servo: $RC_servo"
echo "moby: $RC_moby"
echo "rescue: $RC_rescue"
echo "desko-next: $RC_desko_next"
echo "lappy-next: $RC_lappy_next"
echo "servo-next: $RC_servo_next"
echo "moby-next: $RC_moby_next"
echo "rescue-next: $RC_rescue_next"
# i don't really care if the -next hosts fail. i build them mostly to keep the cache fresh/ready
exit $(($RC_desko | $RC_lappy | $RC_servo | $RC_moby | $RC_rescue))
''
);
};
check.rescue = {
type = "app";
program = builtins.toString (pkgs.writeShellScript "check-rescue" ''
nix build -v '.#imgs.rescue' --out-link ./build/result-rescue-img -j2
'');
};
bench = {
type = "app";
program = builtins.toString (pkgs.writeShellScript "bench" ''
doBench() {
attrPath="$1"
shift
echo -n "benchmarking eval of '$attrPath'... "
/run/current-system/sw/bin/time -f "%e sec" -o /dev/stdout \
nix eval --no-eval-cache --quiet --raw ".#$attrPath" --apply 'result: if result != null then "" else "unexpected null"' $@ 2> /dev/null
}
if [ -n "$1" ]; then
doBench "$@"
else
doBench hostConfigs
doBench hostConfigs.lappy
doBench hostConfigs.lappy.sane.programs
doBench hostConfigs.lappy.sane.users.colin
doBench hostConfigs.lappy.sane.fs
doBench hostConfigs.lappy.environment.systemPackages
fi
'');
};
};
templates = {
env.python-data = {
# initialize with:
# - `nix flake init -t '/home/colin/dev/nixos/#env.python-data'`
# then enter with:
# - `nix develop`
path = ./templates/env/python-data;
description = "python environment for data processing";
};
pkgs.rust-inline = {
# initialize with:
# - `nix flake init -t '/home/colin/dev/nixos/#pkgs.rust-inline'`
path = ./templates/pkgs/rust-inline;
description = "rust package and development environment (inline rust sources)";
};
pkgs.rust = {
# initialize with:
# - `nix flake init -t '/home/colin/dev/nixos/#pkgs.rust'`
path = ./templates/pkgs/rust;
description = "rust package fit to ship in nixpkgs";
};
pkgs.make = {
# initialize with:
# - `nix flake init -t '/home/colin/dev/nixos/#pkgs.make'`
path = ./templates/pkgs/make;
description = "default Makefile-based derivation";
};
};
};
}

View File

@@ -0,0 +1,45 @@
# Samsung chromebook XE303C12
# - <https://wiki.postmarketos.org/wiki/Samsung_Chromebook_(google-snow)>
{ ... }:
{
imports = [
./fs.nix
];
sane.hal.samsung.enable = true;
sane.roles.client = true;
# sane.roles.pc = true;
users.users.colin.initialPassword = "147147";
sane.programs.sway.enableFor.user.colin = true;
sane.programs.calls.enableFor.user.colin = false;
sane.programs.consoleMediaUtils.enableFor.user.colin = true;
sane.programs.epiphany.enableFor.user.colin = true;
sane.programs.geary.enableFor.user.colin = false;
# sane.programs.firefox.enableFor.user.colin = true;
sane.programs.portfolio-filemanager.enableFor.user.colin = true;
sane.programs.signal-desktop.enableFor.user.colin = false;
sane.programs.wike.enableFor.user.colin = true;
sane.programs.dino.config.autostart = false;
sane.programs.dissent.config.autostart = false;
sane.programs.fractal.config.autostart = false;
sane.programs.sway.config.mod = "Mod1"; #< alt key instead of Super
# sane.programs.guiApps.enableFor.user.colin = false;
# sane.programs.pcGuiApps.enableFor.user.colin = false; #< errors!
sane.programs.blueberry.enableFor.user.colin = false; # bluetooth manager: doesn't cross compile!
# sane.programs.brave.enableFor.user.colin = false; # 2024/06/03: fails eval if enabled on cross
# sane.programs.firefox.enableFor.user.colin = false; # 2024/06/03: this triggers an eval error in yarn stuff -- i'm doing IFD somewhere!!?
sane.programs.mepo.enableFor.user.colin = false; # 2024/06/04: doesn't cross compile (nodejs)
sane.programs.mercurial.enableFor.user.colin = false; # 2024/06/03: does not cross compile
sane.programs.nixpkgs-review.enableFor.user.colin = false; # 2024/06/03: OOMs when cross compiling
sane.programs.ntfy-sh.enableFor.user.colin = false; # 2024/06/04: doesn't cross compile (nodejs)
sane.programs.pwvucontrol.enableFor.user.colin = false; # 2024/06/03: doesn't cross compile (libspa-sys)
sane.programs."sane-scripts.bt-search".enableFor.user.colin = false; # 2024/06/03: does not cross compile
sane.programs.sequoia.enableFor.user.colin = false; # 2024/06/03: does not cross compile
sane.programs.zathura.enableFor.user.colin = false; # 2024/06/03: does not cross compile
}

View File

@@ -0,0 +1,16 @@
{ ... }:
{
fileSystems."/nix" = {
device = "/dev/disk/by-uuid/55555555-0303-0c12-86df-eda9e9311526";
fsType = "btrfs";
options = [
"compress=zstd"
"defaults"
];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/303C-5A37";
fsType = "vfat";
};
}

View File

@@ -1,16 +1,22 @@
{ config, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ imports = [
./fs.nix ./fs.nix
]; ];
sane.services.trust-dns.asSystemResolver = false; # TEMPORARY: TODO: re-enable trust-dns sane.services.hickory-dns.asSystemResolver = false; # TEMPORARY: TODO: re-enable hickory-dns
# sane.programs.devPkgs.enableFor.user.colin = true; # sane.programs.devPkgs.enableFor.user.colin = true;
# sane.guest.enable = true; # sane.guest.enable = true;
# don't enable wifi by default: it messes with connectivity. # don't enable wifi by default: it messes with connectivity.
# systemd.services.iwd.enable = false; # systemd.services.iwd.enable = false;
# networking.wireless.enable = false;
# systemd.services.wpa_supplicant.enable = false; # systemd.services.wpa_supplicant.enable = false;
# sane.programs.wpa_supplicant.enableFor.user.colin = lib.mkForce false;
# sane.programs.wpa_supplicant.enableFor.system = lib.mkForce false;
# don't auto-connect to wifi networks
# see: <https://networkmanager.dev/docs/api/latest/NetworkManager.conf.html#device-spec>
networking.networkmanager.unmanaged = [ "type:wifi" ];
sops.secrets.colin-passwd.neededForUsers = true; sops.secrets.colin-passwd.neededForUsers = true;
@@ -20,36 +26,44 @@
sane.roles.pc = true; sane.roles.pc = true;
sane.services.wg-home.enable = true; sane.services.wg-home.enable = true;
sane.services.wg-home.ip = config.sane.hosts.by-name."desko".wg-home.ip; sane.services.wg-home.ip = config.sane.hosts.by-name."desko".wg-home.ip;
sane.services.duplicity.enable = true; sane.ovpn.addrV4 = "172.26.55.21";
# sane.ovpn.addrV6 = "fd00:0000:1337:cafe:1111:1111:20c1:a73c";
sane.services.rsync-net.enable = true;
sane.nixcache.remote-builders.desko = false; sane.nixcache.remote-builders.desko = false;
sane.programs.cups.enableFor.user.colin = true; sane.programs.sane-private-unlock-remote.enableFor.user.colin = true;
sane.programs.sane-private-unlock-remote.config.hosts = [ "servo" ];
sane.programs.sway.enableFor.user.colin = true; sane.programs.sway.enableFor.user.colin = true;
sane.programs.iphoneUtils.enableFor.user.colin = true; sane.programs.iphoneUtils.enableFor.user.colin = true;
sane.programs.steam.enableFor.user.colin = true; sane.programs.steam.enableFor.user.colin = true;
sane.programs."gnome.geary".config.autostart = true; sane.programs.geary.config.autostart = true;
sane.programs.signal-desktop.config.autostart = true; sane.programs.signal-desktop.config.autostart = true;
boot.loader.efi.canTouchEfiVariables = false; sane.programs.nwg-panel.config = {
battery = false;
brightness = false;
};
sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ]; sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ];
# needed to use libimobiledevice/ifuse, for iphone sync # needed to use libimobiledevice/ifuse, for iphone sync
services.usbmuxd.enable = true; services.usbmuxd.enable = true;
# TODO: enable snapper (need to make `/nix` or `/nix/persist` a subvolume, somehow).
# default config: https://man.archlinux.org/man/snapper-configs.5 # default config: https://man.archlinux.org/man/snapper-configs.5
# defaults to something like: # defaults to something like:
# - hourly snapshots # - hourly snapshots
# - auto cleanup; keep the last 10 hourlies, last 10 daylies, last 10 monthlys. # - auto cleanup; keep the last 10 hourlies, last 10 daylies, last 10 monthlys.
services.snapper.configs.nix = { # to list snapshots: `sudo snapper --config nix list`
# TODO: for the impermanent setup, we'd prefer to just do /nix/persist, # to take a snapshot: `sudo snapper --config nix create`
# but that also requires setting up the persist dir as a subvol # services.snapper.configs.nix = {
SUBVOLUME = "/nix"; # # TODO: for the impermanent setup, we'd prefer to just do /nix/persist,
# TODO: ALLOW_USERS doesn't seem to work. still need `sudo snapper -c nix list` # # but that also requires setting up the persist dir as a subvol
ALLOW_USERS = [ "colin" ]; # SUBVOLUME = "/nix";
}; # # TODO: ALLOW_USERS doesn't seem to work. still need `sudo snapper -c nix list`
# ALLOW_USERS = [ "colin" ];
# docs: https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion # };
system.stateVersion = "21.05";
} }

View File

@@ -9,31 +9,37 @@
sane.roles.pc = true; sane.roles.pc = true;
sane.services.wg-home.enable = true; sane.services.wg-home.enable = true;
sane.services.wg-home.ip = config.sane.hosts.by-name."lappy".wg-home.ip; sane.services.wg-home.ip = config.sane.hosts.by-name."lappy".wg-home.ip;
sane.ovpn.addrV4 = "172.23.119.72";
# sane.ovpn.addrV6 = "fd00:0000:1337:cafe:1111:1111:0332:aa96/128";
# sane.guest.enable = true; # sane.guest.enable = true;
boot.loader.efi.canTouchEfiVariables = false;
sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ]; sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ];
sane.programs.cups.enableFor.user.colin = true; sane.programs.sane-private-unlock-remote.enableFor.user.colin = true;
sane.programs.sane-private-unlock-remote.config.hosts = [ "servo" ];
sane.programs.stepmania.enableFor.user.colin = true; sane.programs.stepmania.enableFor.user.colin = true;
sane.programs.sway.enableFor.user.colin = true; sane.programs.sway.enableFor.user.colin = true;
sane.programs."gnome.geary".config.autostart = true; sane.programs.geary.config.autostart = true;
sane.programs.signal-desktop.config.autostart = true; sane.programs.signal-desktop.config.autostart = true;
sops.secrets.colin-passwd.neededForUsers = true; sops.secrets.colin-passwd.neededForUsers = true;
sane.services.rsync-net.enable = true;
# TODO: enable snapper (need to make `/nix` or `/nix/persist` a subvolume, somehow).
# default config: https://man.archlinux.org/man/snapper-configs.5 # default config: https://man.archlinux.org/man/snapper-configs.5
# defaults to something like: # defaults to something like:
# - hourly snapshots # - hourly snapshots
# - auto cleanup; keep the last 10 hourlies, last 10 daylies, last 10 monthlys. # - auto cleanup; keep the last 10 hourlies, last 10 daylies, last 10 monthlys.
services.snapper.configs.nix = { # to list snapshots: `sudo snapper --config nix list`
# TODO: for the impermanent setup, we'd prefer to just do /nix/persist, # to take a snapshot: `sudo snapper --config nix create`
# but that also requires setting up the persist dir as a subvol # services.snapper.configs.nix = {
SUBVOLUME = "/nix"; # # TODO: for the impermanent setup, we'd prefer to just do /nix/persist,
ALLOW_USERS = [ "colin" ]; # # but that also requires setting up the persist dir as a subvol
}; # SUBVOLUME = "/nix";
# # TODO: ALLOW_USERS doesn't seem to work. still need `sudo snapper -c nix list`
# docs: https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion # ALLOW_USERS = [ "colin" ];
system.stateVersion = "21.05"; # };
} }

View File

@@ -1,7 +0,0 @@
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
};

View File

@@ -1,22 +0,0 @@
# tow-boot: <https://tow-boot.org>
# docs (pinephone specific): <https://github.com/Tow-Boot/Tow-Boot/tree/development/boards/pine64-pinephoneA64>
# LED and button behavior is defined here: <https://github.com/Tow-Boot/Tow-Boot/blob/development/modules/tow-boot/phone-ux.nix>
# - hold VOLDOWN: enter recovery mode
# - LED will turn aqua instead of yellow
# - recovery mode would ordinarily allow a selection of entries, but for pinephone i guess it doesn't do anything?
# - hold VOLUP: force it to load the OS from eMMC?
# - LED will turn blue instead of yellow
# boot LEDs:
# - yellow = entered tow-boot
# - 10 red flashes => poweroff means tow-boot couldn't boot into the next stage (i.e. distroboot)
# - distroboot: <https://source.denx.de/u-boot/u-boot/-/blob/v2022.04/doc/develop/distro.rst>)
{ config, pkgs, ... }:
{
# we need space in the GPT header to place tow-boot.
# only actually need 1 MB, but better to over-allocate than under-allocate
sane.image.extraGPTPadding = 16 * 1024 * 1024;
sane.image.firstPartGap = 0;
sane.image.installBootloader = ''
dd if=${pkgs.tow-boot-pinephone}/Tow-Boot.noenv.bin of=$out/nixos.img bs=1024 seek=8 conv=notrunc
'';
}

View File

@@ -1,7 +1,4 @@
# Pinephone # Pinephone
# other setups to reference:
# - <https://hamblingreen.gitlab.io/2022/03/02/my-pinephone-setup.html>
# - sxmo Arch user. lots of app recommendations
# #
# wikis, resources, ...: # wikis, resources, ...:
# - Linux Phone Apps: <https://linuxphoneapps.org/> # - Linux Phone Apps: <https://linuxphoneapps.org/>
@@ -12,33 +9,27 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
imports = [ imports = [
./bootloader.nix
./fs.nix ./fs.nix
./gps.nix
./kernel.nix
./polyfill.nix
]; ];
sane.hal.pine64.enable = true;
sane.roles.client = true; sane.roles.client = true;
sane.roles.handheld = true; sane.roles.handheld = true;
sane.programs.zsh.config.showDeadlines = false; # unlikely to act on them when in shell
sane.services.wg-home.enable = true; sane.services.wg-home.enable = true;
sane.services.wg-home.ip = config.sane.hosts.by-name."moby".wg-home.ip; sane.services.wg-home.ip = config.sane.hosts.by-name."moby".wg-home.ip;
sane.ovpn.addrV4 = "172.24.87.255";
# sane.ovpn.addrV6 = "fd00:0000:1337:cafe:1111:1111:18cd:a72b";
# XXX colin: phosh doesn't work well with passwordless login, # XXX colin: phosh doesn't work well with passwordless login,
# so set this more reliable default password should anything go wrong # so set this more reliable default password should anything go wrong
users.users.colin.initialPassword = "147147"; users.users.colin.initialPassword = "147147";
# services.getty.autologinUser = "root"; # allows for emergency maintenance?
sops.secrets.colin-passwd.neededForUsers = true; sops.secrets.colin-passwd.neededForUsers = true;
# sane.gui.sxmo.enable = true; sane.services.rsync-net.enable = true;
sane.programs.sway.enableFor.user.colin = true; sane.programs.sway.enableFor.user.colin = true;
sane.programs.swaylock.enableFor.user.colin = false; #< not usable on touch sane.programs.sway.config.mod = "Mod1"; #< alt key instead of Super
sane.programs.schlock.enableFor.user.colin = true;
sane.programs.swayidle.config.actions.screenoff.delay = 300;
sane.programs.swayidle.config.actions.screenoff.enable = true;
sane.programs.sane-input-handler.enableFor.user.colin = true;
sane.programs.blueberry.enableFor.user.colin = false; # bluetooth manager: doesn't cross compile! sane.programs.blueberry.enableFor.user.colin = false; # bluetooth manager: doesn't cross compile!
sane.programs.fcitx5.enableFor.user.colin = false; # does not cross compile sane.programs.fcitx5.enableFor.user.colin = false; # does not cross compile
sane.programs.mercurial.enableFor.user.colin = false; # does not cross compile sane.programs.mercurial.enableFor.user.colin = false; # does not cross compile
@@ -46,18 +37,14 @@
# enabled for easier debugging # enabled for easier debugging
sane.programs.eg25-control.enableFor.user.colin = true; sane.programs.eg25-control.enableFor.user.colin = true;
sane.programs.rtl8723cs-wowlan.enableFor.user.colin = true; # sane.programs.rtl8723cs-wowlan.enableFor.user.colin = true;
# sane.programs.ntfy-sh.config.autostart = true; # sane.programs.ntfy-sh.config.autostart = true;
sane.programs.dino.config.autostart = true; sane.programs.dino.config.autostart = true;
# sane.programs.signal-desktop.config.autostart = true; # TODO: enable once electron stops derping. sane.programs.signal-desktop.config.autostart = true;
# sane.programs."gnome.geary".config.autostart = true; # sane.programs.geary.config.autostart = true;
# sane.programs.calls.config.autostart = true; # sane.programs.calls.config.autostart = true;
sane.programs.firefox.mime.priority = 300; # prefer other browsers when possible
# HACK/TODO: make `programs.P.env.VAR` behave according to `mime.priority`
sane.programs.firefox.env = lib.mkForce {};
sane.programs.epiphany.env.BROWSER = "epiphany";
sane.programs.pipewire.config = { sane.programs.pipewire.config = {
# tune so Dino doesn't drop audio # 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>) # there's seemingly two buffers for the mic (see: <https://gitlab.freedesktop.org/pipewire/pipewire/-/wikis/FAQ#pipewire-buffering-explained>)
@@ -74,53 +61,7 @@
max-quantum = 8192; max-quantum = 8192;
}; };
boot.loader.efi.canTouchEfiVariables = false;
# /boot space is at a premium. default was 20. # /boot space is at a premium. default was 20.
# even 10 can be too much # even 10 can be too much
boot.loader.generic-extlinux-compatible.configurationLimit = 8; boot.loader.generic-extlinux-compatible.configurationLimit = 8;
# mobile.bootloader.enable = false;
# mobile.boot.stage-1.enable = false;
# boot.initrd.systemd.enable = false;
# boot.initrd.services.swraid.enable = false; # attempt to fix dm_mod stuff
# hardware.firmware makes the referenced files visible to the kernel, for whenever a driver explicitly asks for them.
# these files are visible from userspace by following `/sys/module/firmware_class/parameters/path`
#
# mobile-nixos' /lib/firmware includes:
# rtl_bt (bluetooth)
# anx7688-fw.bin (USB-C chip: power negotiation, HDMI/dock)
# ov5640_af.bin (camera module)
# hardware.firmware = [ config.mobile.device.firmware ];
# hardware.firmware = [ pkgs.rtl8723cs-firmware ];
hardware.firmware = [
(pkgs.linux-firmware-megous.override {
# rtl_bt = false probably means no bluetooth connectivity.
# N.B.: DON'T RE-ENABLE without first confirming that wake-on-lan works during suspend (rtcwake).
# it seems the rtl_bt stuff ("bluetooth coexist") might make wake-on-LAN radically more flaky.
rtl_bt = false;
})
];
system.stateVersion = "21.11";
# defined: https://www.freedesktop.org/software/systemd/man/machine-info.html
# XXX colin: not sure which, if any, software makes use of this
environment.etc."machine-info".text = ''
CHASSIS="handset"
'';
# enable rotation sensor
# hardware.sensor.iio.enable = true;
services.udev.extraRules = let
chmod = "${pkgs.coreutils}/bin/chmod";
chown = "${pkgs.coreutils}/bin/chown";
in ''
# make Pinephone flashlight writable by user.
# taken from postmarketOS: <repo:postmarketOS/pmaports:device/main/device-pine64-pinephone/60-flashlight.rules>
SUBSYSTEM=="leds", DEVPATH=="*/*:flash", RUN+="${chmod} g+w /sys%p/brightness /sys%p/flash_strobe", RUN+="${chown} :video /sys%p/brightness /sys%p/flash_strobe"
# make Pinephone front LEDs writable by user.
SUBSYSTEM=="leds", DEVPATH=="*/*:indicator", RUN+="${chmod} g+w /sys%p/brightness", RUN+="${chown} :video /sys%p/brightness"
'';
} }

View File

@@ -1,68 +0,0 @@
# pinephone GPS happens in EG25 modem
# serial control interface to modem is /dev/ttyUSB2
# after enabling GPS, readout is /dev/ttyUSB1
#
# minimal process to enable modem and GPS:
# - `echo 1 > /sys/class/modem-power/modem-power/device/powered`
# - `screen /dev/ttyUSB2 115200`
# - `AT+QGPSCFG="nmeasrc",1`
# - `AT+QGPS=1`
# this process is automated by my `eg25-control` program and services (`eg25-control-powered`, `eg25-control-gps`)
# - see the `modules/` directory further up this repository.
#
# now, something like `gpsd` can directly read from /dev/ttyUSB1,
# or geoclue can query the GPS directly through modem-manager
#
# initial GPS fix can take 15+ minutes.
# meanwhile, services like eg25-manager or eg25-control-freshen-agps can speed this up by uploading assisted GPS data to the modem.
#
# support/help:
# - geoclue, gnome-maps
# - irc: #gnome-maps on irc.gimp.org
# - Matrix: #gnome-maps:gnome.org (unclear if bridged to IRC)
#
# programs to pair this with:
# - `satellite-gtk`: <https://codeberg.org/tpikonen/satellite>
# - shows/tracks which satellites the GPS is connected to; useful to understand fix characteristics
# - `gnome-maps`: uses geoclue, has route planning
# - `mepo`: uses gpsd, minimalist, flaky, and buttons are kinda hard to activate on mobile
# - puremaps?
# - osmin?
#
# known/outstanding bugs:
# - `systemctl start eg25-control-gps` can the hang the whole system (2023/10/06)
# - i think it's actually `eg25-control-powered` which does this (started by the gps)
# - best guess is modem draws so much power at launch that other parts of the system see undervoltage
# - workaround is to hard power-cycle the system. the modem may not bring up after reboot: leave unpowered for 60s and boot again.
#
# future work:
# - integrate with [wigle](https://www.wigle.net/) for offline equivalent to Mozilla Location Services
{ config, lib, ... }:
{
# test gpsd with `gpspipe -w -n 10 2> /dev/null | grep -m 1 TPV | jq '.lat, .lon' | tr '\n' ' '`
# ^ should return <lat> <long>
services.gpsd.enable = true;
services.gpsd.devices = [ "/dev/ttyUSB1" ];
# test geoclue2 by building `geoclue2-with-demo-agent`
# and running "${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/where-am-i"
# note that geoclue is dbus-activated, and auto-stops after 60s with no caller
services.geoclue2.enable = true;
services.geoclue2.appConfig.where-am-i = {
# this is the default "agent", shipped by geoclue package: allow it to use location
isAllowed = true;
isSystem = false;
# XXX: setting users != [] might be causing `where-am-i` to time out
users = [
# restrict to only one set of users. empty array (default) means "allow any user to access geolocation".
(builtins.toString config.users.users.colin.uid)
];
};
systemd.services.geoclue.after = lib.mkForce []; #< defaults to network-online, but not all my sources require network
users.users.geoclue.extraGroups = [
"dialout" # TODO: figure out if dialout is required. that's for /dev/ttyUSB1, but geoclue probably doesn't read that?
];
sane.programs.where-am-i.enableFor.user.colin = true;
}

View File

@@ -1,273 +0,0 @@
{ pkgs, ... }:
let
dmesg = "${pkgs.util-linux}/bin/dmesg";
grep = "${pkgs.gnugrep}/bin/grep";
modprobe = "${pkgs.kmod}/bin/modprobe";
ensureHWReady = ''
# common boot failure:
# blank screen (no backlight even), with the following log:
# ```syslog
# sun8i-dw-hdmi 1ee0000.hdmi: Couldn't get the HDMI PHY
# ...
# sun4i-drm display-engine: Couldn't bind all pipelines components
# ...
# sun8i-dw-hdmi: probe of 1ee0000.hdmi failed with error -17
# ```
#
# in particular, that `probe ... failed` occurs *only* on failed boots
# (the other messages might sometimes occur even on successful runs?)
#
# reloading the sun8i hdmi driver usually gets the screen on, showing boot text.
# then restarting display-manager.service gets us to the login.
#
# NB: the above log is default level. though less specific, there's a `err` level message that also signals this:
# sun4i-drm display-engine: failed to bind 1ee0000.hdmi (ops sun8i_dw_hdmi_ops [sun8i_drm_hdmi]): -17
# NB: this is the most common, but not the only, failure mode for `display-manager`.
# another error seems characterized by these dmesg logs, in which reprobing sun8i_drm_hdmi does not fix:
# ```syslog
# sun6i-mipi-dsi 1ca0000.dsi: Couldn't get the MIPI D-PHY
# sun4i-drm display-engine: Couldn't bind all pipelines components
# sun6i-mipi-dsi 1ca0000.dsi: Couldn't register our component
# ```
if (${dmesg} --kernel --level err --color=never --notime | ${grep} -q 'sun4i-drm display-engine: failed to bind 1ee0000.hdmi')
then
echo "reprobing sun8i_drm_hdmi"
# if a command here fails it errors the whole service, so prefer to log instead
${modprobe} -r sun8i_drm_hdmi || echo "failed to unload sun8i_drm_hdmi"
${modprobe} sun8i_drm_hdmi || echo "failed to load sub8i_drm_hdmi"
fi
'';
in
{
# kernel compatibility (2024/05/22: 03dab630)
# - linux-megous: boots to ssh, desktop
# - camera apps: megapixels (no cameras found), snapshot (no cameras found)
# - linux-postmarketos: boots to ssh. desktop ONLY if "anx7688" is in the initrd.availableKernelModules.
# - camera apps: megapixels (both rear and front cameras work), `cam -l` (finds only the rear camera), snapshot (no cameras found)
# - linux-megous.override { withMegiPinephoneConfig = true; }: NO SSH, NO SIGNS OF LIFE
# - linux-megous.override { withFullConfig = false; }: boots to ssh, no desktop
#
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux-postmarketos.override {
withModemPower = true;
});
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-megous;
# boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux-megous.override {
# withFullConfig = false;
# });
# boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux-megous.override {
# withMegiPinephoneConfig = true; #< N.B.: does not boot as of 2024/05/22!
# });
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux-manjaro;
# boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
# nixpkgs.hostPlatform.linux-kernel becomes stdenv.hostPlatform.linux-kernel
nixpkgs.hostPlatform.linux-kernel = {
# defaults:
name = "aarch64-multiplatform";
# baseConfig: defaults to "defconfig";
# baseConfig = "pinephone_defconfig"; #< N.B.: ignored by `pkgs.linux-megous`
DTB = true; #< DTB: compile device tree blobs
# autoModules (default: true): for config options not manually specified, answer `m` to anything which supports it.
# - this effectively builds EVERY MODULE SUPPORTED.
autoModules = true; #< N.B.: ignored by `pkgs.linux-megous`
# preferBuiltin (default: false; true for rpi): for config options which default to `Y` upstream, build them as `Y` (overriding `autoModules`)
# preferBuiltin = false;
# build a compressed kernel image: without this i run out of /boot space in < 10 generations
# target = "Image"; # <-- default
target = "Image.gz"; # <-- compress the kernel image
# target = "zImage"; # <-- confuses other parts of nixos :-(
};
# boot.initrd.kernelModules = [
# "drm" #< force drm to be plugged
# ];
boot.initrd.availableKernelModules = [
# see <repo:postmarketOS/pmaports:device/main/device-pine64-pinephone/modules-initfs>
# - they include sun6i_mipi_dsi sun4i_drm pwm_sun4i sun8i_mixer anx7688 gpio_vibra pinephone_keyboard
"anx7688" #< required for display initialization and functional cameras
# full list of modules active post-boot with the linux-megous kernel + autoModules=true:
# - `lsmod | sort | cut -d ' ' -f 1`
# "8723cs"
# "axp20x_adc" #< NOT FOUND in megous-no-autoModules
# "axp20x_battery"
# "axp20x_pek"
# "axp20x_usb_power"
# "backlight"
# "blake2b_generic"
# "bluetooth"
# "bridge"
# "btbcm"
# "btqca"
# "btrfs"
# "btrtl"
# "cec"
# "cfg80211"
# "chacha_neon"
# "crc_ccitt"
# "crct10dif_ce"
# "crypto_engine"
# "display_connector" #< NOT FOUND in pmos
# "drm"
# "drm_display_helper"
# "drm_dma_helper"
# "drm_kms_helper"
# "drm_shmem_helper"
# "dw_hdmi"
# "dw_hdmi_cec" #< NOT FOUND in pmos
# "dw_hdmi_i2s_audio"
# "ecc"
# "ecdh_generic"
# "fuse"
# "gc2145" #< NOT FOUND in megous-no-autoModules
# "goodix_ts"
# "gpio_vibra" #< NOT FOUND in megous-no-autoModules
# "gpu_sched"
# "hci_uart"
# "i2c_gpio"
# "inv_mpu6050" #< NOT FOUND in megous-no-autoModules
# "inv_mpu6050_i2c" #< NOT FOUND in megous-no-autoModules
# "inv_sensors_timestamp" #< NOT FOUND in megous-no-autoModules
# "ip6t_rpfilter"
# "ip6_udp_tunnel"
# "ip_set"
# "ip_set_hash_ipport"
# "ip_tables"
# "ipt_rpfilter"
# "joydev"
# "led_class_flash" #< NOT FOUND in megous-no-autoModules
# "leds_sgm3140" #< NOT FOUND in megous-no-autoModules
# "ledtrig_pattern" #< NOT FOUND in megous-no-autoModules
# "libarc4"
# "libchacha"
# "libchacha20poly1305"
# "libcrc32c"
# "libcurve25519_generic"
# "lima"
# "llc"
# "mac80211"
# "macvlan"
# "mc"
# "modem_power"
# "mousedev"
# "nf_conntrack"
# "nf_defrag_ipv4"
# "nf_defrag_ipv6"
# "nf_log_syslog"
# "nf_nat"
# "nfnetlink"
# "nf_tables"
# "nft_chain_nat"
# "nft_compat"
# "nls_cp437"
# "nls_iso8859_1"
# "nvmem_reboot_mode"
# "ov5640"
# "panel_sitronix_st7703"
# "phy_sun6i_mipi_dphy"
# "pinctrl_axp209" #< NOT FOUND in pmos
# "pinephone_keyboard" #< NOT FOUND in megous-no-autoModules
# "poly1305_neon"
# "polyval_ce"
# "polyval_generic"
# "ppkb_manager" #< NOT FOUND in megous-no-autoModules
# "pwm_bl"
# "pwm_sun4i"
# "qrtr"
# "raid6_pq"
# "rfkill"
# "rtw88_8703b"
# "rtw88_8723cs"
# "rtw88_8723x"
# "rtw88_core"
# "rtw88_sdio"
# "sch_fq_codel"
# "sm4"
# "snd_soc_bt_sco"
# "snd_soc_ec25" #< NOT FOUND in megous-no-autoModules
# "snd_soc_hdmi_codec"
# "snd_soc_simple_amplifier"
# "snd_soc_simple_card"
# "snd_soc_simple_card_utils"
# "stk3310" #< NOT FOUND in megous-no-autoModules
# "st_magn"
# "st_magn_i2c"
# "st_magn_spi" #< NOT FOUND in pmos
# "stp"
# "st_sensors"
# "st_sensors_i2c"
# "st_sensors_spi" #< NOT FOUND in pmos
# "sun4i_drm"
# "sun4i_i2s"
# "sun4i_lradc_keys" #< NOT FOUND in megous-no-autoModules
# "sun4i_tcon"
# "sun50i_codec_analog"
# "sun6i_csi"
# "sun6i_dma"
# "sun6i_mipi_dsi"
# "sun8i_a33_mbus" #< NOT FOUND in megous-no-autoModules
# "sun8i_adda_pr_regmap"
# "sun8i_ce" #< NOT FOUND in pmos
# "sun8i_codec" #< NOT FOUND in megous-no-autoModules
# "sun8i_di" #< NOT FOUND in megous-no-autoModules
# "sun8i_drm_hdmi"
# "sun8i_mixer"
# "sun8i_rotate" #< NOT FOUND in megous-no-autoModules
# "sun8i_tcon_top"
# "sun9i_hdmi_audio" #< NOT FOUND in megous-no-autoModules
# "sunxi_wdt" #< NOT FOUND in pmos
# "tap"
# "typec" #< NOT FOUND in pmos
# "udp_tunnel"
# "uio" #< NOT FOUND in pmos
# "uio_pdrv_genirq"
# "v4l2_async"
# "v4l2_cci" #< NOT FOUND in pmos
# "v4l2_flash_led_class" #< NOT FOUND in megous-no-autoModules
# "v4l2_fwnode"
# "v4l2_mem2mem"
# "videobuf2_common"
# "videobuf2_dma_contig"
# "videobuf2_memops"
# "videobuf2_v4l2"
# "videodev"
# "wireguard"
# "xor"
# "x_tables"
# "xt_conntrack"
# "xt_LOG"
# "xt_nat"
# "xt_pkttype"
# "xt_set"
# "xt_tcpudp"
# "zram"
];
# disable proximity sensor.
# the filtering/calibration is bad that it causes the screen to go fully dark at times.
# boot.blacklistedKernelModules = [ "stk3310" ];
boot.kernelParams = [
# without this some GUI apps fail: `DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory`
# this is because they can't allocate enough video ram.
# see related nixpkgs issue: <https://github.com/NixOS/nixpkgs/issues/260222>
# TODO(2023/12/03): remove once mesa 23.3.1 lands: <https://github.com/NixOS/nixpkgs/pull/265740>
#
# the default CMA seems to be 32M.
# i was running fine with 256MB from 2022/07-ish through 2022/12-ish, but then the phone quit reliably coming back from sleep (phosh): maybe a memory leak?
# bumped to 512M on 2023/01
# bumped to 1536M on 2024/05
# `cat /proc/meminfo` to see CmaTotal/CmaFree if interested in tuning this.
# kernel param mentioned here: <https://cateee.net/lkddb/web-lkddb/CMA_SIZE_PERCENTAGE.html>
# i think cma mem isn't exclusive -- it can be used as ordinary `malloc`, still. i heard someone suggest the OS default should just be 50% memory to CMA.
"cma=1536M"
# 2023/10/20: potential fix for the lima (GPU) timeout bugs:
# - <https://gitlab.com/postmarketOS/pmaports/-/issues/805#note_890467824>
"lima.sched_timeout_ms=2000"
];
# services.xserver.displayManager.job.preStart = ensureHWReady;
# systemd.services.greetd.preStart = ensureHWReady;
systemd.services.unl0kr.preStart = ensureHWReady;
}

View File

@@ -1,45 +0,0 @@
# this file configures preferences per program, without actually enabling any programs.
# the goal is to separate the place where we decide *what* to use (i.e. `sane.programs.firefox.enable = true` -- at the toplevel)
# from where we specific how that thing should behave *if* it's in use.
#
# NixOS backgrounds:
# - <https://github.com/NixOS/nixos-artwork>
# - <https://github.com/NixOS/nixos-artwork/issues/50> (colorful; unmerged)
# - <https://github.com/NixOS/nixos-artwork/pull/60/files> (desktop-oriented; clean; unmerged)
# - <https://itsfoss.com/content/images/2023/04/nixos-tutorials.png>
{ lib, pkgs, sane-lib, ... }:
{
sane.programs.firefox.config = {
# compromise impermanence for the sake of usability
persistCache = "private";
persistData = "private";
# i don't do crypto stuff on moby
addons.ether-metamask.enable = false;
# sidebery UX doesn't make sense on small screen
addons.sidebery.enable = false;
};
sane.programs.swaynotificationcenter.config = {
backlight = "backlight"; # /sys/class/backlight/*backlight*/brightness
};
sane.programs.alacritty.config.fontSize = 9;
sane.programs.sway.config = {
font = "pango:monospace 10";
mod = "Mod1"; # prefer Alt
workspace_layout = "tabbed";
};
sane.programs.waybar.config = {
fontSize = 14;
height = 26;
persistWorkspaces = [ "1" "2" "3" "4" "5" ];
modules.media = false;
modules.network = false;
modules.perf = false;
modules.windowTitle = false;
# TODO: show modem state
};
}

View File

@@ -4,7 +4,6 @@
./fs.nix ./fs.nix
]; ];
boot.loader.efi.canTouchEfiVariables = false;
sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ]; sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ];
sane.persist.enable = false; # what we mean here is that the image is immutable; `/` is still tmpfs. sane.persist.enable = false; # what we mean here is that the image is immutable; `/` is still tmpfs.
sane.nixcache.enable = false; # don't want to be calling out to dead machines that we're *trying* to rescue sane.nixcache.enable = false; # don't want to be calling out to dead machines that we're *trying* to rescue
@@ -12,7 +11,4 @@
# auto-login at shell # auto-login at shell
services.getty.autologinUser = "colin"; services.getty.autologinUser = "colin";
# users.users.colin.initialPassword = "colin"; # users.users.colin.initialPassword = "colin";
# docs: https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion
system.stateVersion = "21.05";
} }

View File

@@ -7,36 +7,37 @@
./services ./services
]; ];
sane.programs = { # for administering services
# for administering services sane.programs.clightning-sane.enableFor.user.colin = true;
freshrss.enableFor.user.colin = true; # sane.programs.freshrss.enableFor.user.colin = true;
matrix-synapse.enableFor.user.colin = true; # sane.programs.signaldctl.enableFor.user.colin = true;
signaldctl.enableFor.user.colin = true; # sane.programs.matrix-synapse.enableFor.user.colin = true;
};
sane.roles.build-machine.enable = true; sane.roles.build-machine.enable = true;
sane.programs.zsh.config.showDeadlines = false; # ~/knowledge doesn't always exist sane.programs.sane-deadlines.config.showOnLogin = false; # ~/knowledge doesn't always exist
sane.programs.consoleUtils.suggestedPrograms = [ sane.programs.consoleUtils.suggestedPrograms = [
"consoleMediaUtils" # notably, for go2tv / casting "consoleMediaUtils" # notably, for go2tv / casting
"pcConsoleUtils" "pcConsoleUtils"
"sane-scripts.stop-all-servo" "sane-scripts.stop-all-servo"
]; ];
sane.services.dyn-dns.enable = true; sane.services.dyn-dns.enable = true;
sane.services.trust-dns.asSystemResolver = false; # TODO: enable once it's all working well sane.services.hickory-dns.asSystemResolver = false; # TODO: enable once it's all working well
sane.services.wg-home.enable = true; sane.services.wg-home.enable = true;
sane.services.wg-home.visibleToWan = true; sane.services.wg-home.visibleToWan = true;
sane.services.wg-home.forwardToWan = true; sane.services.wg-home.forwardToWan = true;
sane.services.wg-home.routeThroughServo = false; sane.services.wg-home.routeThroughServo = false;
sane.services.wg-home.ip = config.sane.hosts.by-name."servo".wg-home.ip; sane.services.wg-home.ip = config.sane.hosts.by-name."servo".wg-home.ip;
sane.ovpn.addrV4 = "172.23.174.114";
# sane.ovpn.addrV6 = "fd00:0000:1337:cafe:1111:1111:8df3:14b0";
sane.nixcache.remote-builders.desko = false; sane.nixcache.remote-builders.desko = false;
sane.nixcache.remote-builders.servo = false; sane.nixcache.remote-builders.servo = false;
# sane.services.duplicity.enable = true; # TODO: re-enable after HW upgrade sane.services.rsync-net.enable = true;
# automatically log in at the virtual consoles. # automatically log in at the virtual consoles.
# using root here makes sure we always have an escape hatch # using root here makes sure we always have an escape hatch.
services.getty.autologinUser = "root"; # XXX(2024-07-27): this is incompatible with my s6-rc stuff, which needs to auto-login as `colin` to start its user services.
# services.getty.autologinUser = "root";
boot.loader.efi.canTouchEfiVariables = false;
sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ]; sane.image.extraBootFiles = [ pkgs.bootpart-uefi-x86_64 ];
# both transmission and ipfs try to set different net defaults. # both transmission and ipfs try to set different net defaults.
@@ -44,13 +45,5 @@
boot.kernel.sysctl = { boot.kernel.sysctl = {
"net.core.rmem_max" = 4194304; # 4MB "net.core.rmem_max" = 4194304; # 4MB
}; };
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "21.11";
} }

View File

@@ -14,7 +14,7 @@
# show zfs datasets: `zfs list` (will be empty if haven't imported) # show zfs datasets: `zfs list` (will be empty if haven't imported)
# show zfs properties (e.g. compression): `zfs get all pool` # show zfs properties (e.g. compression): `zfs get all pool`
# set zfs properties: `zfs set compression=on pool` # set zfs properties: `zfs set compression=on pool`
{ ... }: { lib, pkgs, ... }:
{ {
# hostId: not used for anything except zfs guardrail? # hostId: not used for anything except zfs guardrail?
@@ -54,7 +54,7 @@
options = [ "acl" ]; #< not sure if this `acl` flag is actually necessary. it mounts without it. options = [ "acl" ]; #< not sure if this `acl` flag is actually necessary. it mounts without it.
}; };
# services.zfs.zed = ... # TODO: zfs can send me emails when disks fail # services.zfs.zed = ... # TODO: zfs can send me emails when disks fail
sane.programs.sysadminUtils.suggestedPrograms = [ "zfs" ]; sane.programs.sysadminUtils.suggestedPrograms = [ "zfs-tools" ];
sane.persist.stores."ext" = { sane.persist.stores."ext" = {
origin = "/mnt/pool/persist"; origin = "/mnt/pool/persist";
@@ -131,6 +131,20 @@
the contents should be a subset of what's in ../media/datasets. the contents should be a subset of what's in ../media/datasets.
''; '';
systemd.services.dedupe-media = {
description = "transparently de-duplicate /var/media entries by using block-level hardlinks";
script = ''
${lib.getExe' pkgs.util-linux "hardlink"} /var/media --reflink=always --ignore-time --verbose
'';
};
systemd.timers.dedupe-media = {
wantedBy = [ "multi-user.target" ];
timerConfig = {
OnStartupSec = "23min";
OnUnitActiveSec = "720min";
};
};
# btrfs doesn't easily support swapfiles # btrfs doesn't easily support swapfiles
# swapDevices = [ # swapDevices = [
# { device = "/nix/persist/swapfile"; size = 4096; } # { device = "/nix/persist/swapfile"; size = 4096; }

View File

@@ -3,9 +3,19 @@
let let
portOpts = with lib; types.submodule { portOpts = with lib; types.submodule {
options = { options = {
visibleTo.ovpn = mkOption { visibleTo.ovpns = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = ''
whether to forward inbound traffic on the OVPN vpn port to the corresponding localhost port.
'';
};
visibleTo.doof = mkOption {
type = types.bool;
default = false;
description = ''
whether to forward inbound traffic on the doofnet vpn port to the corresponding localhost port.
'';
}; };
}; };
}; };
@@ -13,13 +23,21 @@ in
{ {
options = with lib; { options = with lib; {
sane.ports.ports = mkOption { sane.ports.ports = mkOption {
# add the `visibleTo.ovpn` option # add the `visibleTo.{doof,ovpns}` options
type = types.attrsOf portOpts; type = types.attrsOf portOpts;
}; };
}; };
config = { config = {
networking.domain = "uninsane.org"; networking.domain = "uninsane.org";
systemd.network.networks."50-eth0" = {
matchConfig.Name = "eth0";
networkConfig.Address = [
"205.201.63.12/32"
"10.78.79.51/22"
];
networkConfig.DNS = [ "10.78.79.1" ];
};
sane.ports.openFirewall = true; sane.ports.openFirewall = true;
sane.ports.openUpnp = true; sane.ports.openUpnp = true;
@@ -40,18 +58,16 @@ in
# tun-sea config # tun-sea config
sane.dns.zones."uninsane.org".inet.A."doof.tunnel" = "205.201.63.12"; sane.dns.zones."uninsane.org".inet.A."doof.tunnel" = "205.201.63.12";
sane.dns.zones."uninsane.org".inet.AAAA."doof.tunnel" = "2602:fce8:106::51"; # sane.dns.zones."uninsane.org".inet.AAAA."doof.tunnel" = "2602:fce8:106::51"; #< TODO: enable IPv6
networking.wireguard.interfaces.wg-doof = let networking.wireguard.interfaces.wg-doof = {
ip = "${pkgs.iproute2}/bin/ip";
in {
privateKeyFile = config.sops.secrets.wg_doof_privkey.path; privateKeyFile = config.sops.secrets.wg_doof_privkey.path;
# wg is active only in this namespace. # wg is active only in this namespace.
# run e.g. ip netns exec doof <some command like ping/curl/etc, it'll go through wg> # run e.g. ip netns exec doof <some command like ping/curl/etc, it'll go through wg>
# sudo ip netns exec doof ping www.google.com # sudo ip netns exec doof ping www.google.com
interfaceNamespace = "doof"; interfaceNamespace = "doof";
ips = [ ips = [
"205.201.63.12/32" "205.201.63.12"
"2602:fce8:106::51/128" # "2602:fce8:106::51/128" #< TODO: enable IPv6
]; ];
peers = [ peers = [
{ {
@@ -63,45 +79,24 @@ in
persistentKeepalive = 25; #< keep the NAT alive persistentKeepalive = 25; #< keep the NAT alive
} }
]; ];
preSetup = ''
${ip} netns add doof || (test -e /run/netns/doof && echo "doof already exists")
'';
postShutdown = ''
${ip} netns delete doof || echo "couldn't delete doof"
'';
}; };
sane.netns.doof.hostVethIpv4 = "10.0.2.5";
sane.netns.doof.netnsVethIpv4 = "10.0.2.6";
sane.netns.doof.netnsPubIpv4 = "205.201.63.12";
sane.netns.doof.routeTable = 12;
# OVPN CONFIG (https://www.ovpn.com): # OVPN CONFIG (https://www.ovpn.com):
# DOCS: https://nixos.wiki/wiki/WireGuard # DOCS: https://nixos.wiki/wiki/WireGuard
# if you `systemctl restart wireguard-wg-ovpns`, make sure to also restart any other services in `NetworkNamespacePath = .../ovpns`. # if you `systemctl restart wireguard-wg-ovpns`, make sure to also restart any other services in `NetworkNamespacePath = .../ovpns`.
# TODO: why not create the namespace as a seperate operation (nix config for that?) # TODO: why not create the namespace as a seperate operation (nix config for that?)
networking.wireguard.enable = true; networking.wireguard.enable = true;
networking.wireguard.interfaces.wg-ovpns = let networking.wireguard.interfaces.wg-ovpns = {
ip = "${pkgs.iproute2}/bin/ip";
in-ns = "${ip} netns exec ovpns";
iptables = "${pkgs.iptables}/bin/iptables";
veth-host-ip = "10.0.1.5";
veth-local-ip = "10.0.1.6";
vpn-ip = "185.157.162.178";
# DNS = 46.227.67.134, 192.165.9.158, 2a07:a880:4601:10f0:cd45::1, 2001:67c:750:1:cafe:cd45::1
vpn-dns = "46.227.67.134";
bridgePort = port: proto: ''
${in-ns} ${iptables} -A PREROUTING -t nat -p ${proto} --dport ${port} -m iprange --dst-range ${vpn-ip} \
-j DNAT --to-destination ${veth-host-ip}
'';
bridgeStatements = lib.foldlAttrs
(acc: port: portCfg: acc ++ (builtins.map (bridgePort port) portCfg.protocol))
[]
config.sane.ports.ports;
in {
privateKeyFile = config.sops.secrets.wg_ovpns_privkey.path; privateKeyFile = config.sops.secrets.wg_ovpns_privkey.path;
# wg is active only in this namespace. # wg is active only in this namespace.
# run e.g. ip netns exec ovpns <some command like ping/curl/etc, it'll go through wg> # run e.g. ip netns exec ovpns <some command like ping/curl/etc, it'll go through wg>
# sudo ip netns exec ovpns ping www.google.com # sudo ip netns exec ovpns ping www.google.com
interfaceNamespace = "ovpns"; interfaceNamespace = "ovpns";
ips = [ ips = [ "185.157.162.178" ];
"185.157.162.178/32"
];
peers = [ peers = [
{ {
publicKey = "SkkEZDCBde22KTs/Hc7FWvDBfdOCQA4YtBEuC3n5KGs="; publicKey = "SkkEZDCBde22KTs/Hc7FWvDBfdOCQA4YtBEuC3n5KGs=";
@@ -119,99 +114,11 @@ in
# dynamicEndpointRefreshRestartSeconds = 5; # dynamicEndpointRefreshRestartSeconds = 5;
} }
]; ];
preSetup = ''
${ip} netns add ovpns || (test -e /run/netns/ovpns && echo "ovpns already exists")
'';
postShutdown = ''
${in-ns} ip link del ovpns-veth-b || echo "couldn't delete ovpns-veth-b"
${ip} link del ovpns-veth-a || echo "couldn't delete ovpns-veth-a"
${ip} netns delete ovpns || echo "couldn't delete ovpns"
# restore rules/routes
${ip} rule del from ${veth-host-ip} lookup ovpns pref 50 || echo "couldn't delete init -> ovpns rule"
${ip} route del default via ${veth-local-ip} dev ovpns-veth-a proto kernel src ${veth-host-ip} metric 1002 table ovpns || echo "couldn't delete init -> ovpns route"
${ip} rule add from all lookup local pref 0
${ip} rule del from all lookup local pref 100
'';
postSetup = ''
# DOCS:
# - some of this approach is described here: <https://josephmuia.ca/2018-05-16-net-namespaces-veth-nat/>
# - iptables primer: <https://danielmiessler.com/study/iptables/>
# create veth pair
${ip} link add ovpns-veth-a type veth peer name ovpns-veth-b
${ip} addr add ${veth-host-ip}/24 dev ovpns-veth-a
${ip} link set ovpns-veth-a up
# mv veth-b into the ovpns namespace
${ip} link set ovpns-veth-b netns ovpns
${in-ns} ip addr add ${veth-local-ip}/24 dev ovpns-veth-b
${in-ns} ip link set ovpns-veth-b up
# make it so traffic originating from the host side of the veth
# is sent over the veth no matter its destination.
${ip} rule add from ${veth-host-ip} lookup ovpns pref 50
# for traffic originating at the host veth to the WAN, use the veth as our gateway
# not sure if the metric 1002 matters.
${ip} route add default via ${veth-local-ip} dev ovpns-veth-a proto kernel src ${veth-host-ip} metric 1002 table ovpns
# give the default route lower priority
${ip} rule add from all lookup local pref 100
${ip} rule del from all lookup local pref 0
# in order to access DNS in this netns, we need to route it to the VPN's nameservers
# - alternatively, we could fix DNS servers like 1.1.1.1.
${in-ns} ${iptables} -A OUTPUT -t nat -p udp --dport 53 -m iprange --dst-range 127.0.0.53 \
-j DNAT --to-destination ${vpn-dns}:53
'' + (lib.concatStringsSep "\n" bridgeStatements);
}; };
sane.netns.ovpns.hostVethIpv4 = "10.0.1.5";
# create a new routing table that we can use to proxy traffic out of the root namespace sane.netns.ovpns.netnsVethIpv4 = "10.0.1.6";
# through the ovpns namespace, and to the WAN via VPN. sane.netns.ovpns.netnsPubIpv4 = "185.157.162.178";
networking.iproute2.rttablesExtraConfig = '' sane.netns.ovpns.routeTable = 11;
5 ovpns sane.netns.ovpns.dns = "46.227.67.134"; #< DNS requests inside the namespace are forwarded here
'';
networking.iproute2.enable = true;
# HURRICANE ELECTRIC CONFIG:
# networking.sits = {
# hurricane = {
# remote = "216.218.226.238";
# local = "192.168.0.5";
# # local = "10.0.0.5";
# # remote = "10.0.0.1";
# # local = "10.0.0.22";
# dev = "eth0";
# ttl = 255;
# };
# };
# networking.interfaces."hurricane".ipv6 = {
# addresses = [
# # mx.uninsane.org (publically routed /64)
# {
# address = "2001:470:b:465::1";
# prefixLength = 128;
# }
# # client addr
# # {
# # address = "2001:470:a:466::2";
# # prefixLength = 64;
# # }
# ];
# routes = [
# {
# address = "::";
# prefixLength = 0;
# # via = "2001:470:a:466::1";
# }
# ];
# };
# # after configuration, we want the hurricane device to look like this:
# # hurricane: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1480
# # inet6 2001:470:a:450::2 prefixlen 64 scopeid 0x0<global>
# # inet6 fe80::c0a8:16 prefixlen 64 scopeid 0x20<link>
# # sit txqueuelen 1000 (IPv6-in-IPv4)
# # test with:
# # curl --interface hurricane http://[2607:f8b0:400a:80b::2004]
# # ping 2607:f8b0:400a:80b::2004
}; };
} }

View File

@@ -1,34 +0,0 @@
{ config, lib, ... }:
let
cweb-cfg = config.services.calibre-web;
inherit (cweb-cfg) user group;
inherit (cweb-cfg.listen) ip port;
svc-dir = "/var/lib/${cweb-cfg.dataDir}";
in
# XXX: disabled because of runtime errors like:
# > File "/nix/store/c7jqvx980nlg9xhxi065cba61r2ain9y-calibre-web-0.6.19/lib/python3.10/site-packages/calibreweb/cps/db.py", line 926, in speaking_language
# > languages = self.session.query(Languages) \
# > AttributeError: 'NoneType' object has no attribute 'query'
lib.mkIf false
{
sane.persist.sys.byStore.plaintext = [
{ inherit user group; mode = "0700"; path = svc-dir; method = "bind"; }
];
services.calibre-web.enable = true;
services.calibre-web.listen.ip = "127.0.0.1";
# XXX: externally populate `${svc-dir}/metadata.db` (once) from
# <https://github.com/janeczku/calibre-web/blob/master/library/metadata.db>
# i don't know why you have to do this??
# services.calibre-web.options.calibreLibrary = svc-dir;
services.nginx.virtualHosts."calibre.uninsane.org" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://${ip}:${builtins.toString port}";
};
};
sane.dns.zones."uninsane.org".inet.CNAME."calibre" = "native";
}

View File

@@ -36,7 +36,8 @@
# - rb = received bytes # - rb = received bytes
# - sp = sent packets # - sp = sent packets
# - sb = sent bytes # - sb = sent bytes
{ lib, ... }:
{ config, lib, ... }:
let let
# TURN port range (inclusive). # TURN port range (inclusive).
# default coturn behavior is to use the upper quarter of all ports. i.e. 49152 - 65535. # default coturn behavior is to use the upper quarter of all ports. i.e. 49152 - 65535.
@@ -55,7 +56,7 @@ in
# protocol = [ "tcp" "udp" ]; # protocol = [ "tcp" "udp" ];
# # visibleTo.lan = true; # # visibleTo.lan = true;
# # visibleTo.wan = true; # # visibleTo.wan = true;
# visibleTo.ovpn = true; # forward traffic from the VPN to the root NS # visibleTo.ovpns = true; # forward traffic from the VPN to the root NS
# description = "colin-stun-turn"; # description = "colin-stun-turn";
# }; # };
# "5349" = { # "5349" = {
@@ -63,7 +64,7 @@ in
# protocol = [ "tcp" ]; # protocol = [ "tcp" ];
# # visibleTo.lan = true; # # visibleTo.lan = true;
# # visibleTo.wan = true; # # visibleTo.wan = true;
# visibleTo.ovpn = true; # visibleTo.ovpns = true;
# description = "colin-stun-turn-over-tls"; # description = "colin-stun-turn-over-tls";
# }; # };
# } # }
@@ -76,7 +77,7 @@ in
# protocol = [ "tcp" "udp" ]; # protocol = [ "tcp" "udp" ];
# # visibleTo.lan = true; # # visibleTo.lan = true;
# # visibleTo.wan = true; # # visibleTo.wan = true;
# visibleTo.ovpn = true; # visibleTo.ovpns = true;
# description = "colin-turn-${builtins.toString count}-of-${builtins.toString numPorts}"; # description = "colin-turn-${builtins.toString count}-of-${builtins.toString numPorts}";
# }; # };
# }) # })
@@ -130,11 +131,11 @@ in
"verbose" "verbose"
# "Verbose" #< even MORE verbosity than "verbose" (it's TOO MUCH verbosity really) # "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) "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=${config.sane.netns.ovpns.hostVethIpv4}" "external-ip=${config.sane.netns.ovpns.netnsPubIpv4}" #< 2024/04/25: works, if running in root namespace
"listening-ip=185.157.162.178" "external-ip=185.157.162.178" "listening-ip=${config.sane.netns.ovpns.netnsPubIpv4}" "external-ip=${config.sane.netns.ovpns.netnsPubIpv4}"
# old attempts: # old attempts:
# "external-ip=185.157.162.178/10.0.1.5" # "external-ip=${config.sane.netns.ovpns.netnsPubIpv4}/${config.sane.netns.ovpns.hostVethIpv4}"
# "listening-ip=10.78.79.51" # can be specified multiple times; omit for * # "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/10.78.79.51"
# "external-ip=97.113.128.229" # "external-ip=97.113.128.229"

View File

@@ -16,14 +16,17 @@
# - validate with `bitcoin-cli -netinfo` # - validate with `bitcoin-cli -netinfo`
{ config, lib, pkgs, sane-lib, ... }: { config, lib, pkgs, sane-lib, ... }:
let let
# bitcoind = config.sane.programs.bitcoind.packageUnwrapped;
bitcoind = pkgs.bitcoind;
# wrapper to run bitcoind with the tor onion address as externalip (computed at runtime) # wrapper to run bitcoind with the tor onion address as externalip (computed at runtime)
_bitcoindWithExternalIp = with pkgs; writeShellScriptBin "bitcoind" '' _bitcoindWithExternalIp = pkgs.writeShellScriptBin "bitcoind" ''
set -xeu
externalip="$(cat /var/lib/tor/onion/bitcoind/hostname)" externalip="$(cat /var/lib/tor/onion/bitcoind/hostname)"
exec ${bitcoind}/bin/bitcoind "-externalip=$externalip" "$@" exec ${bitcoind}/bin/bitcoind "-externalip=$externalip" "$@"
''; '';
# the package i provide to services.bitcoind ends up on system PATH, and used by other tools like clightning. # the package i provide to services.bitcoind ends up on system PATH, and used by other tools like clightning.
# therefore, even though services.bitcoind only needs `bitcoind` binary, provide all the other bitcoin-related binaries (notably `bitcoin-cli`) as well: # therefore, even though services.bitcoind only needs `bitcoind` binary, provide all the other bitcoin-related binaries (notably `bitcoin-cli`) as well:
bitcoindWithExternalIp = with pkgs; symlinkJoin { bitcoindWithExternalIp = pkgs.symlinkJoin {
name = "bitcoind-with-external-ip"; name = "bitcoind-with-external-ip";
paths = [ _bitcoindWithExternalIp bitcoind ]; paths = [ _bitcoindWithExternalIp bitcoind ];
}; };
@@ -61,23 +64,62 @@ in
passwordHMAC = "30002c05d82daa210550e17a182db3f3$6071444151281e1aa8a2729f75e3e2d224e9d7cac3974810dab60e7c28ffaae4"; passwordHMAC = "30002c05d82daa210550e17a182db3f3$6071444151281e1aa8a2729f75e3e2d224e9d7cac3974810dab60e7c28ffaae4";
}; };
extraConfig = '' extraConfig = ''
# checkblocks: default 6: how many blocks to verify on start
checkblocks=3
# don't load the wallet, and disable wallet RPC calls # don't load the wallet, and disable wallet RPC calls
disablewallet=1 disablewallet=1
# proxy all outbound traffic through Tor # proxy all outbound traffic through Tor
proxy=127.0.0.1:9050 proxy=127.0.0.1:9050
''; '';
extraCmdlineOptions = [
# "-debug"
# "-debug=estimatefee"
# "-debug=http"
# "-debug=net"
"-debug=proxy"
"-debug=rpc"
# "-debug=validation"
];
}; };
users.users.bitcoind-mainnet.extraGroups = [ "tor" ]; users.users.bitcoind-mainnet.extraGroups = [ "tor" ];
systemd.services.bitcoind-mainnet.serviceConfig.RestartSec = "30s"; #< default is 0 systemd.services.bitcoind-mainnet = {
after = [ "tor.service" ];
requires = [ "tor.service" ];
serviceConfig.RestartSec = "30s"; #< default is 0
# hardening (systemd-analyze security bitcoind-mainnet)
serviceConfig.StateDirectory = "bitcoind-mainnet";
serviceConfig.LockPersonality = true;
serviceConfig.MemoryDenyWriteExecute = "true";
serviceConfig.NoNewPrivileges = "true";
serviceConfig.PrivateDevices = "true";
serviceConfig.PrivateMounts = true;
serviceConfig.PrivateTmp = "true";
serviceConfig.PrivateUsers = true;
serviceConfig.ProcSubset = "pid";
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true;
serviceConfig.ProtectHostname = true;
serviceConfig.ProtectKernelLogs = true;
serviceConfig.ProtectKernelModules = true;
serviceConfig.ProtectKernelTunables = true;
serviceConfig.ProtectProc = "invisible";
serviceConfig.ProtectSystem = lib.mkForce "strict";
serviceConfig.RemoveIPC = true;
serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
serviceConfig.RestrictNamespaces = true;
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native";
serviceConfig.SystemCallFilter = [ "@system-service" ];
};
sane.users.colin.fs.".bitcoin/bitcoin.conf" = sane-lib.fs.wantedSymlinkTo config.sops.secrets."bitcoin.conf".path;
sops.secrets."bitcoin.conf" = { sops.secrets."bitcoin.conf" = {
mode = "0600"; mode = "0600";
owner = "colin"; owner = "colin";
group = "users"; group = "users";
}; };
sane.programs.bitcoind.enableFor.user.colin = true; # for debugging/administration: `bitcoin-cli` sane.programs.bitcoin-cli.enableFor.user.colin = true; # for debugging/administration: `bitcoin-cli`
} }

View File

@@ -72,13 +72,11 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
sane.persist.sys.byStore.ext = [ sane.persist.sys.byStore.private = [
# clightning takes up only a few MB. but then several hundred MB of crash logs that i should probably GC.
{ user = "clightning"; group = "clightning"; mode = "0710"; path = "/var/lib/clightning"; method = "bind"; } { user = "clightning"; group = "clightning"; mode = "0710"; path = "/var/lib/clightning"; method = "bind"; }
]; ];
# `lightning-cli` finds its RPC file via `~/.lightning/bitcoin/lightning-rpc`, to message the daemon
sane.user.fs.".lightning".symlink.target = "/var/lib/clightning";
# see bitcoin.nix for how to generate this # see bitcoin.nix for how to generate this
services.bitcoind.mainnet.rpc.users.clightning.passwordHMAC = services.bitcoind.mainnet.rpc.users.clightning.passwordHMAC =
"befcb82d9821049164db5217beb85439$2c31ac7db3124612e43893ae13b9527dbe464ab2d992e814602e7cb07dc28985"; "befcb82d9821049164db5217beb85439$2c31ac7db3124612e43893ae13b9527dbe464ab2d992e814602e7cb07dc28985";
@@ -105,6 +103,7 @@
users.users.clightning.extraGroups = [ "tor" ]; users.users.clightning.extraGroups = [ "tor" ];
systemd.services.clightning.after = [ "tor.service" ]; systemd.services.clightning.after = [ "tor.service" ];
systemd.services.clightning.requires = [ "tor.service" ];
# lightning-config contains fields from here: # lightning-config contains fields from here:
# - <https://docs.corelightning.org/docs/configuration> # - <https://docs.corelightning.org/docs/configuration>
@@ -116,11 +115,16 @@
# - fee-per-satoshi=<ppm> # - fee-per-satoshi=<ppm>
# - feature configs (i.e. experimental-xyz options) # - feature configs (i.e. experimental-xyz options)
sane.services.clightning.extraConfig = '' sane.services.clightning.extraConfig = ''
log-level=debug:lightningd # log levels: "io", "debug", "info", "unusual", "broken"
log-level=info
# log-level=info:lightningd
# log-level=debug:lightningd
# log-level=debug
# peerswap: # peerswap:
# - config example: <https://github.com/fort-nix/nix-bitcoin/pull/462/files#diff-b357d832705b8ce8df1f41934d613f79adb77c4cd5cd9e9eb12a163fca3e16c6> # - config example: <https://github.com/fort-nix/nix-bitcoin/pull/462/files#diff-b357d832705b8ce8df1f41934d613f79adb77c4cd5cd9e9eb12a163fca3e16c6>
# XXX: peerswap crashes clightning on launch. stacktrace is useless. # XXX: peerswap crashes clightning on launch. stacktrace is useless.
# plugin=${pkgs.peerswap}/bin/peerswap # plugin={pkgs.peerswap}/bin/peerswap
# peerswap-db-path=/var/lib/clightning/peerswap/swaps # peerswap-db-path=/var/lib/clightning/peerswap/swaps
# peerswap-policy-path=... # peerswap-policy-path=...
''; '';
@@ -131,5 +135,5 @@
group = "clightning"; group = "clightning";
}; };
sane.programs.clightning.enableFor.user.colin = true; # for debugging/admin: `lightning-cli` sane.programs.lightning-cli.enableFor.user.colin = true; # for debugging/admin:
} }

View File

@@ -1,4 +1,5 @@
{ ... }: { lib, ... }:
lib.mkIf false #< 2024/07/27: i don't use it, too much surface-area for me to run it pro-bono (`systemd-analyze security monero`)
{ {
services.i2p.enable = true; services.i2p.enable = true;
} }

View File

@@ -1,5 +1,6 @@
# as of 2023/11/26: complete downloaded blockchain should be 200GiB on disk, give or take. # as of 2023/11/26: complete downloaded blockchain should be 200GiB on disk, give or take.
{ ... }: { lib, ... }:
lib.mkIf false #< 2024/07/27: i don't use it, too much surface-area for me to run it pro-bono (`systemd-analyze security monero`)
{ {
sane.persist.sys.byStore.ext = [ sane.persist.sys.byStore.ext = [
# /var/lib/monero/lmdb is what consumes most of the space # /var/lib/monero/lmdb is what consumes most of the space

View File

@@ -1,10 +1,10 @@
# tor settings: <https://2019.www.torproject.org/docs/tor-manual.html.en> # tor settings: <https://2019.www.torproject.org/docs/tor-manual.html.en>
{ lib, ... }: { lib, ... }:
{ {
# tor hidden service hostnames aren't deterministic, so persist. sane.persist.sys.byStore.ephemeral = [
# might be able to get away with just persisting /var/lib/tor/onion, not sure. # N.B.: tor hidden service hostnames aren't deterministic, so if you need them
sane.persist.sys.byStore.plaintext = [ # to be preserved across reboots then persist /var/lib/tor/onion in "private" store.
{ user = "tor"; group = "tor"; mode = "0710"; path = "/var/lib/tor"; method = "bind"; } { user = "tor"; group = "tor"; mode = "0710"; path = "/var/lib/tor"; method = "bind"; }
]; ];
# tor: `tor.enable` doesn't start a relay, exit node, proxy, etc. it's minimal. # tor: `tor.enable` doesn't start a relay, exit node, proxy, etc. it's minimal.

View File

@@ -1,17 +1,17 @@
{ ... }: { ... }:
{ {
imports = [ imports = [
./calibre.nix
./coturn.nix ./coturn.nix
./cryptocurrencies ./cryptocurrencies
./email ./email
./ejabberd.nix ./ejabberd.nix
./freshrss.nix ./freshrss.nix
./export ./export
./hickory-dns.nix
./gitea.nix ./gitea.nix
./goaccess.nix ./goaccess.nix
./ipfs.nix ./ipfs.nix
./jackett.nix ./jackett
./jellyfin.nix ./jellyfin.nix
./kiwix-serve.nix ./kiwix-serve.nix
./komga.nix ./komga.nix
@@ -21,13 +21,13 @@
./nginx.nix ./nginx.nix
./nixos-prebuild.nix ./nixos-prebuild.nix
./ntfy ./ntfy
./ollama.nix
./pict-rs.nix ./pict-rs.nix
./pleroma.nix ./pleroma.nix
./postgres.nix ./postgres.nix
./prosody ./prosody
./slskd.nix ./slskd.nix
./transmission.nix ./transmission
./trust-dns.nix
./wikipedia.nix ./wikipedia.nix
]; ];
} }

View File

@@ -44,61 +44,61 @@ in
# everything configured below was fine: used ejabberd for several months. # everything configured below was fine: used ejabberd for several months.
lib.mkIf false lib.mkIf false
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
{ user = "ejabberd"; group = "ejabberd"; path = "/var/lib/ejabberd"; method = "bind"; } { user = "ejabberd"; group = "ejabberd"; path = "/var/lib/ejabberd"; method = "bind"; }
]; ];
sane.ports.ports = lib.mkMerge ([ sane.ports.ports = lib.mkMerge ([
{ {
"3478" = { "3478" = {
protocol = [ "tcp" "udp" ]; protocol = [ "tcp" "udp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-stun-turn"; description = "colin-xmpp-stun-turn";
}; };
"5222" = { "5222" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-client-to-server"; description = "colin-xmpp-client-to-server";
}; };
"5223" = { "5223" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpps-client-to-server"; # XMPP over TLS description = "colin-xmpps-client-to-server"; # XMPP over TLS
}; };
"5269" = { "5269" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.wan = true; visibleTo.doof = true;
description = "colin-xmpp-server-to-server"; description = "colin-xmpp-server-to-server";
}; };
"5270" = { "5270" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.wan = true; visibleTo.doof = true;
description = "colin-xmpps-server-to-server"; # XMPP over TLS description = "colin-xmpps-server-to-server"; # XMPP over TLS
}; };
"5280" = { "5280" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-bosh"; description = "colin-xmpp-bosh";
}; };
"5281" = { "5281" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-bosh-https"; description = "colin-xmpp-bosh-https";
}; };
"5349" = { "5349" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-stun-turn-over-tls"; description = "colin-xmpp-stun-turn-over-tls";
}; };
"5443" = { "5443" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-web-services"; # file uploads, websockets, admin description = "colin-xmpp-web-services"; # file uploads, websockets, admin
}; };
} }
@@ -109,8 +109,8 @@ lib.mkIf false
numPorts = turnPortHigh - turnPortLow + 1; numPorts = turnPortHigh - turnPortLow + 1;
in { in {
protocol = [ "tcp" "udp" ]; protocol = [ "tcp" "udp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-turn-${builtins.toString count}-of-${builtins.toString numPorts}"; description = "colin-xmpp-turn-${builtins.toString count}-of-${builtins.toString numPorts}";
}; };
}) })

View File

@@ -8,14 +8,14 @@
{ {
sane.ports.ports."143" = { sane.ports.ports."143" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-imap-imap.uninsane.org"; description = "colin-imap-imap.uninsane.org";
}; };
sane.ports.ports."993" = { sane.ports.ports."993" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-imaps-imap.uninsane.org"; description = "colin-imaps-imap.uninsane.org";
}; };
@@ -83,8 +83,8 @@
# sieve_plugins = sieve_imapsieve # sieve_plugins = sieve_imapsieve
# } # }
mail_debug = yes # mail_debug = yes
auth_debug = yes # auth_debug = yes
# verbose_ssl = yes # verbose_ssl = yes
''; '';

View File

@@ -1,6 +1,13 @@
# postfix config options: <https://www.postfix.org/postconf.5.html> # postfix config options: <https://www.postfix.org/postconf.5.html>
# config files:
# - /etc/postfix/main.cf
# - /etc/postfix/master.cf
#
# logs:
# - postfix logs directly to *syslog*,
# so check e.g. ~/.local/share/rsyslog
{ lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
submissionOptions = { submissionOptions = {
@@ -18,14 +25,14 @@ let
}; };
in in
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
# TODO: mode? could be more granular # TODO: mode? could be more granular
{ user = "opendkim"; group = "opendkim"; path = "/var/lib/opendkim"; method = "bind"; } { user = "opendkim"; group = "opendkim"; path = "/var/lib/opendkim"; method = "bind"; } #< TODO: migrate to secrets
{ user = "root"; group = "root"; path = "/var/lib/postfix"; method = "bind"; }
{ user = "root"; group = "root"; path = "/var/spool/mail"; method = "bind"; } { user = "root"; group = "root"; path = "/var/spool/mail"; method = "bind"; }
# *probably* don't need these dirs: # *probably* don't need these dirs:
# "/var/lib/dhparams" # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/security/dhparams.nix # "/var/lib/dhparams" # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/security/dhparams.nix
# "/var/lib/dovecot" # "/var/lib/dovecot"
# "/var/lib/postfix"
]; ];
# XXX(2023/10/20): opening these ports in the firewall has the OPPOSITE effect as intended. # XXX(2023/10/20): opening these ports in the firewall has the OPPOSITE effect as intended.
@@ -56,8 +63,7 @@ in
sane.dns.zones."uninsane.org".inet = { sane.dns.zones."uninsane.org".inet = {
MX."@" = "10 mx.uninsane.org."; MX."@" = "10 mx.uninsane.org.";
# XXX: RFC's specify that the MX record CANNOT BE A CNAME A."mx" = "%AOVPNS%"; #< XXX: RFC's specify that the MX record CANNOT BE A CNAME. TODO: use "%AOVPNS%?
A."mx" = "185.157.162.178";
# Sender Policy Framework: # Sender Policy Framework:
# +mx => mail passes if it originated from the MX # +mx => mail passes if it originated from the MX
@@ -96,6 +102,7 @@ in
services.postfix.sslCert = "/var/lib/acme/mx.uninsane.org/fullchain.pem"; services.postfix.sslCert = "/var/lib/acme/mx.uninsane.org/fullchain.pem";
services.postfix.sslKey = "/var/lib/acme/mx.uninsane.org/key.pem"; services.postfix.sslKey = "/var/lib/acme/mx.uninsane.org/key.pem";
# see: `man 5 virtual`
services.postfix.virtual = '' services.postfix.virtual = ''
notify.matrix@uninsane.org matrix-synapse notify.matrix@uninsane.org matrix-synapse
@uninsane.org colin @uninsane.org colin
@@ -136,6 +143,20 @@ in
# smtpd_sender_restrictions = reject_unknown_sender_domain # smtpd_sender_restrictions = reject_unknown_sender_domain
}; };
# debugging options:
# services.postfix.masterConfig = {
# "proxymap".args = [ "-v" ];
# "proxywrite".args = [ "-v" ];
# "relay".args = [ "-v" ];
# "smtp".args = [ "-v" ];
# "smtp_inet".args = [ "-v" ];
# "submission".args = [ "-v" ];
# "submissions".args = [ "-v" ];
# "submissions".chroot = false;
# "submissions".private = false;
# "submissions".privileged = true;
# };
services.postfix.enableSubmission = true; services.postfix.enableSubmission = true;
services.postfix.submissionOptions = submissionOptions; services.postfix.submissionOptions = submissionOptions;
services.postfix.enableSubmissions = true; services.postfix.enableSubmissions = true;
@@ -143,6 +164,10 @@ in
systemd.services.postfix.after = [ "wireguard-wg-ovpns.service" ]; systemd.services.postfix.after = [ "wireguard-wg-ovpns.service" ];
systemd.services.postfix.partOf = [ "wireguard-wg-ovpns.service" ]; systemd.services.postfix.partOf = [ "wireguard-wg-ovpns.service" ];
systemd.services.postfix.unitConfig.RequiresMountsFor = [
"/var/spool/mail" # spooky errors when postfix is run w/o this: `warning: connect #1 to subsystem private/proxymap: Connection refused`
"/var/lib/opendkim"
];
systemd.services.postfix.serviceConfig = { systemd.services.postfix.serviceConfig = {
# run this behind the OVPN static VPN # run this behind the OVPN static VPN
NetworkNamespacePath = "/run/netns/ovpns"; NetworkNamespacePath = "/run/netns/ovpns";
@@ -176,23 +201,30 @@ in
#### OUTGOING MESSAGE REWRITING: #### OUTGOING MESSAGE REWRITING:
services.postfix.enableHeaderChecks = true; # - `man 5 header_checks`
services.postfix.headerChecks = [ # - <https://www.postfix.org/header_checks.5.html>
# intercept gitea registration confirmations and manually screen them # - populates `/var/lib/postfix/conf/header_checks`
{ # XXX(2024-08-06): registration gating via email matches is AWFUL:
# headerChecks are somehow ignorant of alias rules: have to redirect to a real user # 1. bypassed if the service offers localization.
action = "REDIRECT colin@uninsane.org"; # 2. if i try to forward the registration request, it may match the filter again and get sent back to my inbox.
pattern = "/^Subject: Please activate your account/"; # 3. header checks are possibly under-used in the ecosystem, and may break postfix config.
} # services.postfix.enableHeaderChecks = true;
# intercept Matrix registration confirmations # services.postfix.headerChecks = [
{ # # intercept gitea registration confirmations and manually screen them
action = "REDIRECT colin@uninsane.org"; # {
pattern = "/^Subject:.*Validate your email/"; # # headerChecks are somehow ignorant of alias rules: have to redirect to a real user
} # action = "REDIRECT colin@uninsane.org";
# XXX postfix only supports performing ONE action per header. # pattern = "/^Subject: Please activate your account/";
# { # }
# action = "REPLACE Subject: git application: Please activate your account"; # # intercept Matrix registration confirmations
# pattern = "/^Subject:.*activate your account/"; # {
# } # action = "REDIRECT colin@uninsane.org";
]; # pattern = "/^Subject:.*Validate your email/";
# }
# # XXX postfix only supports performing ONE action per header.
# # {
# # action = "REPLACE Subject: git application: Please activate your account";
# # pattern = "/^Subject:.*activate your account/";
# # }
# ];
} }

View File

@@ -37,7 +37,8 @@
wantedBy = [ "nfs.service" "sftpgo.service" ]; wantedBy = [ "nfs.service" "sftpgo.service" ];
file.text = '' file.text = ''
- media/ read-only: Videos, Music, Books, etc - media/ read-only: Videos, Music, Books, etc
- playground/ read-write: use it to share files with other users of this server - playground/ read-write: use it to share files with other users of this server, inaccessible from the www
- pub/ read-only: content made to be shared with the www
''; '';
}; };
@@ -50,4 +51,11 @@
- be a friendly troll - be a friendly troll
''; '';
}; };
sane.fs."/var/export/.public_for_test/test" = {
wantedBy = [ "nfs.service" "sftpgo.service" ];
file.text = ''
automated tests read this file to probe connectivity
'';
};
} }

View File

@@ -15,6 +15,7 @@
# - could maybe be done with some mount option? # - could maybe be done with some mount option?
{ config, lib, ... }: { config, lib, ... }:
lib.mkIf false #< TODO: remove nfs altogether! it's not exactly the most secure
{ {
services.nfs.server.enable = true; services.nfs.server.enable = true;

View File

@@ -9,9 +9,10 @@
{ config, lib, pkgs, sane-lib, ... }: { config, lib, pkgs, sane-lib, ... }:
let let
external_auth_hook = pkgs.static-nix-shell.mkPython3Bin { external_auth_hook = pkgs.static-nix-shell.mkPython3 {
pname = "external_auth_hook"; pname = "external_auth_hook";
srcRoot = ./.; srcRoot = ./.;
pkgs = [ "python3.pkgs.passlib" ];
}; };
# Client initiates a FTP "control connection" on port 21. # 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 # - this handles the client -> server commands, and the server -> client status, but not the actual data
@@ -26,13 +27,12 @@ in
"21" = { "21" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.lan = true; visibleTo.lan = true;
# visibleTo.wan = true;
description = "colin-FTP server"; description = "colin-FTP server";
}; };
"990" = { "990" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-FTPS server"; description = "colin-FTPS server";
}; };
} // (sane-lib.mapToAttrs } // (sane-lib.mapToAttrs
@@ -40,8 +40,8 @@ in
name = builtins.toString port; name = builtins.toString port;
value = { value = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-FTP server data port range"; description = "colin-FTP server data port range";
}; };
}) })
@@ -59,18 +59,8 @@ in
enable = true; enable = true;
group = "export"; 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 { package = pkgs.sftpgo.overrideAttrs (upstream: {
inherit (pkgs.sftpgo) name ldflags nativeBuildInputs doCheck subPackages postInstall passthru meta; patches = (upstream.patches or []) ++ [
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: # fix for compatibility with kodi:
# ftp LIST operation returns entries over-the-wire like: # ftp LIST operation returns entries over-the-wire like:
# - dgrwxrwxr-x 1 ftp ftp 9 Apr 9 15:05 Videos # - dgrwxrwxr-x 1 ftp ftp 9 Apr 9 15:05 Videos
@@ -79,7 +69,7 @@ in
# the full set of bits, from which i filter, is found here: <https://pkg.go.dev/io/fs#FileMode> # the full set of bits, from which i filter, is found here: <https://pkg.go.dev/io/fs#FileMode>
./safe_fileinfo.patch ./safe_fileinfo.patch
]; ];
}; });
settings = { settings = {
ftpd = { ftpd = {
@@ -90,12 +80,6 @@ in
port = 21; port = 21;
debug = true; debug = true;
} }
{
# binding this means any LAN client can connect (also WAN traffic forwarded from the gateway)
address = "10.78.79.51";
port = 21;
debug = true;
}
{ {
# binding this means any wireguard client can connect # binding this means any wireguard client can connect
address = "10.0.10.5"; address = "10.0.10.5";
@@ -106,6 +90,26 @@ in
{ {
# binding this means any LAN client can connect (also WAN traffic forwarded from the gateway) # binding this means any LAN client can connect (also WAN traffic forwarded from the gateway)
address = "10.78.79.51"; address = "10.78.79.51";
port = 21;
debug = true;
}
{
# 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.
}
{
# binding this means any doof client can connect (TLS only)
address = config.sane.netns.doof.hostVethIpv4;
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 via `ftp.uninsane.org` (TLS only)
address = config.sane.netns.doof.netnsPubIpv4;
port = 990; port = 990;
debug = true; debug = true;
tls_mode = 2; # 2 = "implicit FTPS": client negotiates TLS before any FTP command. tls_mode = 2; # 2 = "implicit FTPS": client negotiates TLS before any FTP command.
@@ -126,7 +130,7 @@ in
banner = '' banner = ''
Welcome, friends, to Colin's FTP server! Also available via NFS on the same host, but LAN-only. Welcome, friends, to Colin's FTP server! Also available via NFS on the same host, but LAN-only.
Read-only access (LAN-restricted): Read-only access (LAN clients see everything; WAN clients can only see /pub):
Username: "anonymous" Username: "anonymous"
Password: "anonymous" Password: "anonymous"

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" #!nix-shell -i python3 -p python3 -p python3.pkgs.passlib
# vim: set filetype=python : # vim: set filetype=python :
# #
# available environment variables: # available environment variables:
@@ -37,14 +37,16 @@
# - it seems (empirically) that a user can't cd above their home directory. # - it seems (empirically) that a user can't cd above their home directory.
# though i don't have a reference for that in the docs. # though i don't have a reference for that in the docs.
import crypt
import json import json
import os import os
import passlib.hosts
from hmac import compare_digest from hmac import compare_digest
authFail = dict(username="") authFail = dict(username="")
PERM_DENY = []
PERM_LIST = [ "list" ]
PERM_RO = [ "list", "download" ] PERM_RO = [ "list", "download" ]
PERM_RW = [ PERM_RW = [
# read-only: # read-only:
@@ -112,10 +114,8 @@ def isWireguard(ip: str) -> bool:
def isTrustedCred(password: str) -> bool: def isTrustedCred(password: str) -> bool:
for cred in TRUSTED_CREDS: for cred in TRUSTED_CREDS:
_, method, salt, hash_ = cred.split("$") if passlib.hosts.linux_context.verify(password, cred):
# assert method == "6", f"unrecognized crypt entry: {cred}" return True
if crypt.crypt(password, f"${method}${salt}") == cred:
return True
return False return False
@@ -129,12 +129,14 @@ def getAuthResponse(ip: str, username: str, password: str) -> dict:
return mkAuthOk(username, permissions = { return mkAuthOk(username, permissions = {
"/": PERM_RW, "/": PERM_RW,
"/playground": PERM_RW, "/playground": PERM_RW,
"/.public_for_test": PERM_RO,
}) })
if isWireguard(ip): if isWireguard(ip):
# allow any user from wireguard # allow any user from wireguard
return mkAuthOk(username, permissions = { return mkAuthOk(username, permissions = {
"/": PERM_RW, "/": PERM_RW,
"/playground": PERM_RW, "/playground": PERM_RW,
"/.public_for_test": PERM_RO,
}) })
if isLan(ip): if isLan(ip):
if username == "anonymous": if username == "anonymous":
@@ -142,7 +144,19 @@ def getAuthResponse(ip: str, username: str, password: str) -> dict:
return mkAuthOk("anonymous", permissions = { return mkAuthOk("anonymous", permissions = {
"/": PERM_RO, "/": PERM_RO,
"/playground": PERM_RW, "/playground": PERM_RW,
"/.public_for_test": PERM_RO,
}) })
if username == "anonymous":
# anonymous users from the www can have even more limited access.
# mostly because i need an easy way to test WAN connectivity :-)
return mkAuthOk("anonymous", permissions = {
# "/": PERM_DENY,
"/": PERM_LIST, #< REQUIRED, even for lftp to list a subdir
"/media": PERM_DENY,
"/playground": PERM_DENY,
"/.public_for_test": PERM_RO,
# "/README.md": PERM_RO, #< does not work
})
return authFail return authFail

View File

@@ -10,6 +10,7 @@
# ``` # ```
{ config, lib, pkgs, sane-lib, ... }: { config, lib, pkgs, sane-lib, ... }:
lib.mkIf false #< 2024/07/04: i haven't actively used this for months
{ {
sops.secrets."freshrss_passwd" = { sops.secrets."freshrss_passwd" = {
owner = config.users.users.freshrss.name; owner = config.users.users.freshrss.name;

View File

@@ -1,11 +1,14 @@
# config options: <https://docs.gitea.io/en-us/administration/config-cheat-sheet/> # config options: <https://docs.gitea.io/en-us/administration/config-cheat-sheet/>
# TODO: service shouldn't run as `git` user, but as `gitea`
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
# TODO: mode? could be more granular { user = "git"; group = "gitea"; mode = "0750"; path = "/var/lib/gitea"; method = "bind"; }
{ user = "git"; group = "gitea"; path = "/var/lib/gitea"; method = "bind"; }
]; ];
sane.programs.gitea.enableFor.user.colin = true; # for admin, and monitoring
services.gitea.enable = true; services.gitea.enable = true;
services.gitea.user = "git"; # default is 'gitea' services.gitea.user = "git"; # default is 'gitea'
services.gitea.database.type = "postgres"; services.gitea.database.type = "postgres";
@@ -38,28 +41,41 @@
ROOT_URL = "https://git.uninsane.org/"; ROOT_URL = "https://git.uninsane.org/";
}; };
service = { service = {
# timeout for email approval. 5760 = 4 days # timeout for email approval. 5760 = 4 days. 10080 = 7 days
ACTIVE_CODE_LIVE_MINUTES = 5760; ACTIVE_CODE_LIVE_MINUTES = 10080;
# REGISTER_EMAIL_CONFIRM = false; # REGISTER_EMAIL_CONFIRM = false;
# REGISTER_MANUAL_CONFIRM = true; # REGISTER_EMAIL_CONFIRM = true; #< override REGISTER_MANUAL_CONFIRM
REGISTER_EMAIL_CONFIRM = true; REGISTER_MANUAL_CONFIRM = true;
# not sure what this notified on? # not sure what this notifies *on*...
ENABLE_NOTIFY_MAIL = true; ENABLE_NOTIFY_MAIL = true;
# defaults to image-based captcha. # defaults to image-based captcha.
# also supports recaptcha (with custom URLs) or hCaptcha. # also supports recaptcha (with custom URLs) or hCaptcha.
ENABLE_CAPTCHA = true; ENABLE_CAPTCHA = true;
NOREPLY_ADDRESS = "noreply.anonymous.git@uninsane.org"; NOREPLY_ADDRESS = "noreply.anonymous.git@uninsane.org";
EMAIL_DOMAIN_BLOCKLIST = lib.concatStringsSep ", " [
"*.claychoen.top"
"*.gemmasmith.co.uk"
"*.jenniferlawrence.uk"
"*.sarahconnor.co.uk"
"*.marymarshall.co.uk"
];
};
session = {
COOKIE_SECURE = true;
# keep me logged in for 30 days
SESSION_LIFE_TIME = 60 * 60 * 24 * 30;
}; };
session.COOKIE_SECURE = true;
repository = { repository = {
DEFAULT_BRANCH = "master"; DEFAULT_BRANCH = "master";
ENABLE_PUSH_CREATE_USER = true;
ENABLE_PUSH_CREATE_ORG = true;
}; };
other = { other = {
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false; SHOW_FOOTER_TEMPLATE_LOAD_TIME = false;
}; };
ui = { ui = {
# options: "auto", "gitea", "arc-green" # options: "gitea-auto" (adapt to system theme), "gitea-dark", "gitea-light"
DEFAULT_THEME = "arc-green"; # DEFAULT_THEME = "gitea-auto";
# cache frontend assets if true # cache frontend assets if true
# USE_SERVICE_WORKER = true; # USE_SERVICE_WORKER = true;
}; };
@@ -68,9 +84,10 @@
# alternative is to use nixos-level config: # alternative is to use nixos-level config:
# services.gitea.mailerPasswordFile = ... # services.gitea.mailerPasswordFile = ...
ENABLED = true; ENABLED = true;
MAILER_TYPE = "sendmail";
FROM = "notify.git@uninsane.org"; FROM = "notify.git@uninsane.org";
PROTOCOL = "sendmail";
SENDMAIL_PATH = "${pkgs.postfix}/bin/sendmail"; SENDMAIL_PATH = "${pkgs.postfix}/bin/sendmail";
SENDMAIL_ARGS = "--"; # most "sendmail" programs take options, "--" will prevent an email address being interpreted as an option.
}; };
time = { time = {
# options: ANSIC, UnixDate, RubyDate, RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Kitchen, Stamp, StampMilli, StampMicro, StampNano # options: ANSIC, UnixDate, RubyDate, RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Kitchen, Stamp, StampMilli, StampMicro, StampNano
@@ -90,6 +107,8 @@
]; ];
}; };
services.openssh.settings.UsePAM = true; #< required for `git` user to authenticate
# hosted git (web view and for `git <cmd>` use # hosted git (web view and for `git <cmd>` use
# TODO: enable publog? # TODO: enable publog?
services.nginx.virtualHosts."git.uninsane.org" = { services.nginx.virtualHosts."git.uninsane.org" = {
@@ -100,6 +119,10 @@
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:3000"; proxyPass = "http://127.0.0.1:3000";
}; };
# fuck you @anthropic
locations."= /robots.txt".extraConfig = ''
return 200 "User-agent: *\nDisallow: /\n";
'';
# gitea serves all `raw` files as content-type: plain, but i'd like to serve them as their actual content type. # gitea serves all `raw` files as content-type: plain, but i'd like to serve them as their actual content type.
# or at least, enough to make specific pages viewable (serving unoriginal content as arbitrary content type is dangerous). # or at least, enough to make specific pages viewable (serving unoriginal content as arbitrary content type is dangerous).
locations."~ ^/colin/phone-case-cq/raw/.*.html" = { locations."~ ^/colin/phone-case-cq/raw/.*.html" = {
@@ -125,7 +148,7 @@
sane.ports.ports."22" = { sane.ports.ports."22" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true; visibleTo.doof = true;
description = "colin-git@git.uninsane.org"; description = "colin-git@git.uninsane.org";
}; };
} }

View File

@@ -0,0 +1,145 @@
# TODO: split this file apart into smaller files to make it easier to understand
{ 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;
in
{
sane.ports.ports."53" = {
protocol = [ "udp" "tcp" ];
visibleTo.lan = true;
# visibleTo.wan = true;
visibleTo.ovpns = true;
visibleTo.doof = true;
description = "colin-dns-hosting";
};
sane.dns.zones."uninsane.org".TTL = 900;
# SOA record structure: <https://en.wikipedia.org/wiki/SOA_record#Structure>
# SOA MNAME RNAME (... rest)
# MNAME = Master name server for this zone. this is where update requests should be sent.
# RNAME = admin contact (encoded email address)
# Serial = YYYYMMDDNN, where N is incremented every time this file changes, to trigger secondary NS to re-fetch it.
# Refresh = how frequently secondary NS should query master
# Retry = how long secondary NS should wait until re-querying master after a failure (must be < Refresh)
# Expire = how long secondary NS should continue to reply to queries after master fails (> Refresh + Retry)
sane.dns.zones."uninsane.org".inet = {
SOA."@" = ''
ns1.uninsane.org. admin-dns.uninsane.org. (
2023092101 ; Serial
4h ; Refresh
30m ; Retry
7d ; Expire
5m) ; Negative response TTL
'';
TXT."rev" = "2023092101";
CNAME."native" = "%CNAMENATIVE%";
A."@" = "%ANATIVE%";
A."servo.wan" = "%AWAN%";
A."servo.doof" = "%ADOOF%";
A."servo.lan" = config.sane.hosts.by-name."servo".lan-ip;
A."servo.hn" = config.sane.hosts.by-name."servo".wg-home.ip;
# XXX NS records must also not be CNAME
# it's best that we keep this identical, or a superset of, what org. lists as our NS.
# so, org. can specify ns2/ns3 as being to the VPN, with no mention of ns1. we provide ns1 here.
A."ns1" = "%ANATIVE%";
A."ns2" = "%ADOOF%";
A."ovpns" = "%AOVPNS%";
NS."@" = [
"ns1.uninsane.org."
"ns2.uninsane.org."
];
};
services.hickory-dns.settings.zones = [ "uninsane.org" ];
networking.nat.enable = true; #< TODO: try removing this?
# networking.nat.extraCommands = ''
# # redirect incoming DNS requests from LAN addresses
# # to the LAN-specialized DNS service
# # N.B.: use the `nixos-*` chains instead of e.g. PREROUTING
# # because they get cleanly reset across activations or `systemctl restart firewall`
# # instead of accumulating cruft
# iptables -t nat -A nixos-nat-pre -p udp --dport 53 \
# -m iprange --src-range 10.78.76.0-10.78.79.255 \
# -j DNAT --to-destination :1053
# iptables -t nat -A nixos-nat-pre -p tcp --dport 53 \
# -m iprange --src-range 10.78.76.0-10.78.79.255 \
# -j DNAT --to-destination :1053
# '';
# sane.ports.ports."1053" = {
# # because the NAT above redirects in nixos-nat-pre, LAN requests behave as though they arrived on the external interface at the redirected port.
# # TODO: try nixos-nat-post instead?
# # TODO: or, don't NAT from port 53 -> port 1053, but rather nat from LAN addr to a loopback addr.
# # - this is complicated in that loopback is a different interface than eth0, so rewriting the destination address would cause the packets to just be dropped by the interface
# protocol = [ "udp" "tcp" ];
# visibleTo.lan = true;
# description = "colin-redirected-dns-for-lan-namespace";
# };
sane.services.hickory-dns.enable = true;
sane.services.hickory-dns.instances = let
mkSubstitutions = flavor: {
"%ADOOF%" = config.sane.netns.doof.netnsPubIpv4;
"%ANATIVE%" = nativeAddrs."servo.${flavor}";
"%AOVPNS%" = config.sane.netns.ovpns.netnsPubIpv4;
"%AWAN%" = "$(cat '${dyn-dns.ipPath}')";
"%CNAMENATIVE%" = "servo.${flavor}";
};
in
{
doof = {
substitutions = mkSubstitutions "doof";
listenAddrsIpv4 = [
config.sane.netns.doof.hostVethIpv4
config.sane.netns.doof.netnsPubIpv4
nativeAddrs."servo.lan"
# config.sane.netns.ovpns.hostVethIpv4
];
};
hn = {
substitutions = mkSubstitutions "hn";
listenAddrsIpv4 = [ nativeAddrs."servo.hn" ];
enableRecursiveResolver = true; #< allow wireguard clients to use this as their DNS resolver
# extraConfig = {
# zones = [
# {
# # forward the root zone to the local DNS resolver
# # to allow wireguard clients to use this as their DNS resolver
# zone = ".";
# zone_type = "Forward";
# stores = {
# type = "forward";
# name_servers = [
# {
# socket_addr = "127.0.0.53:53";
# protocol = "udp";
# trust_nx_responses = true;
# }
# ];
# };
# }
# ];
# };
};
# lan = {
# substitutions = mkSubstitutions "lan";
# listenAddrsIpv4 = [ nativeAddrs."servo.lan" ];
# # port = 1053;
# };
# wan = {
# substitutions = mkSubstitutions "wan";
# listenAddrsIpv4 = [
# nativeAddrs."servo.lan"
# ];
# };
};
sane.services.dyn-dns.restartOnChange = lib.map (c: "${c.service}.service") (builtins.attrValues config.sane.services.hickory-dns.instances);
}

View File

@@ -10,7 +10,7 @@
lib.mkIf false # i don't actively use ipfs anymore lib.mkIf false # i don't actively use ipfs anymore
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
# TODO: mode? could be more granular # TODO: mode? could be more granular
{ user = "261"; group = "261"; path = "/var/lib/ipfs"; method = "bind"; } { user = "261"; group = "261"; path = "/var/lib/ipfs"; method = "bind"; }
]; ];

View File

@@ -1,36 +0,0 @@
{ lib, pkgs, ... }:
lib.mkIf false #< TODO: re-enable once confident of sandboxing
{
sane.persist.sys.byStore.plaintext = [
# TODO: mode? we only need this to save Indexer creds ==> migrate to config?
{ user = "root"; group = "root"; path = "/var/lib/jackett"; method = "bind"; }
];
services.jackett.enable = true;
systemd.services.jackett.after = [ "wireguard-wg-ovpns.service" ];
systemd.services.jackett.partOf = [ "wireguard-wg-ovpns.service" ];
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";
};
# jackett torrent search
services.nginx.virtualHosts."jackett.uninsane.org" = {
forceSSL = true;
enableACME = true;
# inherit kTLS;
locations."/" = {
# proxyPass = "http://ovpns.uninsane.org:9117";
proxyPass = "http://10.0.1.6:9117";
recommendedProxySettings = true;
};
};
sane.dns.zones."uninsane.org".inet.CNAME."jackett" = "native";
}

View File

@@ -0,0 +1,68 @@
{ config, lib, pkgs, ... }:
let
cfg = config.services.jackett;
in
{
sane.persist.sys.byStore.private = [
# TODO: mode? we only need this to save Indexer creds ==> migrate to config?
{ user = "jackett"; group = "jackett"; path = "/var/lib/jackett"; method = "bind"; }
];
services.jackett.enable = true;
systemd.services.jackett.after = [ "wireguard-wg-ovpns.service" ];
systemd.services.jackett.partOf = [ "wireguard-wg-ovpns.service" ];
systemd.services.jackett = {
# run this behind the OVPN static VPN
serviceConfig.NetworkNamespacePath = "/run/netns/ovpns";
serviceConfig.ExecStartPre = [ "${lib.getExe pkgs.sane-scripts.ip-check} --no-upnp --expect ${config.sane.netns.ovpns.netnsPubIpv4}" ]; # abort if public IP is not as expected
# patch in `--ListenPublic` so that it's reachable from the netns veth.
# this also makes it reachable from the VPN pub address. oh well.
serviceConfig.ExecStart = lib.mkForce "${cfg.package}/bin/Jackett --ListenPublic --NoUpdates --DataFolder '${cfg.dataDir}'";
serviceConfig.RestartSec = "30s";
# hardening (systemd-analyze security jackett)
# TODO: upstream into nixpkgs
serviceConfig.StateDirectory = "jackett";
serviceConfig.LockPersonality = true;
serviceConfig.NoNewPrivileges = true;
# serviceConfig.MemoryDenyWriteExecute = true; #< Failed to create CoreCLR, HRESULT: 0x80004005
serviceConfig.PrivateDevices = true;
serviceConfig.PrivateMounts = true;
serviceConfig.PrivateTmp = true;
serviceConfig.PrivateUsers = true;
serviceConfig.ProcSubset = "pid";
serviceConfig.ProtectClock = true;
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true;
serviceConfig.ProtectHostname = true;
serviceConfig.ProtectKernelLogs = true;
serviceConfig.ProtectKernelModules = true;
serviceConfig.ProtectKernelTunables = true;
serviceConfig.ProtectProc = "invisible";
serviceConfig.ProtectSystem = "strict";
serviceConfig.RemoveIPC = true;
serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
serviceConfig.RestrictNamespaces = true;
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native";
serviceConfig.SystemCallFilter = [ "@system-service" "~@privileged" ];
};
# jackett torrent search
services.nginx.virtualHosts."jackett.uninsane.org" = {
forceSSL = true;
enableACME = true;
# inherit kTLS;
locations."/" = {
proxyPass = "http://${config.sane.netns.ovpns.netnsVethIpv4}:9117";
recommendedProxySettings = true;
};
locations."= /robots.txt".extraConfig = ''
return 200 "User-agent: *\nDisallow: /\n";
'';
};
sane.dns.zones."uninsane.org".inet.CNAME."jackett" = "native";
}

View File

@@ -21,6 +21,9 @@
enableACME = true; enableACME = true;
# inherit kTLS; # inherit kTLS;
locations."/".proxyPass = "http://127.0.0.1:8013"; locations."/".proxyPass = "http://127.0.0.1:8013";
locations."= /robots.txt".extraConfig = ''
return 200 "User-agent: *\nDisallow: /\n";
'';
}; };
sane.dns.zones."uninsane.org".inet.CNAME."w" = "native"; sane.dns.zones."uninsane.org".inet.CNAME."w" = "native";

View File

@@ -17,6 +17,9 @@ in
locations."/" = { locations."/" = {
proxyPass = "http://127.0.0.1:${builtins.toString port}"; proxyPass = "http://127.0.0.1:${builtins.toString port}";
}; };
locations."= /robots.txt".extraConfig = ''
return 200 "User-agent: *\nDisallow: /\n";
'';
}; };
sane.dns.zones."uninsane.org".inet.CNAME."komga" = "native"; sane.dns.zones."uninsane.org".inet.CNAME."komga" = "native";
} }

View File

@@ -38,14 +38,10 @@ in {
nginx.enable = true; nginx.enable = true;
}; };
systemd.services.lemmy.serviceConfig = {
# fix to use a normal user so we can configure perms correctly
DynamicUser = mkForce false;
User = "lemmy";
Group = "lemmy";
};
systemd.services.lemmy.environment = { systemd.services.lemmy.environment = {
RUST_BACKTRACE = "full"; RUST_BACKTRACE = "full";
RUST_LOG = "error";
# RUST_LOG = "warn";
# RUST_LOG = "debug"; # RUST_LOG = "debug";
# RUST_LOG = "trace"; # RUST_LOG = "trace";
# upstream defaults LEMMY_DATABASE_URL = "postgres:///lemmy?host=/run/postgresql"; # upstream defaults LEMMY_DATABASE_URL = "postgres:///lemmy?host=/run/postgresql";
@@ -72,6 +68,73 @@ in {
sane.dns.zones."uninsane.org".inet.CNAME."lemmy" = "native"; sane.dns.zones."uninsane.org".inet.CNAME."lemmy" = "native";
systemd.services.lemmy = {
# fix to use a normal user so we can configure perms correctly
# XXX(2024-07-28): this hasn't been rigorously tested:
# possible that i've set something too strict and won't notice right away
serviceConfig.DynamicUser = mkForce false;
serviceConfig.User = "lemmy";
serviceConfig.Group = "lemmy";
# hardening (systemd-analyze security lemmy)
# a handful of these are specified in upstream nixpkgs, but mostly not
serviceConfig.LockPersonality = true;
serviceConfig.NoNewPrivileges = true;
serviceConfig.MemoryDenyWriteExecute = true;
serviceConfig.PrivateDevices = true;
serviceConfig.PrivateMounts = true;
serviceConfig.PrivateTmp = true;
serviceConfig.PrivateUsers = true;
serviceConfig.ProcSubset = "pid";
serviceConfig.ProtectClock = true;
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true;
serviceConfig.ProtectHostname = true;
serviceConfig.ProtectKernelLogs = true;
serviceConfig.ProtectKernelModules = true;
serviceConfig.ProtectKernelTunables = true;
serviceConfig.ProtectProc = "invisible";
serviceConfig.ProtectSystem = "strict";
serviceConfig.RemoveIPC = true;
serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
serviceConfig.RestrictNamespaces = true;
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native";
serviceConfig.SystemCallFilter = [ "@system-service" ];
};
systemd.services.lemmy-ui = {
# hardening (systemd-analyze security lemmy-ui)
# TODO: upstream into nixpkgs
serviceConfig.LockPersonality = true;
serviceConfig.NoNewPrivileges = true;
# serviceConfig.MemoryDenyWriteExecute = true; #< it uses v8, JIT
serviceConfig.PrivateDevices = true;
serviceConfig.PrivateMounts = true;
serviceConfig.PrivateTmp = true;
serviceConfig.PrivateUsers = true;
serviceConfig.ProcSubset = "pid";
serviceConfig.ProtectClock = true;
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true;
serviceConfig.ProtectHostname = true;
serviceConfig.ProtectKernelLogs = true;
serviceConfig.ProtectKernelModules = true;
serviceConfig.ProtectKernelTunables = true;
serviceConfig.ProtectProc = "invisible";
serviceConfig.ProtectSystem = "strict";
serviceConfig.RemoveIPC = true;
serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
serviceConfig.RestrictNamespaces = true;
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native";
serviceConfig.SystemCallFilter = [ "@system-service" "@pkey" "@sandbox" ];
};
#v DO NOT REMOVE: defaults to 0.3, instead of latest, so always need to explicitly set this. #v DO NOT REMOVE: defaults to 0.3, instead of latest, so always need to explicitly set this.
services.pict-rs.package = pict-rs; services.pict-rs.package = pict-rs;
@@ -81,10 +144,38 @@ in {
# - via CLI flags (overrides everything above) # - via CLI flags (overrides everything above)
# some of the CLI flags have defaults, making it the only actual way to configure certain things even when docs claim otherwise. # some of the CLI flags have defaults, making it the only actual way to configure certain things even when docs claim otherwise.
# CLI args: <https://git.asonix.dog/asonix/pict-rs#user-content-running> # CLI args: <https://git.asonix.dog/asonix/pict-rs#user-content-running>
systemd.services.pict-rs.serviceConfig.ExecStart = lib.mkForce (lib.concatStringsSep " " [ systemd.services.pict-rs = {
"${lib.getBin pict-rs}/bin/pict-rs run" serviceConfig.ExecStart = lib.mkForce (lib.concatStringsSep " " [
"--media-video-max-frame-count" (builtins.toString (30*60*60)) "${lib.getBin pict-rs}/bin/pict-rs run"
"--media-process-timeout 120" "--media-video-max-frame-count" (builtins.toString (30*60*60))
"--media-video-allow-audio" # allow audio "--media-process-timeout 120"
]); "--media-video-allow-audio" # allow audio
]);
# hardening (systemd-analyze security pict-rs)
# TODO: upstream into nixpkgs
serviceConfig.LockPersonality = true;
serviceConfig.NoNewPrivileges = true;
serviceConfig.MemoryDenyWriteExecute = true;
serviceConfig.PrivateDevices = true;
serviceConfig.PrivateMounts = true;
serviceConfig.PrivateTmp = true;
serviceConfig.PrivateUsers = true;
serviceConfig.ProcSubset = "pid";
serviceConfig.ProtectClock = true;
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true;
serviceConfig.ProtectHostname = true;
serviceConfig.ProtectKernelLogs = true;
serviceConfig.ProtectKernelModules = true;
serviceConfig.ProtectKernelTunables = true;
serviceConfig.ProtectProc = "invisible";
serviceConfig.ProtectSystem = "strict";
serviceConfig.RemoveIPC = true;
serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
serviceConfig.RestrictNamespaces = true;
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native";
serviceConfig.SystemCallFilter = [ "@system-service" ];
};
} }

View File

@@ -1,6 +1,6 @@
# docs: <https://nixos.wiki/wiki/Matrix> # docs: <https://nixos.wiki/wiki/Matrix>
# docs: <https://nixos.org/manual/nixos/stable/index.html#module-services-matrix-synapse> # docs: <https://nixos.org/manual/nixos/stable/index.html#module-services-matrix-synapse>
# example config: <https://github.com/matrix-org/synapse/blob/develop/docs/sample_config.yaml> # example config: <https://github.com/element-hq/synapse/blob/develop/docs/sample_config.yaml>
# #
# ENABLING PUSH NOTIFICATIONS (with UnifiedPush/ntfy): # ENABLING PUSH NOTIFICATIONS (with UnifiedPush/ntfy):
# - Matrix "pushers" API spec: <https://spec.matrix.org/latest/client-server-api/#post_matrixclientv3pushersset> # - Matrix "pushers" API spec: <https://spec.matrix.org/latest/client-server-api/#post_matrixclientv3pushersset>
@@ -20,19 +20,17 @@
./signal.nix ./signal.nix
]; ];
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
{ user = "matrix-synapse"; group = "matrix-synapse"; path = "/var/lib/matrix-synapse"; method = "bind"; } { user = "matrix-synapse"; group = "matrix-synapse"; path = "/var/lib/matrix-synapse"; method = "bind"; }
]; ];
services.matrix-synapse.enable = true; services.matrix-synapse.enable = true;
services.matrix-synapse.log.root.level = "ERROR"; # accepts "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL" (?)
services.matrix-synapse.settings = { services.matrix-synapse.settings = {
# this changes the default log level from INFO to WARN.
# maybe there's an easier way?
log_config = ./synapse-log_level.yaml;
server_name = "uninsane.org"; server_name = "uninsane.org";
# services.matrix-synapse.enable_registration_captcha = true; # services.matrix-synapse.enable_registration_captcha = true;
# services.matrix-synapse.enable_registration_without_verification = true; # services.matrix-synapse.enable_registration_without_verification = true;
enable_registration = true; # enable_registration = true;
# services.matrix-synapse.registration_shared_secret = "<shared key goes here>"; # services.matrix-synapse.registration_shared_secret = "<shared key goes here>";
# default for listeners is port = 8448, tls = true, x_forwarded = false. # default for listeners is port = 8448, tls = true, x_forwarded = false.

View File

@@ -5,7 +5,7 @@
# - recommended to use mautrix-discord: <https://github.com/NixOS/nixpkgs/pull/200462> # - recommended to use mautrix-discord: <https://github.com/NixOS/nixpkgs/pull/200462>
lib.mkIf false lib.mkIf false
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
{ user = "matrix-synapse"; group = "matrix-synapse"; path = "/var/lib/mx-puppet-discord"; method = "bind"; } { user = "matrix-synapse"; group = "matrix-synapse"; path = "/var/lib/mx-puppet-discord"; method = "bind"; }
]; ];

View File

@@ -1,15 +1,13 @@
# config docs: # config docs:
# - <https://github.com/matrix-org/matrix-appservice-irc/blob/develop/config.sample.yaml> # - <https://github.com/matrix-org/matrix-appservice-irc/blob/develop/config.sample.yaml>
# probably want to remove that.
{ config, lib, ... }: { config, lib, ... }:
let let
ircServer = { name, additionalAddresses ? [], sasl ? true, port ? 6697 }: let ircServer = { name, additionalAddresses ? [], ssl ? true, sasl ? true, port ? if ssl then 6697 else 6667 }: let
lowerName = lib.toLower name; lowerName = lib.toLower name;
in { in {
# XXX sasl: appservice doesn't support NickServ identification (only SASL, or PASS if sasl = false) # XXX sasl: appservice doesn't support NickServ identification (only SASL, or PASS if sasl = false)
inherit name additionalAddresses sasl port; inherit additionalAddresses name port sasl ssl;
ssl = true;
botConfig = { botConfig = {
# bot has no presence in IRC channel; only real Matrix users # bot has no presence in IRC channel; only real Matrix users
enabled = false; enabled = false;
@@ -101,7 +99,7 @@ in
}) })
]; ];
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
# TODO: mode? # TODO: mode?
{ user = "matrix-appservice-irc"; group = "matrix-appservice-irc"; path = "/var/lib/matrix-appservice-irc"; method = "bind"; } { user = "matrix-appservice-irc"; group = "matrix-appservice-irc"; path = "/var/lib/matrix-appservice-irc"; method = "bind"; }
]; ];
@@ -129,6 +127,7 @@ in
}; };
ircService = { ircService = {
logging.level = "warn"; # "error", "warn", "info", "debug"
servers = { servers = {
"irc.esper.net" = ircServer { "irc.esper.net" = ircServer {
name = "esper"; name = "esper";
@@ -156,6 +155,10 @@ in
# - #sxmo-offtopic # - #sxmo-offtopic
}; };
"irc.rizon.net" = ircServer { name = "Rizon"; }; "irc.rizon.net" = ircServer { name = "Rizon"; };
"wigle.net" = ircServer {
name = "WiGLE";
ssl = false;
};
}; };
}; };
}; };

View File

@@ -4,7 +4,7 @@
lib.mkIf false # disabled 2024/01/11: i don't use it, and pkgs.mautrix-signal had some API changes lib.mkIf false # disabled 2024/01/11: i don't use it, and pkgs.mautrix-signal had some API changes
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
{ user = "mautrix-signal"; group = "mautrix-signal"; path = "/var/lib/mautrix-signal"; method = "bind"; } { user = "mautrix-signal"; group = "mautrix-signal"; path = "/var/lib/mautrix-signal"; method = "bind"; }
{ user = "signald"; group = "signald"; path = "/var/lib/signald"; method = "bind"; } { user = "signald"; group = "signald"; path = "/var/lib/signald"; method = "bind"; }
]; ];

View File

@@ -1,27 +0,0 @@
version: 1
# In systemd's journal, loglevel is implicitly stored, so let's omit it
# from the message text.
formatters:
journal_fmt:
format: '%(name)s: [%(request)s] %(message)s'
filters:
context:
(): synapse.util.logcontext.LoggingContextFilter
request: ""
handlers:
journal:
class: systemd.journal.JournalHandler
formatter: journal_fmt
filters: [context]
SYSLOG_IDENTIFIER: synapse
# default log level: INFO
root:
level: WARN
handlers: [journal]
disable_existing_loggers: False

View File

@@ -17,18 +17,24 @@ in
sane.ports.ports."80" = { sane.ports.ports."80" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true; visibleTo.ovpns = true; # so that letsencrypt can procure a cert for the mx record
visibleTo.ovpn = true; # so that letsencrypt can procure a cert for the mx record visibleTo.doof = true;
description = "colin-http-uninsane.org"; description = "colin-http-uninsane.org";
}; };
sane.ports.ports."443" = { sane.ports.ports."443" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true; visibleTo.doof = true;
description = "colin-https-uninsane.org"; description = "colin-https-uninsane.org";
}; };
services.nginx.enable = true; services.nginx.enable = true;
# nginxStable is one release behind nginxMainline.
# nginx itself recommends running mainline; nixos defaults to stable.
# services.nginx.package = pkgs.nginxMainline;
# XXX(2024-07-31): nixos defaults to zlib-ng -- supposedly more performant, but spams log with
# "gzip filter failed to use preallocated memory: ..."
services.nginx.package = pkgs.nginxMainline.override { zlib = pkgs.zlib; };
services.nginx.appendConfig = '' services.nginx.appendConfig = ''
# use 1 process per core. # use 1 process per core.
# may want to increase worker_connections too, but `ulimit -n` must be increased first. # may want to increase worker_connections too, but `ulimit -n` must be increased first.
@@ -44,8 +50,10 @@ in
log_format vcombined '$host:$server_port $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referrer" "$http_user_agent"'; log_format vcombined '$host:$server_port $remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referrer" "$http_user_agent"';
access_log /var/log/nginx/private.log vcombined; access_log /var/log/nginx/private.log vcombined;
''; '';
# sets gzip_comp_level = 5 # enables gzip and sets gzip_comp_level = 5
services.nginx.recommendedGzipSettings = true; services.nginx.recommendedGzipSettings = true;
# enables zstd and sets zstd_comp_level = 9
services.nginx.recommendedZstdSettings = true;
# enables OCSP stapling (so clients don't need contact the OCSP server -- i do instead) # enables OCSP stapling (so clients don't need contact the OCSP server -- i do instead)
# - doesn't seem to, actually: <https://www.ssllabs.com/ssltest/analyze.html?d=uninsane.org> # - doesn't seem to, actually: <https://www.ssllabs.com/ssltest/analyze.html?d=uninsane.org>
# caches TLS sessions for 10m # caches TLS sessions for 10m
@@ -99,6 +107,16 @@ in
disable_symlinks on; disable_symlinks on;
''; '';
}; };
locations."/share/Ubunchu/" = {
alias = "/var/media/Books/Visual/HiroshiSeo/Ubunchu/";
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 # allow matrix users to discover that @user:uninsane.org is reachable via matrix.uninsane.org
locations."= /.well-known/matrix/server".extraConfig = locations."= /.well-known/matrix/server".extraConfig =
@@ -180,8 +198,15 @@ in
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.plaintext = [
{ user = "acme"; group = "acme"; path = "/var/lib/acme"; method = "bind"; } { user = "acme"; group = "acme"; path = "/var/lib/acme"; method = "bind"; }
];
sane.persist.sys.byStore.private = [
{ user = "colin"; group = "users"; path = "/var/www/sites"; method = "bind"; } { user = "colin"; group = "users"; path = "/var/www/sites"; method = "bind"; }
]; ];
sane.persist.sys.byStore.ephemeral = [
# logs *could* be persisted to private storage, but then there's the issue of
# "what if servo boots, isn't unlocked, and the whole / tmpfs is consumed by logs"
{ user = "nginx"; group = "nginx"; path = "/var/log/nginx"; method = "bind"; }
];
# let's encrypt default chain looks like: # let's encrypt default chain looks like:
# - End-entity certificate ← R3 ← ISRG Root X1 ← DST Root CA X3 # - End-entity certificate ← R3 ← ISRG Root X1 ← DST Root CA X3

View File

@@ -30,7 +30,7 @@ let
altPort = 2587; altPort = 2587;
in in
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
# not 100% necessary to persist this, but ntfy does keep a 12hr (by default) cache # not 100% necessary to persist this, but ntfy does keep a 12hr (by default) cache
# for pushing notifications to users who become offline. # for pushing notifications to users who become offline.
# ACLs also live here. # ACLs also live here.
@@ -46,7 +46,7 @@ in
# defaults to 45s. # defaults to 45s.
# note that the client may still do its own TCP-level keepalives, typically every 30s # note that the client may still do its own TCP-level keepalives, typically every 30s
keepalive-interval = "15m"; keepalive-interval = "15m";
log-level = "trace"; # trace, debug, info (default), warn, error log-level = "info"; # trace, debug, info (default), warn, error
auth-default-access = "deny-all"; auth-default-access = "deny-all";
}; };
systemd.services.ntfy-sh.serviceConfig.DynamicUser = lib.mkForce false; systemd.services.ntfy-sh.serviceConfig.DynamicUser = lib.mkForce false;
@@ -86,7 +86,7 @@ in
sane.ports.ports."${builtins.toString altPort}" = { sane.ports.ports."${builtins.toString altPort}" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true; visibleTo.doof = true;
description = "colin-ntfy.uninsane.org"; description = "colin-ntfy.uninsane.org";
}; };
} }

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p ntfy-sh #!nix-shell -i python3 -p ntfy-sh -p python3
import argparse import argparse
import logging import logging

View File

@@ -47,7 +47,7 @@ in
}; };
sane.ntfy-waiter.package = mkOption { sane.ntfy-waiter.package = mkOption {
type = types.package; type = types.package;
default = pkgs.static-nix-shell.mkPython3Bin { default = pkgs.static-nix-shell.mkPython3 {
pname = "ntfy-waiter"; pname = "ntfy-waiter";
srcRoot = ./.; srcRoot = ./.;
pkgs = [ "ntfy-sh" ]; pkgs = [ "ntfy-sh" ];
@@ -62,8 +62,8 @@ in
sane.ports.ports = lib.mkMerge (lib.forEach portRange (port: { sane.ports.ports = lib.mkMerge (lib.forEach portRange (port: {
"${builtins.toString port}" = { "${builtins.toString port}" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-notification-waiter-${builtins.toString (port - portLow + 1)}-of-${builtins.toString numPorts}"; description = "colin-notification-waiter-${builtins.toString (port - portLow + 1)}-of-${builtins.toString numPorts}";
}; };
})); }));

View File

@@ -0,0 +1,23 @@
# ollama: <https://github.com/ollama/ollama>
# use: `ollama run llama3.1`
# or: `ollama run llama3.1:70b`
# or use a remote session: <https://github.com/ggozad/oterm>
{ lib, ... }:
lib.mkIf false #< WIP
{
sane.persist.sys.byStore.plaintext = [
{ user = "ollama"; group = "ollama"; path = "/var/lib/ollama"; method = "bind"; }
];
services.ollama.enable = true;
services.ollama.user = "ollama";
services.ollama.group = "ollama";
users.groups.ollama = {};
users.users.ollama = {
group = "ollama";
isSystemUser = true;
};
systemd.services.ollama.serviceConfig.DynamicUser = lib.mkForce false;
}

View File

@@ -7,14 +7,15 @@
# to run it in a oci-container: <https://github.com/barrucadu/nixfiles/blob/master/services/pleroma.nix> # to run it in a oci-container: <https://github.com/barrucadu/nixfiles/blob/master/services/pleroma.nix>
# #
# admin frontend: <https://fed.uninsane.org/pleroma/admin> # admin frontend: <https://fed.uninsane.org/pleroma/admin>
{ config, pkgs, ... }: { config, lib, pkgs, ... }:
let let
logLevel = "warn"; logLevel = "warn";
# logLevel = "debug"; # logLevel = "debug";
in in
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
# contains media i've uploaded to the server
{ user = "pleroma"; group = "pleroma"; path = "/var/lib/pleroma"; method = "bind"; } { user = "pleroma"; group = "pleroma"; path = "/var/lib/pleroma"; method = "bind"; }
]; ];
services.pleroma.enable = true; services.pleroma.enable = true;
@@ -135,25 +136,52 @@ in
# something inside pleroma invokes `sh` w/o specifying it by path, so this is needed to allow pleroma to start # something inside pleroma invokes `sh` w/o specifying it by path, so this is needed to allow pleroma to start
pkgs.bash pkgs.bash
# used by Pleroma to strip geo tags from uploads # used by Pleroma to strip geo tags from uploads
pkgs.exiftool config.sane.programs.exiftool.package
# i saw some errors when pleroma was shutting down about it not being able to find `awk`. probably not critical # i saw some errors when pleroma was shutting down about it not being able to find `awk`. probably not critical
pkgs.gawk config.sane.programs.gawk.package
# needed for email operations like password reset # needed for email operations like password reset
pkgs.postfix pkgs.postfix
]; ];
systemd.services.pleroma.serviceConfig = { systemd.services.pleroma = {
# postgres can be slow to service early requests, preventing pleroma from starting on the first try # postgres can be slow to service early requests, preventing pleroma from starting on the first try
Restart = "on-failure"; serviceConfig.Restart = "on-failure";
RestartSec = "10s"; serviceConfig.RestartSec = "10s";
};
# systemd.services.pleroma.serviceConfig = { # hardening (systemd-analyze security pleroma)
# # required for sendmail. see https://git.pleroma.social/pleroma/pleroma/-/issues/2259 # XXX(2024-07-28): this hasn't been rigorously tested:
# NoNewPrivileges = lib.mkForce false; # possible that i've set something too strict and won't notice right away
# PrivateTmp = lib.mkForce false; # make sure to test:
# CapabilityBoundingSet = lib.mkForce "~"; # - image/media uploading
# }; serviceConfig.CapabilityBoundingSet = "~CAP_SYS_ADMIN"; #< TODO: reduce this. try: CAP_SYS_NICE CAP_DAC_READ_SEARCH CAP_SYS_CHROOT CAP_SETGID CAP_SETUID
serviceConfig.LockPersonality = true;
serviceConfig.NoNewPrivileges = true;
serviceConfig.MemoryDenyWriteExecute = true;
serviceConfig.PrivateDevices = lib.mkForce true; #< dunno why nixpkgs has this set false; it seems to work as true
serviceConfig.PrivateMounts = true;
serviceConfig.PrivateTmp = true;
serviceConfig.PrivateUsers = true;
serviceConfig.ProtectProc = "invisible";
serviceConfig.ProcSubset = "all"; #< needs /proc/sys/kernel/overflowuid for bwrap
serviceConfig.ProtectClock = true;
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true;
serviceConfig.ProtectKernelModules = true;
serviceConfig.ProtectSystem = lib.mkForce "strict";
serviceConfig.RemoveIPC = true;
serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK";
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native";
serviceConfig.SystemCallFilter = [ "@system-service" "@mount" "@sandbox" ]; #< "sandbox" might not actually be necessary
serviceConfig.ProtectHostname = false; #< else brap can't mount /proc
serviceConfig.ProtectKernelLogs = false; #< else breaks exiftool ("bwrap: Can't mount proc on /newroot/proc: Operation not permitted")
serviceConfig.ProtectKernelTunables = false; #< else breaks exiftool
serviceConfig.RestrictNamespaces = false; # media uploads require bwrap
};
# this is required to allow pleroma to send email. # this is required to allow pleroma to send email.
# raw `sendmail` works, but i think pleroma's passing it some funny flags or something, idk. # raw `sendmail` works, but i think pleroma's passing it some funny flags or something, idk.

View File

@@ -6,9 +6,9 @@ let
KiB = n: 1024*n; KiB = n: 1024*n;
in in
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
# TODO: mode? { user = "postgres"; group = "postgres"; mode = "0750"; path = "/var/lib/postgresql"; method = "bind"; }
{ user = "postgres"; group = "postgres"; path = "/var/lib/postgresql"; method = "bind"; } { user = "postgres"; group = "postgres"; mode = "0750"; path = "/var/backup/postgresql"; method = "bind"; }
]; ];
services.postgresql.enable = true; services.postgresql.enable = true;

View File

@@ -56,47 +56,48 @@ let
enableDebug = false; enableDebug = false;
in in
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
# TODO: mode?
{ user = "prosody"; group = "prosody"; path = "/var/lib/prosody"; method = "bind"; } { user = "prosody"; group = "prosody"; path = "/var/lib/prosody"; method = "bind"; }
]; ];
sane.ports.ports."5000" = { sane.ports.ports."5000" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-prosody-fileshare-proxy65"; description = "colin-xmpp-prosody-fileshare-proxy65";
}; };
sane.ports.ports."5222" = { sane.ports.ports."5222" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-client-to-server"; description = "colin-xmpp-client-to-server";
}; };
sane.ports.ports."5223" = { sane.ports.ports."5223" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpps-client-to-server"; # XMPP over TLS description = "colin-xmpps-client-to-server"; # XMPP over TLS
}; };
sane.ports.ports."5269" = { sane.ports.ports."5269" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.wan = true; visibleTo.doof = true;
description = "colin-xmpp-server-to-server"; description = "colin-xmpp-server-to-server";
}; };
sane.ports.ports."5270" = { sane.ports.ports."5270" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.wan = true; visibleTo.doof = true;
description = "colin-xmpps-server-to-server"; # XMPP over TLS description = "colin-xmpps-server-to-server"; # XMPP over TLS
}; };
sane.ports.ports."5280" = { sane.ports.ports."5280" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-bosh"; description = "colin-xmpp-bosh";
}; };
sane.ports.ports."5281" = { sane.ports.ports."5281" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
visibleTo.doof = true;
visibleTo.lan = true; visibleTo.lan = true;
visibleTo.wan = true;
description = "colin-xmpp-prosody-https"; # necessary? description = "colin-xmpp-prosody-https"; # necessary?
}; };

View File

@@ -10,7 +10,9 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.ephemeral = [
# {data,downloads,incomplete,logs}: contains logs, search history, and downloads
# so, move the downloaded data to persistent storage regularly, or configure the downloads/incomplete dirs to point to persisted storage (in nixpkgs slskd config)
{ user = "slskd"; group = "media"; path = "/var/lib/slskd"; method = "bind"; } { user = "slskd"; group = "media"; path = "/var/lib/slskd"; method = "bind"; }
]; ];
sops.secrets."slskd_env" = { sops.secrets."slskd_env" = {
@@ -22,8 +24,7 @@
sane.ports.ports."50300" = { sane.ports.ports."50300" = {
protocol = [ "tcp" ]; protocol = [ "tcp" ];
# not visible to WAN: i run this in a separate netns # visibleTo.ovpns = true; #< not needed: it runs in the ovpns namespace
visibleTo.ovpn = true;
description = "colin-soulseek"; description = "colin-soulseek";
}; };
@@ -33,7 +34,7 @@
forceSSL = true; forceSSL = true;
enableACME = true; enableACME = true;
locations."/" = { locations."/" = {
proxyPass = "http://10.0.1.6:5030"; proxyPass = "http://${config.sane.netns.ovpns.netnsVethIpv4}:5030";
proxyWebsockets = true; proxyWebsockets = true;
}; };
}; };
@@ -69,12 +70,20 @@
# flags.volatile = true; # store searches and active transfers in RAM (completed transfers still go to disk). rec for btrfs/zfs # flags.volatile = true; # store searches and active transfers in RAM (completed transfers still go to disk). rec for btrfs/zfs
}; };
systemd.services.slskd.serviceConfig = { systemd.services.slskd = {
# run this behind the OVPN static VPN # run this behind the OVPN static VPN
NetworkNamespacePath = "/run/netns/ovpns"; serviceConfig.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 serviceConfig.ExecStartPre = [ "${lib.getExe pkgs.sane-scripts.ip-check} --no-upnp --expect ${config.sane.netns.ovpns.netnsPubIpv4}" ]; # abort if public IP is not as expected
Restart = lib.mkForce "always"; # exits "success" when it fails to connect to soulseek server serviceConfig.Restart = lib.mkForce "always"; # exits "success" when it fails to connect to soulseek server
RestartSec = "60s"; serviceConfig.RestartSec = "60s";
# hardening (systemd-analyze security slskd)
# upstream nixpkgs specifies moderate defaults; these are supplementary
# serviceConfig.MemoryDenyWriteExecute = true;
# serviceConfig.ProcSubset = "pid";
# serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
# serviceConfig.SystemCallArchitectures = "native";
# serviceConfig.SystemCallFilter = [ "@system-service" ];
}; };
} }

View File

@@ -22,71 +22,23 @@ let
--replace-fail 'set(TR_USER_AGENT_PREFIX "''${TR_SEMVER}")' 'set(TR_USER_AGENT_PREFIX "3.00")' --replace-fail 'set(TR_USER_AGENT_PREFIX "''${TR_SEMVER}")' 'set(TR_USER_AGENT_PREFIX "3.00")'
''; '';
}); });
download-dir = "/var/media/torrents"; download-dir = "/var/media/torrents"; #< keep in sync with consts embedded in `torrent-done`
torrent-done = pkgs.writeShellApplication { torrent-done = pkgs.static-nix-shell.mkBash {
name = "torrent-done"; pname = "torrent-done";
runtimeInputs = with pkgs; [ srcRoot = ./.;
acl pkgs = [
coreutils "acl"
findutils "coreutils"
rsync "findutils"
util-linux "rsync"
]; ];
text = ''
destructive() {
if [ -n "''${TR_DRY_RUN-}" ]; then
echo "$*"
else
"$@"
fi
}
if [[ "$TR_TORRENT_DIR" =~ ^.*freeleech.*$ ]]; then
# freeleech torrents have no place in my permanent library
echo "freeleech: nothing to do"
exit 0
fi
if ! [[ "$TR_TORRENT_DIR" =~ ^${download-dir}/.*$ ]]; then
echo "unexpected torrent dir, aborting: $TR_TORRENT_DIR"
exit 0
fi
REL_DIR="''${TR_TORRENT_DIR#${download-dir}/}"
MEDIA_DIR="/var/media/$REL_DIR"
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
'';
}; };
in in
lib.mkIf false #< TODO: re-enable once confident of sandboxing
{ {
sane.persist.sys.byStore.plaintext = [ sane.persist.sys.byStore.private = [
# TODO: mode? we need this specifically for the stats tracking in .config/ # TODO: mode? we need this specifically for the stats tracking in .config/
{ user = "transmission"; group = config.users.users.transmission.group; path = "/var/lib/transmission"; method = "bind"; } { user = "transmission"; group = config.users.users.transmission.group; path = "/var/lib/transmission"; method = "bind"; }
{ user = "transmission"; group = config.users.users.transmission.group; path = "/var/backup/torrents"; method = "bind"; }
]; ];
users.users.transmission.extraGroups = [ "media" ]; users.users.transmission.extraGroups = [ "media" ];
@@ -106,8 +58,8 @@ lib.mkIf false #< TODO: re-enable once confident of sandboxing
# DOCUMENTATION/options list: <https://github.com/transmission/transmission/blob/main/docs/Editing-Configuration-Files.md#options> # 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. # message-level = 3; #< enable for debug logging. 0-3, default is 2.
# 10.0.1.6 => allow rpc only from the root servo ns. it'll tunnel things to the net, if need be. # ovpns.netnsVethIpv4 => 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-bind-address = config.sane.netns.ovpns.netnsVethIpv4;
#rpc-host-whitelist = "bt.uninsane.org"; #rpc-host-whitelist = "bt.uninsane.org";
#rpc-whitelist = "*.*.*.*"; #rpc-whitelist = "*.*.*.*";
rpc-authentication-required = true; rpc-authentication-required = true;
@@ -118,7 +70,7 @@ lib.mkIf false #< TODO: re-enable once confident of sandboxing
rpc-whitelist-enabled = false; rpc-whitelist-enabled = false;
# force behind ovpns in case the NetworkNamespace fails somehow # force behind ovpns in case the NetworkNamespace fails somehow
bind-address-ipv4 = "185.157.162.178"; bind-address-ipv4 = config.sane.netns.ovpns.netnsPubIpv4;
port-forwarding-enabled = false; port-forwarding-enabled = false;
# hopefully, make the downloads world-readable # hopefully, make the downloads world-readable
@@ -155,16 +107,31 @@ lib.mkIf false #< TODO: re-enable once confident of sandboxing
script-torrent-done-filename = "${torrent-done}/bin/torrent-done"; script-torrent-done-filename = "${torrent-done}/bin/torrent-done";
}; };
systemd.services.transmission.after = [ "wireguard-wg-ovpns.service" ]; systemd.services.transmission = {
systemd.services.transmission.partOf = [ "wireguard-wg-ovpns.service" ]; after = [ "wireguard-wg-ovpns.service" ];
systemd.services.transmission.serviceConfig = { partOf = [ "wireguard-wg-ovpns.service" ];
environment.TR_DEBUG = "1";
# run this behind the OVPN static VPN # run this behind the OVPN static VPN
NetworkNamespacePath = "/run/netns/ovpns"; serviceConfig.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 serviceConfig.ExecStartPre = [ "${lib.getExe pkgs.sane-scripts.ip-check} --no-upnp --expect ${config.sane.netns.ovpns.netnsPubIpv4}" ]; # abort if public IP is not as expected
Restart = "on-failure"; serviceConfig.Restart = "on-failure";
RestartSec = "30s"; serviceConfig.RestartSec = "30s";
BindPaths = [ "/var/media" ]; #< so it can move completed torrents into the media library serviceConfig.BindPaths = [ "/var/media" ]; #< so it can move completed torrents into the media library
serviceConfig.SystemCallFilter = lib.mkForce [
# the torrent-done script does stuff which fails the nixos default syscall filter.
# allow a bunch of stuff, speculatively, to hopefully fix that:
"@aio"
"@basic-io"
"@chown"
"@file-system"
"@io-event"
"@process"
"@sandbox"
"@sync"
"@system-service"
"quotactl"
];
}; };
# service to automatically backup torrents i add to transmission # service to automatically backup torrents i add to transmission
@@ -190,14 +157,14 @@ lib.mkIf false #< TODO: re-enable once confident of sandboxing
# inherit kTLS; # inherit kTLS;
locations."/" = { locations."/" = {
# proxyPass = "http://ovpns.uninsane.org:9091"; # proxyPass = "http://ovpns.uninsane.org:9091";
proxyPass = "http://10.0.1.6:9091"; proxyPass = "http://${config.sane.netns.ovpns.netnsVethIpv4}:9091";
}; };
}; };
sane.dns.zones."uninsane.org".inet.CNAME."bt" = "native"; sane.dns.zones."uninsane.org".inet.CNAME."bt" = "native";
sane.ports.ports."51413" = { sane.ports.ports."51413" = {
protocol = [ "tcp" "udp" ]; protocol = [ "tcp" "udp" ];
visibleTo.ovpn = true; # visibleTo.ovpns = true; #< not needed: it runs in the ovpns namespace
description = "colin-bittorrent"; description = "colin-bittorrent";
}; };
} }

View File

@@ -0,0 +1,70 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p acl -p bash -p coreutils -p findutils -p rsync
# transmission invokes this with no args, and the following env vars:
# - TR_TORRENT_DIR: full path to the folder i told transmission to download it to.
# e.g. /var/media/torrents/Videos/Film/Jason.Bourne-2016
# optionally:
# - TR_DRY_RUN=1
# - TR_DEBUG=1
DOWNLOAD_DIR=/var/media/torrents
destructive() {
if [ -n "${TR_DRY_RUN-}" ]; then
echo "[dry-run] $*"
else
debug "$@"
"$@"
fi
}
debug() {
if [ -n "${TR_DEBUG-}" ]; then
echo "$@"
fi
}
echo "TR_TORRENT_DIR=$TR_TORRENT_DIR torrent-done $*"
if [[ "$TR_TORRENT_DIR" =~ ^.*freeleech.*$ ]]; then
# freeleech torrents have no place in my permanent library
echo "freeleech: nothing to do"
exit 0
fi
if ! [[ "$TR_TORRENT_DIR" =~ ^$DOWNLOAD_DIR/.*$ ]]; then
echo "unexpected torrent dir, aborting: $TR_TORRENT_DIR"
exit 0
fi
REL_DIR="${TR_TORRENT_DIR#$DOWNLOAD_DIR/}"
MEDIA_DIR="/var/media/$REL_DIR"
destructive mkdir -p "$(dirname "$MEDIA_DIR")"
destructive rsync -rlv "$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 {} \;
destructive find "$MEDIA_DIR" -type f -exec chmod g+rw,a+r {} \;
# if there's a single directory inside the media dir, then inline that
subdirs=("$MEDIA_DIR"/*)
debug "top-level items in torrent dir:" "${subdirs[@]}"
if [ ${#subdirs[@]} -eq 1 ]; then
dirname="${subdirs[0]}"
debug "exactly one top-level item, checking if directory: $dirname"
if [ -d "$dirname" ]; then
destructive mv "$dirname"/* "$MEDIA_DIR/" && destructive rmdir "$dirname"
fi
fi
# remove noisy files:
# -iname means "insensitive", but the syntax is NOT regex -- more similar to shell matching
destructive find "$MEDIA_DIR/" -type f \(\
-iname '*downloaded?from*' \
-o -iname 'source.txt' \
-o -iname '*upcoming?releases*' \
-o -iname 'www.YTS*.jpg' \
-o -iname 'WWW.YIFY*.COM.jpg' \
-o -iname 'YIFY*.com.txt' \
-o -iname 'YTS*.com.txt' \
\) -exec rm {} \;

View File

@@ -1,159 +0,0 @@
# TODO: split this file apart into smaller files to make it easier to understand
{ 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
{
sane.ports.ports."53" = {
protocol = [ "udp" "tcp" ];
visibleTo.lan = true;
visibleTo.wan = true;
visibleTo.ovpn = true;
description = "colin-dns-hosting";
};
sane.dns.zones."uninsane.org".TTL = 900;
# SOA record structure: <https://en.wikipedia.org/wiki/SOA_record#Structure>
# SOA MNAME RNAME (... rest)
# MNAME = Master name server for this zone. this is where update requests should be sent.
# RNAME = admin contact (encoded email address)
# Serial = YYYYMMDDNN, where N is incremented every time this file changes, to trigger secondary NS to re-fetch it.
# Refresh = how frequently secondary NS should query master
# Retry = how long secondary NS should wait until re-querying master after a failure (must be < Refresh)
# Expire = how long secondary NS should continue to reply to queries after master fails (> Refresh + Retry)
sane.dns.zones."uninsane.org".inet = {
SOA."@" = ''
ns1.uninsane.org. admin-dns.uninsane.org. (
2023092101 ; Serial
4h ; Refresh
30m ; Retry
7d ; Expire
5m) ; Negative response TTL
'';
TXT."rev" = "2023092101";
CNAME."native" = "%CNAMENATIVE%";
A."@" = "%ANATIVE%";
A."servo.wan" = "%AWAN%";
A."servo.lan" = config.sane.hosts.by-name."servo".lan-ip;
A."servo.hn" = config.sane.hosts.by-name."servo".wg-home.ip;
# XXX NS records must also not be CNAME
# it's best that we keep this identical, or a superset of, what org. lists as our NS.
# so, org. can specify ns2/ns3 as being to the VPN, with no mention of ns1. we provide ns1 here.
A."ns1" = "%ANATIVE%";
A."ns2" = "185.157.162.178";
A."ns3" = "185.157.162.178";
A."ovpns" = "185.157.162.178";
NS."@" = [
"ns1.uninsane.org."
"ns2.uninsane.org."
"ns3.uninsane.org."
];
};
services.trust-dns.settings.zones = [ "uninsane.org" ];
networking.nat.enable = true;
networking.nat.extraCommands = ''
# redirect incoming DNS requests from LAN addresses
# to the LAN-specialized DNS service
# N.B.: use the `nixos-*` chains instead of e.g. PREROUTING
# because they get cleanly reset across activations or `systemctl restart firewall`
# instead of accumulating cruft
iptables -t nat -A nixos-nat-pre -p udp --dport 53 \
-m iprange --src-range 10.78.76.0-10.78.79.255 \
-j DNAT --to-destination :1053
iptables -t nat -A nixos-nat-pre -p tcp --dport 53 \
-m iprange --src-range 10.78.76.0-10.78.79.255 \
-j DNAT --to-destination :1053
'';
sane.ports.ports."1053" = {
# because the NAT above redirects in nixos-nat-pre, LAN requests behave as though they arrived on the external interface at the redirected port.
# TODO: try nixos-nat-post instead?
# TODO: or, don't NAT from port 53 -> port 1053, but rather nat from LAN addr to a loopback addr.
# - this is complicated in that loopback is a different interface than eth0, so rewriting the destination address would cause the packets to just be dropped by the interface
protocol = [ "udp" "tcp" ];
visibleTo.lan = true;
description = "colin-redirected-dns-for-lan-namespace";
};
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"
"trust-dns-lan.service"
"trust-dns-hn.service"
# "trust-dns-hn-resolver.service" # doesn't need restart because it doesn't know about WAN IP
];
}

51
hosts/common/boot.nix Normal file
View File

@@ -0,0 +1,51 @@
{ lib, pkgs, ... }:
{
boot.initrd.supportedFilesystems = [ "ext4" "btrfs" "ext2" "ext3" "vfat" ];
# useful emergency utils
boot.initrd.extraUtilsCommands = ''
copy_bin_and_libs ${pkgs.btrfs-progs}/bin/btrfstune
copy_bin_and_libs ${pkgs.util-linux}/bin/{cfdisk,lsblk,lscpu}
copy_bin_and_libs ${pkgs.gptfdisk}/bin/{cgdisk,gdisk}
copy_bin_and_libs ${pkgs.smartmontools}/bin/smartctl
copy_bin_and_libs ${pkgs.e2fsprogs}/bin/resize2fs
'' + lib.optionalString pkgs.stdenv.hostPlatform.isx86_64 ''
copy_bin_and_libs ${pkgs.nvme-cli}/bin/nvme # doesn't cross compile
'';
boot.kernelParams = [
"boot.shell_on_fail"
#v experimental full pre-emption for hopefully better call/audio latency on moby.
# also toggleable at runtime via /sys/kernel/debug/sched/preempt
# defaults to preempt=voluntary
# "preempt=full"
];
# other kernelParams:
# "boot.trace"
# "systemd.log_level=debug"
# "systemd.log_target=console"
# moby has to run recent kernels (defined elsewhere).
# meanwhile, kernel variation plays some minor role in things like sandboxing (landlock) and capabilities.
# simpler to keep near the latest kernel on all devices,
# and also makes certain that any weird system-level bugs i see aren't likely to be stale kernel bugs.
# servo needs zfs though, which doesn't support every kernel.
boot.kernelPackages = lib.mkDefault pkgs.zfs.latestCompatibleLinuxPackages;
# hack in the `boot.shell_on_fail` arg since that doesn't always seem to work.
boot.initrd.preFailCommands = "allowShell=1";
# default: 4 (warn). 7 is debug
boot.consoleLogLevel = 7;
boot.loader.grub.enable = lib.mkDefault false;
boot.loader.generic-extlinux-compatible.enable = lib.mkDefault true;
hardware.enableAllFirmware = true; # firmware with licenses that don't allow for redistribution. fuck lawyers, fuck IP, give me the goddamn firmware.
# hardware.enableRedistributableFirmware = true; # proprietary but free-to-distribute firmware (extraneous to `enableAllFirmware` option)
# default is 252274, which is too low particularly for servo.
# manifests as spurious "No space left on device" when trying to install watches,
# e.g. in dyn-dns by `systemctl start dyn-dns-watcher.path`.
# see: <https://askubuntu.com/questions/828779/failed-to-add-run-systemd-ask-password-to-directory-watch-no-space-left-on-dev>
boot.kernel.sysctl."fs.inotify.max_user_watches" = 4194304;
boot.kernel.sysctl."fs.inotify.max_user_instances" = 4194304;
}

View File

@@ -1,24 +1,29 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ imports = [
./boot.nix
./feeds.nix ./feeds.nix
./fs.nix ./fs.nix
./hardware
./home ./home
./hosts.nix ./hosts.nix
./ids.nix ./ids.nix
./machine-id.nix ./machine-id.nix
./net ./net
./nix ./nix.nix
./persist.nix
./polyunfill.nix ./polyunfill.nix
./programs ./programs
./quirks.nix
./secrets.nix ./secrets.nix
./ssh.nix ./ssh.nix
./systemd.nix ./systemd.nix
./users ./users
]; ];
# docs: https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion
# this affects where nixos modules look for stateful data which might have been migrated across releases.
system.stateVersion = "21.11";
sane.nixcache.enable-trusted-keys = true; sane.nixcache.enable-trusted-keys = true;
sane.nixcache.enable = lib.mkDefault true; sane.nixcache.enable = lib.mkDefault true;
sane.persist.enable = lib.mkDefault true; sane.persist.enable = lib.mkDefault true;
@@ -26,9 +31,6 @@
sane.programs.sysadminUtils.enableFor.system = lib.mkDefault true; sane.programs.sysadminUtils.enableFor.system = lib.mkDefault true;
sane.programs.consoleUtils.enableFor.user.colin = lib.mkDefault true; sane.programs.consoleUtils.enableFor.user.colin = lib.mkDefault true;
nixpkgs.config.allowUnfree = true; # NIXPKGS_ALLOW_UNFREE=1
nixpkgs.config.allowBroken = true; # NIXPKGS_ALLOW_BROKEN=1
# time.timeZone = "America/Los_Angeles"; # time.timeZone = "America/Los_Angeles";
time.timeZone = "Etc/UTC"; # DST is too confusing for me => use a stable timezone time.timeZone = "Etc/UTC"; # DST is too confusing for me => use a stable timezone

View File

@@ -1,14 +1,11 @@
# where to find good stuff? # where to find good stuff?
# - universal search/directory: <https://podcastindex.org> # - universal search/directory: <https://podcastindex.org>
# - list of lists: <https://en.wikipedia.org/wiki/Category:Lists_of_podcasts>
# - podcasts w/ a community: <https://lemmyverse.net/communities?query=podcast> # - podcasts w/ a community: <https://lemmyverse.net/communities?query=podcast>
# - podcast rec thread: <https://lemmy.ml/post/1565858> # - podcast recs:
# - active lemmy: <https://slrpnk.net/c/podcasts>
# - old thread: <https://lemmy.ml/post/1565858>
# #
# candidates:
# - The Nonlinear Library (podcast): <https://forum.effectivealtruism.org/posts/JTZTBienqWEAjGDRv/listen-to-more-ea-content-with-the-nonlinear-library>
# - has ~10 posts per day, text-to-speech; i would need better tagging before adding this
# - <https://www.metaculus.com/questions/11102/introducing-the-metaculus-journal-podcast/>
# - dead since 2022/10 - 2023/03
{ lib, sane-data, ... }: { lib, sane-data, ... }:
let let
hourly = { freq = "hourly"; }; hourly = { freq = "hourly"; };
@@ -62,6 +59,7 @@ let
podcasts = [ podcasts = [
(fromDb "acquiredlpbonussecretsecret.libsyn.com" // tech) # ACQ2 - more "Acquired" episodes (fromDb "acquiredlpbonussecretsecret.libsyn.com" // tech) # ACQ2 - more "Acquired" episodes
(fromDb "allinchamathjason.libsyn.com" // pol) (fromDb "allinchamathjason.libsyn.com" // pol)
(fromDb "api.oyez.org/podcasts/oral-arguments/2015" // pol) # Supreme Court Oral Arguments ("2015" in URL means nothing -- it's still updated)
(fromDb "anchor.fm/s/34c7232c/podcast/rss" // tech) # Civboot -- https://anchor.fm/civboot (fromDb "anchor.fm/s/34c7232c/podcast/rss" // tech) # Civboot -- https://anchor.fm/civboot
(fromDb "anchor.fm/s/2da69154/podcast/rss" // tech) # POD OF JAKE -- https://podofjake.com/ (fromDb "anchor.fm/s/2da69154/podcast/rss" // tech) # POD OF JAKE -- https://podofjake.com/
(fromDb "cast.postmarketos.org" // tech) (fromDb "cast.postmarketos.org" // tech)
@@ -75,23 +73,26 @@ let
(fromDb "feeds.feedburner.com/radiolab" // pol) # Radiolab -- also available here, but ONLY OVER HTTP: <http://feeds.wnyc.org/radiolab> (fromDb "feeds.feedburner.com/radiolab" // pol) # Radiolab -- also available here, but ONLY OVER HTTP: <http://feeds.wnyc.org/radiolab>
(fromDb "feeds.megaphone.fm/behindthebastards" // pol) # also Maggie Killjoy (fromDb "feeds.megaphone.fm/behindthebastards" // pol) # also Maggie Killjoy
(fromDb "feeds.megaphone.fm/recodedecode" // tech) # The Verge - Decoder (fromDb "feeds.megaphone.fm/recodedecode" // tech) # The Verge - Decoder
(fromDb "feeds.simplecast.com/54nAGcIl" // pol) # The Daily
(fromDb "feeds.simplecast.com/82FI35Px" // pol) # Ezra Klein Show (fromDb "feeds.simplecast.com/82FI35Px" // pol) # Ezra Klein Show
(fromDb "feeds.simplecast.com/wgl4xEgL" // rat) # Econ Talk (fromDb "feeds.simplecast.com/wgl4xEgL" // rat) # Econ Talk
(fromDb "feeds.simplecast.com/xKJ93w_w" // uncat) # Atlas Obscura (fromDb "feeds.simplecast.com/xKJ93w_w" // uncat) # Atlas Obscura
(fromDb "feeds.transistor.fm/acquired" // tech) (fromDb "feeds.transistor.fm/acquired" // tech)
(fromDb "feeds.transistor.fm/complex-systems-with-patrick-mckenzie-patio11" // tech) # Patrick Mackenzie (from Bits About Money)
(fromDb "feeds.twit.tv/floss.xml" // tech)
(fromDb "fulltimenix.com" // tech) (fromDb "fulltimenix.com" // tech)
(fromDb "futureofcoding.org/episodes" // tech) (fromDb "futureofcoding.org/episodes" // tech)
(fromDb "hackerpublicradio.org" // tech) (fromDb "hackerpublicradio.org" // tech)
(fromDb "lexfridman.com/podcast" // rat) (fromDb "lexfridman.com/podcast" // rat)
(fromDb "linktr.ee/betteroffline" // pol)
(fromDb "mapspodcast.libsyn.com" // uncat) # Multidisciplinary Association for Psychedelic Studies (fromDb "mapspodcast.libsyn.com" // uncat) # Multidisciplinary Association for Psychedelic Studies
(fromDb "microarch.club" // tech) (fromDb "microarch.club" // tech)
(fromDb "mintcast.org" // tech)
(fromDb "omegataupodcast.net" // tech) # 3/4 German; 1/4 eps are English (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/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/money-stuff-the-podcast") # Matt Levine
(fromDb "omny.fm/shows/the-dollop-with-dave-anthony-and-gareth-reynolds") # The Dollop history/comedy (fromDb "omny.fm/shows/the-dollop-with-dave-anthony-and-gareth-reynolds") # The Dollop history/comedy
(fromDb "omny.fm/shows/weird-little-guys") # Cool Zone Media
(fromDb "originstories.libsyn.com" // uncat) (fromDb "originstories.libsyn.com" // uncat)
(fromDb "podcast.posttv.com/itunes/post-reports.xml" // pol)
(fromDb "politicalorphanage.libsyn.com" // pol) (fromDb "politicalorphanage.libsyn.com" // pol)
(fromDb "reverseengineering.libsyn.com/rss" // tech) # UnNamed Reverse Engineering Podcast (fromDb "reverseengineering.libsyn.com/rss" // tech) # UnNamed Reverse Engineering Podcast
(fromDb "rss.acast.com/deconstructed") # The Intercept - Deconstructed (fromDb "rss.acast.com/deconstructed") # The Intercept - Deconstructed
@@ -102,6 +103,7 @@ let
(fromDb "seattlenice.buzzsprout.com" // pol) (fromDb "seattlenice.buzzsprout.com" // pol)
(fromDb "srslywrong.com" // pol) (fromDb "srslywrong.com" // pol)
(fromDb "sharkbytes.transistor.fm" // tech) # Wireshark Podcast o_0 (fromDb "sharkbytes.transistor.fm" // tech) # Wireshark Podcast o_0
(fromDb "sharptech.fm/feed/podcast" // tech)
(fromDb "sscpodcast.libsyn.com" // rat) # Astral Codex Ten (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 "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 "theamphour.com" // tech)
@@ -113,7 +115,9 @@ let
# (fromDb "feeds.libsyn.com/421877" // rat) # Less Wrong Curated # (fromDb "feeds.libsyn.com/421877" // rat) # Less Wrong Curated
# (fromDb "feeds.megaphone.fm/hubermanlab" // uncat) # Daniel Huberman on sleep # (fromDb "feeds.megaphone.fm/hubermanlab" // uncat) # Daniel Huberman on sleep
# (fromDb "feeds.simplecast.com/54nAGcIl" // pol) # The Daily
# (fromDb "feeds.simplecast.com/l2i9YnTd" // tech // pol) # Hard Fork (NYtimes tech) # (fromDb "feeds.simplecast.com/l2i9YnTd" // tech // pol) # Hard Fork (NYtimes tech)
# (fromDb "podcast.posttv.com/itunes/post-reports.xml" // pol)
# (fromDb "podcast.thelinuxexp.com" // tech) # low-brow linux/foss PR announcements # (fromDb "podcast.thelinuxexp.com" // tech) # low-brow linux/foss PR announcements
# (fromDb "rss.art19.com/your-welcome" // pol) # Michael Malice - Your Welcome -- also available here: <https://origin.podcastone.com/podcast?categoryID2=2232> # (fromDb "rss.art19.com/your-welcome" // pol) # Michael Malice - Your Welcome -- also available here: <https://origin.podcastone.com/podcast?categoryID2=2232>
# (fromDb "rss.prod.firstlook.media/deconstructed/podcast.rss" // pol) #< possible URL rot # (fromDb "rss.prod.firstlook.media/deconstructed/podcast.rss" // pol) #< possible URL rot
@@ -134,6 +138,7 @@ let
(fromDb "artemis.sh" // tech) (fromDb "artemis.sh" // tech)
(fromDb "ascii.textfiles.com" // tech) # Jason Scott (fromDb "ascii.textfiles.com" // tech) # Jason Scott
(fromDb "austinvernon.site" // tech) (fromDb "austinvernon.site" // tech)
(fromDb "buttondown.email" // tech)
(fromDb "ben-evans.com/benedictevans" // pol) (fromDb "ben-evans.com/benedictevans" // pol)
(fromDb "bitbashing.io" // tech) (fromDb "bitbashing.io" // tech)
(fromDb "bitsaboutmoney.com" // uncat) (fromDb "bitsaboutmoney.com" // uncat)
@@ -194,6 +199,8 @@ let
(fromDb "weekinethereumnews.com" // tech) (fromDb "weekinethereumnews.com" // tech)
(fromDb "willow.phantoma.online") # wizard@xyzzy.link (fromDb "willow.phantoma.online") # wizard@xyzzy.link
(fromDb "xn--gckvb8fzb.com" // tech) (fromDb "xn--gckvb8fzb.com" // tech)
(fromDb "xorvoid.com" // tech)
(fromDb "www.thebignewsletter.com" // pol)
(mkSubstack "astralcodexten" // rat // daily) # Scott Alexander (mkSubstack "astralcodexten" // rat // daily) # Scott Alexander
(mkSubstack "eliqian" // rat // weekly) (mkSubstack "eliqian" // rat // weekly)
(mkSubstack "oversharing" // pol // daily) (mkSubstack "oversharing" // pol // daily)
@@ -236,9 +243,9 @@ let
(fromDb "youtube.com/@TheB1M") (fromDb "youtube.com/@TheB1M")
(fromDb "youtube.com/@TomScottGo") (fromDb "youtube.com/@TomScottGo")
(fromDb "youtube.com/@Vihart") (fromDb "youtube.com/@Vihart")
(fromDb "youtube.com/@Vox")
(fromDb "youtube.com/@Vsauce")
# (fromDb "youtube.com/@Vox")
# (fromDb "youtube.com/@Vsauce") # they're all like 1-minute long videos now? what happened @Vsauce?
# (fromDb "youtube.com/@rossmanngroup" // pol // tech) # Louis Rossmann # (fromDb "youtube.com/@rossmanngroup" // pol // tech) # Louis Rossmann
]; ];

View File

@@ -26,10 +26,6 @@ let
# lazyMount: defer mounting until first access from userspace. # lazyMount: defer mounting until first access from userspace.
# see: `man systemd.automount`, `man automount`, `man autofs` # see: `man systemd.automount`, `man automount`, `man autofs`
lazyMount = noauto ++ automount; lazyMount = noauto ++ automount;
wg = [
"x-systemd.requires=wireguard-wg-home.service"
"x-systemd.after=wireguard-wg-home.service"
];
fuse = [ fuse = [
"allow_other" # allow users other than the one who mounts it to access it. needed, if systemd is the one mounting this fs (as root) "allow_other" # allow users other than the one who mounts it to access it. needed, if systemd is the one mounting this fs (as root)
@@ -49,7 +45,7 @@ let
"gid=100" "gid=100"
]; ];
ssh = common ++ fuse ++ [ ssh = common ++ fuseColin ++ [
"identityfile=/home/colin/.ssh/id_ed25519" "identityfile=/home/colin/.ssh/id_ed25519"
# i *think* idmap=user means that `colin` on `localhost` and `colin` on the remote are actually treated as the same user, even if their uid/gid differs? # i *think* idmap=user means that `colin` on `localhost` and `colin` on the remote are actually treated as the same user, even if their uid/gid differs?
# i.e., local colin's id is translated to/from remote colin's id on every operation? # i.e., local colin's id is translated to/from remote colin's id on every operation?
@@ -111,66 +107,207 @@ let
"connect_timeout=20" "connect_timeout=20"
]; ];
}; };
ifSshAuthorized = lib.mkIf config.sane.hosts.by-name."${config.networking.hostName}".ssh.authorized;
remoteHome = host: { remoteHome = host: {
sane.programs.sshfs-fuse.enableFor.system = true; sane.programs.sshfs-fuse.enableFor.system = true;
system.fsPackages = [
config.sane.programs.sshfs-fuse.package
];
fileSystems."/mnt/${host}/home" = { fileSystems."/mnt/${host}/home" = {
device = "colin@${host}:/home/colin"; device = "sshfs#colin@${host}:/home/colin";
fsType = "fuse.sshfs"; fsType = "fuse3";
options = fsOpts.sshColin ++ fsOpts.lazyMount; options = fsOpts.sshColin ++ fsOpts.lazyMount ++ [
# drop_privileges: after `mount.fuse3` opens /dev/fuse, it will drop all capabilities before invoking sshfs
"drop_privileges"
"auto_unmount" #< ensures that when the fs exits, it releases its mountpoint. then systemd can recognize it as failed.
];
noCheck = true; noCheck = true;
}; };
sane.fs."/mnt/${host}/home" = sane-lib.fs.wanted { sane.fs."/mnt/${host}/home" = {
dir.acl.user = "colin"; dir.acl.user = "colin";
dir.acl.group = "users"; dir.acl.group = "users";
dir.acl.mode = "0700"; dir.acl.mode = "0700";
wantedBy = [ "default.target" ];
mount.depends = [ "network-online.target" ];
mount.mountConfig.ExecSearchPath = [ "/run/current-system/sw/bin" ];
mount.mountConfig.User = "colin";
mount.mountConfig.AmbientCapabilities = "CAP_SETPCAP CAP_SYS_ADMIN";
# hardening (systemd-analyze security mnt-desko-home.mount):
# TODO: i can't use ProtectSystem=full here, because i can't create a new mount space; but...
# with drop_privileges, i *could* sandbox the actual `sshfs` program using e.g. bwrap
mount.mountConfig.CapabilityBoundingSet = "CAP_SETPCAP CAP_SYS_ADMIN";
mount.mountConfig.LockPersonality = true;
mount.mountConfig.MemoryDenyWriteExecute = true;
mount.mountConfig.NoNewPrivileges = true;
mount.mountConfig.ProtectClock = true;
mount.mountConfig.ProtectHostname = true;
mount.mountConfig.RemoveIPC = true;
mount.mountConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
#VVV this includes anything it reads from, e.g. /bin/sh; /nix/store/...
# see `systemd-analyze filesystems` for a full list
mount.mountConfig.RestrictFileSystems = "@common-block @basic-api fuse";
mount.mountConfig.RestrictRealtime = true;
mount.mountConfig.RestrictSUIDSGID = true;
mount.mountConfig.SystemCallArchitectures = "native";
mount.mountConfig.SystemCallFilter = [
"@system-service"
"@mount"
"~@chown"
"~@cpu-emulation"
"~@keyring"
# could remove almost all io calls, however one has to keep `open`, and `write`, to communicate with the fuse device.
# so that's pretty useless as a way to prevent write access
];
mount.mountConfig.IPAddressDeny = "any";
mount.mountConfig.IPAddressAllow = "10.0.0.0/8";
mount.mountConfig.DevicePolicy = "closed"; # only allow /dev/{null,zero,full,random,urandom}
mount.mountConfig.DeviceAllow = "/dev/fuse";
# mount.mountConfig.RestrictNamespaces = true; #< my sshfs sandboxing uses bwrap
}; };
}; };
remoteServo = subdir: { remoteServo = subdir: let
localPath = "/mnt/servo/${subdir}";
systemdName = utils.escapeSystemdPath localPath;
in {
sane.programs.curlftpfs.enableFor.system = true; sane.programs.curlftpfs.enableFor.system = true;
sane.fs."/mnt/servo/${subdir}" = sane-lib.fs.wanted { system.fsPackages = [
config.sane.programs.curlftpfs.package
];
fileSystems."${localPath}" = {
device = "curlftpfs#ftp://servo-hn:/${subdir}";
noCheck = true;
fsType = "fuse3";
options = fsOpts.ftp ++ fsOpts.noauto ++ [
# drop_privileges: after `mount.fuse3` opens /dev/fuse, it will drop all capabilities before invoking sshfs
"drop_privileges"
"auto_unmount" #< ensures that when the fs exits, it releases its mountpoint. then systemd can recognize it as failed.
];
# fsType = "nfs";
# options = fsOpts.nfs ++ fsOpts.lazyMount;
};
sane.fs."${localPath}" = {
dir.acl.user = "colin"; dir.acl.user = "colin";
dir.acl.group = "users"; dir.acl.group = "users";
dir.acl.mode = "0750"; dir.acl.mode = "0750";
};
fileSystems."/mnt/servo/${subdir}" = {
device = "ftp://servo-hn:/${subdir}";
noCheck = true;
fsType = "fuse.curlftpfs";
options = fsOpts.ftp ++ fsOpts.noauto ++ fsOpts.wg;
# fsType = "nfs";
# options = fsOpts.nfs ++ fsOpts.lazyMount ++ fsOpts.wg;
};
systemd.services."automount-servo-${utils.escapeSystemdPath subdir}" = let
fs = config.fileSystems."/mnt/servo/${subdir}";
in {
# this is a *flaky* network mount, especially on moby.
# if done as a normal autofs mount, access will eternally block when network is dropped.
# notably, this would block *any* sandboxed app which allows media access, whether they actually try to use that media or not.
# a practical solution is this: mount as a service -- instead of autofs -- and unmount on timeout error, in a restart loop.
# until the ftp handshake succeeds, nothing is actually mounted to the vfs, so this doesn't slow down any I/O when network is down.
description = "automount /mnt/servo/${subdir} in a fault-tolerant and non-blocking manner";
after = [ "network-online.target" ];
requires = [ "network-online.target" ];
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
mount.depends = [ "network-online.target" "${systemdName}-reachable.service" ];
#VVV patch so that when the mount fails, we start a timer to remount it.
# and for a disconnection after a good mount (onSuccess), restart the timer to be more aggressive
mount.unitConfig.OnFailure = [ "${systemdName}.timer" ];
mount.unitConfig.OnSuccess = [ "${systemdName}-restart-timer.target" ];
serviceConfig.Type = "simple"; mount.mountConfig.TimeoutSec = "10s";
serviceConfig.ExecStart = lib.escapeShellArgs [ mount.mountConfig.ExecSearchPath = [ "/run/current-system/sw/bin" ];
"/usr/bin/env" mount.mountConfig.User = "colin";
"PATH=/run/current-system/sw/bin" mount.mountConfig.AmbientCapabilities = "CAP_SETPCAP CAP_SYS_ADMIN";
"mount.${fs.fsType}" # hardening (systemd-analyze security mnt-servo-playground.mount)
"-f" # foreground (i.e. don't daemonize) mount.mountConfig.CapabilityBoundingSet = "CAP_SETPCAP CAP_SYS_ADMIN";
"-s" # single-threaded (TODO: it's probably ok to disable this?) mount.mountConfig.LockPersonality = true;
"-o" mount.mountConfig.MemoryDenyWriteExecute = true;
(lib.concatStringsSep "," (lib.filter (o: !lib.hasPrefix "x-systemd." o) fs.options)) mount.mountConfig.NoNewPrivileges = true;
fs.device mount.mountConfig.ProtectClock = true;
"/mnt/servo/${subdir}" mount.mountConfig.ProtectHostname = true;
mount.mountConfig.RemoveIPC = true;
mount.mountConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
#VVV this includes anything it reads from, e.g. /bin/sh; /nix/store/...
# see `systemd-analyze filesystems` for a full list
mount.mountConfig.RestrictFileSystems = "@common-block @basic-api fuse";
mount.mountConfig.RestrictRealtime = true;
mount.mountConfig.RestrictSUIDSGID = true;
mount.mountConfig.SystemCallArchitectures = "native";
mount.mountConfig.SystemCallFilter = [
"@system-service"
"@mount"
"~@chown"
"~@cpu-emulation"
"~@keyring"
# could remove almost all io calls, however one has to keep `open`, and `write`, to communicate with the fuse device.
# so that's pretty useless as a way to prevent write access
]; ];
# not sure if this configures a linear, or exponential backoff. mount.mountConfig.IPAddressDeny = "any";
# but the first restart will be after `RestartSec`, and the n'th restart (n = RestartSteps) will be RestartMaxDelaySec after the n-1'th exit. mount.mountConfig.IPAddressAllow = "10.0.10.5";
serviceConfig.Restart = "always"; mount.mountConfig.DevicePolicy = "closed"; # only allow /dev/{null,zero,full,random,urandom}
serviceConfig.RestartSec = "10s"; mount.mountConfig.DeviceAllow = "/dev/fuse";
serviceConfig.RestartMaxDelaySec = "120s"; # mount.mountConfig.RestrictNamespaces = true;
serviceConfig.RestartSteps = "5"; };
systemd.services."${systemdName}-reachable" = {
serviceConfig.ExecSearchPath = [ "/run/current-system/sw/bin" ];
serviceConfig.ExecStart = lib.escapeShellArgs [
"curlftpfs"
"ftp://servo-hn:/${subdir}"
"/dev/null"
"-o"
(lib.concatStringsSep "," ([ "exit_after_connect" ] ++ config.fileSystems."${localPath}".options))
];
serviceConfig.RemainAfterExit = true;
serviceConfig.Type = "oneshot";
unitConfig.BindsTo = [ "${systemdName}.mount" ];
# hardening (systemd-analyze security mnt-servo-playground-reachable.service)
serviceConfig.AmbientCapabilities = "";
serviceConfig.CapabilityBoundingSet = "";
serviceConfig.DynamicUser = true;
serviceConfig.LockPersonality = true;
serviceConfig.MemoryDenyWriteExecute = true;
serviceConfig.NoNewPrivileges = true;
serviceConfig.PrivateDevices = true;
serviceConfig.PrivateMounts = true;
serviceConfig.PrivateTmp = true;
serviceConfig.PrivateUsers = true;
serviceConfig.ProcSubset = "all";
serviceConfig.ProtectClock = true;
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true;
serviceConfig.ProtectKernelModules = true;
serviceConfig.ProtectProc = "invisible";
serviceConfig.ProtectSystem = "strict";
serviceConfig.RemoveIPC = true;
serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6";
# serviceConfig.RestrictFileSystems = "@common-block @basic-api"; #< NOPE
serviceConfig.RestrictRealtime = true;
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native";
serviceConfig.SystemCallFilter = [
"@system-service"
"@mount"
"~@chown"
"~@cpu-emulation"
"~@keyring"
# "~@privileged" #< NOPE
"~@resources"
# could remove some more probably
];
serviceConfig.IPAddressDeny = "any";
serviceConfig.IPAddressAllow = "10.0.10.5";
serviceConfig.DevicePolicy = "closed";
# exceptions
serviceConfig.ProtectHostname = false;
serviceConfig.ProtectKernelLogs = false;
serviceConfig.ProtectKernelTunables = false;
};
systemd.targets."${systemdName}-restart-timer" = {
# hack unit which, when started, stops the timer (if running), and then starts it again.
after = [ "${systemdName}.timer" ];
conflicts = [ "${systemdName}.timer" ];
upholds = [ "${systemdName}.timer" ];
unitConfig.StopWhenUnneeded = true;
};
systemd.timers."${systemdName}" = {
timerConfig.Unit = "${systemdName}.mount";
timerConfig.AccuracySec = "2s";
timerConfig.OnActiveSec = [
# try to remount at these timestamps, backing off gradually
# there seems to be an implicit mount attempt at t=0.
"10s"
"30s"
"60s"
"120s"
];
# cap the backoff to a fixed interval.
timerConfig.OnUnitActiveSec = [ "120s" ];
}; };
}; };
in in
@@ -216,9 +353,11 @@ lib.mkMerge [
programs.fuse.userAllowOther = true; #< necessary for `allow_other` or `allow_root` options. programs.fuse.userAllowOther = true; #< necessary for `allow_other` or `allow_root` options.
} }
(remoteHome "desko") (ifSshAuthorized (remoteHome "crappy"))
(remoteHome "lappy") (ifSshAuthorized (remoteHome "desko"))
(remoteHome "moby") (ifSshAuthorized (remoteHome "lappy"))
(ifSshAuthorized (remoteHome "moby"))
(ifSshAuthorized (remoteHome "servo"))
# this granularity of servo media mounts is necessary to support sandboxing: # this granularity of servo media mounts is necessary to support sandboxing:
# for flaky mounts, we can only bind the mountpoint itself into the sandbox, # for flaky mounts, we can only bind the mountpoint itself into the sandbox,
# so it's either this or unconditionally bind all of media/. # so it's either this or unconditionally bind all of media/.

View File

@@ -1,99 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports = [
./x86_64.nix
];
boot.initrd.supportedFilesystems = [ "ext4" "btrfs" "ext2" "ext3" "vfat" ];
# useful emergency utils
boot.initrd.extraUtilsCommands = ''
copy_bin_and_libs ${pkgs.btrfs-progs}/bin/btrfstune
copy_bin_and_libs ${pkgs.util-linux}/bin/{cfdisk,lsblk,lscpu}
copy_bin_and_libs ${pkgs.gptfdisk}/bin/{cgdisk,gdisk}
copy_bin_and_libs ${pkgs.smartmontools}/bin/smartctl
copy_bin_and_libs ${pkgs.e2fsprogs}/bin/resize2fs
'' + lib.optionalString pkgs.stdenv.hostPlatform.isx86_64 ''
copy_bin_and_libs ${pkgs.nvme-cli}/bin/nvme # doesn't cross compile
'';
boot.kernelParams = [
"boot.shell_on_fail"
#v experimental full pre-emption for hopefully better call/audio latency on moby.
# also toggleable at runtime via /sys/kernel/debug/sched/preempt
# defaults to preempt=voluntary
# "preempt=full"
];
# other kernelParams:
# "boot.trace"
# "systemd.log_level=debug"
# "systemd.log_target=console"
# moby has to run recent kernels (defined elsewhere).
# meanwhile, kernel variation plays some minor role in things like sandboxing (landlock) and capabilities.
# simpler to keep near the latest kernel on all devices,
# and also makes certain that any weird system-level bugs i see aren't likely to be stale kernel bugs.
# servo needs zfs though, which doesn't support every kernel.
boot.kernelPackages = lib.mkDefault pkgs.zfs.latestCompatibleLinuxPackages;
# TODO: remove after linux 6.9. see: <https://github.com/axboe/liburing/issues/1113>
# - <https://github.com/neovim/neovim/issues/28149>
# - <https://git.kernel.dk/cgit/linux/commit/?h=io_uring-6.9&id=e5444baa42e545bb929ba56c497e7f3c73634099>
# when removing, try starting and suspending (ctrl+z) two instances of neovim simultaneously.
# if the system doesn't freeze, then this is safe to remove.
# added 2024-04-04
sane.user.fs.".profile".symlink.text = lib.mkBefore ''
export UV_USE_IO_URING=0
'';
# hack in the `boot.shell_on_fail` arg since that doesn't always seem to work.
boot.initrd.preFailCommands = "allowShell=1";
# default: 4 (warn). 7 is debug
boot.consoleLogLevel = 7;
boot.loader.grub.enable = lib.mkDefault false;
boot.loader.generic-extlinux-compatible.enable = lib.mkDefault true;
# non-free firmware
hardware.enableRedistributableFirmware = true;
# default is 252274, which is too low particularly for servo.
# manifests as spurious "No space left on device" when trying to install watches,
# e.g. in dyn-dns by `systemctl start dyn-dns-watcher.path`.
# see: <https://askubuntu.com/questions/828779/failed-to-add-run-systemd-ask-password-to-directory-watch-no-space-left-on-dev>
boot.kernel.sysctl."fs.inotify.max_user_watches" = 1048576;
# powertop will default to putting USB devices -- including HID -- to sleep after TWO SECONDS
powerManagement.powertop.enable = false;
# linux CPU governor: <https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt>
# - options:
# - "powersave" => force CPU to always run at lowest supported frequency
# - "performance" => force CPU to always run at highest frequency
# - "ondemand" => adjust frequency based on load
# - "conservative" (ondemand but slower to adjust)
# - "schedutil"
# - "userspace"
# - not all options are available for all platforms
# - intel (intel_pstate) appears to manage scaling w/o intervention/control from the OS.
# - AMD (acpi-cpufreq) appears to manage scaling via the OS *or* HW. but the ondemand defaults never put it to max hardware frequency.
# - qualcomm (cpufreq-dt) appears to manage scaling *only* via the OS. ondemand governor exercises the full range.
# - query details with `sudo cpupower frequency-info`
powerManagement.cpuFreqGovernor = "ondemand";
# 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 = {
# subvolume = "/";
# extraConfig = {
# ALLOW_USERS = "colin";
# };
# };
# };
# services.snapper.snapshotInterval = "daily";
}

View File

@@ -1,31 +1,30 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
sane.user.persist.byStore.plaintext = [ sane.user.persist.byStore.plaintext = [
"archive" # TODO: some of ~/dev should be private too, but maybe not all 800+ GB of it
# perhaps i ought to rethink how it's organized
"dev" "dev"
# TODO: records should be private
"records"
"ref" "ref"
"tmp"
"use" "use"
"Books/local" "Books/local"
"Music" "Music"
# this is persisted simply to save on RAM. mesa_shader_cache is < 10 MB.
# TODO: integrate with sane.programs.sandbox?
".cache/mesa_shader_cache"
];
sane.user.persist.byStore.private = [
"archive"
"Pictures/albums" "Pictures/albums"
"Pictures/cat" "Pictures/cat"
"Pictures/from" "Pictures/from"
"Pictures/Screenshots" #< XXX: something is case-sensitive about this? "Pictures/Screenshots" #< XXX: something is case-sensitive about this?
"Pictures/Photos" "Pictures/Photos"
"Videos/local" "records"
"tmp"
# these are persisted simply to save on RAM.
# ~/.cache/nix can become several GB.
# mesa_shader_cache is < 10 MB.
# TODO: integrate with sane.programs.sandbox?
".cache/mesa_shader_cache"
".cache/nix"
];
sane.user.persist.byStore.private = [
"knowledge" "knowledge"
"Videos/local"
]; ];
# convenience # convenience
@@ -34,7 +33,7 @@
in { in {
".persist/private" = lib.mkIf persistEnabled { symlink.target = config.sane.persist.stores.private.origin; }; ".persist/private" = lib.mkIf persistEnabled { symlink.target = config.sane.persist.stores.private.origin; };
".persist/plaintext" = lib.mkIf persistEnabled { symlink.target = config.sane.persist.stores.plaintext.origin; }; ".persist/plaintext" = lib.mkIf persistEnabled { symlink.target = config.sane.persist.stores.plaintext.origin; };
".persist/ephemeral" = lib.mkIf persistEnabled { symlink.target = config.sane.persist.stores.cryptClearOnBoot.origin; }; ".persist/ephemeral" = lib.mkIf persistEnabled { symlink.target = config.sane.persist.stores.ephemeral.origin; };
"nixos".symlink.target = "dev/nixos"; "nixos".symlink.target = "dev/nixos";

View File

@@ -23,11 +23,5 @@
# see <https://manpages.ubuntu.com/manpages/bionic/man5/user-dirs.conf.5.html> # see <https://manpages.ubuntu.com/manpages/bionic/man5/user-dirs.conf.5.html>
sane.user.fs.".config/user-dirs.conf".symlink.text = "enabled=False"; sane.user.fs.".config/user-dirs.conf".symlink.text = "enabled=False";
sane.user.fs.".profile".symlink.text = '' sane.user.fs.".config/environment.d/30-user-dirs.conf".symlink.target = "../user-dirs.dirs";
# configure XDG_<type>_DIR preferences (e.g. for downloads, screenshots, etc)
# surround with `set -o allexport` since user-dirs.dirs doesn't `export` its vars
set -a
source $HOME/.config/user-dirs.dirs
set +a
'';
} }

View File

@@ -2,6 +2,14 @@
{ {
# TODO: this should be populated per-host # TODO: this should be populated per-host
sane.hosts.by-name."crappy" = {
ssh.user_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMIvSQAGKqmymXIL4La9B00LPxBIqWAr5AsJxk3UQeY5";
ssh.host_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMN0cpRAloCBOE5/2wuzgik35iNDv5KLceWMCVaa7DIQ";
# wg-home.pubkey = "TODO";
# wg-home.ip = "10.0.10.55";
lan-ip = "10.78.79.55";
};
sane.hosts.by-name."desko" = { sane.hosts.by-name."desko" = {
ssh.user_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPU5GlsSfbaarMvDA20bxpSZGWviEzXGD8gtrIowc1pX"; ssh.user_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPU5GlsSfbaarMvDA20bxpSZGWviEzXGD8gtrIowc1pX";
ssh.host_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFw9NoRaYrM6LbDd3aFBc4yyBlxGQn8HjeHd/dZ3CfHk"; ssh.host_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFw9NoRaYrM6LbDd3aFBc4yyBlxGQn8HjeHd/dZ3CfHk";

View File

@@ -4,6 +4,9 @@
{ ... }: { ... }:
{ {
# partially supported in nixpkgs <repo:nixos/nixpkgs:nixos/modules/misc/ids.nix>
sane.ids.networkmanager.uid = 57; #< nixpkgs unofficially reserves this, to match networkmanager's gid
# legacy servo users, some are inconvenient to migrate # legacy servo users, some are inconvenient to migrate
sane.ids.dhcpcd.gid = 991; sane.ids.dhcpcd.gid = 991;
sane.ids.dhcpcd.uid = 992; sane.ids.dhcpcd.uid = 992;
@@ -18,7 +21,7 @@
sane.ids.matrix-appservice-irc.uid = 993; sane.ids.matrix-appservice-irc.uid = 993;
sane.ids.matrix-appservice-irc.gid = 992; sane.ids.matrix-appservice-irc.gid = 992;
# greetd (used by sway) # greetd (legacy)
sane.ids.greeter.uid = 999; sane.ids.greeter.uid = 999;
sane.ids.greeter.gid = 999; sane.ids.greeter.gid = 999;
@@ -42,8 +45,8 @@
sane.ids.pict-rs.gid = 2409; sane.ids.pict-rs.gid = 2409;
sane.ids.sftpgo.uid = 2410; sane.ids.sftpgo.uid = 2410;
sane.ids.sftpgo.gid = 2410; sane.ids.sftpgo.gid = 2410;
sane.ids.trust-dns.uid = 2411; sane.ids.hickory-dns.uid = 2411; #< previously "trust-dns"
sane.ids.trust-dns.gid = 2411; sane.ids.hickory-dns.gid = 2411; #< previously "trust-dns"
sane.ids.export.gid = 2412; sane.ids.export.gid = 2412;
sane.ids.nfsuser.uid = 2413; sane.ids.nfsuser.uid = 2413;
sane.ids.media.gid = 2414; sane.ids.media.gid = 2414;
@@ -59,6 +62,9 @@
sane.ids.clightning.gid = 2419; sane.ids.clightning.gid = 2419;
sane.ids.nix-serve.uid = 2420; sane.ids.nix-serve.uid = 2420;
sane.ids.nix-serve.gid = 2420; sane.ids.nix-serve.gid = 2420;
sane.ids.plugdev.gid = 2421;
sane.ids.ollama.uid = 2422;
sane.ids.ollama.gid = 2422;
sane.ids.colin.uid = 1000; sane.ids.colin.uid = 1000;
sane.ids.guest.uid = 1100; sane.ids.guest.uid = 1100;
@@ -78,6 +84,7 @@
# found on graphical hosts # found on graphical hosts
sane.ids.nm-iodine.uid = 2101; # desko/moby/lappy sane.ids.nm-iodine.uid = 2101; # desko/moby/lappy
sane.ids.seat.gid = 2102;
# found on desko host # found on desko host
# from services.usbmuxd # from services.usbmuxd

View File

@@ -4,12 +4,15 @@
imports = [ imports = [
./dns.nix ./dns.nix
./hostnames.nix ./hostnames.nix
./modemmanager.nix
./networkmanager.nix
./upnp.nix ./upnp.nix
./vpn.nix ./vpn.nix
]; ];
systemd.network.enable = true; systemd.network.enable = true;
networking.useNetworkd = true; networking.useNetworkd = true;
networking.usePredictableInterfaceNames = false; #< set false to get `eth0`, `wlan0`, etc instead of `enp3s0`/etc
# view refused/dropped packets with: `sudo journalctl -k` # view refused/dropped packets with: `sudo journalctl -k`
# networking.firewall.logRefusedPackets = true; # networking.firewall.logRefusedPackets = true;
@@ -24,41 +27,4 @@
# this is required separately by servo and by any `sane-vpn` users, # this is required separately by servo and by any `sane-vpn` users,
# however Nix requires this be set centrally, in only one location (i.e. here) # however Nix requires this be set centrally, in only one location (i.e. here)
boot.kernel.sysctl."net.ipv4.ip_forward" = 1; boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
# the default backend is "wpa_supplicant".
# wpa_supplicant reliably picks weak APs to connect to.
# see: <https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/474>
# iwd is an alternative that shouldn't have this problem
# docs:
# - <https://nixos.wiki/wiki/Iwd>
# - <https://iwd.wiki.kernel.org/networkmanager>
# - `man iwd.config` for global config
# - `man iwd.network` for per-SSID config
# use `iwctl` to control
# networking.networkmanager.wifi.backend = "iwd";
# networking.wireless.iwd.enable = true;
# networking.wireless.iwd.settings = {
# # auto-connect to a stronger network if signal drops below this value
# # bedroom -> bedroom connection is -35 to -40 dBm
# # bedroom -> living room connection is -60 dBm
# General.RoamThreshold = "-52"; # default -70
# General.RoamThreshold5G = "-52"; # default -76
# };
# plugins mostly add support for establishing different VPN connections.
# the default plugin set includes mostly proprietary VPNs:
# - fortisslvpn (Fortinet)
# - iodine (DNS tunnels)
# - l2tp
# - openconnect (Cisco Anyconnect / Juniper / ocserv)
# - openvpn
# - vpnc (Cisco VPN)
# - sstp
#
# i don't use these, and notably they drag in huge dependency sets and don't cross compile well.
# e.g. openconnect drags in webkitgtk (for SSO)!
networking.networkmanager.plugins = lib.mkForce [];
# keyfile.path = where networkmanager should look for connection credentials
networking.networkmanager.settings.keyfile.path = "/var/lib/NetworkManager/system-connections";
} }

View File

@@ -20,19 +20,19 @@
# - each namespace may use a different /etc/resolv.conf to specify different DNS servers # - each namespace may use a different /etc/resolv.conf to specify different DNS 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. # - 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 removing `/var/run/nscd/socket` from the namespace, or disabling nscd altogether. # - this is fixed by either removing `/var/run/nscd/socket` from the namespace, or disabling nscd altogether.
{ config, lib, ... }: { config, lib, pkgs, ... }:
lib.mkMerge [ lib.mkMerge [
{ {
sane.services.trust-dns.enable = lib.mkDefault config.sane.services.trust-dns.asSystemResolver; sane.services.hickory-dns.enable = lib.mkDefault config.sane.services.hickory-dns.asSystemResolver;
sane.services.trust-dns.asSystemResolver = lib.mkDefault true; sane.services.hickory-dns.asSystemResolver = lib.mkDefault true;
} }
(lib.mkIf (!config.sane.services.trust-dns.asSystemResolver) { (lib.mkIf (!config.sane.services.hickory-dns.asSystemResolver) {
# use systemd's stub resolver. # use systemd's stub resolver.
# /etc/resolv.conf isn't sophisticated enough to use different servers per net namespace (or link). # /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 # instead, running the stub resolver on a known address in the root ns lets us rewrite packets
# in servo's ovnps namespace to use the provider's DNS resolvers. # in servo's ovnps namespace to use the provider's DNS resolvers.
# a weakness is we can only query 1 NS at a time (unless we were to clone the packets?) # a weakness is we can only query 1 NS at a time (unless we were to clone the packets?)
# TODO: improve trust-dns recursive resolver and then remove this # TODO: improve hickory-dns recursive resolver and then remove this
services.resolved.enable = true; #< to disable, set ` = lib.mkForce false`, as other systemd features default to enabling `resolved`. services.resolved.enable = true; #< to disable, set ` = lib.mkForce false`, as other systemd features default to enabling `resolved`.
# without DNSSEC: # without DNSSEC:
# - dig matrix.org => works # - dig matrix.org => works
@@ -40,7 +40,7 @@ lib.mkMerge [
# with default DNSSEC: # with default DNSSEC:
# - dig matrix.org => works # - dig matrix.org => works
# - curl https://matrix.org => fails # - curl https://matrix.org => fails
# i don't know why. this might somehow be interfering with the DNS run on this device (trust-dns) # i don't know why. this might somehow be interfering with the DNS run on this device (hickory-dns)
services.resolved.dnssec = "false"; services.resolved.dnssec = "false";
networking.nameservers = [ networking.nameservers = [
# use systemd-resolved resolver # use systemd-resolved resolver
@@ -59,15 +59,35 @@ lib.mkMerge [
# in the netns and we query upstream DNS more often than needed. hm. # in the netns and we query upstream DNS more often than needed. hm.
# services.nscd.enableNsncd = true; # services.nscd.enableNsncd = true;
# disabling nscd LOSES US SOME FUNCTIONALITY. in particular, only the glibc-builtin modules are accessible via /etc/resolv.conf. # disabling nscd LOSES US SOME FUNCTIONALITY. in particular, only the glibc-builtin modules are accessible via /etc/resolv.conf (er, did i mean /etc/nsswitch.conf?).
# - dns: glibc-bultin # - dns: glibc-bultin
# - files: glibc-builtin # - files: glibc-builtin
# - myhostname: systemd # - myhostname: systemd
# - mymachines: systemd # - mymachines: systemd
# - resolve: systemd # - resolve: systemd
# in practice, i see no difference with nscd disabled. # in practice, i see no difference with nscd disabled.
# - the exception is when the system dns resolver doesn't do everything.
# for example, systemd-resolved does mDNS. hickory-dns does not. a hickory-dns system won't be mDNS-capable.
# disabling nscd VASTLY simplifies netns and process isolation. see explainer at top of file. # disabling nscd VASTLY simplifies netns and process isolation. see explainer at top of file.
services.nscd.enable = false; services.nscd.enable = false;
system.nssModules = lib.mkForce []; # system.nssModules = lib.mkForce [];
sane.silencedAssertions = [''.*Loading NSS modules from system.nssModules.*requires services.nscd.enable being set to true.*''];
# add NSS modules into their own subdirectory.
# then i can add just the NSS modules library path to the global LD_LIBRARY_PATH, rather than ALL of /run/current-system/sw/lib.
# TODO: i'm doing this so as to achieve mdns DNS resolution (avahi). it would be better to just have hickory-dns delegate .local to avahi
# (except avahi doesn't act as a local resolver over DNS protocol -- only dbus).
environment.systemPackages = [(pkgs.symlinkJoin {
name = "nss-modules";
paths = config.system.nssModules.list;
postBuild = ''
mkdir nss
mv $out/lib/libnss_* nss
rm -rf $out
mkdir -p $out/lib
mv nss $out/lib
'';
})];
environment.variables.LD_LIBRARY_PATH = [ "/run/current-system/sw/lib/nss" ];
systemd.globalEnvironment.LD_LIBRARY_PATH = "/run/current-system/sw/lib/nss"; #< specifically for `geoclue.service`
} }
] ]

View File

@@ -0,0 +1,81 @@
{ config, lib, pkgs, ... }:
{
networking.modemmanager.package = pkgs.modemmanager-split.daemon.overrideAttrs (upstream: {
# patch to allow the dbus endpoints to be owned by networkmanager user
postInstall = (upstream.postInstall or "") + ''
substitute $out/share/dbus-1/system.d/org.freedesktop.ModemManager1.conf \
$out/share/dbus-1/system.d/networkmanager-org.freedesktop.ModemManager1.conf \
--replace-fail 'user="root"' 'group="networkmanager"'
'';
});
systemd.services.ModemManager = {
# aliases = [ "dbus-org.freedesktop.ModemManager1.service" ];
# after = [ "polkit.service" ];
# requires = [ "polkit.service" ];
wantedBy = [ "network.target" ]; #< default is `multi-user.target`, somehow it doesn't auto-start with that...
# serviceConfig.Type = "dbus";
# serviceConfig.BusName = "org.freedesktop.ModemManager1";
# only if started with `--debug` does mmcli let us issue AT commands like
# `mmcli --modem any --command=<AT_CMD>`
serviceConfig.ExecStart = [
"" # first blank line is to clear the upstream `ExecStart` field.
"${lib.getExe' config.networking.modemmanager.package "ModemManager"} --debug"
];
# --debug sets DEBUG level logging: so reset
serviceConfig.ExecStartPost = "${lib.getExe config.sane.programs.mmcli.package} --set-logging=INFO";
# v this is what upstream ships
# serviceConfig.Restart = "on-abort";
# serviceConfig.StandardError = "null";
# serviceConfig.CapabilityBoundingSet = "CAP_SYS_ADMIN CAP_NET_ADMIN";
# serviceConfig.ProtectSystem = true; # makes empty: /boot, /usr
# serviceConfig.ProtectHome = true; # makes empty: /home, /root, /run/user
# serviceConfig.PrivateTmp = true;
# serviceConfig.RestrictAddressFamilies = "AF_NETLINK AF_UNIX AF_QIPCRTR";
# serviceConfig.NoNewPrivileges = true;
serviceConfig.CapabilityBoundingSet = [
"" #< reset upstream capabilities
"CAP_NET_ADMIN"
"CAP_SYS_ADMIN" #< TODO: remove CAP_SYS_ADMIN!
];
serviceConfig.LockPersonality = true;
# serviceConfig.PrivateUsers = true; #< untried, not likely to work since it needs capabilities
serviceConfig.PrivateTmp = true;
serviceConfig.ProtectClock = true; # syscall filter to prevent changing the RTC
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true; # makes empty: /home, /root, /run/user
serviceConfig.ProtectHostname = true; # prevents changing hostname
serviceConfig.ProtectKernelLogs = true; # disable /proc/kmsg, /dev/kmsg
serviceConfig.ProtectKernelModules = true; # syscall filter to prevent module calls
serviceConfig.ProtectKernelTunables = true;
serviceConfig.ProtectSystem = "strict"; # makes read-only all but /dev, /proc, /sys
serviceConfig.RestrictAddressFamilies = [
"AF_NETLINK"
"AF_QIPCRTR"
"AF_UNIX"
];
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native"; # prevents e.g. aarch64 syscalls in the event that the kernel is multi-architecture.
# from earlier `landlock` sandboxing, i know it needs these directories:
# - # "/"
# - "/dev" #v modem-power + net are not enough
# - # "/dev/modem-power"
# - # "/dev/net"
# - "/proc"
# - # /run #v can likely be reduced more
# - "/run/dbus"
# - "/run/NetworkManager"
# - "/run/resolvconf"
# - "/run/systemd"
# - "/run/udev"
# - "/sys"
};
# so that ModemManager can discover when the modem appears
# services.udev.packages = lib.mkIf cfg.enabled [ cfg.package ];
}

View File

@@ -0,0 +1,301 @@
{ config, pkgs, ... }:
let
# networkmanager = pkgs.networkmanager;
networkmanager = pkgs.networkmanager.overrideAttrs (upstream: {
# src = pkgs.fetchFromGitea {
# domain = "git.uninsane.org";
# owner = "colin";
# repo = "NetworkManager";
# # patched to fix polkit permissions (with `nmcli`) when NetworkManager runs as user networkmanager
# rev = "dev-sane-1.48.0";
# hash = "sha256-vGmOKtwVItxjYioZJlb1og3K6u9s4rcmDnjAPLBC3ao=";
# };
patches = (upstream.patches or []) ++ [
(pkgs.fetchpatch {
name = "polkit: add owner annotations to all actions";
url = "https://git.uninsane.org/colin/NetworkManager/commit/a01293861fa24201ffaeb84c07f1c71136c49759.patch";
hash = "sha256-th1/M2slo7rjkVBwETZII53Lmhyw8OMS0aT9QYI5Uvk=";
})
];
});
# split the package into `daemon` and `nmcli` outputs, because the networkmanager *service*
# doesn't need `nmcli`/`nmtui` tooling
networkmanager-split = pkgs.networkmanager-split.override { inherit networkmanager; };
in {
networking.networkmanager.enable = true;
systemd.network.wait-online.enable = false; # systemd-networkd-wait-online.service reliably fails on lappy. docs don't match behavior. shit software.
# plugins mostly add support for establishing different VPN connections.
# the default plugin set includes mostly proprietary VPNs:
# - fortisslvpn (Fortinet)
# - iodine (DNS tunnels)
# - l2tp
# - openconnect (Cisco Anyconnect / Juniper / ocserv)
# - openvpn
# - vpnc (Cisco VPN)
# - sstp
#
# i don't use these, and notably they drag in huge dependency sets and don't cross compile well.
# e.g. openconnect drags in webkitgtk (for SSO)!
# networking.networkmanager.plugins = lib.mkForce [];
networking.networkmanager.enableDefaultPlugins = false;
networking.networkmanager.package = networkmanager-split.daemon.overrideAttrs (upstream: {
# postPatch = (upstream.postPatch or "") + ''
# substituteInPlace src/{core/org.freedesktop.NetworkManager,nm-dispatcher/nm-dispatcher}.conf --replace-fail \
# 'user="root"' 'user="networkmanager"'
# '';
postInstall = (upstream.postInstall or "") + ''
# allow the bus to owned by either root or networkmanager users
# use the group here, that way ordinary users can be elevated to control networkmanager
# (via e.g. `nmcli`)
for f in org.freedesktop.NetworkManager.conf nm-dispatcher.conf ; do
substitute $out/share/dbus-1/system.d/$f \
$out/share/dbus-1/system.d/networkmanager-$f \
--replace-fail 'user="root"' 'group="networkmanager"'
done
# remove unused services to prevent any unexpected interactions
rm $out/etc/systemd/system/{nm-cloud-setup.service,nm-cloud-setup.timer,nm-priv-helper.service}
'';
});
# fixup the services to run as `networkmanager` and with less permissions
systemd.services.NetworkManager = {
serviceConfig.RuntimeDirectory = "NetworkManager"; #< tells systemd to create /run/NetworkManager
# serviceConfig.StateDirectory = "NetworkManager"; #< tells systemd to create /var/lib/NetworkManager
serviceConfig.User = "networkmanager";
serviceConfig.Group = "networkmanager";
serviceConfig.AmbientCapabilities = [
"CAP_NET_ADMIN"
"CAP_NET_RAW"
"CAP_NET_BIND_SERVICE"
];
serviceConfig.CapabilityBoundingSet = [
# "CAP_DAC_OVERRIDE"
"CAP_NET_ADMIN"
"CAP_NET_RAW" #< required, else `libndp: ndp_sock_open: Failed to create ICMP6 socket.`
"CAP_NET_BIND_SERVICE" #< this *does* seem to be necessary, though i don't understand why. DHCP?
# "CAP_SYS_MODULE"
# "CAP_AUDIT_WRITE" #< allow writing to the audit log (optional)
# "CAP_KILL"
];
serviceConfig.LockPersonality = true;
serviceConfig.NoNewPrivileges = true;
serviceConfig.MemoryDenyWriteExecute = true;
serviceConfig.PrivateDevices = true; # remount /dev with just the basics, syscall filter to block @raw-io
serviceConfig.PrivateIPC = true;
serviceConfig.PrivateTmp = true;
# serviceConfig.PrivateUsers = true; #< BREAKS NetworkManager (presumably, it causes a new user namespace, breaking CAP_NET_ADMIN & others). "platform-linux: do-change-link[3]: failure 1 (Operation not permitted)"
serviceConfig.ProtectClock = true; # syscall filter to prevent changing the RTC
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true; # makes empty: /home, /root, /run/user
serviceConfig.ProtectHostname = true; # probably not upstreamable: prevents changing hostname
serviceConfig.ProtectKernelLogs = true; # disable /proc/kmsg, /dev/kmsg
serviceConfig.ProtectKernelModules = true; # syscall filter to prevent module calls (probably not upstreamable: NM will want to load modules like `ppp`)
serviceConfig.ProtectKernelTunables = true; # but NM might need to write /proc/sys/net/...
serviceConfig.ProtectProc = "invisible";
serviceConfig.ProcSubset = "pid";
serviceConfig.ProtectSystem = "strict"; # makes read-only: all but /dev, /proc, /sys.
serviceConfig.RemoveIPC = true;
serviceConfig.RestrictAddressFamilies = [
"AF_INET"
"AF_INET6"
"AF_NETLINK" # breaks near DHCP without this
"AF_PACKET" # for DHCP
"AF_UNIX"
# AF_ALG ?
# AF_BLUETOOTH ?
# AF_BRIDGE ?
];
serviceConfig.RestrictNamespaces = true;
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native"; # prevents e.g. aarch64 syscalls in the event that the kernel is multi-architecture.
serviceConfig.SystemCallFilter = [
"@system-service"
# TODO: restrict SystemCallFilter more aggressively
];
# TODO: restrict `DeviceAllow`
# from earlier `landlock` sandboxing, i know it needs these directories:
# - "/proc/net"
# - "/proc/sys/net"
# - "/run/NetworkManager"
# - "/run/systemd" # for hickory-dns-nmhook
# - "/run/udev"
# - # "/run/wg-home.priv"
# - "/sys/class"
# - "/sys/devices"
# - "/var/lib/NetworkManager"
# - "/var/lib/hickory-dns" #< for hickory-dns-nmhook
# - "/run/systemd"
};
systemd.services.NetworkManager-wait-online = {
serviceConfig.User = "networkmanager";
serviceConfig.Group = "networkmanager";
};
# fix NetworkManager-dispatcher to actually run as a daemon,
# and sandbox it a bit
systemd.services.NetworkManager-dispatcher = {
#VVV so that /var/lib/hickory-dns will exist (the hook needs to write here).
# but this creates a cycle: hickory-dns-localhost > network.target > NetworkManager-dispatcher > hickory-dns-localhost.
# (seemingly) impossible to remove the network.target dep on NetworkManager-dispatcher.
# beffore would be to have the dispatcher not write hickory-dns files
# but rather just its own, and create a .path unit which restarts hickory-dns appropriately.
# after = [ "hickory-dns-localhost.service" ];
# 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";
# serviceConfig.DynamicUser = true; #< not possible, else we lose group perms (so can't write to `hickory-dns`'s files in the nm hook)
serviceConfig.User = "networkmanager"; # TODO: should arguably use `DynamicUser`
serviceConfig.Group = "networkmanager";
serviceConfig.LockPersonality = true;
serviceConfig.NoNewPrivileges = true;
serviceConfig.PrivateDevices = true; # remount /dev with just the basics, syscall filter to block @raw-io
serviceConfig.PrivateIPC = true;
serviceConfig.PrivateTmp = true;
serviceConfig.PrivateUsers = true;
serviceConfig.ProtectClock = true; # syscall filter to prevent changing the RTC
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true; # makes empty: /home, /root, /run/user
serviceConfig.ProtectHostname = true; # probably not upstreamable: prevents changing hostname
serviceConfig.ProtectKernelLogs = true; # disable /proc/kmsg, /dev/kmsg
serviceConfig.ProtectKernelModules = true; # syscall filter to prevent module calls
serviceConfig.ProtectKernelTunables = true;
serviceConfig.ProtectSystem = "full"; # makes read-only: /boot, /etc/, /usr. `strict` isn't possible due to hickory-dns hook
serviceConfig.RestrictAddressFamilies = [
"AF_UNIX" # required, probably for dbus or systemd connectivity
];
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native"; # prevents e.g. aarch64 syscalls in the event that the kernel is multi-architecture.
};
# harden wpa_supplicant (used by NetworkManager)
systemd.services.wpa_supplicant = {
serviceConfig.User = "networkmanager";
serviceConfig.Group = "networkmanager";
serviceConfig.AmbientCapabilities = [
"CAP_NET_ADMIN"
"CAP_NET_RAW"
];
serviceConfig.LockPersonality = true;
serviceConfig.NoNewPrivileges = true;
# serviceConfig.PrivateDevices = true; # untried, not likely to work. remount /dev with just the basics, syscall filter to block @raw-io
serviceConfig.PrivateIPC = true;
serviceConfig.PrivateTmp = true;
# serviceConfig.PrivateUsers = true; #< untried, not likely to work
serviceConfig.ProtectClock = true; # syscall filter to prevent changing the RTC
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true; # makes empty: /home, /root, /run/user
serviceConfig.ProtectHostname = true; # prevents changing hostname
serviceConfig.ProtectKernelLogs = true; # disable /proc/kmsg, /dev/kmsg
serviceConfig.ProtectKernelModules = true; # syscall filter to prevent module calls
serviceConfig.ProtectKernelTunables = true; #< N.B.: i think this makes certain /proc writes fail
serviceConfig.ProtectSystem = "strict"; # makes read-only: all but /dev, /proc, /sys.
serviceConfig.RestrictAddressFamilies = [
"AF_INET" #< required
"AF_INET6"
"AF_NETLINK" #< required
"AF_PACKET" #< required
"AF_UNIX" #< required (wpa_supplicant wants to use dbus)
];
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native"; # prevents e.g. aarch64 syscalls in the event that the kernel is multi-architecture.
# from earlier `landlock` sandboxing, i know it needs only these paths:
# - "/dev/net"
# - "/dev/rfkill"
# - "/proc/sys/net"
# - "/sys/class/net"
# - "/sys/devices"
# - "/run/systemd"
};
networking.networkmanager.settings = {
# keyfile.path = where networkmanager should look for connection credentials
keyfile.path = "/var/lib/NetworkManager/system-connections";
# wifi.backend = "wpa_supplicant"; #< default
# wifi.scan-rand-mac-address = true; #< default
# logging.audit = false; #< default
logging.level = "INFO";
# main.dhcp = "internal"; #< default
# main.dns controls what to do when NM gets a DNS server via DHCP
# - "none" (populate /run/NetworkManager/resolv.conf with DHCP settings)
# - "internal" (?)
# - "systemd-resolved" (tell systemd-resolved about it, and point /run/NetworkManager/resolv.conf -> systemd)
# without this, systemd-resolved won't be able to resolve anything (because it has no upstream servers)
# note that NM's resolv.conf isn't (necessarily) /etc/resolv.conf -- that is managed by nixos (via symlinking)
main.dns = if config.services.resolved.enable then
"systemd-resolved"
else if config.sane.services.hickory-dns.enable && config.sane.services.hickory-dns.asSystemResolver then
"none"
else
"internal"
;
main.systemd-resolved = false;
};
environment.etc."NetworkManager/system-connections".source = "/var/lib/NetworkManager/system-connections";
# the default backend is "wpa_supplicant".
# wpa_supplicant reliably picks weak APs to connect to.
# see: <https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/474>
# iwd is an alternative that shouldn't have this problem
# docs:
# - <https://nixos.wiki/wiki/Iwd>
# - <https://iwd.wiki.kernel.org/networkmanager>
# - `man iwd.config` for global config
# - `man iwd.network` for per-SSID config
# use `iwctl` to control
# networking.networkmanager.wifi.backend = "iwd";
# networking.wireless.iwd.enable = true;
# networking.wireless.iwd.settings = {
# # auto-connect to a stronger network if signal drops below this value
# # bedroom -> bedroom connection is -35 to -40 dBm
# # bedroom -> living room connection is -60 dBm
# General.RoamThreshold = "-52"; # default -70
# General.RoamThreshold5G = "-52"; # default -76
# };
# allow networkmanager to control systemd-resolved,
# which it needs to do to apply new DNS settings when using systemd-resolved.
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
if (subject.isInGroup("networkmanager") && action.id.indexOf("org.freedesktop.resolve1.") == 0) {
return polkit.Result.YES;
}
});
'';
users.users.networkmanager = {
isSystemUser = true;
group = "networkmanager";
extraGroups = [ "hickory-dns" ];
};
# there is, unfortunately, no proper interface by which to plumb wpa_supplicant into the NixOS service, except by overlay.
nixpkgs.overlays = [(self: super: {
wpa_supplicant = super.wpa_supplicant.overrideAttrs (upstream: {
# postPatch = (upstream.postPatch or "") + ''
# substituteInPlace wpa_supplicant/dbus/dbus-wpa_supplicant.conf --replace-fail \
# 'user="root"' 'user="networkmanager"'
# '';
postInstall = (upstream.postInstall or "") + ''
substitute $out/share/dbus-1/system.d/dbus-wpa_supplicant.conf \
$out/share/dbus-1/system.d/networkmanager-wpa_supplicant.conf \
--replace-fail 'user="root"' 'group="networkmanager"'
'';
postFixup = (upstream.postFixup or "") + ''
# remove unused services to avoid unexpected interactions
rm $out/etc/systemd/system/{wpa_supplicant-nl80211@,wpa_supplicant-wired@,wpa_supplicant@}.service
'';
});
})];
}

View File

@@ -7,50 +7,62 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
def-ovpn = name: { endpoint, publicKey, addrV4, id }: { # N.B.: OVPN issues each key (i.e. device) a different IP (addrV4), and requires you use it.
sane.vpn."ovpnd-${name}" = { # the IP it issues can be used to connect to any of their VPNs.
inherit endpoint publicKey addrV4 id; # effectively the IP and key map 1-to-1.
privateKeyFile = config.sops.secrets."wg/ovpnd_${name}_privkey".path; # it seems to still be possible to keep two active tunnels on one device, using the same key/IP address, though.
def-ovpn = name: { endpoint, publicKey, id }: let
inherit (config.sane.ovpn) addrV4;
in {
sane.vpn."ovpnd-${name}" = lib.mkIf (addrV4 != null) {
inherit addrV4 endpoint publicKey id;
privateKeyFile = config.sops.secrets."ovpn_privkey".path;
dns = [ dns = [
"46.227.67.134" "46.227.67.134"
"192.165.9.158" "192.165.9.158"
# "2a07:a880:4601:10f0:cd45::1"
# "2001:67c:750:1:cafe:cd45::1"
]; ];
}; };
sops.secrets."wg/ovpnd_${name}_privkey" = { sops.secrets."ovpn_privkey" = lib.mkIf (addrV4 != null) {
# needs to be readable by systemd-network or else it says "Ignoring network device" and doesn't expose it to networkctl. # needs to be readable by systemd-network or else it says "Ignoring network device" and doesn't expose it to networkctl.
owner = "systemd-network"; owner = "systemd-network";
}; };
}; };
in lib.mkMerge [ in {
(def-ovpn "us" { options = with lib; {
endpoint = "vpn31.prd.losangeles.ovpn.com:9929"; sane.ovpn.addrV4 = mkOption {
publicKey = "VW6bEWMOlOneta1bf6YFE25N/oMGh1E1UFBCfyggd0k="; type = types.nullOr types.str;
id = 1; default = null;
addrV4 = "172.27.237.218"; description = ''
# addrV6 = "fd00:0000:1337:cafe:1111:1111:ab00:4c8f"; ovpn issues one IP address per device.
}) set `null` to disable OVPN for this host.
# TODO: us-atl disabled until i can give it a different link-local address and wireguard key than us-mi '';
# (def-ovpn "us-atl" { };
# endpoint = "vpn18.prd.atlanta.ovpn.com:9929"; };
# publicKey = "Dpg/4v5s9u0YbrXukfrMpkA+XQqKIFpf8ZFgyw0IkE0=";
# address = [ config = lib.mkMerge [
# "172.21.182.178/32" (def-ovpn "us" {
# "fd00:0000:1337:cafe:1111:1111:cfcb:27e3/128" endpoint = "vpn31.prd.losangeles.ovpn.com:9929";
# ]; publicKey = "VW6bEWMOlOneta1bf6YFE25N/oMGh1E1UFBCfyggd0k=";
# }) id = 1;
(def-ovpn "us-mi" { })
endpoint = "vpn34.prd.miami.ovpn.com:9929"; (def-ovpn "us-mi" {
publicKey = "VtJz2irbu8mdkIQvzlsYhU+k9d55or9mx4A2a14t0V0="; endpoint = "vpn34.prd.miami.ovpn.com:9929";
id = 2; publicKey = "VtJz2irbu8mdkIQvzlsYhU+k9d55or9mx4A2a14t0V0=";
addrV4 = "172.21.182.178"; id = 2;
# addrV6 = "fd00:0000:1337:cafe:1111:1111:cfcb:27e3"; })
}) (def-ovpn "ukr" {
(def-ovpn "ukr" { endpoint = "vpn96.prd.kyiv.ovpn.com:9929";
endpoint = "vpn96.prd.kyiv.ovpn.com:9929"; publicKey = "CjZcXDxaaKpW8b5As1EcNbI6+42A6BjWahwXDCwfVFg=";
publicKey = "CjZcXDxaaKpW8b5As1EcNbI6+42A6BjWahwXDCwfVFg="; id = 3;
id = 3; })
addrV4 = "172.18.180.159"; # TODO: us-atl disabled until i need it again, i guess.
# addrV6 = "fd00:0000:1337:cafe:1111:1111:ec5c:add3"; # (def-ovpn "us-atl" {
}) # endpoint = "vpn18.prd.atlanta.ovpn.com:9929";
] # publicKey = "Dpg/4v5s9u0YbrXukfrMpkA+XQqKIFpf8ZFgyw0IkE0=";
# id = 4;
# })
];
}

View File

@@ -59,14 +59,18 @@
# note the import starts at repo root: this allows `./overlay/default.nix` to access the stuff at the root # note the import starts at repo root: this allows `./overlay/default.nix` to access the stuff at the root
# "nixpkgs-overlays=${../../..}/hosts/common/nix-path/overlay" # "nixpkgs-overlays=${../../..}/hosts/common/nix-path/overlay"
# as long as my system itself doesn't rely on NIXPKGS at runtime, we can point the overlays to git # as long as my system itself doesn't rely on NIXPKGS at runtime, we can point the overlays to git
# to avoid switching so much during development # to avoid `switch`ing so much during development.
"nixpkgs-overlays=/home/colin/dev/nixos/hosts/common/nix/overlay" # TODO: it would be nice to remove this someday!
# it's an impurity that touches way more than i need and tends to cause hard-to-debug eval issues
# when it goes wrong. should i port my `nix-shell` scripts to something more tailored to my uses
# and then delete `nixpkgs-overlays`?
"nixpkgs-overlays=/home/colin/dev/nixos/integrations/nixpkgs/nixpkgs-overlays.nix"
]; ];
# ensure new deployments have a source of this repo with which they can bootstrap. # 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`. # this however changes on every commit and can be slow to copy for e.g. `moby`.
environment.etc."nixos" = lib.mkIf (config.sane.maxBuildCost >= 3) { environment.etc."nixos" = lib.mkIf (config.sane.maxBuildCost >= 3) {
source = ../../..; source = pkgs.sane-nix-files;
}; };
environment.etc."nix/registry.json" = lib.mkIf (config.sane.maxBuildCost < 3) { environment.etc."nix/registry.json" = lib.mkIf (config.sane.maxBuildCost < 3) {
enable = false; enable = false;

View File

@@ -1,4 +0,0 @@
# XXX: NIX_PATH=...:nixpkgs-overlays=... will import every overlay in the directory
# so we prefer to give it a directory with just this *one* overlay, otherwise it imports conflicting overlays
# and gets stuck in a loop until it OOMs
import ../../../../overlays/all.nix

View File

@@ -1,17 +0,0 @@
{ ... }:
{
# store /home/colin/a/b in /mnt/persist/private/a/b instead of /mnt/persist/private/home/colin/a/b
sane.persist.stores.private.prefix = "/home/colin";
sane.persist.sys.byStore.initrd = [
"/var/log"
];
sane.persist.sys.byStore.plaintext = [
# TODO: these should be private.. somehow
"/var/backup" # for e.g. postgres dumps
];
sane.persist.sys.byStore.cryptClearOnBoot = [
"/var/lib/systemd/coredump"
];
}

View File

@@ -1,88 +1,223 @@
# strictly *decrease* the scope of the default nixos installation/config # strictly *decrease* the scope of the default nixos installation/config
{ lib, ... }: { config, lib, pkgs, ... }:
let
suidlessPam = pkgs.pam.overrideAttrs (upstream: {
# nixpkgs' pam hardcodes unix_chkpwd path to the /run/wrappers one,
# but i don't want the wrapper, so undo that.
# ideally i would patch this via an overlay, but pam is in the bootstrap so that forces a full rebuild.
postPatch = (if upstream.postPatch != null then upstream.postPatch else "") + ''
substituteInPlace modules/pam_unix/Makefile.am --replace-fail \
"/run/wrappers/bin/unix_chkpwd" "$out/bin/unix_chkpwd"
'';
});
in
{ {
# disable non-required packages like nano, perl, rsync, strace # remove a few items from /run/wrappers we don't need.
environment.defaultPackages = []; options.security.wrappers = lib.mkOption {
apply = lib.filterAttrs (name: _: !(builtins.elem name [
# from <repo:nixos/nixpkgs:nixos/modules/security/polkit.nix>
"pkexec"
"polkit-agent-helper-1" #< used by systemd; without this you'll have to `sudo systemctl daemon-reload` instead of unauth'd `systemctl daemon-reload`
# from <repo:nixos/nixpkgs:nixos/modules/services/system/dbus.nix>
"dbus-daemon-launch-helper"
# from <repo:nixos/nixpkgs:nixos/modules/security/wrappers/default.nix>
"fusermount" #< only needed if you want to mount entries declared in /etc/fstab or mtab as unprivileged user
"fusermount3"
"mount" #< only needed if you want to mount entries declared in /etc/fstab or mtab as unprivileged user
"umount"
# from <repo:nixos/nixpkgs:nixos/modules/programs/shadow.nix>
"newgidmap"
"newgrp"
"newuidmap"
"sg"
"su"
# from: <repo:nixos/nixpkgs:nixos/modules/security/pam.nix>
# requires associated `pam` patch to not hardcode unix_chkpwd path
"unix_chkpwd"
]));
};
options.security.pam.services = lib.mkOption {
apply = lib.filterAttrs (name: _: !(builtins.elem name [
# from <repo:nixos/nixpkgs:nixos/modules/security/pam.nix>
"i3lock"
"i3lock-color"
"vlock"
"xlock"
"xscreensaver"
"runuser"
"runuser-l"
# from ??
"chfn"
"chpasswd"
"chsh"
"groupadd"
"groupdel"
"groupmems"
"groupmod"
"useradd"
"userdel"
"usermod"
# from <repo:nixos/nixpkgs:nixos/modules/system/boot/systemd/user.nix>
"systemd-user" #< N.B.: this causes the `systemd --user` service manager to not be started!
]));
};
# remove all the non-existent default directories from XDG_DATA_DIRS, XDG_CONFIG_DIRS to simplify debugging. options.environment.systemPackages = lib.mkOption {
# this is defaulted in <repo:nixos/nixpkgs:nixos/modules/programs/environment.nix>, # see: <repo:nixos/nixpkgs:nixos/modules/config/system-path.nix>
# without being gated by any higher config. # it's 31 "requiredPackages", with no explanation of why they're "required"...
environment.profiles = lib.mkForce [ # most of these can be safely removed without breaking the *boot*,
"/etc/profiles/per-user/$USER" # but some core system services DO implicitly depend on them.
"/run/current-system/sw" # TODO: see which more of these i can remove (or shadow/sandbox)
]; apply = let
requiredPackages = builtins.map (pkg: lib.setPrio ((pkg.meta.priority or 5) + 3) pkg) [
# pkgs.acl
# pkgs.attr
# pkgs.bashInteractive
# pkgs.bzip2
# pkgs.coreutils-full
# pkgs.cpio
# pkgs.curl
# pkgs.diffutils
# pkgs.findutils
# pkgs.gawk
# pkgs.stdenv.cc.libc
# pkgs.getent
# pkgs.getconf
# pkgs.gnugrep
# pkgs.gnupatch
# pkgs.gnused
# pkgs.gnutar
# pkgs.gzip
# pkgs.xz
pkgs.less
# pkgs.libcap #< implicitly required by NetworkManager/wpa_supplicant!
# pkgs.ncurses
pkgs.netcat
# config.programs.ssh.package
# pkgs.mkpasswd
pkgs.procps
# pkgs.su
# pkgs.time
# pkgs.util-linux
# pkgs.which
# pkgs.zstd
];
conveniencePackages = [
config.boot.kernelPackages.cpupower # <repo:nixos/nixpkgs:nixos/modules/tasks/cpu-freq.nix> places it on PATH for convenience if powerManagement.cpuFreqGovernor is set
pkgs.kbd # <repo:nixos/nixpkgs:nixos/modules/config/console.nix> places it on PATH as part of console/virtual TTYs, but probably not needed unless you want to set console fonts
];
in lib.filter (p: ! builtins.elem p (requiredPackages ++ conveniencePackages));
};
# NIXPKGS_CONFIG defaults to "/etc/nix/nixpkgs-config.nix" in <nixos/modules/programs/environment.nix>. options.system.fsPackages = lib.mkOption {
# that's never existed on my system and everything does fine without it set empty (no nixpkgs API to forcibly *unset* it). # <repo:nixos/nixpkgs:nixos/modules/tasks/filesystems/vfat.nix> adds `mtools` and `dosfstools`
environment.variables.NIXPKGS_CONFIG = lib.mkForce ""; # dosfstools actually makes its way into the initrd (`fsck.vfat`).
# XDG_CONFIG_DIRS defaults to "/etc/xdg", which doesn't exist. # mtools is like "MS-DOS for Linux", ancient functionality i'll never use.
# in practice, pam appends the values i want to XDG_CONFIG_DIRS, though this approach causes an extra leading `:` apply = lib.filter (p: p != pkgs.mtools);
environment.sessionVariables.XDG_CONFIG_DIRS = lib.mkForce []; };
# XCURSOR_PATH: defaults to `[ "$HOME/.icons" "$HOME/.local/share/icons" ]`, neither of which i use, just adding noise.
# see: <repo:nixos/nixpkgs:nixos/modules/config/xdg/icons.nix>
environment.sessionVariables.XCURSOR_PATH = lib.mkForce [];
# disable nixos' portal module, otherwise /share/applications gets linked into the system and complicates things (sandboxing). config = {
# instead, i manage portals myself via the sane.programs API (e.g. sane.programs.xdg-desktop-portal). # disable non-required packages like nano, perl, rsync, strace
xdg.portal.enable = false; environment.defaultPackages = [];
xdg.menus.enable = false; #< links /share/applications, and a bunch of other empty (i.e. unused) dirs
# xdg.autostart.enable defaults to true, and links /etc/xdg/autostart into the environment, populated with .desktop files. # remove all the non-existent default directories from XDG_DATA_DIRS, XDG_CONFIG_DIRS to simplify debugging.
# see: <repo:nixos/nixpkgs:nixos/modules/config/xdg/autostart.nix> # this is defaulted in <repo:nixos/nixpkgs:nixos/modules/programs/environment.nix>,
# .desktop files are a questionable way to autostart things: i generally prefer a service manager for that. # without being gated by any higher config.
xdg.autostart.enable = false; environment.profiles = lib.mkForce [
"/etc/profiles/per-user/$USER"
"/run/current-system/sw"
];
# nix.channel.enable: populates `/nix/var/nix/profiles/per-user/root/channels`, `/root/.nix-channels`, `$HOME/.nix-defexpr/channels` # NIXPKGS_CONFIG defaults to "/etc/nix/nixpkgs-config.nix" in <nixos/modules/programs/environment.nix>.
# <repo:nixos/nixpkgs:nixos/modules/config/nix-channel.nix> # that's never existed on my system and everything does fine without it set empty (no nixpkgs API to forcibly *unset* it).
# TODO: may want to recreate NIX_PATH, nix.settings.nix-path environment.variables.NIXPKGS_CONFIG = lib.mkForce "";
nix.channel.enable = false; # XDG_CONFIG_DIRS defaults to "/etc/xdg", which doesn't exist.
# in practice, pam appends the values i want to XDG_CONFIG_DIRS, though this approach causes an extra leading `:`
environment.sessionVariables.XDG_CONFIG_DIRS = lib.mkForce [];
# XCURSOR_PATH: defaults to `[ "$HOME/.icons" "$HOME/.local/share/icons" ]`, neither of which i use, just adding noise.
# see: <repo:nixos/nixpkgs:nixos/modules/config/xdg/icons.nix>
environment.sessionVariables.XCURSOR_PATH = lib.mkForce [];
# environment.stub-ld: populate /lib/ld-linux.so with an object that unconditionally errors on launch, # disable nixos' portal module, otherwise /share/applications gets linked into the system and complicates things (sandboxing).
# so as to inform when trying to run a non-nixos binary? # instead, i manage portals myself via the sane.programs API (e.g. sane.programs.xdg-desktop-portal).
# IMO that's confusing: i thought /lib/ld-linux.so was some file actually required by nix. xdg.portal.enable = false;
environment.stub-ld.enable = false; xdg.menus.enable = false; #< links /share/applications, and a bunch of other empty (i.e. unused) dirs
# `less.enable` sets LESSKEYIN_SYSTEM, LESSOPEN, LESSCLOSE env vars, which does confusing "lesspipe" things, so disable that. # xdg.autostart.enable defaults to true, and links /etc/xdg/autostart into the environment, populated with .desktop files.
# it's enabled by default from `<nixos/modules/programs/environment.nix>`, who also sets `PAGER="less"` and `EDITOR="nano"` (keep). # see: <repo:nixos/nixpkgs:nixos/modules/config/xdg/autostart.nix>
programs.less.enable = lib.mkForce false; # .desktop files are a questionable way to autostart things: i generally prefer a service manager for that.
environment.variables.PAGER = lib.mkOverride 900 ""; # mkDefault sets 1000. non-override is 100. 900 will beat the nixpkgs `mkDefault` but not anyone else. xdg.autostart.enable = false;
environment.variables.EDITOR = lib.mkOverride 900 "";
# several packages (dconf, modemmanager, networkmanager, gvfs, polkit, udisks, bluez/blueman, feedbackd, etc) # nix.channel.enable: populates `/nix/var/nix/profiles/per-user/root/channels`, `/root/.nix-channels`, `$HOME/.nix-defexpr/channels`
# will add themselves to the dbus search path. # <repo:nixos/nixpkgs:nixos/modules/config/nix-channel.nix>
# i prefer dbus to only search XDG paths (/share/dbus-1) for service files, as that's more introspectable. # TODO: may want to recreate NIX_PATH, nix.settings.nix-path
# see: <repo:nixos/nixpkgs:nixos/modules/services/system/dbus.nix> nix.channel.enable = false;
# TODO: sandbox dbus? i pretty explicitly don't want to use it as a launcher.
services.dbus.packages = lib.mkForce [
"/run/current-system/sw"
# config.system.path
# pkgs.dbus
# pkgs.polkit.out
# pkgs.modemmanager
# pkgs.networkmanager
# pkgs.udisks
# pkgs.wpa_supplicant
];
# systemd by default forces shitty defaults for e.g. /tmp/.X11-unix. # environment.stub-ld: populate /lib/ld-linux.so with an object that unconditionally errors on launch,
# nixos propagates those in: <nixos/modules/system/boot/systemd/tmpfiles.nix> # so as to inform when trying to run a non-nixos binary?
# by overwriting this with an empty file, we can effectively remove it. # IMO that's confusing: i thought /lib/ld-linux.so was some file actually required by nix.
environment.etc."tmpfiles.d/x11.conf".text = "# (removed by Colin)"; environment.stub-ld.enable = false;
# see: <nixos/modules/tasks/swraid.nix> # `less.enable` sets LESSKEYIN_SYSTEM, LESSOPEN, LESSCLOSE env vars, which does confusing "lesspipe" things, so disable that.
# it was enabled by default before 23.11 # it's enabled by default from `<nixos/modules/programs/environment.nix>`, who also sets `PAGER="less"` and `EDITOR="nano"` (keep).
boot.swraid.enable = lib.mkDefault false; programs.less.enable = lib.mkForce false;
environment.variables.PAGER = lib.mkOverride 900 ""; # mkDefault sets 1000. non-override is 100. 900 will beat the nixpkgs `mkDefault` but not anyone else.
environment.variables.EDITOR = lib.mkOverride 900 "";
# see: <nixos/modules/system/boot/kernel.nix> # several packages (dconf, modemmanager, networkmanager, gvfs, polkit, udisks, bluez/blueman, feedbackd, etc)
# by default, it adds to boot.initrd.availableKernelModules: # will add themselves to the dbus search path.
# - SATA: "ahci" "sata_nv" "sata_via" "sata_sis" "sata_uli" "ata_piix" "pata_marvell" # i prefer dbus to only search XDG paths (/share/dbus-1) for service files, as that's more introspectable.
# - "nvme" # see: <repo:nixos/nixpkgs:nixos/modules/services/system/dbus.nix>
# - scsi: "sd_mod" "sr_mod" # TODO: sandbox dbus? i pretty explicitly don't want to use it as a launcher.
# - SD/eMMC: "mmc_block" services.dbus.packages = lib.mkForce [
# - USB keyboards: "uhci_hcd" "ehci_hcd" "ehci_pci" "ohci_hcd" "ohci_pci" "xhci_hcd" "xhci_pci" "usbhid" "hid_generic" "hid_lenovo" "hid_apple" "hid_roccat" "hid_logitech_hidpp" "hid_logitech_dj" "hid_microsoft" "hid_cherry" "hid_corsair" "/run/current-system/sw"
# - LVM: "dm_mod" # config.system.path
# - on x86 only: more keyboard stuff: "pcips2" "atkbd" "i8042" # pkgs.dbus
# pkgs.polkit.out
# pkgs.modemmanager
# pkgs.networkmanager
# pkgs.udisks
# pkgs.wpa_supplicant
];
boot.initrd.includeDefaultModules = lib.mkDefault false; # systemd by default forces shitty defaults for e.g. /tmp/.X11-unix.
# nixos propagates those in: <nixos/modules/system/boot/systemd/tmpfiles.nix>
# by overwriting this with an empty file, we can effectively remove it.
environment.etc."tmpfiles.d/x11.conf".text = "# (removed by Colin)";
# see: <nixos/modules/tasks/swraid.nix>
# it was enabled by default before 23.11
boot.swraid.enable = lib.mkDefault false;
# see: <nixos/modules/tasks/bcache.nix>
# these allow you to use the Linux block cache (cool! doesn't need to be a default though)
boot.bcache.enable = lib.mkDefault false;
# see: <nixos/modules/system/boot/kernel.nix>
# by default, it adds to boot.initrd.availableKernelModules:
# - SATA: "ahci" "sata_nv" "sata_via" "sata_sis" "sata_uli" "ata_piix" "pata_marvell"
# - "nvme"
# - scsi: "sd_mod" "sr_mod"
# - SD/eMMC: "mmc_block"
# - USB keyboards: "uhci_hcd" "ehci_hcd" "ehci_pci" "ohci_hcd" "ohci_pci" "xhci_hcd" "xhci_pci" "usbhid" "hid_generic" "hid_lenovo" "hid_apple" "hid_roccat" "hid_logitech_hidpp" "hid_logitech_dj" "hid_microsoft" "hid_cherry" "hid_corsair"
# - LVM: "dm_mod"
# - on x86 only: more keyboard stuff: "pcips2" "atkbd" "i8042"
boot.initrd.includeDefaultModules = lib.mkDefault false;
# see: <repo:nixos/nixpkgs:nixos/modules/virtualisation/nixos-containers.nix>
boot.enableContainers = lib.mkDefault false;
# see: <repo:nixos/nixpkgs:nixos/modules/tasks/lvm.nix>
# lvm places `pkgs.lvm2` onto PATH, which has like 100 binaries.
# it is, actually, needed for some userspace tools (cryptsetup). probably just the udev rules. try to reduce this set?
services.lvm.enable = lib.mkDefault false;
services.udev.packages = [ pkgs.lvm2.out ]; #< N.B. `lvm2.out` != `lvm2`
# systemd.packages = [ pkgs.lvm2 ];
# systemd.tmpfiles.packages = [ pkgs.lvm2.out ];
# environment.systemPackages = [ pkgs.lvm2 ];
security.pam.package = suidlessPam;
};
} }

View File

@@ -15,39 +15,33 @@ in
}; };
# upstream alsa ships with PinePhone audio configs, but they don't actually produce sound. # upstream alsa ships with PinePhone audio configs, but they don't actually produce sound.
# see: <https://github.com/alsa-project/alsa-ucm-conf/pull/134> # - still true as of 2024-05-26
# these audio files come from some revision of: # - see: <https://github.com/alsa-project/alsa-ucm-conf/pull/134>
# - <https://gitlab.manjaro.org/manjaro-arm/packages/community/phosh/alsa-ucm-pinephone>
# #
# alternative to patching is to plumb `ALSA_CONFIG_UCM2 = "${./ucm2}"` environment variable into the relevant places # we can substitute working UCM conf in two ways:
# e.g. `systemd.services.pulseaudio.environment`. # 1. nixpkgs' override for the `alsa-ucm-conf` package
# that leaves more opportunity for gaps (i.e. missing a service), # - that forces a rebuild of ~500 packages (including webkitgtk).
# on the other hand this method causes about 500 packages to be rebuilt (including qt5 and webkitgtk). # 2. set ALSA_CONFIG_UCM2 = /path/to/ucm2 in the relevant places
# - e.g. pulsewire service.
# - easy to miss places, though.
# #
# note that with these files, the following audio device support: # alsa-ucm-pinephone-manjaro (2024-05-26):
# - headphones work. # - headphones work
# - "internal earpiece" works. # - "internal earpiece" works
# - "internal speaker" doesn't work (but that's probably because i broke the ribbon cable) # - "internal speaker" is silent (maybe hardware issue)
# - "analog output" doesn't work. # - 3.5mm connection is flapping when playing to my car, which eventually breaks audio and requires restarting wireplumber
packageUnwrapped = pkgs.alsa-ucm-conf.overrideAttrs (upstream: { # packageUnwrapped = pkgs.alsa-ucm-pinephone-manjaro.override {
postPatch = (upstream.postPatch or "") + '' # inherit (cfg.config) preferEarpiece;
cp ${./ucm2/PinePhone}/* ucm2/Allwinner/A64/PinePhone/ # };
# alsa-ucm-pinephone-pmos (2024-05-26):
# - headphones work
# - "internal earpiece" works
# - "internal speaker" is silent (maybe hardware issue)
packageUnwrapped = pkgs.alsa-ucm-pinephone-pmos.override {
inherit (cfg.config) preferEarpiece;
};
# fix the self-contained ucm files i source from to have correct path within the alsa-ucm-conf source tree sandbox.enable = false; #< only provides $out/share/alsa
substituteInPlace ucm2/Allwinner/A64/PinePhone/PinePhone.conf \
--replace-fail 'HiFi.conf' '/Allwinner/A64/PinePhone/HiFi.conf'
substituteInPlace ucm2/Allwinner/A64/PinePhone/PinePhone.conf \
--replace-fail 'VoiceCall.conf' '/Allwinner/A64/PinePhone/VoiceCall.conf'
'' + lib.optionalString cfg.config.preferEarpiece ''
# decrease the priority of the internal speaker so that sounds are routed
# to the earpiece by default.
# this is just personal preference.
substituteInPlace ucm2/Allwinner/A64/PinePhone/{HiFi.conf,VoiceCall.conf} \
--replace-fail 'PlaybackPriority 300' 'PlaybackPriority 100'
'';
});
sandbox.enable = false; #< only provides #out/share/alsa
# alsa-lib package only looks in its $out/share/alsa to find runtime config data, by default. # alsa-lib package only looks in its $out/share/alsa to find runtime config data, by default.
# but ALSA_CONFIG_UCM2 is an env var that can override that. # but ALSA_CONFIG_UCM2 is an env var that can override that.

View File

@@ -34,26 +34,33 @@ in
]; ];
sysadminUtils = declPackageSet [ sysadminUtils = declPackageSet [
"ausyscall"
"bridge-utils" # for brctl; debug linux "bridge" inet devices "bridge-utils" # for brctl; debug linux "bridge" inet devices
"btrfs-progs" "btrfs-progs"
"cacert.unbundled" # some services require unbundled /etc/ssl/certs "cacert.unbundled" # some services require unbundled /etc/ssl/certs
"captree"
"cryptsetup" "cryptsetup"
"curl"
"ddrescue" "ddrescue"
"dig" "dig"
"dtc" # device tree [de]compiler "dtc" # device tree [de]compiler
"e2fsprogs" # resize2fs "e2fsprogs" # resize2fs
"efibootmgr" "efibootmgr"
"errno"
"ethtool" "ethtool"
"evtest"
"fatresize" "fatresize"
"fd" "fd"
"file" "file"
"forkstat" # monitor every spawned/forked process "forkstat" # monitor every spawned/forked process
"free"
# "fwupd" # "fwupd"
"gawk" "gawk"
"gdb" # to debug segfaults "gdb" # to debug segfaults
"git" "git"
"gptfdisk" # gdisk "gptfdisk" # gdisk
"hdparm" "hdparm"
"hping"
"htop" "htop"
"iftop" "iftop"
"inetutils" # for telnet "inetutils" # for telnet
@@ -64,22 +71,26 @@ in
"killall" "killall"
"less" "less"
"lftp" "lftp"
# "libcap_ng" # for `netcap` "libcap_ng" # for `netcap`, `pscap`, `captest`
"lsof" "lsof"
"man-pages" "man-pages"
"man-pages-posix" "man-pages-posix"
# "miniupnpc" # "miniupnpc"
"mmcli"
"nano" "nano"
# "ncdu" # ncurses disk usage. doesn't cross compile (zig) # "ncdu" # ncurses disk usage. doesn't cross compile (zig)
"neovim" "neovim"
"netcat" "netcat"
"nethogs" "nethogs"
"nix"
"nmap" "nmap"
"nmcli"
"nvme-cli" # nvme "nvme-cli" # nvme
# "openssl" # "openssl"
"parted" "parted"
"pciutils" "pciutils"
"powertop" "powertop"
"ps"
"pstree" "pstree"
"ripgrep" "ripgrep"
"s6-rc" # service manager "s6-rc" # service manager
@@ -93,15 +104,13 @@ in
"usbutils" # lsusb "usbutils" # lsusb
"util-linux" # lsblk, lscpu, etc "util-linux" # lsblk, lscpu, etc
"valgrind" "valgrind"
"watch"
"wget" "wget"
"wirelesstools" # iwlist "wirelesstools" # iwlist
# "xq" # jq for XML # "xq" # jq for XML
# "zfs" # doesn't cross-compile (requires samba) # "zfs" # doesn't cross-compile (requires samba)
]; ];
sysadminExtraUtils = declPackageSet [ sysadminExtraUtils = declPackageSet [
"backblaze-b2"
"duplicity"
"sane-scripts.backup"
"sqlite" # to debug sqlite3 databases "sqlite" # to debug sqlite3 databases
]; ];
@@ -117,6 +126,7 @@ in
# "dmidecode" # "dmidecode"
"dtrx" # `unar` alternative, "Do The Right eXtraction" "dtrx" # `unar` alternative, "Do The Right eXtraction"
# "efivar" # "efivar"
"exiftool"
"eza" # a better 'ls' "eza" # a better 'ls'
# "flashrom" # "flashrom"
"git" # needed as a user package, for config. "git" # needed as a user package, for config.
@@ -144,11 +154,16 @@ in
# "ponymix" # "ponymix"
"pulsemixer" "pulsemixer"
"python3-repl" "python3-repl"
# "python3Packages.eyeD3" # music tagging # "python3.pkgs.eyeD3" # music tagging
"ripgrep" # needed as a user package so that its user-level config file can be installed "ripgrep" # needed as a user package so that its user-level config file can be installed
"rsync" "rsync"
# "rsyslog" # KEEP THIS HERE if you want persistent logging (TODO: port to systemd, store in /var/log/...)
"sane-deadlines"
"sane-scripts.bittorrent" "sane-scripts.bittorrent"
"sane-scripts.cli" "sane-scripts.cli"
"sane-secrets-unlock"
"sane-sysload"
"sc-im"
# "snapper" # "snapper"
"sops" # for manually viewing secrets; outside `sane-secrets` (TODO: improve sane-secrets!) "sops" # for manually viewing secrets; outside `sane-secrets` (TODO: improve sane-secrets!)
"speedtest-cli" "speedtest-cli"
@@ -165,12 +180,15 @@ in
]; ];
pcConsoleUtils = declPackageSet [ pcConsoleUtils = declPackageSet [
"errno" # 2024/05/18: doesn't cross compile (perl File-ShareDir / Module-Build-Tiny)
# "gh" # MS GitHub cli # "gh" # MS GitHub cli
"nix-index" "nix-index"
"nixpkgs-review" "nixpkgs-review"
"qmk-udev-rules"
"sane-scripts.dev" "sane-scripts.dev"
"sequoia" "sequoia"
# "via"
"wally-cli"
# "zsa-udev-rules"
]; ];
consoleMediaUtils = declPackageSet [ consoleMediaUtils = declPackageSet [
@@ -210,6 +228,179 @@ in
# "tree-sitter" # "tree-sitter"
]; ];
gameApps = declPackageSet [
"animatch"
"gnome-2048"
"gnome.hitori" # like sudoku
];
pcGameApps = declPackageSet [
# "andyetitmoves" # TODO: fix build!
# "armagetronad" # tron/lightcycles; WAN and LAN multiplayer
"celeste64"
# "cutemaze" # meh: trivial maze game; qt6 and keyboard-only
# "cuyo" # trivial puyo-puyo clone
"endless-sky" # space merchantilism/exploration
# "factorio"
"frozen-bubble" # WAN + LAN + 1P/2P bubble bobble
"hase" # WAN worms game
# "hedgewars" # WAN + LAN worms game (5~10 people online at any moment; <https://hedgewars.org>)
# "libremines" # meh: trivial minesweeper; qt6
# "mario0" # SMB + portal
# "mindustry"
# "minesweep-rs" # CLI minesweeper
# "nethack"
# "osu-lazer"
# "pinball" # 3d pinball; kb/mouse. old sourceforge project
# "powermanga" # STYLISH space invaders derivative (keyboard-only)
"shattered-pixel-dungeon" # doesn't cross compile
"space-cadet-pinball" # LMB/RMB controls (bindable though. volume buttons?)
"steam"
"superTux" # keyboard-only controls
"superTuxKart" # poor FPS on pinephone
"tumiki-fighters" # keyboard-only
"vvvvvv" # keyboard-only controls
# "wine"
];
guiApps = declPackageSet [
# package sets
"gameApps"
"guiBaseApps"
];
guiBaseApps = declPackageSet [
# "abaddon" # discord client
"alacritty" # terminal emulator
"calls" # gnome calls (dialer/handler)
"dbus"
"dconf" # required by many packages, but not well-documented :(
# "delfin" # Jellyfin client
"dialect" # language translation
"dino" # XMPP client
"dissent" # Discord client (formerly known as: gtkcord4)
# "emote"
# "evince" # PDF viewer
# "flare-signal" # gtk4 signal client
"fractal" # matrix client
"g4music" # local music player
# "gnome.cheese"
# "gnome-feeds" # RSS reader (with claimed mobile support)
# "gnome.file-roller"
"geary" # adaptive e-mail client; uses webkitgtk 4.1
"gnome-calculator"
"gnome-calendar"
"gnome.gnome-clocks"
"gnome.gnome-maps"
# "gnome-podcasts"
# "gnome.gnome-system-monitor"
# "gnome.gnome-terminal" # works on phosh
"gnome.gnome-weather"
# "seahorse" # keyring/secret manager
"gnome-frog" # OCR/QR decoder
"gpodder"
# "gst-device-monitor" # for debugging audio/video
# "gthumb"
# "lemoa" # lemmy app
# "libcamera" # for `cam` binary (useful for debugging cameras)
"libnotify" # for notify-send; debugging
# "lollypop"
"loupe" # image viewer
"mate.engrampa" # archive manager
"mepo" # maps viewer
# "mesa-demos" # for eglinfo, glxinfo & other testing tools
"mpv"
"networkmanagerapplet" # for nm-connection-editor: it's better than not having any gui!
"ntfy-sh" # notification service
"newsflash" # RSS viewer
"pavucontrol"
"pwvucontrol" # pipewire version of pavu
# "picard" # music tagging
# "libsForQt5.plasmatube" # Youtube player
"signal-desktop"
# "snapshot" # camera app
# "spot" # Gnome Spotify client
# "sublime-music"
# "tdesktop" # broken on phosh
# "tokodon"
"tuba" # mastodon/pleroma client (stores pw in keyring)
"vulkan-tools" # vulkaninfo
# "whalebird" # pleroma client (Electron). input is broken on phosh.
"xdg-terminal-exec"
"youtube-tui"
"zathura" # PDF/CBZ/ePUB viewer
];
handheldGuiApps = declPackageSet [
# "celluloid" # mpv frontend
# "chatty" # matrix/xmpp/irc client (2023/12/29: disabled because broken cross build)
# "cozy" # audiobook player
"epiphany" # gnome's web browser
"foliate" # e-book reader
# "iotas" # note taking app
"komikku"
"koreader"
"lgtrombetta-compass"
"megapixels" # camera app
"notejot" # note taking, e.g. shopping list
"planify" # todo-tracker/planner
"portfolio-filemanager"
"tangram" # web browser
"wike" # Wikipedia Reader
"xarchiver" # archiver, backup option for when engrampa UI overflows screen and is unusale (xarchiver UI fails in different ways)
];
pcGuiApps = declPackageSet [
# package sets
"pcGameApps"
"pcTuiApps"
####
"audacity"
# "blanket" # ambient noise generator
"brave" # for the integrated wallet -- as a backup
# "cantata" # music player (mpd frontend)
# "chromium" # chromium takes hours to build. brave is chromium-based, distributed in binary form, so prefer it.
# "cups"
"discord" # x86-only
# "electrum"
"element-desktop"
"firefox"
"font-manager"
# "gajim" # XMPP client. cross build tries to import host gobject-introspection types (2023/09/01)
"gimp" # broken on phosh
# "gnome.dconf-editor"
# "gnome.file-roller"
"gnome-disk-utility"
"nautilus" # file browser
# "gnome.totem" # video player, supposedly supports UPnP
# "handbrake" #< TODO: fix build
"inkscape"
# "jellyfin-media-player"
"kdenlive"
# "keymapp"
# "kid3" # audio tagging
"krita"
"libreoffice" # TODO: replace with an office suite that uses saner packaging?
"losslesscut-bin" # x86-only
# "makemkv" # x86-only
# "monero-gui" # x86-only
# "mumble"
# "nheko" # Matrix chat client
"nicotine-plus" # soulseek client
# "obsidian"
# "openscad" # 3d modeling
# "rhythmbox" # local music player
# "slic3r"
"soundconverter"
# "spotify" # x86-only
"tor-browser" # x86-only
# "vlc"
"wireshark" # could maybe ship the cli as sysadmin pkg
# "xterm" # requires Xwayland
# "zecwallet-lite" # x86-only
# "zulip"
];
# INDIVIDUAL PACKAGE DEFINITIONS # INDIVIDUAL PACKAGE DEFINITIONS
@@ -237,23 +428,20 @@ in
bridge-utils.sandbox.method = "bwrap"; #< bwrap, landlock: both work bridge-utils.sandbox.method = "bwrap"; #< bwrap, landlock: both work
bridge-utils.sandbox.net = "all"; bridge-utils.sandbox.net = "all";
brightnessctl.sandbox.method = "landlock"; # also bwrap, but landlock is more responsive
brightnessctl.sandbox.extraPaths = [
"/sys/class/backlight"
"/sys/class/leds"
"/sys/devices"
];
brightnessctl.sandbox.whitelistDbus = [ "system" ];
btrfs-progs.sandbox.method = "bwrap"; #< bwrap, landlock: both work btrfs-progs.sandbox.method = "bwrap"; #< bwrap, landlock: both work
btrfs-progs.sandbox.autodetectCliPaths = "existing"; # e.g. `btrfs filesystem df /my/fs` btrfs-progs.sandbox.autodetectCliPaths = "existing"; # e.g. `btrfs filesystem df /my/fs`
"cacert.unbundled".sandbox.enable = false; "cacert.unbundled".sandbox.enable = false; #< data only
cargo.persist.byStore.plaintext = [ ".cargo" ]; cargo.persist.byStore.plaintext = [ ".cargo" ];
clang = {}; clang = {};
clightning-sane.sandbox.method = "bwrap";
clightning-sane.sandbox.extraPaths = [
"/var/lib/clightning/bitcoin/lightning-rpc"
];
# cryptsetup: typical use is `cryptsetup open /dev/loopxyz mappedName`, and creates `/dev/mapper/mappedName` # cryptsetup: typical use is `cryptsetup open /dev/loopxyz mappedName`, and creates `/dev/mapper/mappedName`
cryptsetup.sandbox.method = "landlock"; cryptsetup.sandbox.method = "landlock";
cryptsetup.sandbox.extraPaths = [ cryptsetup.sandbox.extraPaths = [
@@ -305,7 +493,7 @@ in
]; ];
dtc.sandbox.method = "bwrap"; dtc.sandbox.method = "bwrap";
dtc.sandbox.autodetectCliPaths = true; # TODO:sandbox: untested dtc.sandbox.autodetectCliPaths = "existingFile"; # TODO:sandbox: untested
duplicity = {}; duplicity = {};
@@ -323,7 +511,7 @@ in
electrum.sandbox.method = "bwrap"; # TODO:sandbox: untested electrum.sandbox.method = "bwrap"; # TODO:sandbox: untested
electrum.sandbox.net = "all"; # TODO: probably want to make this run behind a VPN, always electrum.sandbox.net = "all"; # TODO: probably want to make this run behind a VPN, always
electrum.sandbox.whitelistWayland = true; electrum.sandbox.whitelistWayland = true;
electrum.persist.byStore.cryptClearOnBoot = [ ".electrum" ]; #< TODO: use XDG dirs! electrum.persist.byStore.ephemeral = [ ".electrum" ]; #< TODO: use XDG dirs!
endless-sky.buildCost = 1; endless-sky.buildCost = 1;
endless-sky.persist.byStore.plaintext = [ ".local/share/endless-sky" ]; endless-sky.persist.byStore.plaintext = [ ".local/share/endless-sky" ];
@@ -340,11 +528,18 @@ in
ethtool.sandbox.method = "landlock"; ethtool.sandbox.method = "landlock";
ethtool.sandbox.capabilities = [ "net_admin" ]; ethtool.sandbox.capabilities = [ "net_admin" ];
evtest.sandbox.method = "bwrap";
evtest.sandbox.autodetectCliPaths = "existingFile"; # `evtest /dev/foo` to monitor events for a specific device
evtest.sandbox.extraPaths = [
"/dev/input"
];
# eza `ls` replacement # eza `ls` replacement
# landlock is OK, only `whitelistPwd` doesn't make the intermediate symlinks traversable, so it breaks on e.g. ~/Videos/servo/Shows/foo # bwrap causes `/proc` files to be listed differently (e.g. `eza /proc/sys/net/ipv6/conf/`)
# eza.sandbox.method = "landlock"; # bwrap loses group info (so files owned by other users appear as owner "nobody")
eza.sandbox.method = "bwrap"; eza.sandbox.method = "landlock";
eza.sandbox.autodetectCliPaths = true; # eza.sandbox.method = "bwrap";
eza.sandbox.autodetectCliPaths = "existing";
eza.sandbox.whitelistPwd = true; eza.sandbox.whitelistPwd = true;
eza.sandbox.extraHomePaths = [ eza.sandbox.extraHomePaths = [
# so that e.g. `eza -l ~` can show which symlink exist # so that e.g. `eza -l ~` can show which symlink exist
@@ -356,7 +551,7 @@ in
fatresize.sandbox.autodetectCliPaths = "parent"; # /dev/sda1 -> needs /dev/sda fatresize.sandbox.autodetectCliPaths = "parent"; # /dev/sda1 -> needs /dev/sda
fd.sandbox.method = "landlock"; fd.sandbox.method = "landlock";
fd.sandbox.autodetectCliPaths = true; fd.sandbox.autodetectCliPaths = "existing";
fd.sandbox.whitelistPwd = true; fd.sandbox.whitelistPwd = true;
fd.sandbox.extraHomePaths = [ fd.sandbox.extraHomePaths = [
# let it follow symlinks to non-sensitive data # let it follow symlinks to non-sensitive data
@@ -369,10 +564,10 @@ in
ffmpeg.sandbox.autodetectCliPaths = "existingFileOrParent"; # it outputs uncreated files -> parent dir needs mounting ffmpeg.sandbox.autodetectCliPaths = "existingFileOrParent"; # it outputs uncreated files -> parent dir needs mounting
file.sandbox.method = "bwrap"; file.sandbox.method = "bwrap";
file.sandbox.autodetectCliPaths = true; file.sandbox.autodetectCliPaths = "existing"; #< file OR directory, yes
findutils.sandbox.method = "bwrap"; findutils.sandbox.method = "bwrap";
findutils.sandbox.autodetectCliPaths = true; findutils.sandbox.autodetectCliPaths = "existing";
findutils.sandbox.whitelistPwd = true; findutils.sandbox.whitelistPwd = true;
findutils.sandbox.extraHomePaths = [ findutils.sandbox.extraHomePaths = [
# let it follow symlinks to non-sensitive data # let it follow symlinks to non-sensitive data
@@ -391,9 +586,7 @@ in
}); });
forkstat.sandbox.method = "landlock"; #< doesn't seem to support bwrap forkstat.sandbox.method = "landlock"; #< doesn't seem to support bwrap
forkstat.sandbox.extraConfig = [ forkstat.sandbox.isolatePids = false;
"--sanebox-keep-namespace" "pid"
];
forkstat.sandbox.extraPaths = [ forkstat.sandbox.extraPaths = [
"/proc" "/proc"
]; ];
@@ -407,11 +600,7 @@ in
gawk.sandbox.method = "bwrap"; # TODO:sandbox: untested gawk.sandbox.method = "bwrap"; # TODO:sandbox: untested
gawk.sandbox.wrapperType = "inplace"; # /share/gawk libraries refer to /libexec gawk.sandbox.wrapperType = "inplace"; # /share/gawk libraries refer to /libexec
gawk.sandbox.autodetectCliPaths = true; gawk.sandbox.autodetectCliPaths = "existingFile";
gdb.sandbox.enable = false; # gdb doesn't sandbox well. i don't know how you could.
# gdb.sandbox.method = "landlock"; # permission denied when trying to attach, even as root
gdb.sandbox.autodetectCliPaths = true;
geoclue2-with-demo-agent = {}; geoclue2-with-demo-agent = {};
@@ -439,32 +628,39 @@ in
"/tmp" # "Cannot open display:" if it can't mount /tmp 👀 "/tmp" # "Cannot open display:" if it can't mount /tmp 👀
]; ];
"gnome.gnome-calculator".buildCost = 1; gitea = {};
"gnome.gnome-calculator".sandbox.method = "bwrap";
"gnome.gnome-calculator".sandbox.whitelistWayland = true;
"gnome.gnome-calendar".buildCost = 1; gnome-calculator.buildCost = 1;
gnome-calculator.sandbox.method = "bwrap";
gnome-calculator.sandbox.whitelistWayland = true;
gnome-calendar.buildCost = 1;
# gnome-calendar surely has data to persist, but i use it strictly to do date math, not track events. # 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-calendar.sandbox.method = "bwrap";
"gnome.gnome-calendar".sandbox.whitelistWayland = true; gnome-calendar.sandbox.whitelistWayland = true;
# gnome-disks # gnome-disks
"gnome.gnome-disk-utility".buildCost = 1; gnome-disk-utility.buildCost = 1;
"gnome.gnome-disk-utility".sandbox.method = "bwrap"; gnome-disk-utility.sandbox.method = "bwrap";
"gnome.gnome-disk-utility".sandbox.whitelistDbus = [ "system" ]; gnome-disk-utility.sandbox.whitelistDbus = [ "system" ];
"gnome.gnome-disk-utility".sandbox.whitelistWayland = true; gnome-disk-utility.sandbox.whitelistWayland = true;
"gnome.gnome-disk-utility".sandbox.extraHomePaths = [ gnome-disk-utility.sandbox.extraHomePaths = [
"tmp" "tmp"
"use/iso" "use/iso"
# TODO: probably need /dev and such # TODO: probably need /dev and such
]; ];
hping.sandbox.method = "landlock";
hping.sandbox.net = "all";
hping.sandbox.capabilities = [ "net_raw" ];
hping.sandbox.autodetectCliPaths = "existingFile"; # for sending packet data from file
# seahorse: dump gnome-keyring secrets. # seahorse: dump gnome-keyring secrets.
"gnome.seahorse".buildCost = 1; seahorse.buildCost = 1;
# N.B.: it can also manage ~/.ssh keys, but i explicitly don't add those to the sandbox for now. # N.B. it can lso manage ~/.ssh keys, but i explicitly don't add those to the sandbox for now.
"gnome.seahorse".sandbox.method = "bwrap"; seahorse.sandbox.method = "bwrap";
"gnome.seahorse".sandbox.whitelistDbus = [ "user" ]; seahorse.sandbox.whitelistDbus = [ "user" ];
"gnome.seahorse".sandbox.whitelistWayland = true; seahorse.sandbox.whitelistWayland = true;
gnome-2048.buildCost = 1; gnome-2048.buildCost = 1;
gnome-2048.sandbox.method = "bwrap"; gnome-2048.sandbox.method = "bwrap";
@@ -489,7 +685,7 @@ in
"Pictures/Screenshots" "Pictures/Screenshots"
"Pictures/servo-macros" "Pictures/servo-macros"
]; ];
gnome-frog.persist.byStore.cryptClearOnBoot = [ gnome-frog.persist.byStore.ephemeral = [
".local/share/tessdata" # 15M; dunno what all it is. ".local/share/tessdata" # 15M; dunno what all it is.
]; ];
@@ -503,7 +699,7 @@ in
"gnome.hitori".sandbox.whitelistWayland = true; "gnome.hitori".sandbox.whitelistWayland = true;
gnugrep.sandbox.method = "bwrap"; gnugrep.sandbox.method = "bwrap";
gnugrep.sandbox.autodetectCliPaths = true; gnugrep.sandbox.autodetectCliPaths = "existing";
gnugrep.sandbox.whitelistPwd = true; gnugrep.sandbox.whitelistPwd = true;
gnugrep.sandbox.extraHomePaths = [ gnugrep.sandbox.extraHomePaths = [
# let it follow symlinks to non-sensitive data # let it follow symlinks to non-sensitive data
@@ -511,7 +707,6 @@ in
".persist/plaintext" ".persist/plaintext"
]; ];
# sed: there is an edgecase of `--file=<foo>`, wherein `foo` won't be whitelisted.
gnused.sandbox.method = "bwrap"; gnused.sandbox.method = "bwrap";
gnused.sandbox.autodetectCliPaths = "existingFile"; gnused.sandbox.autodetectCliPaths = "existingFile";
gnused.sandbox.whitelistPwd = true; #< `-i` flag creates a temporary file in pwd (?) and then moves it. gnused.sandbox.whitelistPwd = true; #< `-i` flag creates a temporary file in pwd (?) and then moves it.
@@ -537,7 +732,7 @@ in
# hdparm: has to be run as sudo. e.g. `sudo hdparm -i /dev/sda` # hdparm: has to be run as sudo. e.g. `sudo hdparm -i /dev/sda`
hdparm.sandbox.method = "bwrap"; hdparm.sandbox.method = "bwrap";
hdparm.sandbox.autodetectCliPaths = true; hdparm.sandbox.autodetectCliPaths = "existingFile";
host.sandbox.method = "landlock"; host.sandbox.method = "landlock";
host.sandbox.net = "all"; #< technically, only needs to contact localhost's DNS server host.sandbox.net = "all"; #< technically, only needs to contact localhost's DNS server
@@ -572,16 +767,16 @@ in
iotop.sandbox.capabilities = [ "net_admin" ]; iotop.sandbox.capabilities = [ "net_admin" ];
# provides `ip`, `routel`, `bridge`, others. # provides `ip`, `routel`, `bridge`, others.
# landlock works fine for most of these, but `ip netns exec` uses namespaces internally, # landlock works fine for most of these, but `ip netns exec` wants to attach to an existing namespace (which requires sudo)
# and that's incompatible with landlock # and that means we can't use ANY sandboxer for it.
iproute2.sandbox.method = "bwrap"; iproute2.sandbox.enable = false;
iproute2.sandbox.net = "all"; # iproute2.sandbox.net = "all";
iproute2.sandbox.capabilities = [ "net_admin" ]; # iproute2.sandbox.capabilities = [ "net_admin" ];
iproute2.sandbox.extraPaths = [ # iproute2.sandbox.extraPaths = [
"/run/netns" # for `ip netns ...` to work, but maybe not needed anymore? # "/run/netns" # for `ip netns ...` to work, but maybe not needed anymore?
"/sys/class/net" # for `ip netns ...` to work # "/sys/class/net" # for `ip netns ...` to work
"/var/run/netns" # "/var/run/netns"
]; # ];
iptables.sandbox.method = "landlock"; iptables.sandbox.method = "landlock";
iptables.sandbox.net = "all"; iptables.sandbox.net = "all";
@@ -620,14 +815,23 @@ in
"tmp" "tmp"
]; ];
landlock-sandboxer.sandbox.enable = false; #< sandbox helper
libcamera = {}; libcamera = {};
libcap.sandbox.enable = false; #< for `capsh`, which i use as a sandboxer libcap_ng.sandbox.enable = false; # TODO: `pscap` can sandbox with bwrap, `captest` and `netcap` with landlock
libcap_ng.sandbox.enable = false; # there's something about /proc/$pid/fd which breaks `readlink`/stat with every sandbox technique (except capsh-only)
libnotify.sandbox.method = "bwrap"; libnotify.sandbox.method = "bwrap";
libnotify.sandbox.whitelistDbus = [ "user" ]; # notify-send libnotify.sandbox.whitelistDbus = [ "user" ]; # notify-send
lightning-cli.packageUnwrapped = pkgs.linkBinIntoOwnPackage pkgs.clightning "lightning-cli";
lightning-cli.sandbox.method = "bwrap";
lightning-cli.sandbox.extraHomePaths = [
".lightning/bitcoin/lightning-rpc"
];
# `lightning-cli` finds its RPC file via `~/.lightning/bitcoin/lightning-rpc`, to message the daemon
lightning-cli.fs.".lightning".symlink.target = "/var/lib/clightning";
losslesscut-bin.buildCost = 1; losslesscut-bin.buildCost = 1;
losslesscut-bin.sandbox.method = "bwrap"; losslesscut-bin.sandbox.method = "bwrap";
losslesscut-bin.sandbox.extraHomePaths = [ losslesscut-bin.sandbox.extraHomePaths = [
@@ -648,13 +852,18 @@ in
lua = {}; lua = {};
man-pages.sandbox.enable = false; man-pages.sandbox.enable = false; #< data only
man-pages-posix.sandbox.enable = false; man-pages-posix.sandbox.enable = false; #< data only
mercurial.sandbox.method = "bwrap"; # TODO:sandbox: untested mercurial.sandbox.method = "bwrap"; # TODO:sandbox: untested
mercurial.sandbox.net = "clearnet"; mercurial.sandbox.net = "clearnet";
mercurial.sandbox.whitelistPwd = true; mercurial.sandbox.whitelistPwd = true;
mesa-demos.sandbox.method = "bwrap";
mesa-demos.sandbox.whitelistDri = true;
mesa-demos.sandbox.whitelistWayland = true;
mesa-demos.sandbox.whitelistX = true;
# actual monero blockchain (not wallet/etc; safe to delete, just slow to regenerate) # actual monero blockchain (not wallet/etc; safe to delete, just slow to regenerate)
monero-gui.buildCost = 1; monero-gui.buildCost = 1;
# XXX: is it really safe to persist this? it doesn't have info that could de-anonymize if captured? # XXX: is it really safe to persist this? it doesn't have info that could de-anonymize if captured?
@@ -693,9 +902,15 @@ in
nixpkgs-review.sandbox.wrapperType = "inplace"; #< shell completions use full paths nixpkgs-review.sandbox.wrapperType = "inplace"; #< shell completions use full paths
nixpkgs-review.sandbox.net = "clearnet"; nixpkgs-review.sandbox.net = "clearnet";
nixpkgs-review.sandbox.whitelistPwd = true; nixpkgs-review.sandbox.whitelistPwd = true;
nixpkgs-review.sandbox.extraHomePaths = [
".config/git" #< it needs to know commiter name/email, even if not posting
];
nixpkgs-review.sandbox.extraPaths = [ nixpkgs-review.sandbox.extraPaths = [
"/nix" "/nix"
]; ];
nixpkgs-review.persist.byStore.ephemeral = [
".cache/nixpkgs-review" #< help it not exhaust / tmpfs
];
nmap.sandbox.method = "bwrap"; nmap.sandbox.method = "bwrap";
nmap.sandbox.net = "all"; # clearnet and lan nmap.sandbox.net = "all"; # clearnet and lan
@@ -744,7 +959,7 @@ in
"/sys/devices" "/sys/devices"
]; ];
"perlPackages.FileMimeInfo".sandbox.enable = false; #< TODO: sandbox `mimetype` but not `mimeopen`. "perlPackages.FileMimeInfo" = {};
powertop.sandbox.method = "landlock"; powertop.sandbox.method = "landlock";
powertop.sandbox.capabilities = [ "ipc_lock" "sys_admin" ]; powertop.sandbox.capabilities = [ "ipc_lock" "sys_admin" ];
@@ -757,9 +972,7 @@ in
# procps: free, pgrep, pidof, pkill, ps, pwait, top, uptime, couple others # procps: free, pgrep, pidof, pkill, ps, pwait, top, uptime, couple others
procps.sandbox.method = "bwrap"; procps.sandbox.method = "bwrap";
procps.sandbox.extraConfig = [ procps.sandbox.isolatePids = false;
"--sanebox-keep-namespace" "pid"
];
pstree.sandbox.method = "landlock"; pstree.sandbox.method = "landlock";
pstree.sandbox.extraPaths = [ pstree.sandbox.extraPaths = [
@@ -779,7 +992,9 @@ in
python3-repl.packageUnwrapped = pkgs.python3.withPackages (ps: with ps; [ python3-repl.packageUnwrapped = pkgs.python3.withPackages (ps: with ps; [
psutil psutil
pykakasi
requests requests
unidecode
]); ]);
python3-repl.sandbox.method = "bwrap"; python3-repl.sandbox.method = "bwrap";
python3-repl.sandbox.net = "clearnet"; python3-repl.sandbox.net = "clearnet";
@@ -797,15 +1012,29 @@ in
rustc = {}; rustc = {};
sane-cast = {}; #< TODO: sandbox this the same way i sandbox go2tv sane-cast.sandbox.method = "bwrap";
sane-cast.sandbox.net = "clearnet";
sane-cast.sandbox.autodetectCliPaths = "existingFile";
sane-cast.suggestedPrograms = [ "go2tv" ];
sane-die-with-parent.sandbox.enable = false; #< it's a launcher; can't sandbox sane-die-with-parent.sandbox.enable = false; #< it's a launcher; can't sandbox
sane-weather.sandbox.method = "bwrap";
sane-weather.sandbox.net = "clearnet";
sc-im.sandbox.method = "bwrap";
sc-im.sandbox.autodetectCliPaths = "existingFile";
screen.sandbox.enable = false; #< tty; needs to run anything screen.sandbox.enable = false; #< tty; needs to run anything
sequoia.sandbox.method = "bwrap"; # TODO:sandbox: untested sequoia.packageUnwrapped = pkgs.sequoia.overrideAttrs (_: {
# XXX(2024-07-30): sq_autocrypt_import test failure: "Warning: 9B7DD433F254904A is expired."
doCheck = false;
});
sequoia.buildCost = 1;
sequoia.sandbox.method = "bwrap";
sequoia.sandbox.whitelistPwd = true; sequoia.sandbox.whitelistPwd = true;
sequoia.sandbox.autodetectCliPaths = true; sequoia.sandbox.autodetectCliPaths = "existingFileOrParent"; # supports `-o <file-to-create>`
shattered-pixel-dungeon.buildCost = 1; shattered-pixel-dungeon.buildCost = 1;
shattered-pixel-dungeon.persist.byStore.plaintext = [ ".local/share/.shatteredpixel/shattered-pixel-dungeon" ]; shattered-pixel-dungeon.persist.byStore.plaintext = [ ".local/share/.shatteredpixel/shattered-pixel-dungeon" ];
@@ -827,9 +1056,11 @@ in
smartmontools.sandbox.autodetectCliPaths = "existing"; smartmontools.sandbox.autodetectCliPaths = "existing";
smartmontools.sandbox.capabilities = [ "sys_rawio" ]; smartmontools.sandbox.capabilities = [ "sys_rawio" ];
# snapshot camera, based on libcamera
# TODO: enable dma heaps for more efficient buffer sharing: <https://gitlab.com/postmarketOS/pmaports/-/issues/2789>
snapshot = {}; snapshot = {};
sops.sandbox.method = "bwrap"; # TODO:sandbox: untested sops.sandbox.method = "bwrap";
sops.sandbox.extraHomePaths = [ sops.sandbox.extraHomePaths = [
".config/sops" ".config/sops"
"nixos" "nixos"
@@ -845,7 +1076,9 @@ in
"Music" "Music"
"tmp" "tmp"
"use" "use"
".config/dconf"
]; ];
soundconverter.sandbox.whitelistDbus = [ "user" ]; # for dconf
soundconverter.sandbox.extraPaths = [ soundconverter.sandbox.extraPaths = [
"/mnt/servo/media/Music" "/mnt/servo/media/Music"
"/mnt/servo/media/games" "/mnt/servo/media/games"
@@ -868,7 +1101,16 @@ in
sqlite = {}; sqlite = {};
sshfs-fuse = {}; # used by fs.nix sshfs-fuse.sandbox.method = "bwrap"; #< N.B. if you call this from the CLI -- without `mount.fuse` -- set this to `none`
sshfs-fuse.sandbox.net = "all";
sshfs-fuse.sandbox.autodetectCliPaths = "parent";
# sshfs-fuse.sandbox.extraPaths = [
# "/dev/fd" # fuse.mount3 -o drop_privileges passes us data over /dev/fd/3
# "/mnt" # XXX: not sure why i need all this, instead of just /mnt/desko, or /mnt/desko/home, etc
# ];
sshfs-fuse.sandbox.extraHomePaths = [
".ssh/id_ed25519" #< TODO: add -o foo,bar=path/to/thing style arguments to autodetection
];
strace.sandbox.enable = false; #< needs to `exec` its args, and therefore support *anything* strace.sandbox.enable = false; #< needs to `exec` its args, and therefore support *anything*
@@ -900,7 +1142,7 @@ in
tokodon.persist.byStore.private = [ ".cache/KDE/tokodon" ]; tokodon.persist.byStore.private = [ ".cache/KDE/tokodon" ];
tree.sandbox.method = "landlock"; tree.sandbox.method = "landlock";
tree.sandbox.autodetectCliPaths = true; tree.sandbox.autodetectCliPaths = "existing";
tree.sandbox.whitelistPwd = true; tree.sandbox.whitelistPwd = true;
tumiki-fighters.buildCost = 1; tumiki-fighters.buildCost = 1;
@@ -910,7 +1152,7 @@ in
tumiki-fighters.sandbox.whitelistWayland = true; tumiki-fighters.sandbox.whitelistWayland = true;
tumiki-fighters.sandbox.whitelistX = true; tumiki-fighters.sandbox.whitelistX = true;
util-linux.sandbox.enable = false; #< TODO: possible to sandbox if i specific a different profile for each of its ~50 binaries util-linux.sandbox.enable = false; #< TODO: possible to sandbox if i specify a different profile for each of its ~50 binaries
unzip.sandbox.method = "bwrap"; unzip.sandbox.method = "bwrap";
unzip.sandbox.autodetectCliPaths = "existingOrParent"; unzip.sandbox.autodetectCliPaths = "existingOrParent";
@@ -925,9 +1167,6 @@ in
valgrind.buildCost = 1; valgrind.buildCost = 1;
valgrind.sandbox.enable = false; #< it's a launcher: can't sandbox valgrind.sandbox.enable = false; #< it's a launcher: can't sandbox
visidata.sandbox.method = "bwrap"; # TODO:sandbox: untested
visidata.sandbox.autodetectCliPaths = true;
# `vulkaninfo`, `vkcube` # `vulkaninfo`, `vkcube`
vulkan-tools.sandbox.method = "landlock"; vulkan-tools.sandbox.method = "landlock";
@@ -945,6 +1184,8 @@ in
"tmp" "tmp"
]; ];
watch.sandbox.enable = false; #< it executes the command it's given
wdisplays.sandbox.method = "bwrap"; wdisplays.sandbox.method = "bwrap";
wdisplays.sandbox.whitelistWayland = true; wdisplays.sandbox.whitelistWayland = true;
@@ -957,16 +1198,20 @@ in
# `wg`, `wg-quick` # `wg`, `wg-quick`
wireguard-tools.sandbox.method = "landlock"; wireguard-tools.sandbox.method = "landlock";
wireguard-tools.sandbox.net = "all";
wireguard-tools.sandbox.capabilities = [ "net_admin" ]; wireguard-tools.sandbox.capabilities = [ "net_admin" ];
# provides `iwconfig`, `iwlist`, `iwpriv`, ... # provides `iwconfig`, `iwlist`, `iwpriv`, ...
wirelesstools.sandbox.method = "landlock"; wirelesstools.sandbox.method = "landlock";
wirelesstools.sandbox.net = "all";
wirelesstools.sandbox.capabilities = [ "net_admin" ]; wirelesstools.sandbox.capabilities = [ "net_admin" ];
wl-clipboard.sandbox.method = "bwrap"; wl-clipboard.sandbox.method = "bwrap";
wl-clipboard.sandbox.whitelistWayland = true; wl-clipboard.sandbox.whitelistWayland = true;
wtype = {}; wtype = {};
wtype.sandbox.method = "bwrap";
wtype.sandbox.whitelistWayland = true;
xwayland.sandbox.method = "bwrap"; xwayland.sandbox.method = "bwrap";
xwayland.sandbox.wrapperType = "inplace"; #< consumers use it as a library (e.g. wlroots) xwayland.sandbox.wrapperType = "inplace"; #< consumers use it as a library (e.g. wlroots)
@@ -978,14 +1223,48 @@ in
yarn.persist.byStore.plaintext = [ ".cache/yarn" ]; yarn.persist.byStore.plaintext = [ ".cache/yarn" ];
yt-dlp.sandbox.method = "bwrap"; # TODO:sandbox: untested yt-dlp.sandbox.method = "bwrap";
yt-dlp.sandbox.net = "all"; yt-dlp.sandbox.net = "all";
yt-dlp.sandbox.whitelistPwd = true; # saves to pwd by default yt-dlp.sandbox.whitelistPwd = true; # saves to pwd by default
zfs = {};
}; };
programs.feedbackd = lib.mkIf config.sane.programs.feedbackd.enabled { sane.persist.sys.byStore.plaintext = lib.mkIf config.sane.programs.guiApps.enabled [
# "/var/lib/alsa" # preserve output levels, default devices
{ path = "/var/lib/systemd/backlight"; method = "bind"; } # backlight brightness; bind because systemd T_T
];
systemd.services."systemd-backlight@" = lib.mkIf config.sane.programs.guiApps.enabled {
after = [
"ensure-var-lib-systemd-backlight.service"
];
wants = [
"ensure-var-lib-systemd-backlight.service"
];
};
hardware.graphics = lib.mkIf config.sane.programs.guiApps.enabled ({
enable = true; enable = true;
} // (lib.optionalAttrs pkgs.stdenv.isx86_64 {
# for 32 bit applications
# upstream nixpkgs forbids setting enable32Bit unless specifically x86_64 (so aarch64 isn't allowed)
enable32Bit = lib.mkDefault true;
}));
system.activationScripts.notifyActive = lib.mkIf config.sane.programs.guiApps.enabled {
text = lib.concatStringsSep "\n" ([
''
tryNotifyUser() {
local user="$1"
local new_path="$PATH:/etc/profiles/per-user/$user/bin:${pkgs.sudo}/bin:${pkgs.libnotify}/bin"
local version="$(cat $systemConfig/nixos-version)"
PATH="$new_path" sudo -u "$user" \
env PATH="$new_path" NIXOS_VERSION="$version" /bin/sh -c \
'. $HOME/.profile; dbus_file="$XDG_RUNTIME_DIR/bus"; if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -e "$dbus_file" ]; then export DBUS_SESSION_BUS_ADDRESS="unix:path=$dbus_file"; fi ; if [ -n "$DBUS_SESSION_BUS_ADDRESS" ]; then notify-send "nixos activated" "version: $NIXOS_VERSION" ; fi'
}
''
] ++ lib.mapAttrsToList
(user: en: lib.optionalString en "tryNotifyUser ${user} > /dev/null")
config.sane.programs.guiApps.enableFor.user
);
}; };
} }

View File

@@ -19,7 +19,7 @@
sandbox.method = "bwrap"; sandbox.method = "bwrap";
sandbox.whitelistAudio = true; sandbox.whitelistAudio = true;
sandbox.whitelistWayland = true; sandbox.whitelistWayland = true;
sandbox.autodetectCliPaths = true; sandbox.autodetectCliPaths = "existingFile";
sandbox.extraHomePaths = [ sandbox.extraHomePaths = [
# support media imports via file->open dir to some common media directories # support media imports via file->open dir to some common media directories
"tmp" "tmp"

View File

@@ -0,0 +1,10 @@
# `ausyscall --dump`: lists all syscalls by number and name
{ pkgs, ... }:
{
sane.programs.ausyscall = {
packageUnwrapped = pkgs.linkBinIntoOwnPackage pkgs.audit "ausyscall";
sandbox.method = "landlock";
};
}

View File

@@ -0,0 +1,91 @@
# Avahi zeroconf (mDNS) implementation.
# runs as systemd `avahi-daemon.service`
#
# - <https://avahi.org/>
# - code: <https://github.com/avahi/avahi>
# - IRC: #avahi on irc.libera.chat
#
# - `avahi-browse --help` for usage
# - `man avahi-daemon.conf`
# - `LD_LIBRARY_PATH=/nix/store/ngwj3jqmxh8k4qji2z0lj7y1f8vzqrn2-nss-mdns-0.15.1/lib getent hosts desko.local`
# nss-mdns goes through avahi-daemon, so there IS caching here
#
{ config, lib, pkgs, ... }:
{
sane.programs.avahi = {
packageUnwrapped = pkgs.avahi.overrideAttrs (upstream: {
# avahi wants to do its own sandboxing opaque to systemd & maybe in conflict with my bwrap.
# --no-drop-root disables that, so that i can e.g. run it as User=avahi, etc.
# do this here, because the service isn't so easily patched.
postInstall = (upstream.postInstall or "") + ''
wrapProgram "$out/sbin/avahi-daemon" \
--add-flags --no-drop-root
'';
nativeBuildInputs = upstream.nativeBuildInputs ++ [
pkgs.makeBinaryWrapper
];
});
sandbox.method = "bwrap";
sandbox.whitelistDbus = [ "system" ];
sandbox.net = "all"; #< otherwise it will show 'null' in place of each interface name.
sandbox.extraPaths = [
"/" #< TODO: decrease this, but be weary that the daemon might exit immediately
];
};
services.avahi = lib.mkIf config.sane.programs.avahi.enabled {
enable = true;
package = config.sane.programs.avahi.package;
publish.enable = true;
publish.userServices = true;
nssmdns4 = true;
nssmdns6 = true;
# reflector = true;
allowInterfaces = [
# particularly, the default config disallows loopback, which is kinda fucking retarded, right?
"ens1" #< servo
"enp5s0" #< desko
"eth0"
"lo"
"wg-home"
"wlan0" #< moby
"wlp3s0" #< lappy
"wlp4s0" #< desko
];
};
systemd.services.avahi-daemon = lib.mkIf config.sane.programs.avahi.enabled {
# hardening: see `systemd-analyze security avahi-daemon`
serviceConfig.User = "avahi";
serviceConfig.Group = "avahi";
serviceConfig.AmbientCapabilities = "";
serviceConfig.CapabilityBoundingSet = "";
serviceConfig.LockPersonality = true;
serviceConfig.MemoryDenyWriteExecute = true;
serviceConfig.NoNewPrivileges = true;
serviceConfig.PrivateDevices = true;
serviceConfig.PrivateMounts = true;
serviceConfig.PrivateTmp = true;
serviceConfig.PrivateUsers = true;
serviceConfig.ProcSubset = "all";
serviceConfig.ProtectClock = true;
serviceConfig.ProtectControlGroups = true;
serviceConfig.ProtectHome = true;
serviceConfig.ProtectHostname = true;
serviceConfig.ProtectKernelLogs = true;
serviceConfig.ProtectKernelModules = true;
serviceConfig.ProtectKernelTunables = true;
serviceConfig.ProtectProc = "noaccess";
serviceConfig.ProtectSystem = "strict";
serviceConfig.RemoveIPC = true; #< this *might* slow down the initial connection?
serviceConfig.RestrictAddressFamilies = "AF_UNIX AF_INET AF_INET6 AF_NETLINK";
serviceConfig.RestrictRealtime = true;
serviceConfig.RestrictSUIDSGID = true;
serviceConfig.SystemCallArchitectures = "native";
serviceConfig.SystemCallFilter = [
"@system-service"
"@mount"
"~@resources"
# "~@privileged"
];
};
}

View File

@@ -87,7 +87,7 @@ let
in in
{ {
sane.programs.bemenu = { sane.programs.bemenu = {
sandbox.method = "bwrap"; # landlock works, but requires *all* of /run/user/$ID to be granted. sandbox.method = "bwrap"; # landlock works, but requires *all* of $XDG_RUNTIME_DIR to be granted.
sandbox.whitelistWayland = true; sandbox.whitelistWayland = true;
sandbox.extraHomePaths = [ sandbox.extraHomePaths = [
".cache/fontconfig" #< else it complains, and is *way* slower ".cache/fontconfig" #< else it complains, and is *way* slower
@@ -95,7 +95,7 @@ in
packageUnwrapped = pkgs.bemenu.overrideAttrs (upstream: { packageUnwrapped = pkgs.bemenu.overrideAttrs (upstream: {
nativeBuildInputs = (upstream.nativeBuildInputs or []) ++ [ nativeBuildInputs = (upstream.nativeBuildInputs or []) ++ [
pkgs.makeWrapper pkgs.makeBinaryWrapper
]; ];
# can alternatively be specified as CLI flags # can alternatively be specified as CLI flags
postInstall = (upstream.postInstall or "") + '' postInstall = (upstream.postInstall or "") + ''

View File

@@ -0,0 +1,13 @@
{ pkgs, ... }:
{
sane.programs.bitcoin-cli = {
packageUnwrapped = pkgs.linkBinIntoOwnPackage pkgs.bitcoind "bitcoin-cli";
sandbox.method = "bwrap";
sandbox.autodetectCliPaths = "existing"; #< for `bitcoin-cli -datadir=/var/lib/...`
sandbox.extraHomePaths = [
".bitcoin/bitcoin.conf"
];
sandbox.net = "all"; # actually needs only localhost
secrets.".bitcoin/bitcoin.conf" = ../../../secrets/servo/bitcoin.conf.bin;
};
}

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p blast-ugjka #!nix-shell -i python3 -p blast-ugjka -p python3
# vim: set filetype=python : # vim: set filetype=python :
import logging import logging

View File

@@ -31,7 +31,7 @@ in
sane.programs.blast-to-default = { sane.programs.blast-to-default = {
# helper to deal with blast's interactive CLI # helper to deal with blast's interactive CLI
packageUnwrapped = pkgs.static-nix-shell.mkPython3Bin { packageUnwrapped = pkgs.static-nix-shell.mkPython3 {
pname = "blast-to-default"; pname = "blast-to-default";
pkgs = [ "blast-ugjka" ]; pkgs = [ "blast-ugjka" ];
srcRoot = ./.; srcRoot = ./.;
@@ -39,11 +39,9 @@ in
sandbox.method = "bwrap"; sandbox.method = "bwrap";
sandbox.whitelistAudio = true; sandbox.whitelistAudio = true;
sandbox.net = "clearnet"; sandbox.net = "clearnet";
sandbox.extraConfig = [ #v else it fails to reap its children (or, maybe, it fails to hook its parent's death signal?)
# else it fails to reap its children (or, maybe, it fails to hook its parent's death signal?) #v might be possible to remove this, but kinda hard to see a clean way.
# might be possible to remove this, but kinda hard to see a clean way. sandbox.isolatePids = false;
"--sanebox-keep-namespace" "pid"
];
suggestedPrograms = [ "blast-ugjka" "sane-die-with-parent" ]; suggestedPrograms = [ "blast-ugjka" "sane-die-with-parent" ];
}; };

View File

@@ -103,19 +103,37 @@ in
}; };
}; };
fs.".config/bonsai/bonsai_tree.json".symlink.text = builtins.toJSON cfg.config.transitions; packageUnwrapped = pkgs.bonsai.overrideAttrs (upstream: {
# patch to place the socket in a subdirectory where it can be sandboxed
postPatch = (upstream.postPatch or "") + ''
substituteInPlace cmd/{bonsaictl,bonsaid}/main.ha \
--replace-fail 'path::set(&buf, statedir, "bonsai")' 'path::set(&buf, statedir, "bonsai/bonsai")'
'';
});
fs.".config/bonsai/bonsai_tree.json".symlink.target = pkgs.writers.writeJSON "bonsai_tree.json" cfg.config.transitions;
sandbox.method = "bwrap"; sandbox.method = "bwrap";
sandbox.extraRuntimePaths = [ sandbox.extraRuntimePaths = [
"/" #< just needs "bonsai", but needs to create it first... "bonsai"
]; ];
services.bonsaid = { services.bonsaid = {
description = "bonsai: programmable input dispatcher"; description = "bonsai: programmable input dispatcher";
dependencyOf = [ "sway" ]; # to ensure `$XDG_RUNTIME_DIR/bonsai` exists before sway binds it
partOf = [ "graphical-session" ]; partOf = [ "graphical-session" ];
# 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) # 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"; command = pkgs.writeShellScript "bonsai-start" ''
cleanupCommand = "rm -f $XDG_RUNTIME_DIR/bonsai"; # TODO: don't create the sway directory here!
# i do it for now because sway and bonsai call into eachother; circular dependency:
# - sway -> bonsai -> sane-input-handler -> swaymsg
mkdir -p $XDG_RUNTIME_DIR/{bonsai,sway}
exec nice -n -11 bonsaid -t $HOME/.config/bonsai/bonsai_tree.json
'';
cleanupCommand = "rm -f $XDG_RUNTIME_DIR/bonsai/bonsai";
readiness.waitExists = [
"$XDG_RUNTIME_DIR/bonsai/bonsai"
];
}; };
}; };
} }

View File

@@ -1,6 +1,12 @@
{ ... }: { pkgs, ... }:
{ {
sane.programs.brave = { sane.programs.brave = {
# convert eval error to build failure
packageUnwrapped = if (builtins.tryEval pkgs.brave).success then
pkgs.brave
else
pkgs.runCommandLocal "brave-not-supported" {} "false"
;
sandbox.method = "bwrap"; sandbox.method = "bwrap";
sandbox.wrapperType = "inplace"; # /opt/share/brave.com vendor-style packaging sandbox.wrapperType = "inplace"; # /opt/share/brave.com vendor-style packaging
sandbox.net = "all"; sandbox.net = "all";
@@ -8,11 +14,14 @@
"dev" # for developing anything web-related "dev" # for developing anything web-related
"tmp" "tmp"
]; ];
sandbox.extraPaths = [
"/tmp" # needed particularly if run from `sane-vpn do`
];
sandbox.whitelistAudio = true; sandbox.whitelistAudio = true;
sandbox.whitelistDri = true; sandbox.whitelistDri = true;
sandbox.whitelistWayland = true; sandbox.whitelistWayland = true;
persist.byStore.cryptClearOnBoot = [ persist.byStore.ephemeral = [
".cache/BraveSoftware" ".cache/BraveSoftware"
".config/BraveSoftware" ".config/BraveSoftware"
]; ];

View File

@@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sane.programs.brightnessctl;
in
{
sane.programs.brightnessctl = {
sandbox.method = "landlock"; # also bwrap, but landlock is more responsive
sandbox.extraPaths = [
"/sys/class/backlight"
"/sys/class/leds"
"/sys/devices"
];
# sandbox.whitelistDbus = [ "system" ]; #< only necessary if not granting udev perms
};
services.udev.extraRules = let
chmod = "${pkgs.coreutils}/bin/chmod";
chown = "${pkgs.coreutils}/bin/chown";
in lib.mkIf cfg.enabled ''
# make backlight controllable by members of `video`
SUBSYSTEM=="backlight", RUN+="${chown} :video $sys$devpath/brightness", RUN+="${chmod} g+w $sys$devpath/brightness"
'';
}

View File

@@ -13,6 +13,10 @@
sane.programs.callaudiod = { sane.programs.callaudiod = {
packageUnwrapped = pkgs.rmDbusServices pkgs.callaudiod; packageUnwrapped = pkgs.rmDbusServices pkgs.callaudiod;
sandbox.method = "bwrap";
sandbox.whitelistAudio = true;
sandbox.whitelistDbus = [ "user" ];
services.callaudiod = { services.callaudiod = {
description = "callaudiod: dbus service to switch audio profiles and mute microphone"; description = "callaudiod: dbus service to switch audio profiles and mute microphone";
partOf = [ "default" ]; partOf = [ "default" ];

View File

@@ -24,7 +24,23 @@ in
}; };
}; };
packageUnwrapped = pkgs.calls.overrideAttrs (upstream: { packageUnwrapped = pkgs.rmDbusServicesInPlace ((pkgs.calls.override {
gtk3 = pkgs.gtk4;
libpeas = pkgs.libpeas2;
wrapGAppsHook3 = pkgs.wrapGAppsHook4;
}).overrideAttrs (upstream: {
# XXX(2024-08-08): v46.3 has a bug where if it has no network connection on launch, it forever stays disconnected & never retries
version = "47_beta.0-unstable-2024-08-08";
src = lib.warnIf (lib.versionOlder "47.0" upstream.version) "gnome-calls outdated; remove src override? (keep UI patches though!)" pkgs.fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "GNOME";
repo = "calls";
fetchSubmodules = true;
# rev = "main";
rev = "ff213579a52222e7c95e585843d97b5b817b2a8b";
hash = "sha256-0QYC8FJpfg/X2lIjBDooba2idUfpJNQhcpv8Z5I/B4k=";
};
patches = (upstream.patches or []) ++ [ patches = (upstream.patches or []) ++ [
(pkgs.fetchpatch { (pkgs.fetchpatch {
# usability improvement... if the UI is visible, then i can receive calls. otherwise, i can't! # usability improvement... if the UI is visible, then i can receive calls. otherwise, i can't!
@@ -33,10 +49,18 @@ in
hash = "sha256-NoVQV2TlkCcsBt0uwSyK82hBKySUW4pADrJVfLFvWgU="; hash = "sha256-NoVQV2TlkCcsBt0uwSyK82hBKySUW4pADrJVfLFvWgU=";
}) })
]; ];
});
nativeBuildInputs = upstream.nativeBuildInputs ++ [
pkgs.dbus #< for dbus-run-session (should be test only, but it's not)
];
buildInputs = upstream.buildInputs ++ [
pkgs.libadwaita
];
}));
sandbox.method = "bwrap"; sandbox.method = "bwrap";
sandbox.net = "clearnet"; sandbox.net = "vpn.wg-home"; #< XXX(2024/07/05): my cell carrier seems to block RTP, so tunnel it.
sandbox.whitelistAudio = true; sandbox.whitelistAudio = true;
sandbox.whitelistDbus = [ "user" ]; # necessary for secrets, at the minimum sandbox.whitelistDbus = [ "user" ]; # necessary for secrets, at the minimum
sandbox.whitelistWayland = true; sandbox.whitelistWayland = true;

View File

@@ -0,0 +1,7 @@
{ pkgs, ... }:
{
sane.programs.capsh = {
packageUnwrapped = pkgs.linkBinIntoOwnPackage pkgs.libcap "capsh";
sandbox.enable = false; #< i use `capsh` as a sandboxer.
};
}

View File

@@ -0,0 +1,8 @@
{ pkgs, ... }:
{
sane.programs.captree = {
packageUnwrapped = pkgs.linkBinIntoOwnPackage pkgs.libcap-with-captree "captree";
sandbox.method = "bwrap";
sandbox.isolatePids = false;
};
}

View File

@@ -1,184 +0,0 @@
#!/bin/sh
#!/usr/bin/env nix-shell
#!nix-shell -i bash
usage() {
echo "usage: battery_estimate [options...]"
echo
echo "pretty-prints a battery estimate (icon to indicate state, and a duration estimate)"
echo
echo "options:"
echo " --debug: output additional information, to stderr"
echo " --minute-suffix <string>: use the provided string as a minutes suffix"
echo " --hour-suffix <string>: use the provided string as an hours suffix"
echo " --icon-suffix <string>: use the provided string as an icon suffix"
echo " --percent-suffix <string>: use the provided string when displaying percents"
}
# these icons come from sxmo; they only render in nerdfonts
icon_bat_chg=("󰢟" "󱊤" "󱊥" "󰂅")
icon_bat_dis=("󰂎" "󱊡" "󱊢" "󱊣")
suffix_icon="" # thin space
suffix_percent="%"
# suffix_icon=" "
# render time like: 2ʰ08ᵐ
# unicode sub/super-scripts: <https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts>
# symbol_hr="ʰ"
# symbol_min="ᵐ"
# render time like: 2ₕ08ₘ
# symbol_hr="ₕ"
# symbol_min="ₘ"
# render time like: 2h08m
# symbol_hr="h"
# symbol_min="m"
# render time like: 2:08
# symbol_hr=":"
# symbol_min=
# render time like: 208⧗
symbol_hr=""
symbol_min="⧗"
# variants:
# symbol_hr=":"
# symbol_min="⧖"
# symbol_min="⌛"
# render time like: 2'08"
# symbol_hr="'"
# symbol_min='"'
log() {
if [ "$BATTERY_ESTIMATE_DEBUG" = "1" ]; then
printf "$@" >&2
echo >&2
fi
}
render_icon() {
# args:
# 1: "chg" or "dis"
# 2: current battery percentage
level=$(($2 / 25))
level=$(($level > 3 ? 3 : $level))
level=$(($level < 0 ? 0 : $level))
log "icon: %s %d" "$1" "$level"
if [ "$1" = "dis" ]; then
printf "%s" "${icon_bat_dis[$level]}"
elif [ "$1" = "chg" ]; then
printf "%s" "${icon_bat_chg[$level]}"
fi
}
try_path() {
# assigns output variables:
# - perc, perc_from_full (0-100)
# - full, rate (pos means charging)
if [ -f "$1/capacity" ]; then
log "perc, perc_from_full from %s" "$1/capacity"
perc=$(cat "$1/capacity")
perc_from_full=$((100 - $perc))
fi
if [ -f "$1/charge_full_design" ] && [ -f "$1/current_now" ]; then
log "full, rate from %s and %s" "$1/charge_full_design" "$1/current_now"
# current is positive when charging
full=$(cat "$1/charge_full_design")
rate=$(cat "$1/current_now")
elif [ -f "$1/energy_full" ] && [ -f "$1/power_now" ]; then
log "full, rate from %s and %s" "$1/energy_full" "$1/power_now"
# power_now is positive when discharging
full=$(cat "$1/energy_full")
rate=-$(cat "$1/power_now")
elif [ -f "$1/energy_full" ] && [ -f "$1/energy_now" ]; then
log "full, rate from %s and %s" "$1/energy_full" "$1/energy_now"
log " this is a compatibility path for legacy Thinkpad batteries which do not populate the 'power_now' field, and incorrectly populate 'energy_now' with power info"
# energy_now is positive when discharging
full=$(cat "$1/energy_full")
rate=-$(cat "$1/energy_now")
fi
}
try_all_paths() {
try_path "/sys/class/power_supply/axp20x-battery" # Pinephone
try_path "/sys/class/power_supply/BAT0" # Thinkpad
log "perc: %d, perc_from_full: %d" "$perc" "$perc_from_full"
log "full: %f, rate: %f" "$full" "$rate"
log " rate > 0 means charging, else discharging"
}
fmt_minutes() {
# args:
# 1: icon to render
# 2: string to show if charge/discharge time is indefinite
# 3: minutes to stable state (i.e. to full charge or full discharge)
# - we work in minutes instead of hours for precision: bash math is integer-only
log "charge/discharge time: %f min" "$3"
# args: <battery symbol> <text if ludicrous estimate> <estimated minutes to full/empty>
if [ -n "$3" ] && [ "$3" -lt 1440 ]; then
hr=$(($3 / 60))
hr_in_min=$(($hr * 60))
min=$(($3 - $hr_in_min))
printf "%s%s%d%s%02d%s" "$1" "$suffix_icon" "$hr" "$symbol_hr" "$min" "$symbol_min"
else
log "charge/discharge duration > 1d"
printf "%s%s%s" "$1" "$suffix_icon" "$2" # more than 1d
fi
}
pretty_output() {
if [ -n "$perc" ]; then
duration=""
if [ "$rate" -gt 0 ]; then
log "charging"
icon="$(render_icon chg $perc)"
duration="$(($full * 60 * $perc_from_full / (100 * $rate)))"
else
log "discharging"
icon="$(render_icon dis $perc)"
if [ "$rate" -lt 0 ]; then
duration="$(($full * 60 * $perc / (-100 * $rate)))"
fi
fi
fmt_minutes "$icon" "$perc$suffix_percent" "$duration"
fi
}
while [ "$#" -gt 0 ]; do
case "$1" in
"--debug")
shift
BATTERY_ESTIMATE_DEBUG=1
;;
"--icon-suffix")
shift
suffix_icon="$1"
shift
;;
"--hour-suffix")
shift
symbol_hr="$1"
shift
;;
"--minute-suffix")
shift
symbol_min="$1"
shift
;;
"--percent-suffix")
shift
suffix_percent="$1"
shift
;;
*)
usage
exit 1
;;
esac
done
try_all_paths
pretty_output

View File

@@ -66,6 +66,7 @@ end
if vars.percent ~= nil then if vars.percent ~= nil then
bat_args = bat_args .. " --percent-suffix '" .. vars.percent .. "'" bat_args = bat_args .. " --percent-suffix '" .. vars.percent .. "'"
end end
bat_args = bat_args .. " {bat}"
-- N.B.: `[[ <text> ]]` is Lua's multiline string literal -- N.B.: `[[ <text> ]]` is Lua's multiline string literal
conky.text = [[ conky.text = [[
@@ -73,8 +74,8 @@ ${color1}${shadecolor 707070}${font sans-serif:size=50:style=Bold}${alignc}${exe
${color2}${shadecolor a4d7d0}${font sans-serif:size=20}${alignc}${exec date +"%a %d %b"}${font} ${color2}${shadecolor a4d7d0}${font sans-serif:size=20}${alignc}${exec date +"%a %d %b"}${font}
${color1}${shadecolor}${font sans-serif:size=22:style=Bold}${alignc}${execp @bat@ ]] .. bat_args .. [[ }${font} ${color1}${shadecolor}${font sans-serif:size=22:style=Bold}${alignc}${execp sane-sysload ]] .. bat_args .. [[ }${font}
${color1}${shadecolor}${font sans-serif:size=20:style=Bold}${alignc}${texeci 600 @weather@ }${font} ${color1}${shadecolor}${font sans-serif:size=20:style=Bold}${alignc}${texeci 600 timeout 20 sane-weather }${font}
${color2}${shadecolor a4d7d0}${font sans-serif:size=16}${alignc}⇅ ${downspeedf wlan0}]] .. vars.kBps .. [[${font} ${color2}${shadecolor a4d7d0}${font sans-serif:size=16}${alignc}⇅ ${downspeedf wlan0}]] .. vars.kBps .. [[${font}

View File

@@ -1,29 +1,22 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
sane.programs.conky = { sane.programs.conky = {
# TODO: non-sandboxed `conky` still ships via `sxmo-utils`, but unused
sandbox.method = "bwrap"; sandbox.method = "bwrap";
sandbox.net = "clearnet"; #< for the scripts it calls (weather) sandbox.net = "clearnet"; #< for the scripts it calls (weather)
sandbox.extraPaths = [ sandbox.extraPaths = [
"/sys/class/power_supply" "/sys/class/power_supply"
"/sys/devices" # needed by battery_estimate "/sys/devices" # needed by sane-sysload
# "/sys/devices/cpu" # "/sys/devices/cpu"
# "/sys/devices/system" # "/sys/devices/system"
]; ];
sandbox.whitelistWayland = true; sandbox.whitelistWayland = true;
fs.".config/conky/conky.conf".symlink.target = suggestedPrograms = [
let "sane-sysload"
# TODO: make this just another `suggestedPrograms`! "sane-weather"
battery_estimate = pkgs.static-nix-shell.mkBash { ];
pname = "battery_estimate";
srcRoot = ./.; fs.".config/conky/conky.conf".symlink.target = ./conky.conf;
};
in pkgs.substituteAll {
src = ./conky.conf;
bat = "${battery_estimate}/bin/battery_estimate";
weather = "timeout 20 ${pkgs.sane-weather}/bin/sane-weather";
};
services.conky = { services.conky = {
description = "conky dynamic desktop background"; description = "conky dynamic desktop background";

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