Compare commits
311 Commits
wip-doofne
...
dev
Author | SHA1 | Date | |
---|---|---|---|
50add19b14 | |||
56032bc040 | |||
6ee33240d7 | |||
4aaeb42cab | |||
2697d068ce | |||
3ae650bcae | |||
ddce650bc5 | |||
96bf9d594f | |||
c2185f44b1 | |||
549fa8e5cd | |||
afc31dfc2f | |||
2011065497 | |||
ca6bb7518a | |||
612274d0b2 | |||
b801ed07d6 | |||
53fd4ee42f | |||
0b610a6683 | |||
3696953ba0 | |||
da8b3fc188 | |||
91db9fef82 | |||
682e9c0c68 | |||
cd9f1cc95e | |||
607845d495 | |||
79c8521f38 | |||
fa284c3dec | |||
3fe5e57c3c | |||
05c212a227 | |||
ea2da626d1 | |||
f8d0c9ce3b | |||
46bf7c5ac9 | |||
d12120d53c | |||
22e3f58ab3 | |||
9f483541a4 | |||
8d8f19752f | |||
49c3bf0f34 | |||
065aba0996 | |||
c7425e792b | |||
74b7e90a34 | |||
9f642980fd | |||
c638218c07 | |||
1ad933ad9c | |||
3dc007448c | |||
3487303216 | |||
b74e797b13 | |||
bb3f148c32 | |||
e235e09cf1 | |||
64610a5806 | |||
15ca5fbfa4 | |||
997b841777 | |||
9ced7bd3b5 | |||
2710f2b2ca | |||
572a340c8a | |||
b844a9ef5d | |||
d41d067405 | |||
f8349a646b | |||
706667f403 | |||
99e0d5f03b | |||
3d82bc8c87 | |||
a3212f6955 | |||
0d3e89a431 | |||
b7c86d5867 | |||
5db8372b24 | |||
da09ab3617 | |||
133744fa4b | |||
bfd272b2c9 | |||
3edc8d87f4 | |||
6824080f6b | |||
0786475c63 | |||
ae082b1654 | |||
a77816e9de | |||
f50b10682f | |||
b062610866 | |||
bce8a0d91f | |||
3c53bca156 | |||
46806e36f0 | |||
4a8a5b309e | |||
8f46bd5497 | |||
2c3239da8b | |||
a08394edf1 | |||
5e5ecfe81e | |||
5048bd8d70 | |||
c7d8d9ee86 | |||
2e49946c65 | |||
a12aa02655 | |||
6d66a5dbf8 | |||
a31f67b793 | |||
5d80e298b5 | |||
56e488b130 | |||
5ebaaf46a2 | |||
bee3ec1fa0 | |||
46eab8f4e2 | |||
828d4fcc9c | |||
ca2ac89cec | |||
1ae1d94d53 | |||
c68f333bc9 | |||
9a09faa9e4 | |||
ae2eaa786c | |||
9c523b3ddd | |||
44c4e88b90 | |||
5ca0ca4f47 | |||
00ea7e17c5 | |||
823f8f2be3 | |||
13bec790cb | |||
e72f9be1bf | |||
0fd8dc2a01 | |||
24ed242bac | |||
f290b16f12 | |||
b4cb3decff | |||
7084bf95fa | |||
acd0926d1f | |||
2dba46da6b | |||
110c440697 | |||
f4047bfbea | |||
c573ac4e7e | |||
cc15be54d4 | |||
8b95a5fa37 | |||
b596f88ccc | |||
e82feb9f71 | |||
4839a40205 | |||
631c47c9bc | |||
b2f36e4ef6 | |||
9a210b4a63 | |||
181ebfc627 | |||
ddb904ae19 | |||
a234e57d89 | |||
a75a8f8425 | |||
9cbe74b20b | |||
6b06062cc9 | |||
b009b2c836 | |||
d46239f2ad | |||
47f474fecd | |||
828ef00b61 | |||
5d14a39d52 | |||
58f89aadf3 | |||
d9a03ee64a | |||
697543a675 | |||
ff235f5806 | |||
39fe0ce43a | |||
98fde86ff6 | |||
5c6a5b01c4 | |||
bb4f963c9c | |||
9eb0b3fc86 | |||
5b7f15b278 | |||
5176d6a3bc | |||
84ba7e3d68 | |||
6d16d83aab | |||
e9c51eddb3 | |||
75473c7123 | |||
10f7714cfd | |||
fe78f8bc45 | |||
6bbe3a8e23 | |||
98c4a5ec87 | |||
bf3a894d38 | |||
c973f2e03b | |||
9f76469b5c | |||
52231f2adc | |||
8c5d9d79d7 | |||
961c38e79b | |||
fc5068f4d4 | |||
e641f5c93a | |||
870e766966 | |||
a75a341b56 | |||
8b7ed2cdd4 | |||
b3a685aa31 | |||
9b8c461ce9 | |||
27de05a751 | |||
f54f1c57bc | |||
98d6439f2a | |||
fbcf2aed41 | |||
fb7701027e | |||
0bc228c07b | |||
943ebba7fb | |||
e41bf78db6 | |||
8588230f80 | |||
8ef1af7e22 | |||
989344f87e | |||
90f8d1e042 | |||
d8ca5f91c3 | |||
167bb4d8de | |||
6b117fa9bf | |||
4b9dcd50fb | |||
84e6d536d6 | |||
4c74e53052 | |||
5def8f30ad | |||
45dd144b24 | |||
66d4b380da | |||
8e7da2c956 | |||
0f11b9a7b7 | |||
d9437bf4aa | |||
5d1c52d0bc | |||
a0dfdb5125 | |||
cbc2ba02a4 | |||
ef0adb5689 | |||
b1bd4399f1 | |||
2b252e3ede | |||
9aaf89408a | |||
283ca45c5d | |||
7955d90f8d | |||
a06481fbef | |||
5db4d73ad6 | |||
304c8f8e3e | |||
5a09a2665b | |||
209545fc41 | |||
1e12566207 | |||
9a53cbc833 | |||
439bb5263f | |||
845dba3ca5 | |||
5e7fe850ec | |||
832338488d | |||
86ee95f607 | |||
5f5e55c98b | |||
7d59782005 | |||
62b541012b | |||
514197a17f | |||
143bdf672b | |||
a6c48eda71 | |||
a603c3e6bc | |||
1f48f41927 | |||
c0d9f05575 | |||
7f46b034f9 | |||
ba66378bc0 | |||
dcc8168aa0 | |||
f7d3c26d12 | |||
3d871e8d7c | |||
78f4cd9be2 | |||
f83bac3c2b | |||
58de5d661f | |||
599832d59c | |||
625cb0992b | |||
a02f221628 | |||
ad8bcfc09e | |||
815ce6287f | |||
0d1d56870f | |||
2445b882c2 | |||
12465e111e | |||
65a0914828 | |||
dab60e79c1 | |||
fe57f186cd | |||
78d66a8b09 | |||
b2955c9c9d | |||
b0e184b0f0 | |||
3cd97b522c | |||
c91681c77c | |||
d0d623da15 | |||
0db86d8c86 | |||
b74dfe7578 | |||
d1843b6b3d | |||
b482a1dfd6 | |||
5ba74a4055 | |||
b3b77e3e62 | |||
63bc58a56f | |||
efcf8639dc | |||
90b86dc7fc | |||
8bf8d31c5f | |||
2e44abc55d | |||
9e92069ba3 | |||
2a592a4a15 | |||
8ca357ea7f | |||
4f4c05a922 | |||
7c4be0f4e9 | |||
afea7fe5e7 | |||
294f0061bd | |||
4efe159933 | |||
b7f99c022b | |||
b3c5e53156 | |||
91c2b04ab4 | |||
27efb10a27 | |||
e4e32f46fe | |||
64b169069a | |||
c2c15e1ac3 | |||
0b3156c4c7 | |||
1c8551c842 | |||
2755d98b99 | |||
543108a5dd | |||
b32d02dc3f | |||
0bd92ef77e | |||
a7df4cc125 | |||
09a615ee62 | |||
8523b406ad | |||
6021da072c | |||
a49abbd123 | |||
f9091c0b0c | |||
bbf8fd5b20 | |||
be84747ffc | |||
478b443430 | |||
ded5f6560d | |||
c1b3629dcf | |||
5879499924 | |||
5a63f294c0 | |||
891a29feeb | |||
0863505877 | |||
0c922bd63a | |||
e04ec4c706 | |||
b0f9733ac8 | |||
e2babfc076 | |||
ef29b569e5 | |||
6f0a455d0b | |||
7d6a420c52 | |||
259143b87e | |||
fce426c318 | |||
9b794777b5 | |||
3ada668366 | |||
39a39e763d | |||
50353280d3 | |||
72b8211029 | |||
dbf719b59b | |||
57d7d3821f | |||
e86e9fc079 | |||
d708b78ebe | |||
075418eda1 | |||
9fc5b83b61 |
32
TODO.md
32
TODO.md
@@ -6,16 +6,14 @@
|
||||
- `ip monitor` can detect those manual link state changes (NM-dispatcher it seems cannot)
|
||||
- or try dnsmasq?
|
||||
- trust-dns: can't recursively resolve api.mangadex.org
|
||||
- nor `m.wikipedia.org` (`dyna.wikipedia.org`)
|
||||
- and *sometimes* apple.com fails
|
||||
- sandbox: link cache means that if i update ~/.config/... files inline, sandboxed programs still see the old version
|
||||
- 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
|
||||
- ringer (i.e. dino incoming call) doesn't prevent moby from sleeping
|
||||
- sysvol (volume overlay): when casting with `blast`, sysvol doesn't react to volume changes
|
||||
- syshud (volume overlay): when casting with `blast`, syshud doesn't react to volume changes
|
||||
- moby: kaslr is effectively disabled
|
||||
- `dmesg | grep "KASLR disabled due to lack of seed"`
|
||||
- fix by adding `kaslrseed` to uboot script before `booti`
|
||||
@@ -26,6 +24,10 @@
|
||||
- `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
|
||||
- nwg-panel will sometimes create nested bars (happens maybe when i turn an external display off, then on?)
|
||||
- wg-home is unreachable for a couple minutes when switching between LAN/WAN/3G
|
||||
- because the endpoint DNS changes.
|
||||
- causes calls to not transfer from WiFi -> cellular.
|
||||
|
||||
## REFACTORING:
|
||||
- add import checks to my Python nix-shell scripts
|
||||
@@ -65,6 +67,8 @@
|
||||
- /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)
|
||||
- port all sane.programs to be sandboxed
|
||||
- sandbox `curlftpfs`
|
||||
- sandbox `sshfs-fuse`
|
||||
- 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
|
||||
- LL_FS_RW=/ isn't enough -- need all mount points like `=/:/proc:/sys:...`.
|
||||
@@ -80,21 +84,15 @@
|
||||
- make dconf stuff less monolithic
|
||||
- i.e. per-app dconf profiles for those which need it. possible static config.
|
||||
- flatpak/spectrum has some stuff to proxy dconf per-app
|
||||
- canaries for important services
|
||||
- e.g. daily email checks; daily backup checks
|
||||
- integrate `nix check` into Gitea actions?
|
||||
|
||||
### user experience
|
||||
- rofi: sort items case-insensitively
|
||||
- xdg-desktop-portal shouldn't kill children on exit
|
||||
- *maybe* a job for `setsid -f`?
|
||||
- replace starship prompt with something more efficient
|
||||
- watch `forkstat`: it does way too much
|
||||
- cleanup waybar/nwg-panel so that it's not invoking playerctl every 2 seconds
|
||||
- nwg-panel: swaync icon is stuck as the refresh icon
|
||||
- nwg-panel: doesn't appear on all desktops
|
||||
- nwg-panel: doesn't know that virtual-desktop 10/TV exists
|
||||
- install apps:
|
||||
- compass viewer (moby)
|
||||
- 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/>
|
||||
- offline Wikipedia (or, add to `wike`)
|
||||
@@ -124,13 +122,11 @@
|
||||
- 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
|
||||
- run only geoclue, and not gpsd, to save power?
|
||||
- fix iio-sensor-proxy magnetometer scaling
|
||||
- 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?
|
||||
- manually do smoothing, as some layer between mepo and geoclue/gpsd?
|
||||
- manually do smoothing, as some layer between mepo and geoclue?
|
||||
- moby: port `freshen-agps` timer service to s6 (maybe i want some `s6-cron` or something)
|
||||
- moby: show battery state on ssh login
|
||||
- moby: improve gPodder launch time
|
||||
@@ -157,13 +153,9 @@
|
||||
- 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
|
||||
- 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
|
||||
- debug nixos-rebuild times
|
||||
- use `systemctl list-jobs` to show what's being waited on
|
||||
- i think it's `systemd-networkd-wait-online.service` that's blocking this?
|
||||
- i wonder what interface it's waiting for. i should use `--ignore=...` to ignore interfaces i don't care about.
|
||||
- also `wireguard-wg-home.target` when net is offline
|
||||
- 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
|
||||
- would be super handy for package prototyping!
|
||||
|
70
default.nix
70
default.nix
@@ -1,67 +1,5 @@
|
||||
# limited, non-flake interface to this repo.
|
||||
# this file exposes the same view into `pkgs` which the flake would see when evaluated.
|
||||
#
|
||||
# the primary purpose of this file is so i can run `updateScript`s which expect
|
||||
# the root to be `default.nix`
|
||||
{ }:
|
||||
{ ... }@args:
|
||||
let
|
||||
mkPkgs = args: (import ./pkgs/additional/nixpkgs args).extend
|
||||
(import ./overlays/all.nix);
|
||||
inherit (mkPkgs {}) lib;
|
||||
|
||||
evalHost = { name, system, branch ? "master", variant ? null }:
|
||||
let
|
||||
pkgs = mkPkgs { inherit system; variant = branch; };
|
||||
in pkgs.nixos (
|
||||
[
|
||||
(lib.optionalAttrs (variant == "light") {
|
||||
sane.maxBuildCost = 2;
|
||||
})
|
||||
(lib.optionalAttrs (variant == "min") {
|
||||
sane.maxBuildCost = 0;
|
||||
})
|
||||
(import ./hosts/instantiate.nix { hostName = name; })
|
||||
(import ./modules)
|
||||
pkgs.sops-nix.nixosModules.sops
|
||||
]
|
||||
);
|
||||
mkFlavoredHost = args: let
|
||||
host = evalHost args;
|
||||
# expose the toplevel nixos system as the toplevel attribute itself,
|
||||
# with nested aliases for other common build targets
|
||||
in host.config.system.build.toplevel.overrideAttrs (base: {
|
||||
passthru = (base.passthru or {}) // {
|
||||
config = host.config;
|
||||
fs = host.config.sane.fs;
|
||||
img = host.config.system.build.img;
|
||||
pkgs = host.config.system.build.pkgs;
|
||||
programs = lib.mapAttrs (_: p: p.package) host.config.sane.programs;
|
||||
toplevel = host.config.system.build.toplevel; #< self
|
||||
};
|
||||
});
|
||||
mkHost = args: {
|
||||
# TODO: swap order: $host-{next,staging}-{min,light}:
|
||||
# then lexicographically-adjacent targets would also have the minimal difference in closure,
|
||||
# and the order in which each target should be built is more evident
|
||||
"${args.name}" = mkFlavoredHost args;
|
||||
"${args.name}-next" = mkFlavoredHost args // { branch = "staging-next"; };
|
||||
"${args.name}-staging" = mkFlavoredHost args // { branch = "staging"; };
|
||||
"${args.name}-light" = mkFlavoredHost args // { variant = "light"; };
|
||||
"${args.name}-light-next" = mkFlavoredHost args // { variant = "light"; branch = "staging-next"; };
|
||||
"${args.name}-light-staging" = mkFlavoredHost args // { variant = "light"; branch = "staging"; };
|
||||
"${args.name}-min" = mkFlavoredHost args // { variant = "min"; };
|
||||
"${args.name}-min-next" = mkFlavoredHost args // { variant = "min"; branch = "staging-next"; };
|
||||
"${args.name}-min-staging" = mkFlavoredHost args // { variant = "min"; branch = "staging-staging"; };
|
||||
};
|
||||
|
||||
hosts = lib.foldl' (acc: host: acc // (mkHost host)) {} [
|
||||
{ name = "crappy"; system = "armv7l-linux"; }
|
||||
{ name = "desko"; system = "x86_64-linux"; }
|
||||
{ name = "lappy"; system = "x86_64-linux"; }
|
||||
{ name = "moby"; system = "aarch64-linux"; }
|
||||
{ name = "rescue"; system = "x86_64-linux"; }
|
||||
{ name = "servo"; system = "x86_64-linux"; }
|
||||
];
|
||||
in {
|
||||
inherit hosts;
|
||||
} // (mkPkgs {})
|
||||
sane-nix-files = import ./pkgs/additional/sane-nix-files { };
|
||||
in
|
||||
import "${sane-nix-files}/impure.nix" args
|
||||
|
@@ -16,7 +16,7 @@
|
||||
sane.programs.calls.enableFor.user.colin = false;
|
||||
sane.programs.consoleMediaUtils.enableFor.user.colin = true;
|
||||
sane.programs.epiphany.enableFor.user.colin = true;
|
||||
sane.programs."gnome.geary".enableFor.user.colin = false;
|
||||
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;
|
||||
@@ -25,6 +25,7 @@
|
||||
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;
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
sane.programs.iphoneUtils.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.nwg-panel.config = {
|
||||
|
@@ -18,7 +18,7 @@
|
||||
sane.programs.stepmania.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;
|
||||
|
||||
sops.secrets.colin-passwd.neededForUsers = true;
|
||||
|
@@ -10,7 +10,6 @@
|
||||
{
|
||||
imports = [
|
||||
./fs.nix
|
||||
./gps.nix
|
||||
];
|
||||
|
||||
sane.hal.pine64.enable = true;
|
||||
@@ -29,6 +28,7 @@
|
||||
sops.secrets.colin-passwd.neededForUsers = true;
|
||||
|
||||
sane.programs.sway.enableFor.user.colin = true;
|
||||
sane.programs.sway.config.mod = "Mod1"; #< alt key instead of Super
|
||||
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.mercurial.enableFor.user.colin = false; # does not cross compile
|
||||
@@ -36,12 +36,12 @@
|
||||
|
||||
# enabled for easier debugging
|
||||
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.dino.config.autostart = true;
|
||||
# sane.programs.signal-desktop.config.autostart = true; # TODO: enable once electron stops derping.
|
||||
# sane.programs."gnome.geary".config.autostart = true;
|
||||
sane.programs.signal-desktop.config.autostart = true;
|
||||
# sane.programs.geary.config.autostart = true;
|
||||
# sane.programs.calls.config.autostart = true;
|
||||
|
||||
sane.programs.pipewire.config = {
|
||||
|
@@ -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;
|
||||
}
|
@@ -7,12 +7,11 @@
|
||||
./services
|
||||
];
|
||||
|
||||
sane.programs = {
|
||||
# for administering services
|
||||
freshrss.enableFor.user.colin = true;
|
||||
matrix-synapse.enableFor.user.colin = true;
|
||||
signaldctl.enableFor.user.colin = true;
|
||||
};
|
||||
# for administering services
|
||||
sane.programs.clightning-sane.enableFor.user.colin = true;
|
||||
# sane.programs.freshrss.enableFor.user.colin = true;
|
||||
# sane.programs.signaldctl.enableFor.user.colin = true;
|
||||
# sane.programs.matrix-synapse.enableFor.user.colin = true;
|
||||
|
||||
sane.roles.build-machine.enable = true;
|
||||
sane.programs.zsh.config.showDeadlines = false; # ~/knowledge doesn't always exist
|
||||
|
@@ -54,7 +54,7 @@
|
||||
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
|
||||
sane.programs.sysadminUtils.suggestedPrograms = [ "zfs" ];
|
||||
sane.programs.sysadminUtils.suggestedPrograms = [ "zfs-tools" ];
|
||||
|
||||
sane.persist.stores."ext" = {
|
||||
origin = "/mnt/pool/persist";
|
||||
|
@@ -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";
|
||||
}
|
@@ -36,7 +36,8 @@
|
||||
# - rb = received bytes
|
||||
# - sp = sent packets
|
||||
# - sb = sent bytes
|
||||
{ lib, ... }:
|
||||
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
# TURN port range (inclusive).
|
||||
# default coturn behavior is to use the upper quarter of all ports. i.e. 49152 - 65535.
|
||||
@@ -130,11 +131,11 @@ in
|
||||
"verbose"
|
||||
# "Verbose" #< even MORE verbosity than "verbose" (it's TOO MUCH verbosity really)
|
||||
"no-multicast-peers" # disables sending to IPv4 broadcast addresses (e.g. 224.0.0.0/3)
|
||||
# "listening-ip=10.0.1.5" "external-ip=185.157.162.178" #< 2024/04/25: works, if running in root namespace
|
||||
"listening-ip=185.157.162.178" "external-ip=185.157.162.178"
|
||||
# "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=${config.sane.netns.ovpns.netnsPubIpv4}" "external-ip=${config.sane.netns.ovpns.netnsPubIpv4}"
|
||||
|
||||
# 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 *
|
||||
# "external-ip=97.113.128.229/10.78.79.51"
|
||||
# "external-ip=97.113.128.229"
|
||||
|
@@ -16,14 +16,16 @@
|
||||
# - validate with `bitcoin-cli -netinfo`
|
||||
{ config, lib, pkgs, sane-lib, ... }:
|
||||
let
|
||||
# bitcoind = config.sane.programs.bitcoind.packageUnwrapped;
|
||||
bitcoind = pkgs.bitcoind;
|
||||
# wrapper to run bitcoind with the tor onion address as externalip (computed at runtime)
|
||||
_bitcoindWithExternalIp = with pkgs; writeShellScriptBin "bitcoind" ''
|
||||
_bitcoindWithExternalIp = pkgs.writeShellScriptBin "bitcoind" ''
|
||||
externalip="$(cat /var/lib/tor/onion/bitcoind/hostname)"
|
||||
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.
|
||||
# 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";
|
||||
paths = [ _bitcoindWithExternalIp bitcoind ];
|
||||
};
|
||||
|
@@ -116,7 +116,10 @@
|
||||
# - fee-per-satoshi=<ppm>
|
||||
# - feature configs (i.e. experimental-xyz options)
|
||||
sane.services.clightning.extraConfig = ''
|
||||
log-level=debug:lightningd
|
||||
# log levels: "io", "debug", "info", "unusual", "broken"
|
||||
log-level=info:lightningd
|
||||
# log-level=debug:lightningd
|
||||
|
||||
# peerswap:
|
||||
# - config example: <https://github.com/fort-nix/nix-bitcoin/pull/462/files#diff-b357d832705b8ce8df1f41934d613f79adb77c4cd5cd9e9eb12a163fca3e16c6>
|
||||
# XXX: peerswap crashes clightning on launch. stacktrace is useless.
|
||||
@@ -132,4 +135,5 @@
|
||||
};
|
||||
|
||||
sane.programs.clightning.enableFor.user.colin = true; # for debugging/admin: `lightning-cli`
|
||||
sane.programs.clightning.packageUnwrapped = config.sane.services.clightning.package;
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./calibre.nix
|
||||
./coturn.nix
|
||||
./cryptocurrencies
|
||||
./email
|
||||
@@ -26,7 +25,7 @@
|
||||
./postgres.nix
|
||||
./prosody
|
||||
./slskd.nix
|
||||
./transmission.nix
|
||||
./transmission
|
||||
./trust-dns.nix
|
||||
./wikipedia.nix
|
||||
];
|
||||
|
@@ -51,54 +51,54 @@ lib.mkIf false
|
||||
{
|
||||
"3478" = {
|
||||
protocol = [ "tcp" "udp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-stun-turn";
|
||||
};
|
||||
"5222" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-client-to-server";
|
||||
};
|
||||
"5223" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpps-client-to-server"; # XMPP over TLS
|
||||
};
|
||||
"5269" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.wan = true;
|
||||
visibleTo.doof = true;
|
||||
description = "colin-xmpp-server-to-server";
|
||||
};
|
||||
"5270" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.wan = true;
|
||||
visibleTo.doof = true;
|
||||
description = "colin-xmpps-server-to-server"; # XMPP over TLS
|
||||
};
|
||||
"5280" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-bosh";
|
||||
};
|
||||
"5281" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-bosh-https";
|
||||
};
|
||||
"5349" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-stun-turn-over-tls";
|
||||
};
|
||||
"5443" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-web-services"; # file uploads, websockets, admin
|
||||
};
|
||||
}
|
||||
@@ -109,8 +109,8 @@ lib.mkIf false
|
||||
numPorts = turnPortHigh - turnPortLow + 1;
|
||||
in {
|
||||
protocol = [ "tcp" "udp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-turn-${builtins.toString count}-of-${builtins.toString numPorts}";
|
||||
};
|
||||
})
|
||||
|
@@ -8,14 +8,14 @@
|
||||
{
|
||||
sane.ports.ports."143" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-imap-imap.uninsane.org";
|
||||
};
|
||||
sane.ports.ports."993" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-imaps-imap.uninsane.org";
|
||||
};
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# postfix config options: <https://www.postfix.org/postconf.5.html>
|
||||
|
||||
{ lib, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
submissionOptions = {
|
||||
@@ -56,8 +56,7 @@ in
|
||||
|
||||
sane.dns.zones."uninsane.org".inet = {
|
||||
MX."@" = "10 mx.uninsane.org.";
|
||||
# XXX: RFC's specify that the MX record CANNOT BE A CNAME
|
||||
A."mx" = "185.157.162.178";
|
||||
A."mx" = "%AOVPNS%"; #< XXX: RFC's specify that the MX record CANNOT BE A CNAME. TODO: use "%AOVPNS%?
|
||||
|
||||
# Sender Policy Framework:
|
||||
# +mx => mail passes if it originated from the MX
|
||||
|
@@ -12,6 +12,10 @@
|
||||
device = "/var/media";
|
||||
options = [ "rbind" ];
|
||||
};
|
||||
fileSystems."/var/export/pub" = {
|
||||
device = "/var/www/sites/uninsane.org/share";
|
||||
options = [ "rbind" ];
|
||||
};
|
||||
# fileSystems."/var/export/playground" = {
|
||||
# device = config.fileSystems."/mnt/persist/ext".device;
|
||||
# fsType = "btrfs";
|
||||
@@ -37,7 +41,8 @@
|
||||
wantedBy = [ "nfs.service" "sftpgo.service" ];
|
||||
file.text = ''
|
||||
- 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
|
||||
'';
|
||||
};
|
||||
|
||||
|
@@ -9,10 +9,10 @@
|
||||
|
||||
{ config, lib, pkgs, sane-lib, ... }:
|
||||
let
|
||||
external_auth_hook = pkgs.static-nix-shell.mkPython3Bin {
|
||||
external_auth_hook = pkgs.static-nix-shell.mkPython3 {
|
||||
pname = "external_auth_hook";
|
||||
srcRoot = ./.;
|
||||
pyPkgs = [ "passlib" ];
|
||||
pkgs = [ "python3.pkgs.passlib" ];
|
||||
};
|
||||
# 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
|
||||
@@ -27,13 +27,12 @@ in
|
||||
"21" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.lan = true;
|
||||
# visibleTo.wan = true;
|
||||
description = "colin-FTP server";
|
||||
};
|
||||
"990" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-FTPS server";
|
||||
};
|
||||
} // (sane-lib.mapToAttrs
|
||||
@@ -41,8 +40,8 @@ in
|
||||
name = builtins.toString port;
|
||||
value = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-FTP server data port range";
|
||||
};
|
||||
})
|
||||
@@ -101,6 +100,13 @@ in
|
||||
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.
|
||||
}
|
||||
];
|
||||
|
||||
# active mode is susceptible to "bounce attacks", without much benefit over passive mode
|
||||
@@ -117,7 +123,7 @@ in
|
||||
banner = ''
|
||||
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"
|
||||
Password: "anonymous"
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ps.passlib ])"
|
||||
#!nix-shell -i python3 -p python3 -p python3.pkgs.passlib
|
||||
# vim: set filetype=python :
|
||||
#
|
||||
# available environment variables:
|
||||
@@ -45,6 +45,8 @@ from hmac import compare_digest
|
||||
|
||||
authFail = dict(username="")
|
||||
|
||||
PERM_DENY = []
|
||||
PERM_LIST = [ "list" ]
|
||||
PERM_RO = [ "list", "download" ]
|
||||
PERM_RW = [
|
||||
# read-only:
|
||||
@@ -127,12 +129,14 @@ def getAuthResponse(ip: str, username: str, password: str) -> dict:
|
||||
return mkAuthOk(username, permissions = {
|
||||
"/": PERM_RW,
|
||||
"/playground": PERM_RW,
|
||||
"/pub": PERM_RO,
|
||||
})
|
||||
if isWireguard(ip):
|
||||
# allow any user from wireguard
|
||||
return mkAuthOk(username, permissions = {
|
||||
"/": PERM_RW,
|
||||
"/playground": PERM_RW,
|
||||
"/pub": PERM_RO,
|
||||
})
|
||||
if isLan(ip):
|
||||
if username == "anonymous":
|
||||
@@ -140,7 +144,19 @@ def getAuthResponse(ip: str, username: str, password: str) -> dict:
|
||||
return mkAuthOk("anonymous", permissions = {
|
||||
"/": PERM_RO,
|
||||
"/playground": PERM_RW,
|
||||
"/pub": 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,
|
||||
"/pub": PERM_RO,
|
||||
# "/README.md": PERM_RO, #< does not work
|
||||
})
|
||||
|
||||
return authFail
|
||||
|
||||
|
@@ -10,6 +10,7 @@
|
||||
# ```
|
||||
|
||||
{ config, lib, pkgs, sane-lib, ... }:
|
||||
lib.mkIf false #< 2024/07/04: i haven't actively used this for months
|
||||
{
|
||||
sops.secrets."freshrss_passwd" = {
|
||||
owner = config.users.users.freshrss.name;
|
||||
|
@@ -38,12 +38,12 @@
|
||||
ROOT_URL = "https://git.uninsane.org/";
|
||||
};
|
||||
service = {
|
||||
# timeout for email approval. 5760 = 4 days
|
||||
ACTIVE_CODE_LIVE_MINUTES = 5760;
|
||||
# timeout for email approval. 5760 = 4 days. 10080 = 7 days
|
||||
ACTIVE_CODE_LIVE_MINUTES = 10080;
|
||||
# REGISTER_EMAIL_CONFIRM = false;
|
||||
# REGISTER_MANUAL_CONFIRM = true;
|
||||
REGISTER_EMAIL_CONFIRM = true;
|
||||
# not sure what this notified on?
|
||||
# not sure what this notifies *on*...
|
||||
ENABLE_NOTIFY_MAIL = true;
|
||||
# defaults to image-based captcha.
|
||||
# also supports recaptcha (with custom URLs) or hCaptcha.
|
||||
@@ -64,8 +64,8 @@
|
||||
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false;
|
||||
};
|
||||
ui = {
|
||||
# options: "auto", "gitea", "arc-green"
|
||||
DEFAULT_THEME = "arc-green";
|
||||
# options: "gitea-auto" (adapt to system theme), "gitea-dark", "gitea-light"
|
||||
# DEFAULT_THEME = "gitea-auto";
|
||||
# cache frontend assets if true
|
||||
# USE_SERVICE_WORKER = true;
|
||||
};
|
||||
@@ -74,9 +74,10 @@
|
||||
# alternative is to use nixos-level config:
|
||||
# services.gitea.mailerPasswordFile = ...
|
||||
ENABLED = true;
|
||||
MAILER_TYPE = "sendmail";
|
||||
FROM = "notify.git@uninsane.org";
|
||||
PROTOCOL = "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 = {
|
||||
# options: ANSIC, UnixDate, RubyDate, RFC822, RFC822Z, RFC850, RFC1123, RFC1123Z, RFC3339, RFC3339Nano, Kitchen, Stamp, StampMilli, StampMicro, StampNano
|
||||
@@ -133,7 +134,7 @@
|
||||
sane.ports.ports."22" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
visibleTo.doof = true;
|
||||
description = "colin-git@git.uninsane.org";
|
||||
};
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
{ lib, pkgs, ... }:
|
||||
{ config, 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?
|
||||
@@ -13,7 +12,7 @@ lib.mkIf false #< TODO: re-enable once confident of sandboxing
|
||||
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
|
||||
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 jackett to listen on the public interfaces
|
||||
# ExecStart = lib.mkForce "${pkgs.jackett}/bin/Jackett --NoUpdates --DataFolder /var/lib/jackett/.config/Jackett --ListenPublic";
|
||||
@@ -25,8 +24,7 @@ lib.mkIf false #< TODO: re-enable once confident of sandboxing
|
||||
enableACME = true;
|
||||
# inherit kTLS;
|
||||
locations."/" = {
|
||||
# proxyPass = "http://ovpns.uninsane.org:9117";
|
||||
proxyPass = "http://10.0.1.6:9117";
|
||||
proxyPass = "http://${config.sane.netns.ovpns.netnsVethIpv4}:9117";
|
||||
recommendedProxySettings = true;
|
||||
};
|
||||
};
|
||||
|
@@ -46,6 +46,7 @@ in {
|
||||
};
|
||||
systemd.services.lemmy.environment = {
|
||||
RUST_BACKTRACE = "full";
|
||||
RUST_LOG = "warn";
|
||||
# RUST_LOG = "debug";
|
||||
# RUST_LOG = "trace";
|
||||
# upstream defaults LEMMY_DATABASE_URL = "postgres:///lemmy?host=/run/postgresql";
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# docs: <https://nixos.wiki/wiki/Matrix>
|
||||
# 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):
|
||||
# - Matrix "pushers" API spec: <https://spec.matrix.org/latest/client-server-api/#post_matrixclientv3pushersset>
|
||||
@@ -24,10 +24,8 @@
|
||||
{ user = "matrix-synapse"; group = "matrix-synapse"; path = "/var/lib/matrix-synapse"; method = "bind"; }
|
||||
];
|
||||
services.matrix-synapse.enable = true;
|
||||
services.matrix-synapse.log.root.level = "WARNING"; # accepts "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL" (?)
|
||||
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";
|
||||
|
||||
# services.matrix-synapse.enable_registration_captcha = true;
|
||||
|
@@ -1,15 +1,13 @@
|
||||
# config docs:
|
||||
# - <https://github.com/matrix-org/matrix-appservice-irc/blob/develop/config.sample.yaml>
|
||||
# probably want to remove that.
|
||||
{ config, lib, ... }:
|
||||
|
||||
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;
|
||||
in {
|
||||
# XXX sasl: appservice doesn't support NickServ identification (only SASL, or PASS if sasl = false)
|
||||
inherit name additionalAddresses sasl port;
|
||||
ssl = true;
|
||||
inherit additionalAddresses name port sasl ssl;
|
||||
botConfig = {
|
||||
# bot has no presence in IRC channel; only real Matrix users
|
||||
enabled = false;
|
||||
@@ -129,6 +127,7 @@ in
|
||||
};
|
||||
|
||||
ircService = {
|
||||
logging.level = "warn"; # "error", "warn", "info", "debug"
|
||||
servers = {
|
||||
"irc.esper.net" = ircServer {
|
||||
name = "esper";
|
||||
@@ -156,6 +155,10 @@ in
|
||||
# - #sxmo-offtopic
|
||||
};
|
||||
"irc.rizon.net" = ircServer { name = "Rizon"; };
|
||||
"wigle.net" = ircServer {
|
||||
name = "WiGLE";
|
||||
ssl = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@@ -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
|
||||
|
@@ -17,7 +17,6 @@ in
|
||||
sane.ports.ports."80" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
visibleTo.ovpns = true; # so that letsencrypt can procure a cert for the mx record
|
||||
visibleTo.doof = true;
|
||||
description = "colin-http-uninsane.org";
|
||||
@@ -25,7 +24,6 @@ in
|
||||
sane.ports.ports."443" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
visibleTo.doof = true;
|
||||
description = "colin-https-uninsane.org";
|
||||
};
|
||||
|
@@ -86,7 +86,7 @@ in
|
||||
sane.ports.ports."${builtins.toString altPort}" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
visibleTo.doof = true;
|
||||
description = "colin-ntfy.uninsane.org";
|
||||
};
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/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 logging
|
||||
|
@@ -47,7 +47,7 @@ in
|
||||
};
|
||||
sane.ntfy-waiter.package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.static-nix-shell.mkPython3Bin {
|
||||
default = pkgs.static-nix-shell.mkPython3 {
|
||||
pname = "ntfy-waiter";
|
||||
srcRoot = ./.;
|
||||
pkgs = [ "ntfy-sh" ];
|
||||
@@ -62,8 +62,8 @@ in
|
||||
sane.ports.ports = lib.mkMerge (lib.forEach portRange (port: {
|
||||
"${builtins.toString port}" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-notification-waiter-${builtins.toString (port - portLow + 1)}-of-${builtins.toString numPorts}";
|
||||
};
|
||||
}));
|
||||
|
@@ -61,42 +61,42 @@ in
|
||||
];
|
||||
sane.ports.ports."5000" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-prosody-fileshare-proxy65";
|
||||
};
|
||||
sane.ports.ports."5222" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-client-to-server";
|
||||
};
|
||||
sane.ports.ports."5223" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpps-client-to-server"; # XMPP over TLS
|
||||
};
|
||||
sane.ports.ports."5269" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.wan = true;
|
||||
visibleTo.doof = true;
|
||||
description = "colin-xmpp-server-to-server";
|
||||
};
|
||||
sane.ports.ports."5270" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.wan = true;
|
||||
visibleTo.doof = true;
|
||||
description = "colin-xmpps-server-to-server"; # XMPP over TLS
|
||||
};
|
||||
sane.ports.ports."5280" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-bosh";
|
||||
};
|
||||
sane.ports.ports."5281" = {
|
||||
protocol = [ "tcp" ];
|
||||
visibleTo.doof = true;
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
description = "colin-xmpp-prosody-https"; # necessary?
|
||||
};
|
||||
|
||||
|
@@ -32,7 +32,7 @@
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://10.0.1.6:5030";
|
||||
proxyPass = "http://${config.sane.netns.ovpns.netnsVethIpv4}:5030";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
@@ -71,7 +71,7 @@
|
||||
systemd.services.slskd.serviceConfig = {
|
||||
# run this behind the OVPN static VPN
|
||||
NetworkNamespacePath = "/run/netns/ovpns";
|
||||
ExecStartPre = [ "${lib.getExe pkgs.sane-scripts.ip-check} --no-upnp --expect 185.157.162.178" ]; # abort if public IP is not as expected
|
||||
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
|
||||
RestartSec = "60s";
|
||||
|
@@ -22,67 +22,19 @@ let
|
||||
--replace-fail 'set(TR_USER_AGENT_PREFIX "''${TR_SEMVER}")' 'set(TR_USER_AGENT_PREFIX "3.00")'
|
||||
'';
|
||||
});
|
||||
download-dir = "/var/media/torrents";
|
||||
torrent-done = pkgs.writeShellApplication {
|
||||
name = "torrent-done";
|
||||
runtimeInputs = with pkgs; [
|
||||
acl
|
||||
coreutils
|
||||
findutils
|
||||
rsync
|
||||
util-linux
|
||||
download-dir = "/var/media/torrents"; #< keep in sync with consts embedded in `torrent-done`
|
||||
torrent-done = pkgs.static-nix-shell.mkBash {
|
||||
pname = "torrent-done";
|
||||
srcRoot = ./.;
|
||||
pkgs = [
|
||||
"acl"
|
||||
"coreutils"
|
||||
"findutils"
|
||||
"rsync"
|
||||
"util-linux"
|
||||
];
|
||||
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
|
||||
lib.mkIf false #< TODO: re-enable once confident of sandboxing
|
||||
{
|
||||
sane.persist.sys.byStore.plaintext = [
|
||||
# TODO: mode? we need this specifically for the stats tracking in .config/
|
||||
@@ -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>
|
||||
|
||||
# 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.
|
||||
rpc-bind-address = "10.0.1.6";
|
||||
# ovpns.netnsVethIpv4 => allow rpc only from the root servo ns. it'll tunnel things to the net, if need be.
|
||||
rpc-bind-address = config.sane.netns.ovpns.netnsVethIpv4;
|
||||
#rpc-host-whitelist = "bt.uninsane.org";
|
||||
#rpc-whitelist = "*.*.*.*";
|
||||
rpc-authentication-required = true;
|
||||
@@ -118,7 +70,7 @@ lib.mkIf false #< TODO: re-enable once confident of sandboxing
|
||||
rpc-whitelist-enabled = false;
|
||||
|
||||
# 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;
|
||||
|
||||
# hopefully, make the downloads world-readable
|
||||
@@ -160,7 +112,7 @@ lib.mkIf false #< TODO: re-enable once confident of sandboxing
|
||||
systemd.services.transmission.serviceConfig = {
|
||||
# run this behind the OVPN static VPN
|
||||
NetworkNamespacePath = "/run/netns/ovpns";
|
||||
ExecStartPre = [ "${lib.getExe pkgs.sane-scripts.ip-check} --no-upnp --expect 185.157.162.178" ]; # abort if public IP is not as expected
|
||||
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";
|
||||
RestartSec = "30s";
|
||||
@@ -190,7 +142,7 @@ lib.mkIf false #< TODO: re-enable once confident of sandboxing
|
||||
# inherit kTLS;
|
||||
locations."/" = {
|
||||
# proxyPass = "http://ovpns.uninsane.org:9091";
|
||||
proxyPass = "http://10.0.1.6:9091";
|
||||
proxyPass = "http://${config.sane.netns.ovpns.netnsVethIpv4}:9091";
|
||||
};
|
||||
};
|
||||
|
76
hosts/by-name/servo/services/transmission/torrent-done
Executable file
76
hosts/by-name/servo/services/transmission/torrent-done
Executable file
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p acl -p bash -p coreutils -p findutils -p rsync -p util-linux
|
||||
|
||||
# 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
|
||||
# - TR_NO_HARDLINK=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 -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"/*)
|
||||
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:
|
||||
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 {} \;
|
||||
|
||||
if ! [ -n "${TR_NO_HARDLINK}" ]; then
|
||||
# dedupe the whole media library.
|
||||
# yeah, a bit excessive: move this to a cron job if that's problematic
|
||||
# or make it run with only 1/N probability, etc.
|
||||
destructive hardlink /var/media --reflink=always --ignore-time --verbose
|
||||
fi
|
@@ -4,14 +4,12 @@
|
||||
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";
|
||||
bindDoof = "10.0.2.5";
|
||||
in
|
||||
{
|
||||
sane.ports.ports."53" = {
|
||||
protocol = [ "udp" "tcp" ];
|
||||
visibleTo.lan = true;
|
||||
visibleTo.wan = true;
|
||||
# visibleTo.wan = true;
|
||||
visibleTo.ovpns = true;
|
||||
visibleTo.doof = true;
|
||||
description = "colin-dns-hosting";
|
||||
@@ -41,6 +39,7 @@ in
|
||||
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;
|
||||
|
||||
@@ -48,9 +47,9 @@ in
|
||||
# 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";
|
||||
A."ns2" = "%ADOOF%";
|
||||
A."ns3" = "%AOVPNS%";
|
||||
A."ovpns" = "%AOVPNS%";
|
||||
NS."@" = [
|
||||
"ns1.uninsane.org."
|
||||
"ns2.uninsane.org."
|
||||
@@ -61,102 +60,91 @@ in
|
||||
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";
|
||||
};
|
||||
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.trust-dns.enable = true;
|
||||
sane.services.trust-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}";
|
||||
"%ANATIVE%" = nativeAddrs."servo.${flavor}";
|
||||
"%AOVPNS%" = "185.157.162.178";
|
||||
};
|
||||
in
|
||||
{
|
||||
wan = {
|
||||
substitutions = mkSubstitutions "wan";
|
||||
doof = {
|
||||
substitutions = mkSubstitutions "doof";
|
||||
listenAddrsIpv4 = [
|
||||
nativeAddrs."servo.lan"
|
||||
bindOvpn
|
||||
bindDoof
|
||||
config.sane.netns.doof.hostVethIpv4
|
||||
config.sane.netns.ovpns.hostVethIpv4
|
||||
];
|
||||
};
|
||||
lan = {
|
||||
substitutions = mkSubstitutions "lan";
|
||||
listenAddrsIpv4 = [ nativeAddrs."servo.lan" ];
|
||||
port = 1053;
|
||||
};
|
||||
hn = {
|
||||
substitutions = mkSubstitutions "hn";
|
||||
listenAddrsIpv4 = [ nativeAddrs."servo.hn" ];
|
||||
port = 1053;
|
||||
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;
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
};
|
||||
# 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;
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
lan = {
|
||||
substitutions = mkSubstitutions "lan";
|
||||
listenAddrsIpv4 = [ nativeAddrs."servo.lan" ];
|
||||
# port = 1053;
|
||||
};
|
||||
# wan = {
|
||||
# substitutions = mkSubstitutions "wan";
|
||||
# listenAddrsIpv4 = [
|
||||
# nativeAddrs."servo.lan"
|
||||
# ];
|
||||
# };
|
||||
};
|
||||
|
||||
sane.services.dyn-dns.restartOnChange = [
|
||||
"trust-dns-wan.service"
|
||||
"trust-dns-lan.service"
|
||||
"trust-dns-doof.service"
|
||||
"trust-dns-hn.service"
|
||||
# "trust-dns-hn-resolver.service" # doesn't need restart because it doesn't know about WAN IP
|
||||
"trust-dns-lan.service"
|
||||
# "trust-dns-wan.service"
|
||||
];
|
||||
}
|
||||
|
@@ -1,14 +1,9 @@
|
||||
# where to find good stuff?
|
||||
# - 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>
|
||||
# - podcast rec 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, ... }:
|
||||
let
|
||||
hourly = { freq = "hourly"; };
|
||||
@@ -80,6 +75,7 @@ let
|
||||
(fromDb "feeds.simplecast.com/wgl4xEgL" // rat) # Econ Talk
|
||||
(fromDb "feeds.simplecast.com/xKJ93w_w" // uncat) # Atlas Obscura
|
||||
(fromDb "feeds.transistor.fm/acquired" // tech)
|
||||
(fromDb "feeds.twit.tv/floss.xml" // tech)
|
||||
(fromDb "fulltimenix.com" // tech)
|
||||
(fromDb "futureofcoding.org/episodes" // tech)
|
||||
(fromDb "hackerpublicradio.org" // tech)
|
||||
@@ -103,6 +99,7 @@ let
|
||||
(fromDb "seattlenice.buzzsprout.com" // pol)
|
||||
(fromDb "srslywrong.com" // pol)
|
||||
(fromDb "sharkbytes.transistor.fm" // tech) # Wireshark Podcast o_0
|
||||
(fromDb "sharptech.fm/feed/podcast" // tech)
|
||||
(fromDb "sscpodcast.libsyn.com" // rat) # Astral Codex Ten
|
||||
(fromDb "talesfromthebridge.buzzsprout.com" // tech) # Sci-Fi? has Peter Watts; author of No Moods, Ads or Cutesy Fucking Icons (rifters.com)
|
||||
(fromDb "theamphour.com" // tech)
|
||||
@@ -135,6 +132,7 @@ let
|
||||
(fromDb "artemis.sh" // tech)
|
||||
(fromDb "ascii.textfiles.com" // tech) # Jason Scott
|
||||
(fromDb "austinvernon.site" // tech)
|
||||
(fromDb "buttondown.email" // tech)
|
||||
(fromDb "ben-evans.com/benedictevans" // pol)
|
||||
(fromDb "bitbashing.io" // tech)
|
||||
(fromDb "bitsaboutmoney.com" // uncat)
|
||||
@@ -196,6 +194,7 @@ let
|
||||
(fromDb "willow.phantoma.online") # wizard@xyzzy.link
|
||||
(fromDb "xn--gckvb8fzb.com" // tech)
|
||||
(fromDb "xorvoid.com" // tech)
|
||||
(fromDb "www.thebignewsletter.com" // pol)
|
||||
(mkSubstack "astralcodexten" // rat // daily) # Scott Alexander
|
||||
(mkSubstack "eliqian" // rat // weekly)
|
||||
(mkSubstack "oversharing" // pol // daily)
|
||||
|
@@ -26,10 +26,6 @@ let
|
||||
# lazyMount: defer mounting until first access from userspace.
|
||||
# see: `man systemd.automount`, `man automount`, `man autofs`
|
||||
lazyMount = noauto ++ automount;
|
||||
wg = [
|
||||
"x-systemd.requires=wireguard-wg-home.service"
|
||||
"x-systemd.after=wireguard-wg-home.service"
|
||||
];
|
||||
|
||||
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)
|
||||
@@ -136,9 +132,9 @@ let
|
||||
device = "ftp://servo-hn:/${subdir}";
|
||||
noCheck = true;
|
||||
fsType = "fuse.curlftpfs";
|
||||
options = fsOpts.ftp ++ fsOpts.noauto ++ fsOpts.wg;
|
||||
options = fsOpts.ftp ++ fsOpts.noauto;
|
||||
# fsType = "nfs";
|
||||
# options = fsOpts.nfs ++ fsOpts.lazyMount ++ fsOpts.wg;
|
||||
# options = fsOpts.nfs ++ fsOpts.lazyMount;
|
||||
};
|
||||
systemd.services."automount-servo-${utils.escapeSystemdPath subdir}" = let
|
||||
fs = config.fileSystems."/mnt/servo/${subdir}";
|
||||
|
@@ -62,6 +62,7 @@
|
||||
sane.ids.clightning.gid = 2419;
|
||||
sane.ids.nix-serve.uid = 2420;
|
||||
sane.ids.nix-serve.gid = 2420;
|
||||
sane.ids.plugdev.gid = 2421;
|
||||
|
||||
sane.ids.colin.uid = 1000;
|
||||
sane.ids.guest.uid = 1100;
|
||||
|
@@ -20,7 +20,7 @@
|
||||
# - 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.
|
||||
# - this is fixed by either removing `/var/run/nscd/socket` from the namespace, or disabling nscd altogether.
|
||||
{ config, lib, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
lib.mkMerge [
|
||||
{
|
||||
sane.services.trust-dns.enable = lib.mkDefault config.sane.services.trust-dns.asSystemResolver;
|
||||
@@ -59,15 +59,35 @@ lib.mkMerge [
|
||||
# in the netns and we query upstream DNS more often than needed. hm.
|
||||
# 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
|
||||
# - files: glibc-builtin
|
||||
# - myhostname: systemd
|
||||
# - mymachines: systemd
|
||||
# - resolve: systemd
|
||||
# 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.
|
||||
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 trust-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`
|
||||
}
|
||||
]
|
||||
|
@@ -14,7 +14,7 @@
|
||||
# after = [ "polkit.service" ];
|
||||
# requires = [ "polkit.service" ];
|
||||
wantedBy = [ "network.target" ]; #< default is `multi-user.target`, somehow it doesn't auto-start with that...
|
||||
# path = [ "/run/current-system/sw" ]; #< so it can find `sanebox`
|
||||
path = [ "/run/current-system/sw" ]; #< so it can find `sanebox`
|
||||
|
||||
# serviceConfig.Type = "dbus";
|
||||
# serviceConfig.BusName = "org.freedesktop.ModemManager1";
|
||||
|
@@ -57,6 +57,7 @@ in
|
||||
"git"
|
||||
"gptfdisk" # gdisk
|
||||
"hdparm"
|
||||
"hping"
|
||||
"htop"
|
||||
"iftop"
|
||||
"inetutils" # for telnet
|
||||
@@ -151,7 +152,7 @@ in
|
||||
# "ponymix"
|
||||
"pulsemixer"
|
||||
"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
|
||||
"rsync"
|
||||
"sane-scripts.bittorrent"
|
||||
@@ -175,8 +176,12 @@ in
|
||||
# "gh" # MS GitHub cli
|
||||
"nix-index"
|
||||
"nixpkgs-review"
|
||||
"qmk-udev-rules"
|
||||
"sane-scripts.dev"
|
||||
"sequoia"
|
||||
# "via"
|
||||
"wally-cli"
|
||||
# "zsa-udev-rules"
|
||||
];
|
||||
|
||||
consoleMediaUtils = declPackageSet [
|
||||
@@ -276,28 +281,28 @@ in
|
||||
# "gnome.cheese"
|
||||
# "gnome-feeds" # RSS reader (with claimed mobile support)
|
||||
# "gnome.file-roller"
|
||||
"gnome.geary" # adaptive e-mail client; uses webkitgtk 4.1
|
||||
"gnome.gnome-calculator"
|
||||
"gnome.gnome-calendar"
|
||||
"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"
|
||||
# "gnome.seahorse" # keyring/secret manager
|
||||
# "seahorse" # keyring/secret manager
|
||||
"gnome-frog" # OCR/QR decoder
|
||||
"gpodder"
|
||||
"gst-device-monitor" # for debugging audio/video
|
||||
# "gst-device-monitor" # for debugging audio/video
|
||||
# "gthumb"
|
||||
# "lemoa" # lemmy app
|
||||
"libcamera" # for `cam` binary (useful for debugging cameras)
|
||||
# "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
|
||||
# "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
|
||||
@@ -307,7 +312,7 @@ in
|
||||
# "picard" # music tagging
|
||||
# "libsForQt5.plasmatube" # Youtube player
|
||||
"signal-desktop"
|
||||
"snapshot" # camera app
|
||||
# "snapshot" # camera app
|
||||
"spot" # Gnome Spotify client
|
||||
# "sublime-music"
|
||||
# "tdesktop" # broken on phosh
|
||||
@@ -322,7 +327,7 @@ in
|
||||
handheldGuiApps = declPackageSet [
|
||||
# "celluloid" # mpv frontend
|
||||
# "chatty" # matrix/xmpp/irc client (2023/12/29: disabled because broken cross build)
|
||||
"cozy" # audiobook player
|
||||
# "cozy" # audiobook player
|
||||
"epiphany" # gnome's web browser
|
||||
# "iotas" # note taking app
|
||||
"komikku"
|
||||
@@ -348,7 +353,7 @@ in
|
||||
# "chromium" # chromium takes hours to build. brave is chromium-based, distributed in binary form, so prefer it.
|
||||
# "cups"
|
||||
"discord" # x86-only
|
||||
"electrum"
|
||||
# "electrum"
|
||||
"element-desktop"
|
||||
"firefox"
|
||||
"font-manager"
|
||||
@@ -356,13 +361,14 @@ in
|
||||
"gimp" # broken on phosh
|
||||
# "gnome.dconf-editor"
|
||||
# "gnome.file-roller"
|
||||
"gnome.gnome-disk-utility"
|
||||
"gnome.nautilus" # file browser
|
||||
"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?
|
||||
@@ -394,6 +400,12 @@ in
|
||||
|
||||
backblaze-b2 = {};
|
||||
|
||||
bitcoind.sandbox.method = "bwrap";
|
||||
bitcoind.sandbox.extraHomePaths = [
|
||||
".config/bitcoin/bitcoin.conf"
|
||||
];
|
||||
bitcoind.sandbox.net = "all"; # actually needs only localhost
|
||||
|
||||
blanket.buildCost = 1;
|
||||
blanket.sandbox.method = "bwrap";
|
||||
blanket.sandbox.whitelistAudio = true;
|
||||
@@ -422,6 +434,16 @@ in
|
||||
|
||||
clang = {};
|
||||
|
||||
clightning.sandbox.method = "bwrap";
|
||||
clightning.sandbox.extraHomePaths = [
|
||||
".lightning/bitcoin/lightning-rpc"
|
||||
];
|
||||
|
||||
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.sandbox.method = "landlock";
|
||||
cryptsetup.sandbox.extraPaths = [
|
||||
@@ -574,10 +596,6 @@ in
|
||||
gawk.sandbox.wrapperType = "inplace"; # /share/gawk libraries refer to /libexec
|
||||
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 = {};
|
||||
|
||||
# MS GitHub stores auth token in .config
|
||||
@@ -604,32 +622,37 @@ in
|
||||
"/tmp" # "Cannot open display:" if it can't mount /tmp 👀
|
||||
];
|
||||
|
||||
"gnome.gnome-calculator".buildCost = 1;
|
||||
"gnome.gnome-calculator".sandbox.method = "bwrap";
|
||||
"gnome.gnome-calculator".sandbox.whitelistWayland = true;
|
||||
gnome-calculator.buildCost = 1;
|
||||
gnome-calculator.sandbox.method = "bwrap";
|
||||
gnome-calculator.sandbox.whitelistWayland = true;
|
||||
|
||||
"gnome.gnome-calendar".buildCost = 1;
|
||||
gnome-calendar.buildCost = 1;
|
||||
# gnome-calendar surely has data to persist, but i use it strictly to do date math, not track events.
|
||||
"gnome.gnome-calendar".sandbox.method = "bwrap";
|
||||
"gnome.gnome-calendar".sandbox.whitelistWayland = true;
|
||||
gnome-calendar.sandbox.method = "bwrap";
|
||||
gnome-calendar.sandbox.whitelistWayland = true;
|
||||
|
||||
# gnome-disks
|
||||
"gnome.gnome-disk-utility".buildCost = 1;
|
||||
"gnome.gnome-disk-utility".sandbox.method = "bwrap";
|
||||
"gnome.gnome-disk-utility".sandbox.whitelistDbus = [ "system" ];
|
||||
"gnome.gnome-disk-utility".sandbox.whitelistWayland = true;
|
||||
"gnome.gnome-disk-utility".sandbox.extraHomePaths = [
|
||||
gnome-disk-utility.buildCost = 1;
|
||||
gnome-disk-utility.sandbox.method = "bwrap";
|
||||
gnome-disk-utility.sandbox.whitelistDbus = [ "system" ];
|
||||
gnome-disk-utility.sandbox.whitelistWayland = true;
|
||||
gnome-disk-utility.sandbox.extraHomePaths = [
|
||||
"tmp"
|
||||
"use/iso"
|
||||
# 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.
|
||||
"gnome.seahorse".buildCost = 1;
|
||||
# N.B.: it can also manage ~/.ssh keys, but i explicitly don't add those to the sandbox for now.
|
||||
"gnome.seahorse".sandbox.method = "bwrap";
|
||||
"gnome.seahorse".sandbox.whitelistDbus = [ "user" ];
|
||||
"gnome.seahorse".sandbox.whitelistWayland = true;
|
||||
seahorse.buildCost = 1;
|
||||
# N.B. it can lso manage ~/.ssh keys, but i explicitly don't add those to the sandbox for now.
|
||||
seahorse.sandbox.method = "bwrap";
|
||||
seahorse.sandbox.whitelistDbus = [ "user" ];
|
||||
seahorse.sandbox.whitelistWayland = true;
|
||||
|
||||
gnome-2048.buildCost = 1;
|
||||
gnome-2048.sandbox.method = "bwrap";
|
||||
@@ -819,7 +842,10 @@ in
|
||||
mercurial.sandbox.net = "clearnet";
|
||||
mercurial.sandbox.whitelistPwd = true;
|
||||
|
||||
mesa-demos = {};
|
||||
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)
|
||||
monero-gui.buildCost = 1;
|
||||
@@ -949,7 +975,9 @@ in
|
||||
|
||||
python3-repl.packageUnwrapped = pkgs.python3.withPackages (ps: with ps; [
|
||||
psutil
|
||||
pykakasi
|
||||
requests
|
||||
unidecode
|
||||
]);
|
||||
python3-repl.sandbox.method = "bwrap";
|
||||
python3-repl.sandbox.net = "clearnet";
|
||||
@@ -1023,7 +1051,9 @@ in
|
||||
"Music"
|
||||
"tmp"
|
||||
"use"
|
||||
".config/dconf"
|
||||
];
|
||||
soundconverter.sandbox.whitelistDbus = [ "user" ]; # for dconf
|
||||
soundconverter.sandbox.extraPaths = [
|
||||
"/mnt/servo/media/Music"
|
||||
"/mnt/servo/media/games"
|
||||
@@ -1103,9 +1133,6 @@ in
|
||||
valgrind.buildCost = 1;
|
||||
valgrind.sandbox.enable = false; #< it's a launcher: can't sandbox
|
||||
|
||||
visidata.sandbox.method = "bwrap"; # TODO:sandbox: untested
|
||||
visidata.sandbox.autodetectCliPaths = true;
|
||||
|
||||
# `vulkaninfo`, `vkcube`
|
||||
vulkan-tools.sandbox.method = "landlock";
|
||||
|
||||
@@ -1163,8 +1190,6 @@ in
|
||||
yt-dlp.sandbox.method = "bwrap"; # TODO:sandbox: untested
|
||||
yt-dlp.sandbox.net = "all";
|
||||
yt-dlp.sandbox.whitelistPwd = true; # saves to pwd by default
|
||||
|
||||
zfs = {};
|
||||
};
|
||||
|
||||
sane.persist.sys.byStore.plaintext = lib.mkIf config.sane.programs.guiApps.enabled [
|
||||
@@ -1181,13 +1206,12 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
hardware.opengl = lib.mkIf config.sane.programs.guiApps.enabled ({
|
||||
hardware.graphics = lib.mkIf config.sane.programs.guiApps.enabled ({
|
||||
enable = true;
|
||||
driSupport = lib.mkDefault true;
|
||||
} // (lib.optionalAttrs pkgs.stdenv.isx86_64 {
|
||||
# for 32 bit applications
|
||||
# upstream nixpkgs forbids setting driSupport32Bit unless specifically x86_64 (so aarch64 isn't allowed)
|
||||
driSupport32Bit = lib.mkDefault true;
|
||||
# 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 {
|
||||
|
42
hosts/common/programs/avahi.nix
Normal file
42
hosts/common/programs/avahi.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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, ... }:
|
||||
{
|
||||
sane.programs.avahi = {
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistDbus = [ "system" ];
|
||||
sandbox.net = "all"; #< otherwise it will show 'null' in place of each interface name.
|
||||
sandbox.extraPaths = [
|
||||
"/" #< else the daemon exits immediately. TODO: decrease this scope.
|
||||
];
|
||||
};
|
||||
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
|
||||
"lo"
|
||||
"wg-home"
|
||||
"wlan0" #< moby
|
||||
"wlp3s0" #< lappy
|
||||
"wlp4s0" #< desko
|
||||
];
|
||||
};
|
||||
}
|
@@ -95,7 +95,7 @@ in
|
||||
|
||||
packageUnwrapped = pkgs.bemenu.overrideAttrs (upstream: {
|
||||
nativeBuildInputs = (upstream.nativeBuildInputs or []) ++ [
|
||||
pkgs.makeWrapper
|
||||
pkgs.makeBinaryWrapper
|
||||
];
|
||||
# can alternatively be specified as CLI flags
|
||||
postInstall = (upstream.postInstall or "") + ''
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/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 :
|
||||
|
||||
import logging
|
||||
|
@@ -31,7 +31,7 @@ in
|
||||
|
||||
sane.programs.blast-to-default = {
|
||||
# helper to deal with blast's interactive CLI
|
||||
packageUnwrapped = pkgs.static-nix-shell.mkPython3Bin {
|
||||
packageUnwrapped = pkgs.static-nix-shell.mkPython3 {
|
||||
pname = "blast-to-default";
|
||||
pkgs = [ "blast-ugjka" ];
|
||||
srcRoot = ./.;
|
||||
|
@@ -111,7 +111,7 @@ in
|
||||
'';
|
||||
});
|
||||
|
||||
fs.".config/bonsai/bonsai_tree.json".symlink.text = builtins.toJSON cfg.config.transitions;
|
||||
fs.".config/bonsai/bonsai_tree.json".symlink.target = pkgs.writers.writeJSON "bonsai_tree.json" cfg.config.transitions;
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.extraRuntimePaths = [
|
||||
|
@@ -13,7 +13,7 @@
|
||||
sane.programs.callaudiod = {
|
||||
packageUnwrapped = pkgs.rmDbusServices pkgs.callaudiod;
|
||||
|
||||
# probably more needed once i enable proper sandboxing, but for now this ensures the service isn't started too early!
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistAudio = true;
|
||||
sandbox.whitelistDbus = [ "user" ];
|
||||
|
||||
|
@@ -24,7 +24,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
packageUnwrapped = pkgs.calls.overrideAttrs (upstream: {
|
||||
packageUnwrapped = pkgs.rmDbusServicesInPlace (pkgs.calls.overrideAttrs (upstream: {
|
||||
patches = (upstream.patches or []) ++ [
|
||||
(pkgs.fetchpatch {
|
||||
# usability improvement... if the UI is visible, then i can receive calls. otherwise, i can't!
|
||||
@@ -33,10 +33,10 @@ in
|
||||
hash = "sha256-NoVQV2TlkCcsBt0uwSyK82hBKySUW4pADrJVfLFvWgU=";
|
||||
})
|
||||
];
|
||||
});
|
||||
}));
|
||||
|
||||
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.whitelistDbus = [ "user" ]; # necessary for secrets, at the minimum
|
||||
sandbox.whitelistWayland = true;
|
||||
|
@@ -66,6 +66,7 @@ end
|
||||
if vars.percent ~= nil then
|
||||
bat_args = bat_args .. " --percent-suffix '" .. vars.percent .. "'"
|
||||
end
|
||||
bat_args = bat_args .. " {bat}"
|
||||
|
||||
-- N.B.: `[[ <text> ]]` is Lua's multiline string literal
|
||||
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}
|
||||
|
||||
|
||||
${color1}${shadecolor}${font sans-serif:size=22:style=Bold}${alignc}${execp @bat@ ]] .. bat_args .. [[ }${font}
|
||||
${color1}${shadecolor}${font sans-serif:size=20:style=Bold}${alignc}${texeci 600 @weather@ }${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 timeout 20 sane-weather }${font}
|
||||
|
||||
|
||||
${color2}${shadecolor a4d7d0}${font sans-serif:size=16}${alignc}⇅ ${downspeedf wlan0}]] .. vars.kBps .. [[${font}
|
||||
|
@@ -5,22 +5,18 @@
|
||||
sandbox.net = "clearnet"; #< for the scripts it calls (weather)
|
||||
sandbox.extraPaths = [
|
||||
"/sys/class/power_supply"
|
||||
"/sys/devices" # needed by sane-sysinfo
|
||||
"/sys/devices" # needed by sane-sysload
|
||||
# "/sys/devices/cpu"
|
||||
# "/sys/devices/system"
|
||||
];
|
||||
sandbox.whitelistWayland = true;
|
||||
|
||||
suggestedPrograms = [
|
||||
"sane-sysinfo"
|
||||
"sane-sysload"
|
||||
"sane-weather"
|
||||
];
|
||||
|
||||
fs.".config/conky/conky.conf".symlink.target = pkgs.substituteAll {
|
||||
src = ./conky.conf;
|
||||
bat = "sane-sysinfo";
|
||||
weather = "timeout 20 sane-weather";
|
||||
};
|
||||
fs.".config/conky/conky.conf".symlink.target = ./conky.conf;
|
||||
|
||||
services.conky = {
|
||||
description = "conky dynamic desktop background";
|
||||
|
@@ -10,6 +10,7 @@
|
||||
./assorted.nix
|
||||
./audacity.nix
|
||||
./ausyscall.nix
|
||||
./avahi.nix
|
||||
./bemenu.nix
|
||||
./blast-ugjka
|
||||
./bonsai.nix
|
||||
@@ -50,8 +51,11 @@
|
||||
./fwupd.nix
|
||||
./g4music.nix
|
||||
./gajim.nix
|
||||
./gdb.nix
|
||||
./gdbus.nix
|
||||
./geary.nix
|
||||
./geoclue-demo-agent.nix
|
||||
./geoclue2.nix
|
||||
./git.nix
|
||||
./gnome-clocks.nix
|
||||
./gnome-feeds.nix
|
||||
@@ -60,6 +64,8 @@
|
||||
./gnome-weather.nix
|
||||
./go2tv.nix
|
||||
./gpodder.nix
|
||||
./gpsd.nix
|
||||
./gps-share.nix
|
||||
./grimshot.nix
|
||||
./gst-device-monitor.nix
|
||||
./gthumb.nix
|
||||
@@ -67,9 +73,11 @@
|
||||
./handbrake.nix
|
||||
./helix.nix
|
||||
./htop
|
||||
./iio-sensor-proxy.nix
|
||||
./imagemagick.nix
|
||||
./jellyfin-media-player.nix
|
||||
./kdenlive.nix
|
||||
./keymapp.nix
|
||||
./komikku.nix
|
||||
./koreader
|
||||
./less.nix
|
||||
@@ -87,6 +95,7 @@
|
||||
./msmtp.nix
|
||||
./nautilus.nix
|
||||
./neovim.nix
|
||||
./networkmanager_dmenu
|
||||
./newsflash.nix
|
||||
./nheko.nix
|
||||
./nicotine-plus.nix
|
||||
@@ -98,13 +107,17 @@
|
||||
./objdump.nix
|
||||
./obsidian.nix
|
||||
./offlineimap.nix
|
||||
./ols.nix
|
||||
./open-in-mpv.nix
|
||||
./pactl.nix
|
||||
./pidof.nix
|
||||
./pipewire.nix
|
||||
./pkill.nix
|
||||
./planify.nix
|
||||
./portfolio-filemanager.nix
|
||||
./playerctl.nix
|
||||
./ps.nix
|
||||
./qmk-udev-rules.nix
|
||||
./rhythmbox.nix
|
||||
./ripgrep.nix
|
||||
./rofi
|
||||
@@ -114,9 +127,10 @@
|
||||
./sane-open.nix
|
||||
./sane-screenshot.nix
|
||||
./sane-scripts.nix
|
||||
./sane-sysinfo.nix
|
||||
./sane-sysload.nix
|
||||
./sane-theme.nix
|
||||
./sanebox.nix
|
||||
./satellite.nix
|
||||
./schlock.nix
|
||||
./seatd.nix
|
||||
./sfeed.nix
|
||||
@@ -136,14 +150,18 @@
|
||||
./swaylock.nix
|
||||
./swaynotificationcenter
|
||||
./switchboard.nix
|
||||
./sysvol.nix
|
||||
./syshud.nix
|
||||
./tangram.nix
|
||||
./tor-browser.nix
|
||||
./tuba.nix
|
||||
./unl0kr
|
||||
./via.nix
|
||||
./visidata.nix
|
||||
./vlc.nix
|
||||
./wally-cli.nix
|
||||
./waybar
|
||||
./waylock.nix
|
||||
./where-am-i.nix
|
||||
./wike.nix
|
||||
./wine.nix
|
||||
./wireplumber.nix
|
||||
@@ -159,6 +177,8 @@
|
||||
./zeal.nix
|
||||
./zecwallet-lite.nix
|
||||
./zulip.nix
|
||||
./zsa-udev-rules.nix
|
||||
./zfs-tools.nix
|
||||
./zsh
|
||||
];
|
||||
|
||||
|
@@ -50,32 +50,13 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
packageUnwrapped = (pkgs.dino.override {
|
||||
packageUnwrapped = pkgs.dino.override {
|
||||
# XXX(2024/04/24): build without echo cancelation (i.e. force WITH_VOICE_PROCESSOR to be undefined).
|
||||
# this means that if the other end of the call is on speaker phone, i'm liable to hear my own voice
|
||||
# leave their speaker, enter their mic, and then return to me.
|
||||
# the benefit is a >50% reduction in CPU use. insignificant on any modern PC; make-or-break on a low-power Pinephone.
|
||||
webrtc-audio-processing = null;
|
||||
}).overrideAttrs (upstream: {
|
||||
# i'm updating experimentally to see if it improves call performance.
|
||||
# i don't *think* this is actually necessary; i don't notice any difference.
|
||||
version = "0.4.3-unstable-2024-04-28";
|
||||
src = lib.warnIf (lib.versionOlder "0.4.3" upstream.version) "dino update: safe to remove sane patches" pkgs.fetchFromGitHub {
|
||||
owner = "dino";
|
||||
repo = "dino";
|
||||
rev = "657502955567dd538e56f300e075c7db52e25d74";
|
||||
hash = "sha256-SApJy9FgxxLOB5A/zGtpdFZtSqSiS03vggRrCte1tFE=";
|
||||
};
|
||||
# avoid double-application of upstreamed patches
|
||||
# https://github.com/NixOS/nixpkgs/pull/309265
|
||||
patches = [];
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
./xmpp-vala-test
|
||||
# ./signal-protocol-vala-test # doesn't exist anymore
|
||||
runHook postCheck
|
||||
'';
|
||||
});
|
||||
};
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.net = "clearnet";
|
||||
|
@@ -6,6 +6,17 @@ in
|
||||
sane.programs.eg25-control = {
|
||||
suggestedPrograms = [ "mmcli" ];
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.extraPaths = [
|
||||
"/sys/class/modem-power"
|
||||
"/sys/devices"
|
||||
# "/var/lib/eg25-control"
|
||||
];
|
||||
sandbox.net = "all"; #< for downloading the almanac
|
||||
sandbox.whitelistDbus = [
|
||||
"system" #< used by `mmcli`
|
||||
];
|
||||
|
||||
services.eg25-control-powered = {
|
||||
description = "eg25-control-powered: power to the Qualcomm eg25 modem used by PinePhone";
|
||||
startCommand = "eg25-control --power-on --verbose";
|
||||
|
@@ -55,7 +55,7 @@ in
|
||||
# - theme-demo
|
||||
# - timeout-completed
|
||||
# - window-close
|
||||
fs.".config/feedbackd/themes/proxied.json".symlink.text = builtins.toJSON {
|
||||
fs.".config/feedbackd/themes/proxied.json".symlink.target = pkgs.writers.writeJSON "proxied.json" {
|
||||
name = "proxied";
|
||||
parent-theme = "default";
|
||||
profiles = [
|
||||
|
13
hosts/common/programs/gdb.nix
Normal file
13
hosts/common/programs/gdb.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
sane.programs.gdb = {
|
||||
sandbox.enable = false; # gdb doesn't sandbox well. i don't know how you could.
|
||||
# sandbox.method = "landlock"; # permission denied when trying to attach, even as root
|
||||
sandbox.autodetectCliPaths = true;
|
||||
fs.".config/gdb/gdbinit".symlink.text = ''
|
||||
# enable commands like `py-bt`, `py-list`, etc.
|
||||
# for usage, see: <https://wiki.python.org/moin/DebuggingWithGdb>
|
||||
source ${pkgs.python3}/share/gdb/libpython.py
|
||||
'';
|
||||
};
|
||||
}
|
@@ -5,10 +5,10 @@
|
||||
# <https://gitlab.gnome.org/GNOME/geary/-/issues/1212>
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.sane.programs."gnome.geary";
|
||||
cfg = config.sane.programs."geary";
|
||||
in
|
||||
{
|
||||
sane.programs."gnome.geary" = {
|
||||
sane.programs."geary" = {
|
||||
configOption = with lib; mkOption {
|
||||
default = {};
|
||||
type = types.submodule {
|
||||
|
23
hosts/common/programs/geoclue-demo-agent.nix
Normal file
23
hosts/common/programs/geoclue-demo-agent.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
sane.programs.geoclue-demo-agent = {
|
||||
packageUnwrapped = pkgs.linkFarm "geoclue-demo-agent" [{
|
||||
# bring the demo agent into a `bin/` directory so it can be invokable via PATH
|
||||
name = "bin/geoclue-demo-agent";
|
||||
path = "${config.sane.programs.geoclue2.packageUnwrapped}/libexec/geoclue-2.0/demos/agent";
|
||||
}];
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistDbus = [
|
||||
"system"
|
||||
];
|
||||
|
||||
services.geoclue-agent = {
|
||||
description = "geoclue 'demo' agent";
|
||||
# XXX: i don't actually understand how this works: upstream dbus rules would appear to restrict
|
||||
# the dbus owner to just root/geoclue, but we're neither and this still works (and breaks if i remove the agent service!)
|
||||
command = "geoclue-demo-agent";
|
||||
partOf = [ "graphical-session" ];
|
||||
};
|
||||
};
|
||||
}
|
76
hosts/common/programs/geoclue2.nix
Normal file
76
hosts/common/programs/geoclue2.nix
Normal file
@@ -0,0 +1,76 @@
|
||||
# geoclue location services daemon.
|
||||
#
|
||||
# SUPPORT:
|
||||
# - irc: #gnome-maps on irc.gimp.org
|
||||
# - Matrix: #gnome-maps:gnome.org (unclear if bridged to IRC)
|
||||
# - forums: <https://discourse.gnome.org/c/platform>
|
||||
# - git: <https://gitlab.freedesktop.org/geoclue/geoclue/>
|
||||
# - D-Bus API docs: <https://www.freedesktop.org/software/geoclue/docs/>
|
||||
#
|
||||
# HOW TO TEST:
|
||||
# - just invoke `where-am-i`: it should output the current latitude/longitude.
|
||||
## more manual testing:
|
||||
# - build `geoclue2-with-demo-agent`
|
||||
# - run the service: `systemctl start geoclue` or "${geoclue2-with-demo-agent}/libexec/geoclue"
|
||||
# - run "${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/agent"
|
||||
# - keep this running in the background
|
||||
# - run "${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/where-am-i"
|
||||
#
|
||||
# DATA FLOW:
|
||||
# - geoclue2 does http calls into local `ols`, which either hits the local disk or queries https://wigle.net.
|
||||
# - geoclue users like gnome-maps somehow depend on an "agent",
|
||||
# a user service which launches the geoclue system service on-demand (via dbus activation).
|
||||
#
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.geoclue2;
|
||||
in
|
||||
{
|
||||
sane.programs.geoclue2 = {
|
||||
# packageUnwrapped = pkgs.rmDbusServices pkgs.geoclue2;
|
||||
# packageUnwrapped = pkgs.geoclue2.override { withDemoAgent = true; };
|
||||
packageUnwrapped = pkgs.geoclue2-with-demo-agent;
|
||||
suggestedPrograms = [
|
||||
"avahi" #< to discover LAN gps devices
|
||||
"geoclue-demo-agent"
|
||||
# "gps-share"
|
||||
"iio-sensor-proxy"
|
||||
"ols" #< WiFi SSID -> lat/long lookups
|
||||
"satellite" #< graphical view into GPS fix data
|
||||
"where-am-i" #< handy debugging/testing tool
|
||||
];
|
||||
|
||||
# XXX(2024/07/05): no way to plumb my sandboxed geoclue into `services.geoclue2`.
|
||||
# then, the package doesn't get used directly anywhere. but other programs reference `packageUnwrapped`,
|
||||
# so keep that part still.
|
||||
sandbox.enable = false;
|
||||
package = lib.mkForce null;
|
||||
|
||||
# experimental sandboxing (2024/07/05)
|
||||
# sandbox.method = "bwrap";
|
||||
# sandbox.whitelistDbus = [
|
||||
# "system"
|
||||
# ];
|
||||
# sandbox.net = "all";
|
||||
};
|
||||
|
||||
# sane.programs.geoclue2.enableFor.system = lib.mkIf (builtins.any (en: en) (builtins.attrValues cfg.enableFor.user)) true;
|
||||
|
||||
services.geoclue2 = lib.mkIf cfg.enabled {
|
||||
enable = true;
|
||||
geoProviderUrl = "http://127.0.0.1:8088/v1/geolocate"; #< ols
|
||||
# XXX(2024/06/25): when Geoclue uses ModemManager's GPS API, it wants to enable GPS
|
||||
# tracking at the start, and disable it at the end. that causes tracking to be lost, regularly.
|
||||
# this is not optional behavior: if Geoclue fails to control modem manager (because of a polkit policy, say),
|
||||
# then it won't even try to read the data from modem manager.
|
||||
# SOLUTION: tell Geoclue to get GPS from gps-share ("enableNmea", i.e. `network-nmea.enable`)
|
||||
# and NOT from modem manager.
|
||||
enableModemGPS = false;
|
||||
enableNmea = true;
|
||||
};
|
||||
systemd.user.services = lib.mkIf cfg.enabled {
|
||||
# nixos services.geoclue2 runs the agent as a user service by default, but i don't use systemd so that doesn't work.
|
||||
# i manage the agent myself, in sane.programs.geoclue-demo-agent.
|
||||
geoclue-agent.enable = false;
|
||||
};
|
||||
}
|
@@ -40,6 +40,7 @@ in
|
||||
alias.amend = "commit --amend --no-edit";
|
||||
alias.br = "branch";
|
||||
alias.co = "checkout";
|
||||
alias.com = "commit";
|
||||
alias.cp = "cherry-pick";
|
||||
alias.d = "difftool";
|
||||
alias.dif = "diff"; # common typo
|
||||
|
@@ -1,12 +1,12 @@
|
||||
# gnome feeds RSS viewer
|
||||
{ config, lib, sane-lib, ... }:
|
||||
{ config, lib, pkgs, sane-lib, ... }:
|
||||
|
||||
let
|
||||
feeds = sane-lib.feeds;
|
||||
all-feeds = config.sane.feeds;
|
||||
wanted-feeds = feeds.filterByFormat ["text" "image"] all-feeds;
|
||||
in {
|
||||
sane.programs.gnome-feeds.fs.".config/org.gabmus.gfeeds.json".symlink.text = builtins.toJSON {
|
||||
sane.programs.gnome-feeds.fs.".config/org.gabmus.gfeeds.json".symlink.target = pkgs.writers.writeJSON "org.gabmus.gfeeds.json" {
|
||||
# feed format is a map from URL to a dict,
|
||||
# with dict["tags"] a list of string tags.
|
||||
feeds = sane-lib.mapToAttrs (feed: {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
sane.programs.gnome-keyring = {
|
||||
packageUnwrapped = pkgs.rmDbusServices pkgs.gnome.gnome-keyring;
|
||||
packageUnwrapped = pkgs.rmDbusServices pkgs.gnome-keyring;
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistDbus = [ "user" ];
|
||||
sandbox.extraRuntimePaths = [
|
||||
|
@@ -1,7 +1,30 @@
|
||||
# SUPPORT:
|
||||
# - irc: #gnome-maps on irc.gimp.org
|
||||
# - Matrix: #gnome-maps:gnome.org (unclear if bridged to IRC)
|
||||
#
|
||||
# INTEGRATIONS:
|
||||
# - uses https://graphhopper.com for routing
|
||||
# - <https://github.com/graphhopper/graphhopper> (not packaged for Nix)
|
||||
# - uses https://tile.openstreetmap.org for tiles
|
||||
# - uses https://overpass-api.de for ... ?
|
||||
# TIPS:
|
||||
# - use "Northwest" instead of "NW", and "Street" instead of "St", etc.
|
||||
# otherwise, it might not find your destination!
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
sane.programs."gnome.gnome-maps" = {
|
||||
packageUnwrapped = pkgs.rmDbusServices pkgs.gnome.gnome-maps;
|
||||
packageUnwrapped = pkgs.rmDbusServicesInPlace (pkgs.gnome.gnome-maps.overrideAttrs (base: {
|
||||
# default .desktop file is trying to do some dbus launch (?) which fails even *if* i install `gapplication` (glib.bin)
|
||||
postPatch = (base.postPatch or "") + ''
|
||||
substituteInPlace data/org.gnome.Maps.desktop.in.in \
|
||||
--replace-fail 'Exec=gapplication launch @app-id@ %U' 'Exec=gnome-maps %U'
|
||||
'';
|
||||
}));
|
||||
suggestedPrograms = [
|
||||
"geoclue2"
|
||||
];
|
||||
|
||||
sandbox.wrapperType = "inplace"; #< /share directory contains Gir info which references libgnome-maps.so by path
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistDri = true; # for perf
|
||||
sandbox.whitelistDbus = [
|
||||
|
56
hosts/common/programs/gps-share.nix
Normal file
56
hosts/common/programs/gps-share.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
# gps-share: <https://github.com/zeenix/gps-share>
|
||||
# takes a local GPS device (e.g. /dev/ttyUSB1) and makes it available over TCP/Avahi (multicast DNS).
|
||||
#
|
||||
# common usecases:
|
||||
# 1. make positioning available to any device on a network, even if that device has no local GPS
|
||||
# - e.g. my desktop can use my phone's GPS device, if on the same network.
|
||||
# 2. allow multiple clients to share a GPS device.
|
||||
# GPS devices are serial devices, and so only one process can consume the data at a time.
|
||||
# gps-share can camp the serial device, and then allow *multiple* subscribers
|
||||
# 3. provide a *read-only* API to clients like Geoclue.
|
||||
# that is, expose the GPS device *output* to a client, but don't let the client write to the device (e.g. enable/disable the GPS).
|
||||
# this is the primary function i derive from gps-share
|
||||
#
|
||||
# HOW TO TEST:
|
||||
# - `nc localhost 10110`
|
||||
# should stream GPS NMEA output to the console
|
||||
# - `avahi-browse --resolve _nmea-0183._tcp`: should show hosts on the local network which provide GPS info
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.gps-share;
|
||||
in
|
||||
{
|
||||
sane.programs.gps-share = {
|
||||
suggestedPrograms = [
|
||||
"jq"
|
||||
# and systemd, for udevadm
|
||||
];
|
||||
services.gps-share = {
|
||||
description = "gps-share: make local GPS serial readings available over Avahi";
|
||||
# usage:
|
||||
# gps-share --no-announce # to disable Avahi
|
||||
# gps-share --no-tcp # only makes sense if using --socket-path
|
||||
# gps-share --network-interface lo # defaults to all interfaces, but firewalling means actually more restrictive
|
||||
# gps-share --socket-path $XDG_RUNTIME_DIR/gps-share/gps-share.sock # share over a unix socket
|
||||
command = pkgs.writeShellScript "gps-share" ''
|
||||
dev=$(udevadm info --property-match=ID_MM_PORT_TYPE_GPS=1 --json=pretty --export-db | jq -r .DEVNAME)
|
||||
if [ -z "$dev" ]; then
|
||||
echo "no GPS device found"
|
||||
exit 1
|
||||
fi
|
||||
echo "using $dev for GPS NMEA"
|
||||
gps-share "$dev"
|
||||
'';
|
||||
# TODO: this should be `partOf = [ "gps" ]`:
|
||||
# it fails to launch if the NMEA device doesn't yet exist, and so restart loop when modem is not booted
|
||||
dependencyOf = [ "geoclue-agent" ];
|
||||
};
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.net = "all";
|
||||
sandbox.autodetectCliPaths = "existingFile";
|
||||
};
|
||||
|
||||
# TODO: restrict this to just LAN devices!!
|
||||
networking.firewall.allowedTCPPorts = lib.mkIf cfg.enabled [ 10110 ];
|
||||
}
|
33
hosts/common/programs/gpsd.nix
Normal file
33
hosts/common/programs/gpsd.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
# test gpsd with `gpspipe -w -n 10 2> /dev/null | grep -m 1 TPV | jq '.lat, .lon' | tr '\n' ' '`
|
||||
# ^ should return <lat> <long>
|
||||
#
|
||||
# TODO(2024/06/19): nixpkgs' gpsd service isn't sandboxed at ALL. i should sandbox that, or remove this integration.
|
||||
#
|
||||
# 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.
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.gpsd;
|
||||
in
|
||||
{
|
||||
sane.programs.gpsd = {};
|
||||
services.gpsd = lib.mkIf cfg.enabled {
|
||||
enable = true;
|
||||
devices = [ "/dev/ttyUSB1" ];
|
||||
};
|
||||
}
|
@@ -20,5 +20,14 @@
|
||||
pkgs.pipewire #< required for Video/Source (video4linux)
|
||||
];
|
||||
});
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistAudio = true;
|
||||
sandbox.extraPaths = [
|
||||
"/dev" # tried, but failed to narrow this down (moby)
|
||||
"/run/udev/data"
|
||||
"/sys/class/video4linux"
|
||||
"/sys/devices"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
55
hosts/common/programs/iio-sensor-proxy.nix
Normal file
55
hosts/common/programs/iio-sensor-proxy.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
# chat (Matrix): #iio-sensor-proxy:dylanvanassche.be
|
||||
# src: <https://gitlab.freedesktop.org/hadess/iio-sensor-proxy>
|
||||
# IIO = "Industrial I/O": <https://www.kernel.org/doc/html/v4.12/driver-api/iio/index.html>
|
||||
# iio-sensor-proxy reads IIO data reported by the kernel at /sys/bus/iio/* and makes it available to dbus applications.
|
||||
# this includes:
|
||||
# - ambient light sensor
|
||||
# - compass/magnetometer (LIMITED)
|
||||
# - accelerometer (rotation)
|
||||
#
|
||||
# use:
|
||||
# - show available sensors: `gdbus introspect --system --dest net.hadess.SensorProxy --object-path /net/hadess/SensorProxy`
|
||||
# - read sensors: `sudo -u geoclue monitor-sensor --compass`
|
||||
# - default dbus policy only allows geoclue to use the compass
|
||||
# - `sudo monitor-sensor` for light/rotation
|
||||
#
|
||||
# HARDWARE SUPPORT: PINEPHONE (2024/07/01)
|
||||
# - accelerometer and light sensor seem to work
|
||||
# - magnetometer (af8133j, different but similar to lis3mdl) IS NOT SUPPORTED
|
||||
# - <https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/310>
|
||||
# - exists in sysfs and can be viewed with
|
||||
# `cat /sys/devices/platform/soc/1c2b000.i2c/i2c-1/1-001c/iio:device2/in_magn_x_raw`
|
||||
# - nothing in iio-sensor-proxy reads anything related to "magn".
|
||||
# - WIP PR to support magnetometers: <https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/merge_requests/316>
|
||||
# - after rebase, it *functions*, but does not scale the readings correctly
|
||||
# heading changes only over the range of 50 - 70 deg.
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.iio-sensor-proxy;
|
||||
in
|
||||
{
|
||||
sane.programs.iio-sensor-proxy = {
|
||||
packageUnwrapped = pkgs.iio-sensor-proxy.overrideAttrs (upstream: {
|
||||
patches = (upstream.patches or []) ++ [
|
||||
(pkgs.fetchpatch {
|
||||
name = "WIP:compass: Add support for polling uncalibrated devices";
|
||||
# url = "https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/merge_requests/316.diff";
|
||||
url = "https://git.uninsane.org/colin/iio-sensor-proxy/commit/fd21f1f4bf1eadd603b1f24f628b979691d9cf3b.diff";
|
||||
hash = "sha256-+GoEPby6q+uSkQlZWFWr5ghx3BKBMGk7uv/DDhGnxDk=";
|
||||
})
|
||||
];
|
||||
});
|
||||
enableFor.system = lib.mkIf (builtins.any (en: en) (builtins.attrValues cfg.enableFor.user)) true; #< for dbus/polkit policies
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistDbus = [ "system" ];
|
||||
sandbox.extraPaths = [
|
||||
"/run/udev/data"
|
||||
"/sys/bus"
|
||||
"/sys/devices"
|
||||
];
|
||||
};
|
||||
services.udev.packages = lib.mkIf cfg.enabled [ cfg.package ];
|
||||
# services.dbus.packages = lib.mkIf cfg.enabled [ cfg.package ]; #< for bus ownership policy
|
||||
systemd.packages = lib.mkIf cfg.enabled [ cfg.package ]; #< for iio-sensor-proxy.service
|
||||
}
|
8
hosts/common/programs/keymapp.nix
Normal file
8
hosts/common/programs/keymapp.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
# ZSA keyboard (Ergodox, Moonlander, ...) firmware flasher and keymap viewer.
|
||||
# video: <https://www.zsa.io/flash>
|
||||
# displays on launch:
|
||||
# - "Error connecting to the keyboard, make sure the layout flashed on your keyboard was recently compiled with Oryx and that the [Live training] option is toggled on in the advanced settings."
|
||||
{ ... }:
|
||||
{
|
||||
sane.programs.keymapp = {};
|
||||
}
|
@@ -17,7 +17,7 @@
|
||||
# - these are stored in `~/.config/koreader/data/dict`
|
||||
# - configure defaults:
|
||||
# - edit keys in ~/.config/koreader/settings.reader.lua
|
||||
# - default font size: `["copt_font_size"] = 28,`
|
||||
# - default font size: `["copt_font_size"] = 30,`
|
||||
# - home dir: `["home_dir"] = "/home/colin/Books",`
|
||||
{ config, lib, pkgs, sane-lib, ... }:
|
||||
|
||||
|
@@ -1,14 +1,18 @@
|
||||
# docs: <https://git.sr.ht/~mil/mepo>
|
||||
# irc #mepo:irc.oftc.net
|
||||
#
|
||||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
sane.programs.mepo = {
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.net = "all"; # for tiles *and* for localhost comm to gpsd
|
||||
sandbox.whitelistDri = true;
|
||||
sandbox.whitelistWayland = true;
|
||||
sandbox.whitelistDbus = [ "user" ]; # for geoclue
|
||||
sandbox.whitelistDbus = [
|
||||
"system" # system is required for non-portal location services
|
||||
"user" #< not sure if "user" is necessary?
|
||||
];
|
||||
sandbox.usePortal = false; # TODO: set up portal-based location services
|
||||
|
||||
persist.byStore.plaintext = [ ".cache/mepo/tiles" ];
|
||||
# ~/.cache/mepo/savestate has precise coordinates and pins: keep those private
|
||||
@@ -16,11 +20,11 @@
|
||||
{ type = "file"; path = ".cache/mepo/savestate"; }
|
||||
];
|
||||
|
||||
# give mepo access to gpsd for location data, if that's enabled.
|
||||
# same with geoclue2.
|
||||
suggestedPrograms = lib.optional config.services.gpsd.enable "gpsd"
|
||||
++ lib.optional config.services.geoclue2.enable "geoclue2-with-demo-agent"
|
||||
;
|
||||
# enable geoclue2 and gpsd for location data.
|
||||
suggestedPrograms = [
|
||||
"geoclue2"
|
||||
# "gpsd" #< not required, and mepo only uses it if geoclue is unavailable
|
||||
];
|
||||
};
|
||||
|
||||
# programs.mepo = lib.mkIf config.sane.programs.mepo.enabled {
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# alternative to mimeo is jaro: <https://github.com/isamert/jaro>
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
mimeo-open-desktop = pkgs.static-nix-shell.mkPython3Bin {
|
||||
mimeo-open-desktop = pkgs.static-nix-shell.mkPython3 {
|
||||
pname = "mimeo-open-desktop";
|
||||
srcRoot = ./.;
|
||||
pkgs = [ "mimeo" ];
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i python3 -p "python3.withPackages (ps: [ ])" -p mimeo
|
||||
#!nix-shell -i python3 -p mimeo -p python3
|
||||
|
||||
# TODO: migrate nixpkgs mimeo to be `buildPythonPackage` to make it importable here.
|
||||
# see <doc/languages-frameworks/python.section.md>
|
||||
|
@@ -1,3 +1,19 @@
|
||||
# GPS:
|
||||
# - enable: `mmcli --modem any --location-enable-gps-unmanaged`
|
||||
# - or `mmcli -m any --location-enable-gps-nmea`
|
||||
# - or use `s6-rc start eg25-control-gps`
|
||||
# - verify GPS is enabled: `mmcli --modem any --location-status`
|
||||
# - query GPS coordinates: `mmcli -m any --location-get`
|
||||
# - monitor constellation info: `mmcli -m any --location-monitor`
|
||||
# - i.e. which satellites are in view
|
||||
# - or just `cat /dev/ttyUSB1`
|
||||
#
|
||||
# interactions, warnings:
|
||||
# - Geoclue (`where-am-i`) toggles mmcli GPS on/off every 60s, often resetting it to the "off" state
|
||||
# - see: <https://gitlab.freedesktop.org/geoclue/geoclue/-/issues/180>
|
||||
# - the effect is that GPS data is effectively useless inside apps like gnome-maps
|
||||
# i think the trick is to get "--location-enable-gps-unmanaged" gps working again
|
||||
# or use gnss-share/gpsd (this may be what "unmanaged" means).
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
sane.programs.mmcli = {
|
||||
@@ -6,7 +22,11 @@
|
||||
mainProgram = "mmcli";
|
||||
};
|
||||
});
|
||||
# TODO: sandbox
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistDbus = [
|
||||
"system"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -241,9 +241,10 @@ in
|
||||
mime.associations."video/webm" = "mpv.desktop";
|
||||
mime.associations."video/x-flv" = "mpv.desktop";
|
||||
mime.associations."video/x-matroska" = "mpv.desktop";
|
||||
mime.urlAssociations."^https?://(www.)?youtube.com/watch\?.*v=" = "mpv.desktop";
|
||||
mime.urlAssociations."^https?://(www.)?youtube.com/v/" = "mpv.desktop";
|
||||
mime.urlAssociations."^https?://(www.)?youtu.be/.+" = "mpv.desktop";
|
||||
mime.urlAssociations."^https?://(m\.)?(www\.)?youtu.be/.+" = "mpv.desktop";
|
||||
mime.urlAssociations."^https?://(m\.)?(www\.)?youtube.com/shorts/.+" = "mpv.desktop";
|
||||
mime.urlAssociations."^https?://(m\.)?(www\.)?youtube.com/v/" = "mpv.desktop";
|
||||
mime.urlAssociations."^https?://(m\.)?(www\.)?youtube.com/watch\?.*v=" = "mpv.desktop";
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
sane.programs."gnome.nautilus" = {
|
||||
sane.programs."nautilus" = {
|
||||
# some of its dbus services don't even refer to real paths
|
||||
packageUnwrapped = pkgs.rmDbusServicesInPlace (pkgs.gnome.nautilus.overrideAttrs (orig: {
|
||||
packageUnwrapped = pkgs.rmDbusServicesInPlace (pkgs.nautilus.overrideAttrs (orig: {
|
||||
# enable the "Audio and Video Properties" pane. see: <https://nixos.wiki/wiki/Nautilus>
|
||||
buildInputs = orig.buildInputs ++ (with pkgs.gst_all_1; [
|
||||
gst-plugins-good
|
||||
|
44
hosts/common/programs/networkmanager_dmenu/config.ini
Normal file
44
hosts/common/programs/networkmanager_dmenu/config.ini
Normal file
@@ -0,0 +1,44 @@
|
||||
[dmenu]
|
||||
dmenu_command = rofi -dmenu
|
||||
# # Note that dmenu_command can contain arguments as well like:
|
||||
# # `dmenu_command = rofi -dmenu -i -theme nmdm`
|
||||
# # `dmenu_command = rofi -dmenu -width 30 -i`
|
||||
# # `dmenu_command = dmenu -i -l 25 -b -nb #909090 -nf #303030`
|
||||
# # `dmenu_command = fuzzel --dmenu`
|
||||
rofi_highlight = True
|
||||
compact = True
|
||||
# pinentry = <Pinentry command> # (Default: None) e.g. `pinentry-gtk`
|
||||
# wifi_chars = <string of 4 unicode characters representing 1-4 bars strength>
|
||||
wifi_chars = ▂▄▆█
|
||||
# wifi_icons = <characters representing signal strength as an icon>
|
||||
wifi_icons =
|
||||
# format = <Python style format string for the access point entries>
|
||||
# # TODO: replace `{sec}` with a locked/unlocked icon
|
||||
format = {icon} {name} [{signal}%%] [{sec}]
|
||||
# # Available variables are:
|
||||
# # * {name} - Access point name
|
||||
# # * {sec} - Security type
|
||||
# # * {signal} - Signal strength on a scale of 0-100
|
||||
# # * {bars} - Bar-based display of signal strength (see wifi_chars)
|
||||
# # * {icon} - Icon-based display of signal strength (see wifi_icons)
|
||||
# # * {max_len_name} and {max_len_sec} are the maximum lengths of {name} / {sec}
|
||||
# # respectively and may be useful for formatting.
|
||||
# list_saved = <True or False> # (Default: False) list saved connections
|
||||
|
||||
[dmenu_passphrase]
|
||||
# # Uses the -password flag for Rofi, -x for bemenu. For dmenu, sets -nb and
|
||||
# # -nf to the same color or uses -P if the dmenu password patch is applied
|
||||
# # https://tools.suckless.org/dmenu/patches/password/
|
||||
# obscure = True
|
||||
# obscure_color = #222222
|
||||
|
||||
[pinentry]
|
||||
# description = <Pinentry description> (Default: Get network password)
|
||||
# prompt = <Pinentry prompt> (Default: Password:)
|
||||
|
||||
[editor]
|
||||
# terminal = <name of terminal program>
|
||||
# gui_if_available = <True or False> (Default: True)
|
||||
|
||||
[nmdm]
|
||||
# rescan_delay = <seconds> # (seconds to wait after a wifi rescan before redisplaying the results)
|
21
hosts/common/programs/networkmanager_dmenu/default.nix
Normal file
21
hosts/common/programs/networkmanager_dmenu/default.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
# source: <https://github.com/firecat53/networkmanager-dmenu>
|
||||
{ ... }:
|
||||
{
|
||||
sane.programs.networkmanager_dmenu = {
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.isolatePids = false; #< so it can know that NetworkManager really is running... (?)
|
||||
sandbox.whitelistDbus = [
|
||||
"system"
|
||||
];
|
||||
sandbox.whitelistWayland = true;
|
||||
sandbox.extraHomePaths = [
|
||||
".cache/rofi"
|
||||
".config/rofi"
|
||||
];
|
||||
suggestedPrograms = [
|
||||
"pidof"
|
||||
];
|
||||
|
||||
fs.".config/networkmanager-dmenu/config.ini".symlink.target = ./config.ini;
|
||||
};
|
||||
}
|
@@ -2,6 +2,9 @@
|
||||
{
|
||||
sane.programs.nmcli = {
|
||||
packageUnwrapped = pkgs.networkmanager-split.nmcli;
|
||||
# TODO: sandbox
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistDbus = [
|
||||
"system"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
7
hosts/common/programs/nwg-panel/common-settings.json
Normal file
7
hosts/common/programs/nwg-panel/common-settings.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"restart-on-display": true,
|
||||
"restart-delay": 500,
|
||||
"run-through-compositor": false,
|
||||
"processes-background-only": true,
|
||||
"processes-own-only": true
|
||||
}
|
@@ -4,11 +4,15 @@
|
||||
# - add network/bluetooth indicator
|
||||
# - <https://github.com/nwg-piotr/nwg-panel/issues/269>
|
||||
# - add CPU/meminfo executor
|
||||
# - use sane-sysinfo
|
||||
# - use sane-sysload
|
||||
{
|
||||
components,
|
||||
controlsSettingsComponents,
|
||||
controlsSettingsCustomItems,
|
||||
height,
|
||||
locker,
|
||||
modulesRight,
|
||||
playerctlChars,
|
||||
mediaPrevNext,
|
||||
windowIcon,
|
||||
windowTitle,
|
||||
workspaceHideEmpty,
|
||||
@@ -49,9 +53,7 @@
|
||||
modules-center = [
|
||||
"clock"
|
||||
];
|
||||
modules-right = [
|
||||
"playerctl"
|
||||
];
|
||||
modules-right = modulesRight;
|
||||
|
||||
clock = {
|
||||
angle = 0.0;
|
||||
@@ -79,9 +81,9 @@
|
||||
battery-low-interval = 4; #< notify every N minutes when battery continues to remain low
|
||||
battery-low-level = 15; #< notify if battery is lower than this percent
|
||||
# commands.battery = ""; #< optional action to perform when battery icon is clicked in the drop-down menu
|
||||
components = components;
|
||||
components = controlsSettingsComponents;
|
||||
click-closes = false;
|
||||
custom-items = [];
|
||||
custom-items = controlsSettingsCustomItems;
|
||||
css-name = "controls-window";
|
||||
hover-opens = false;
|
||||
icon-size = 16;
|
||||
@@ -90,21 +92,20 @@
|
||||
menu.icon = "system-shutdown-symbolic";
|
||||
menu.items = [
|
||||
{
|
||||
# TODO: plumb through the configured locker instead of assuming `swaylock`
|
||||
name = "Lock";
|
||||
cmd = "swaylock -f -c 000000";
|
||||
}
|
||||
{
|
||||
name = "Logout";
|
||||
cmd = "swaymsg exit";
|
||||
cmd = "s6-rc start ${locker}";
|
||||
}
|
||||
# {
|
||||
# name = "Logout";
|
||||
# cmd = "swaymsg exit";
|
||||
# }
|
||||
{
|
||||
name = "Reboot";
|
||||
cmd = "systemctl reboot";
|
||||
cmd = "reboot";
|
||||
}
|
||||
{
|
||||
name = "Shutdown";
|
||||
cmd = "systemctl -i poweroff";
|
||||
cmd = "shutdown now";
|
||||
}
|
||||
];
|
||||
menu.name = "Exit";
|
||||
@@ -127,6 +128,23 @@
|
||||
interval = 2;
|
||||
label-css-name = "playerctl-label";
|
||||
scroll = false;
|
||||
show-cover = false; #< don't show the little music-note icon
|
||||
show-previous = mediaPrevNext;
|
||||
show-next = mediaPrevNext;
|
||||
show-name = mediaPrevNext;
|
||||
};
|
||||
swaync = {
|
||||
css-name = "swaync-label";
|
||||
# interval = 1;
|
||||
# icon-placement = "left";
|
||||
# icon-size = 18;
|
||||
# tooltip-text = "";
|
||||
# on-left-click = "swaync-client -t";
|
||||
# on-right-click = "";
|
||||
# on-middle-click = "";
|
||||
# on-scroll-up = "";
|
||||
# on-scroll-down = "";
|
||||
# always-show-icon = true;
|
||||
};
|
||||
sway-workspaces = {
|
||||
angle = 0.0;
|
||||
@@ -143,6 +161,20 @@
|
||||
show-name = windowTitle;
|
||||
};
|
||||
|
||||
executor-sysload = {
|
||||
script = "sane-sysload {mem} {cpu}";
|
||||
interval = 10;
|
||||
css-name = "";
|
||||
on-right-click = "";
|
||||
icon-size = 16;
|
||||
show-icon = false;
|
||||
tooltip-text = "";
|
||||
on-left-click = "";
|
||||
on-middle-click = "";
|
||||
on-scroll-up = "";
|
||||
on-scroll-down = "";
|
||||
};
|
||||
|
||||
# unused modules:
|
||||
brightness-slider = {};
|
||||
dwl-tags = {};
|
||||
|
@@ -13,6 +13,19 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
sane.programs.torch-toggle = {
|
||||
packageUnwrapped = pkgs.static-nix-shell.mkBash {
|
||||
pname = "torch-toggle";
|
||||
pkgs = [ "brightnessctl" ];
|
||||
srcRoot = ./.;
|
||||
};
|
||||
|
||||
suggestedPrograms = [
|
||||
"brightnessctl"
|
||||
];
|
||||
sandbox.enable = false; # trivial, and all deps are sandboxed
|
||||
};
|
||||
|
||||
sane.programs.nwg-panel = {
|
||||
configOption = with lib; mkOption {
|
||||
default = {};
|
||||
@@ -23,7 +36,8 @@ in
|
||||
# what looks good:
|
||||
# - 15px on moby
|
||||
# - 24px on lappy
|
||||
default = lib.min 24 (cfg.config.fontSize - 1);
|
||||
# there's about 10px padding total around this (above + below)
|
||||
default = lib.min 24 (cfg.config.height - 11);
|
||||
};
|
||||
fontSize = mkOption {
|
||||
type = types.int;
|
||||
@@ -36,10 +50,27 @@ in
|
||||
height of the top bar in px.
|
||||
'';
|
||||
};
|
||||
locker = mkOption {
|
||||
type = types.str;
|
||||
default = config.sane.programs.swayidle.config.actions.lock.service;
|
||||
description = ''
|
||||
s6 service to start which can lock the screen
|
||||
'';
|
||||
};
|
||||
torch = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
device name for the torch (flashlight), if any.
|
||||
find with `brightnessctl -l`
|
||||
'';
|
||||
example = "white:flash";
|
||||
};
|
||||
battery = mkEnableOption' true "display battery status";
|
||||
brightness = mkEnableOption' true "display backlight level and slider";
|
||||
mediaTitle = mkEnableOption' true "display title of current song/media";
|
||||
mediaPrevNext = mkEnableOption' true "display prev/next button in media";
|
||||
sysload = mkEnableOption' true "display system load info (cpu/memory)";
|
||||
windowIcon = mkEnableOption' true "display icon of active window";
|
||||
windowTitle = mkEnableOption' true "display title of active window";
|
||||
workspaceNumbers = mkOption {
|
||||
@@ -65,9 +96,23 @@ in
|
||||
hyprland = null;
|
||||
# XXX(2024/06/13): wlr-randr does not cross compile
|
||||
wlr-randr = null; #< only used if not on sway/hyprland; or if using dwl
|
||||
python3Packages = pkgs.python3Packages // {
|
||||
dasbus = pkgs.python3Packages.dasbus.overridePythonAttrs (_: {
|
||||
# XXX(2024/07/07): python3.12 update broke tests
|
||||
doCheck = false;
|
||||
});
|
||||
};
|
||||
}).overrideAttrs (base: {
|
||||
patches = (base.patches or []) ++ lib.optionals (!cfg.config.mediaPrevNext) [
|
||||
./playerctl-no-prev-next.diff
|
||||
# patches = (base.patches or []) ++ lib.optionals (!cfg.config.mediaPrevNext) [
|
||||
# ./playerctl-no-prev-next.diff
|
||||
# ];
|
||||
patches = (base.patches or []) ++ [
|
||||
(pkgs.fetchpatch {
|
||||
# upstreaming: <https://github.com/nwg-piotr/nwg-panel/pull/309>
|
||||
url = "https://git.uninsane.org/colin/nwg-panel/commit/a714e4100c409feb02c454874d030d192bfb0ae5.patch";
|
||||
name = "playerctl: add settings to control which elements are displayed";
|
||||
hash = "sha256-OofS46wAI3EDE3JbYs/Nn+Vkw9TP1mwSFvk+vBERg2s=";
|
||||
})
|
||||
];
|
||||
|
||||
# - disable the drop-down chevron by the controls.
|
||||
@@ -75,17 +120,22 @@ in
|
||||
# - disable brightness indicator for same reason.
|
||||
# - *leave* the volume indicator: one *could* remove it, however on desko that would leave the controls pane empty
|
||||
# making the dropdown inaccessible
|
||||
# also, remove padding from the items. i can manage that in css and the python padding prevents that.
|
||||
postPatch = (base.postPatch or "") + ''
|
||||
substituteInPlace nwg_panel/modules/controls.py --replace-fail \
|
||||
'self.box.pack_start(box, False, False, 6)' \
|
||||
'self.box.pack_start(box, False, False, 0)'
|
||||
|
||||
substituteInPlace nwg_panel/modules/controls.py --replace-fail \
|
||||
'box.pack_start(self.pan_image, False, False, 4)' \
|
||||
'# box.pack_start(self.pan_image, False, False, 4)'
|
||||
'# box.pack_start(self.pan_image, False, False, 0)'
|
||||
substituteInPlace nwg_panel/modules/controls.py --replace-fail \
|
||||
'box.pack_start(self.bri_image, False, False, 4)' \
|
||||
'# box.pack_start(self.bri_image, False, False, 4)'
|
||||
'# box.pack_start(self.bri_image, False, False, 0)'
|
||||
|
||||
# substituteInPlace nwg_panel/modules/controls.py --replace-fail \
|
||||
# 'box.pack_start(self.vol_image, False, False, 4)' \
|
||||
# '# box.pack_start(self.vol_image, False, False, 4)'
|
||||
substituteInPlace nwg_panel/modules/controls.py --replace-fail \
|
||||
'box.pack_start(self.vol_image, False, False, 4)' \
|
||||
'box.pack_start(self.vol_image, False, False, 0)'
|
||||
'';
|
||||
|
||||
# XXX(2024/06/13) the bluetooth stuff doesn't cross compile, so disable it
|
||||
@@ -95,18 +145,23 @@ in
|
||||
});
|
||||
|
||||
suggestedPrograms = [
|
||||
"brightnessctl"
|
||||
"pactl" # pactl required by `per-app-volume` component.
|
||||
"sane-die-with-parent"
|
||||
] ++ lib.optionals (cfg.config.torch != null) [
|
||||
"torch-toggle"
|
||||
];
|
||||
|
||||
fs.".config/nwg-panel/style.css".symlink.target = pkgs.substituteAll {
|
||||
src = ./style.css;
|
||||
inherit (cfg.config) fontSize clockFontSize;
|
||||
};
|
||||
fs.".config/nwg-panel/common-settings.json".symlink.target = ./common-settings.json;
|
||||
fs.".config/nwg-panel/config".symlink.target = pkgs.writers.writeJSON "config" (import ./config.nix {
|
||||
inherit (cfg.config) height windowIcon windowTitle workspaceHideEmpty workspaceNumbers;
|
||||
inherit (cfg.config) locker height mediaPrevNext windowIcon windowTitle workspaceHideEmpty workspaceNumbers;
|
||||
# component order matters, mostly for the drop-down.
|
||||
# default for most tools (e.g. swaync) is brightness control above volume.
|
||||
components =
|
||||
controlsSettingsComponents =
|
||||
lib.optionals cfg.config.brightness [
|
||||
"brightness"
|
||||
] ++ [
|
||||
@@ -116,9 +171,41 @@ in
|
||||
"battery"
|
||||
]
|
||||
;
|
||||
controlsSettingsCustomItems = lib.optionals (cfg.config.torch != null) [
|
||||
{
|
||||
name = "Torch";
|
||||
# icons: find them in /etc/profiles/per-user/colin/share/icons
|
||||
# display-brightness-symbolic, keyboard-brightness-symbolic, night-light-symbolic
|
||||
icon = "display-brightness-symbolic";
|
||||
cmd = "torch-toggle ${cfg.config.torch}";
|
||||
}
|
||||
];
|
||||
modulesRight = [
|
||||
"playerctl"
|
||||
] ++ lib.optionals cfg.config.sysload [
|
||||
"executor-sysload"
|
||||
];
|
||||
playerctlChars = if cfg.config.mediaTitle then 60 else 0;
|
||||
});
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistAudio = true;
|
||||
sandbox.whitelistDri = true;
|
||||
sandbox.whitelistS6 = true;
|
||||
sandbox.whitelistWayland = true;
|
||||
sandbox.whitelistDbus = [
|
||||
"user" # playerctl, swaync, ...
|
||||
"system" # for "shutdown" option to speak to systemd
|
||||
];
|
||||
sandbox.extraPaths = [
|
||||
"/run/systemd" #< for "shutdown" option
|
||||
"/sys/class/backlight"
|
||||
"/sys/class/leds" #< for torch/flashlight on moby
|
||||
"/sys/class/power_supply" #< for the battery indicator
|
||||
"/sys/devices"
|
||||
];
|
||||
sandbox.extraRuntimePaths = [ "sway" ];
|
||||
|
||||
services.nwg-panel = {
|
||||
description = "nwg-panel status/topbar for wayland";
|
||||
partOf = [ "graphical-session" ];
|
||||
@@ -126,7 +213,8 @@ in
|
||||
# to debug styling, run with GTK_DEBUG=interactive
|
||||
# N.B.: G_MESSAGES_DEBUG=all causes the swaync icon to not render
|
||||
# command = "env G_MESSAGES_DEBUG=all nwg-panel";
|
||||
command = "nwg-panel";
|
||||
# XXX: try `nwg-panel & ; kill $$`. the inner nwg-panel doesn't die (without sane-die-with-parent), and hence the service would be prone to maintaining _multiple_ bars.
|
||||
command = "sane-die-with-parent --descendants --signal SIGKILL nwg-panel";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@@ -1,11 +1,19 @@
|
||||
commit 7aa759990b38b09abf9010dfe58e4cbdc1493282 (HEAD -> dev-sane)
|
||||
Author: Colin <colin@uninsane.org>
|
||||
Date: 2024-06-15 21:41:46 +0000
|
||||
|
||||
playerctl: remove backward/forward/music-note icons
|
||||
|
||||
these aren't worth the space cost on narrow devices (moby)
|
||||
|
||||
diff --git a/nwg_panel/modules/playerctl.py b/nwg_panel/modules/playerctl.py
|
||||
index 9b53b4b..c4d96ae 100644
|
||||
index ff48d4c..43ae221 100644
|
||||
--- a/nwg_panel/modules/playerctl.py
|
||||
+++ b/nwg_panel/modules/playerctl.py
|
||||
@@ -180,15 +180,6 @@ class Playerctl(Gtk.EventBox):
|
||||
@@ -211,15 +211,6 @@ class Playerctl(Gtk.EventBox):
|
||||
if self.settings["angle"] != 0.0:
|
||||
button_box.set_orientation(Gtk.Orientation.VERTICAL)
|
||||
|
||||
|
||||
- img = Gtk.Image()
|
||||
- update_image(img, "media-skip-backward-symbolic", self.settings["icon-size"], icons_path=self.icons_path)
|
||||
- btn = Gtk.Button()
|
||||
@@ -18,10 +26,10 @@ index 9b53b4b..c4d96ae 100644
|
||||
self.play_pause_btn = Gtk.Button()
|
||||
if self.settings["button-css-name"]:
|
||||
self.play_pause_btn.set_property("name", self.settings["button-css-name"])
|
||||
@@ -198,15 +189,6 @@ class Playerctl(Gtk.EventBox):
|
||||
@@ -229,15 +220,6 @@ class Playerctl(Gtk.EventBox):
|
||||
self.play_pause_btn.connect("clicked", self.launch, self.PlayerOps.PLAY_PAUSE)
|
||||
button_box.pack_start(self.play_pause_btn, False, False, 1)
|
||||
|
||||
|
||||
- img = Gtk.Image()
|
||||
- update_image(img, "media-skip-forward-symbolic", self.settings["icon-size"], icons_path=self.icons_path)
|
||||
- btn = Gtk.Button()
|
||||
@@ -31,6 +39,21 @@ index 9b53b4b..c4d96ae 100644
|
||||
- btn.connect("clicked", self.launch, self.PlayerOps.NEXT)
|
||||
- button_box.pack_start(btn, False, False, 1)
|
||||
-
|
||||
self.label = AutoScrollLabel(self.settings["scroll"],
|
||||
self.settings["chars"],
|
||||
self.settings["interval"])
|
||||
self.num_players_lbl = Gtk.Label.new("")
|
||||
if self.settings["label-css-name"]:
|
||||
self.num_players_lbl.set_property("name", self.settings["label-css-name"])
|
||||
@@ -257,13 +239,9 @@ class Playerctl(Gtk.EventBox):
|
||||
self.box.pack_start(button_box, False, False, 2)
|
||||
if self.settings["show-cover"]:
|
||||
self.box.pack_start(self.cover_img, False, False, 0)
|
||||
- self.box.pack_start(self.num_players_lbl, False, False, 0)
|
||||
- self.box.pack_start(self.label, False, False, 5)
|
||||
else:
|
||||
if self.settings["show-cover"]:
|
||||
self.box.pack_start(self.cover_img, False, False, 2)
|
||||
- self.box.pack_start(self.num_players_lbl, False, False, 0)
|
||||
- self.box.pack_start(self.label, False, False, 2)
|
||||
self.box.pack_start(button_box, False, False, 10)
|
||||
|
||||
def launch(self, button, op):
|
||||
|
||||
|
@@ -20,35 +20,61 @@
|
||||
font-size: @fontSize@px;
|
||||
}
|
||||
|
||||
button {
|
||||
margin: 2px;
|
||||
}
|
||||
|
||||
#task-box {
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
#task-box-focused {
|
||||
background-color: @accent-g2;
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
|
||||
#playerctl-button {
|
||||
background-color: rgba(0, 0, 0, 0.08);
|
||||
background-image: none;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
margin: -1;
|
||||
/* remove the 1px gap between buttons, since that causes color stripes if the background is a different color */
|
||||
margin-left: -1;
|
||||
margin-right: -1;
|
||||
outline: none;
|
||||
/* prevent the buttons from pushing the whole bar down */
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
#panel-top {
|
||||
background: @accent-g1;
|
||||
color: @fg1;
|
||||
}
|
||||
/* fix up the top bar sections so that the clock can be centered, even without forcing it to take 1/3rd of the bar */
|
||||
/* pair with `homogenous = false` in config. on overflow, the clock may be rendered on top of the left portion of the bar */
|
||||
/* and the right portion of the bar will render on top of all */
|
||||
#panel-top > box > box > box > #left-box {
|
||||
margin-left: 0px;
|
||||
margin-right: -16384px;
|
||||
}
|
||||
#panel-top > box > box > box > #center-box {
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
}
|
||||
#panel-top > box > box > box > box {
|
||||
/* this is the *parent* of #right-box, which is uniquely under an unnamed "helper box" */
|
||||
/* i have to address this parent, because otherwise only the controls are visible and the executors (including playerctl) */
|
||||
/* are packed in a fill mode that pushes them off the visible section of the bar */
|
||||
margin-left: -16384px;
|
||||
}
|
||||
|
||||
#right-box > widget > * {
|
||||
/* TODO: tune this for moby */
|
||||
padding-right: 3px;
|
||||
padding-left: 2px;
|
||||
}
|
||||
|
||||
#swaync-label {
|
||||
/* move the notification count closer to the bell icon */
|
||||
margin-left: -3px;
|
||||
/* TODO: this should be main font size -1 */
|
||||
font-size: 14px;
|
||||
color: @accent-r2;
|
||||
}
|
||||
|
||||
/* increase the size of each workspace icon */
|
||||
#sway-workspaces-item > label {
|
||||
|
12
hosts/common/programs/nwg-panel/torch-toggle
Executable file
12
hosts/common/programs/nwg-panel/torch-toggle
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p bash -p brightnessctl
|
||||
dev="$1"
|
||||
if [ -z "$dev" ]; then
|
||||
dev="white:flash"
|
||||
fi
|
||||
|
||||
if [ "$(brightnessctl -d "$dev" get)" -gt 0 ]; then
|
||||
brightnessctl -q -d "$dev" set "0%"
|
||||
else
|
||||
brightnessctl -q -d "$dev" set "100%"
|
||||
fi
|
@@ -4,5 +4,7 @@
|
||||
# binutils-unwrapped is like 80 MiB, just for this one binary;
|
||||
# dynamic linking means copying the binary doesn't reduce the closure much at all compared to just symlinking it.
|
||||
packageUnwrapped = pkgs.linkIntoOwnPackage pkgs.binutils-unwrapped "bin/objdump";
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.autodetectCliPaths = "existingFile";
|
||||
};
|
||||
}
|
||||
|
48
hosts/common/programs/ols.nix
Normal file
48
hosts/common/programs/ols.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
# OLS: Offline Location Service: <https://codeberg.org/tpikonen/ols>
|
||||
# fields {wifi SSID,cell tower} -> lat/long queries from geoclue
|
||||
# satisfies queries via https://wigle.net, by learning about map tiles
|
||||
# and caching those on-disk so that repeat queries may be serviced offline.
|
||||
#
|
||||
# it listens on localhost:8088, and one can validate its operation with a query like (substitute macAddresses for something real):
|
||||
# - WiFi: curl -d '{"wifiAccessPoints":[{"macAddress":"01:23:45:67:89:ab","signalStrength":-78},{"macAddress":"cd:ef:01:23:45:56","signalStrength":-76}]}' http://127.0.0.1:8088/v1/geolocate
|
||||
# - Cell: curl -d '{"cellTowers":[{ "radioType": "lte", "mobileCountryCode": 310, "mobileNetworkCode": 260, "locationAreaCode": NNNNN, "cellId": MMMMMMMM }]}' http://127.0.0.1:8088/v1/geolocate
|
||||
#
|
||||
## wigle docs:
|
||||
# - IRC: #wigle on WiGLE.net:6667
|
||||
# - API: <https://api.wigle.net/swagger>
|
||||
# API return codes:
|
||||
# - 429: "too many queries today."
|
||||
#
|
||||
# rate limiting:
|
||||
# - as a new user you'll be limited to something ridiculous like 5 queries per day.
|
||||
# supposedly this improves "based on history and participation".
|
||||
# - source: <https://api.wigle.net/swagger#/Network%20search%20and%20information%20tools/search_2>
|
||||
# - "API for some functions is limited on a daily basis for all users for the time being, but if you'd like increased access, please email us (include your username and usecase) at WiGLE-admin@wigle.net."
|
||||
# - source: <https://wigle.net/account>
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
sane.programs.ols = {
|
||||
packageUnwrapped = pkgs.geoclue-ols;
|
||||
|
||||
fs.".config/ols/cell.db".symlink.target = pkgs.runCommandLocal "cell.db" {
|
||||
nativeBuildInputs = [ pkgs.geoclue-ols ];
|
||||
} ''
|
||||
cellid-ols-import -o "$out" "${pkgs.opencellid}"
|
||||
'';
|
||||
|
||||
persist.byStore.private = [
|
||||
".local/share/ols"
|
||||
];
|
||||
|
||||
secrets.".config/ols/ols.toml" = ../../../secrets/common/ols.toml.bin;
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.net = "all";
|
||||
|
||||
services.ols = {
|
||||
description = "ols: Offline Location Service";
|
||||
command = "ols 2>&1"; # XXX: it logs to stderr, and my s6 infrastructure apparently doesn't handle that
|
||||
partOf = [ "graphical-session" ];
|
||||
};
|
||||
};
|
||||
}
|
@@ -2,5 +2,7 @@
|
||||
{
|
||||
sane.programs.pactl = {
|
||||
packageUnwrapped = pkgs.linkIntoOwnPackage pkgs.pulseaudio "bin/pactl";
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistAudio = true;
|
||||
};
|
||||
}
|
||||
|
8
hosts/common/programs/pidof.nix
Normal file
8
hosts/common/programs/pidof.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
sane.programs.pidof = {
|
||||
packageUnwrapped = pkgs.linkIntoOwnPackage pkgs.procps "bin/pidof";
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.isolatePids = false;
|
||||
};
|
||||
}
|
8
hosts/common/programs/pkill.nix
Normal file
8
hosts/common/programs/pkill.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
sane.programs.pkill = {
|
||||
packageUnwrapped = pkgs.linkIntoOwnPackage pkgs.procps "bin/pkill";
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.isolatePids = false;
|
||||
};
|
||||
}
|
9
hosts/common/programs/qmk-udev-rules.nix
Normal file
9
hosts/common/programs/qmk-udev-rules.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.qmk-udev-rules;
|
||||
in
|
||||
{
|
||||
sane.programs.qmk-udev-rules.sandbox.enable = false;
|
||||
services.udev.packages = lib.mkIf cfg.enabled [ cfg.package ];
|
||||
}
|
||||
|
@@ -55,6 +55,12 @@ let
|
||||
mimeTypes = [ "application/x-desktop" ];
|
||||
noDisplay = true;
|
||||
})
|
||||
(pkgs.makeDesktopItem {
|
||||
name = "close";
|
||||
exec = "true";
|
||||
desktopName = "Close Menu";
|
||||
mimeTypes = [ "application/x-desktop" ];
|
||||
})
|
||||
];
|
||||
});
|
||||
# rofi-emoji = pkgs.rofi-emoji.override {
|
||||
@@ -116,6 +122,8 @@ in
|
||||
|
||||
fs.".config/rofi/config.rasi".symlink.target = ./config.rasi;
|
||||
fs."Apps".symlink.target = ".local/share/applications/rofi-applications.desktop";
|
||||
fs."WiFi".symlink.target = ".local/share/applications/networkmanager_dmenu.desktop";
|
||||
fs."close".symlink.target = ".local/share/applications/close.desktop"; #< provide an escape from the file browser
|
||||
persist.byStore.cryptClearOnBoot = [
|
||||
# this gets us a few things:
|
||||
# - file browser remembers its last directory
|
||||
|
@@ -16,7 +16,8 @@ binArgs=("$@")
|
||||
if [ "$desktop" != .desktop ]; then
|
||||
exec sane-open --auto-keyboard --application "$desktop"
|
||||
elif [ "$binary" = "xdg-open" ]; then
|
||||
exec sane-open --auto-keyboard --file "${binArgs[@]}"
|
||||
# the file we want to open could be a symlink to a .desktop file, so omit `--file` and let sane-open figure that part out for itself:
|
||||
exec sane-open --auto-keyboard "${binArgs[@]}"
|
||||
fi
|
||||
|
||||
printf "no .desktop file, and unexpected binary; not invoking: %s %s\n" "$binary" "${binArgs[*]}" >&2
|
||||
|
@@ -3,7 +3,7 @@
|
||||
sane.programs.s6-rc = {
|
||||
packageUnwrapped = pkgs.s6-rc.overrideAttrs (upstream: {
|
||||
nativeBuildInputs = (upstream.nativeBuildInputs or []) ++ (with pkgs; [
|
||||
makeWrapper
|
||||
makeWrapper # requires shell wrapper -- not binary -- so that env var args can be expanded by the wrapper
|
||||
]);
|
||||
# s6-rc looks for files in /run/s6/{live,compiled,...} by default.
|
||||
# let's patch that to be a user-specific runtime dir, since i run it as an ordinary user.
|
||||
@@ -11,7 +11,7 @@
|
||||
postInstall = (upstream.postInstall or "") + ''
|
||||
for prog in s6-rc s6-rc-bundle s6-rc-db s6-rc-format-upgrade s6-rc-init s6-rc-update; do
|
||||
wrapProgram "$bin/bin/$prog" \
|
||||
--add-flags '-l $XDG_RUNTIME_DIR/s6/live'
|
||||
--add-flags '-l' --add-flags '$XDG_RUNTIME_DIR/s6/live'
|
||||
done
|
||||
'';
|
||||
});
|
||||
|
@@ -83,7 +83,7 @@ in
|
||||
"jq"
|
||||
"killall"
|
||||
"playerctl"
|
||||
"procps"
|
||||
"procps" #< TODO: reduce to just those parts of procps which are really needed
|
||||
"sane-open"
|
||||
# "sway" #< TODO: circular dependency :-(
|
||||
"wireplumber"
|
||||
|
@@ -162,8 +162,10 @@ in
|
||||
|
||||
"sane-scripts.reboot".sandbox = {
|
||||
method = "bwrap";
|
||||
whitelistDbus = [
|
||||
"system"
|
||||
];
|
||||
extraPaths = [
|
||||
"/run/dbus"
|
||||
"/run/systemd"
|
||||
];
|
||||
};
|
||||
@@ -181,6 +183,7 @@ in
|
||||
".config/sops"
|
||||
];
|
||||
};
|
||||
"sane-scripts.secrets-unlock".fs.".config/sops".dir = {};
|
||||
|
||||
# sane-secrets-dump is a thin wrapper around sops + some utilities.
|
||||
# really i should sandbox just the utilities
|
||||
@@ -200,13 +203,23 @@ in
|
||||
|
||||
"sane-scripts.shutdown".sandbox = {
|
||||
method = "bwrap";
|
||||
whitelistDbus = [
|
||||
"system"
|
||||
];
|
||||
extraPaths = [
|
||||
"/run/dbus"
|
||||
"/run/systemd"
|
||||
];
|
||||
};
|
||||
|
||||
"sane-scripts.stop-all-servo" = {};
|
||||
"sane-scripts.stop-all-servo".sandbox = {
|
||||
method = "bwrap";
|
||||
whitelistDbus = [
|
||||
"system"
|
||||
];
|
||||
extraPaths = [
|
||||
"/run/systemd"
|
||||
];
|
||||
};
|
||||
|
||||
# if `tee` isn't trustworthy we have bigger problems
|
||||
"sane-scripts.sudo-redirect".sandbox.enable = false;
|
||||
@@ -279,5 +292,6 @@ in
|
||||
".persist/private/.mozilla"
|
||||
];
|
||||
};
|
||||
"sane-scripts.wipe".suggestedPrograms = [ "pkill" ];
|
||||
};
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{ ... }:
|
||||
{
|
||||
sane.programs.sane-sysinfo = {
|
||||
sane.programs.sane-sysload = {
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.extraPaths = [
|
||||
"/sys/class/power_supply"
|
@@ -106,7 +106,7 @@ let
|
||||
yaru-theme
|
||||
zuki-themes
|
||||
;
|
||||
inherit (pkgs.gnome)
|
||||
inherit (pkgs)
|
||||
adwaita-icon-theme
|
||||
gnome-themes-extra
|
||||
;
|
||||
@@ -120,11 +120,11 @@ let
|
||||
Dracula-cursors = dracula-theme;
|
||||
};
|
||||
cursor-theme = {
|
||||
Adwaita = gnome.adwaita-icon-theme;
|
||||
Adwaita = adwaita-icon-theme;
|
||||
};
|
||||
gtk-theme = {
|
||||
Adwaita = gnome.gnome-themes-extra; # gtk-3.0
|
||||
Adwaita-dark = gnome.gnome-themes-extra; # gtk-3.0
|
||||
Adwaita = gnome-themes-extra; # gtk-3.0
|
||||
Adwaita-dark = gnome-themes-extra; # gtk-3.0
|
||||
Arc = arc-theme; # gtk-4.0
|
||||
Arc-Dark = arc-theme; # gtk-4.0
|
||||
Arc-Darker = arc-theme; # gtk-4.0
|
||||
@@ -137,7 +137,7 @@ let
|
||||
Fluent-Dark-compact = fluent-gtk-theme; # gtk-4.0
|
||||
Fluent-Light = fluent-gtk-theme; # gtk-4.0
|
||||
Fluent-Light-compact = fluent-gtk-theme; # gtk-4.0, NICE!
|
||||
HighContrast = gnome.gnome-themes-extra; # gtk-3.0
|
||||
HighContrast = gnome-themes-extra; # gtk-3.0
|
||||
Matcha-light-azul = matcha-gtk-theme; # gtk-4.0, NICE!
|
||||
Matcha-light-sea = matcha-gtk-theme; # gtk-4.0, NICE!
|
||||
# additional Matcha-* omitted
|
||||
@@ -182,13 +182,13 @@ let
|
||||
# - that's probably why so many themes here also symlink Adwaita
|
||||
# my accounting of "adwaita coverage" seems to be overoptimistic somehow
|
||||
# maybe some apps bundle adwaita themselves
|
||||
Adwaita = gnome.adwaita-icon-theme;
|
||||
Adwaita = adwaita-icon-theme;
|
||||
Arc = arc-icon-theme; # 4.5/5, meh icon for "vertical ellipsis". 3/5 adwaita coverage
|
||||
elementary-xfce = elementary-xfce-icon-theme; # does not cross compile (2023/10/03)
|
||||
elementary-xfce-dark = elementary-xfce-icon-theme;
|
||||
elementary-xfce-darker = elementary-xfce-icon-theme;
|
||||
elementary-xfce-darkest = elementary-xfce-icon-theme;
|
||||
HighContrast = gnome.gnome-themes-extra; # 5/5. 5/5 adwaita coverage (4/5 cross)
|
||||
HighContrast = gnome-themes-extra; # 5/5. 5/5 adwaita coverage (4/5 cross)
|
||||
Humanity = humanity-icon-theme; # 5/5. 5/5 adwaita coverage (3.5/5 cross, unique in which icons work)
|
||||
Humanity-Dark = humanity-icon-theme;
|
||||
kora = kora-icon-theme;
|
||||
|
@@ -44,19 +44,19 @@ in
|
||||
# XXX: /run/current-system symlink can't be cached without forcing regular mass rebuilds:
|
||||
# mount it as if it were a directory instead.
|
||||
"/run/current-system" = "";
|
||||
} // lib.optionalAttrs config.hardware.opengl.enable {
|
||||
} // lib.optionalAttrs config.hardware.graphics.enable {
|
||||
"/run/opengl-driver" = let
|
||||
gl = config.hardware.opengl;
|
||||
# from: <repo:nixos/nixpkgs:nixos/modules/hardware/opengl.nix>
|
||||
gl = config.hardware.graphics;
|
||||
# from: <repo:nixos/nixpkgs:nixos/modules/hardware/graphics.nix>
|
||||
package = pkgs.buildEnv {
|
||||
name = "opengl-drivers";
|
||||
paths = [ gl.package ] ++ gl.extraPackages;
|
||||
};
|
||||
in "${package}";
|
||||
} // lib.optionalAttrs (config.hardware.opengl.enable && config.hardware.opengl.driSupport32Bit) {
|
||||
} // lib.optionalAttrs (config.hardware.graphics.enable && config.hardware.graphics.enable32Bit) {
|
||||
"/run/opengl-driver-32" = let
|
||||
gl = config.hardware.opengl;
|
||||
# from: <repo:nixos/nixpkgs:nixos/modules/hardware/opengl.nix>
|
||||
gl = config.hardware.graphics;
|
||||
# from: <repo:nixos/nixpkgs:nixos/modules/hardware/graphics.nix>
|
||||
package = pkgs.buildEnv {
|
||||
name = "opengl-drivers-32bit";
|
||||
paths = [ gl.package32 ] ++ gl.extraPackages32;
|
||||
|
59
hosts/common/programs/satellite.nix
Normal file
59
hosts/common/programs/satellite.nix
Normal file
@@ -0,0 +1,59 @@
|
||||
# satellite-gtk: <https://codeberg.org/tpikonen/satellite>
|
||||
# - presents GPS tracking *details* in a graphical way
|
||||
# - shows which satellites are in view, their SNR, and the subset currently being used for triangulation
|
||||
# - shows fix coordinates (time, lat, long, altitude, speed)
|
||||
#
|
||||
### how to read the bargraph (example):
|
||||
#
|
||||
# 14 | XXXXXXXXXXXXX 26
|
||||
# 76 | =========== 23
|
||||
# 15 | XXXXXXXX 16
|
||||
# =
|
||||
# +----------------|
|
||||
# 0 30
|
||||
#
|
||||
# ^ this view means:
|
||||
# - GPS is receiving from sats 14, 76, 15 (by PRN) -- this comes from GSGSV NMEA data (Satellites in-View)
|
||||
# - sat 14 and 15 (shaded solid) are "active" -- this comes from GSGSA NMEA data ("Satellites Active")
|
||||
# - i believe "active" means "this sat was used in the most recent solution"
|
||||
#
|
||||
### text fields
|
||||
# - Modes (GP,GL,GA) ...
|
||||
# one letter each, indicating the mode for GPS, GLONASS, Galileo sats:
|
||||
# - N = no fix
|
||||
# - A = autonomous
|
||||
# - D = differential mode
|
||||
# - E = estimated (dead reckoning)
|
||||
# - etc
|
||||
# - Active / in use sats
|
||||
# - A/U, where A = number of satellites used in the previous fix,
|
||||
# U = number of satellites mentioned in latest GNS + GGA messages
|
||||
# - Receiving sats
|
||||
# shows the count of sats with non-zero SNR, from GSV messages
|
||||
# - Visible sats
|
||||
# shows the count of sats from GSV messages
|
||||
# - Age of update / fix
|
||||
# - Sys. Time
|
||||
# - Latitude
|
||||
# - Longitude
|
||||
# - Altitude
|
||||
# - Geoidal separation
|
||||
# - Speed
|
||||
# - True Course
|
||||
# - PDOP/HDOP/VDOP
|
||||
# - shows how sensitive the reported location is to measurement error (low values are better)
|
||||
# - HDOP = horizontal sensitivity, VDOP = vertical sensitivity, PDOP = positional (d) sensitivity
|
||||
# - 1-2 => excellent fix
|
||||
# - >10 => low confidence fix; recommended to discard the fix
|
||||
# - <https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)>
|
||||
#
|
||||
{ ... }:
|
||||
{
|
||||
sane.programs.satellite = {
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.whitelistDbus = [
|
||||
"system" #< reads NMEA data via ModemManager
|
||||
];
|
||||
sandbox.whitelistWayland = true;
|
||||
};
|
||||
}
|
@@ -25,6 +25,9 @@ in
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.net = "clearnet";
|
||||
sandbox.whitelistAudio = true;
|
||||
sandbox.whitelistDbus = [
|
||||
"user" # so i can click on links
|
||||
];
|
||||
sandbox.whitelistWayland = true;
|
||||
sandbox.extraHomePaths = [
|
||||
"Music"
|
||||
@@ -44,6 +47,8 @@ in
|
||||
".config/Signal"
|
||||
];
|
||||
|
||||
buildCost = 1;
|
||||
|
||||
services.signal-desktop = {
|
||||
description = "signal-desktop Signal Messenger client";
|
||||
# depends = [ "graphical-session" ];
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user