Compare commits
2 Commits
68683fba28
...
d8a70620e4
Author | SHA1 | Date | |
---|---|---|---|
d8a70620e4 | |||
cc479ee57e |
@ -59,6 +59,7 @@
|
||||
profile.workstation.enable = true;
|
||||
common.remoteAccess.enable = true;
|
||||
hardware.opengl.enable = true;
|
||||
hardware.gps.enable = true;
|
||||
packageSets = {
|
||||
gaming.enable = true;
|
||||
fun.enable = true;
|
||||
@ -124,6 +125,9 @@
|
||||
settings.reboot-for-bitlocker = true;
|
||||
};
|
||||
|
||||
# GPS data from my phone
|
||||
services.gpsd.devices = lib.mkIf config.nixfiles.hardware.gps.enable [ "tcp://pixel.magpie-moth.ts.net:6000" ];
|
||||
|
||||
# systemd power/suspend configuration
|
||||
systemd.targets = lib.genAttrs ["suspend" "hybrid-sleep" "suspend-then-hibernate"] (_: {
|
||||
enable = false;
|
||||
|
@ -6,5 +6,6 @@
|
||||
./opengl.nix
|
||||
./sound.nix
|
||||
./binfmt.nix
|
||||
./gps.nix
|
||||
];
|
||||
}
|
||||
|
48
system/hardware/gps.nix
Normal file
48
system/hardware/gps.nix
Normal file
@ -0,0 +1,48 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.nixfiles.hardware.gps;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
nixfiles.hardware.gps = {
|
||||
enable = lib.mkEnableOption "GPS configuration";
|
||||
gpsdBridge = lib.mkOption {
|
||||
description = "Whether to enable bridging of gpsd data to Geoclue2";
|
||||
default = true;
|
||||
example = false;
|
||||
type = lib.types.bool;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
services.geoclue2 = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
environment.etc."geoclue/conf.d/00-nmea-socket.conf".text = lib.mkIf cfg.gpsdBridge ''
|
||||
[network-nmea]
|
||||
enable=true
|
||||
nmea-socket=/run/gpsd-nmea/nmea.sock
|
||||
'';
|
||||
|
||||
# this could probably be a systemd socket but i don't know how to make those
|
||||
systemd.services.gpsd-nmea-bridge = lib.mkIf cfg.gpsdBridge {
|
||||
path = with pkgs; [
|
||||
gpsd
|
||||
coreutils
|
||||
socat
|
||||
];
|
||||
description = "gpsd to Geoclue2 GPS data bridge";
|
||||
before = [ "geoclue.service" ];
|
||||
wantedBy = [ "geoclue.service" "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
RuntimeDirectory = "gpsd-nmea";
|
||||
ExecStart = pkgs.writeShellScript "gpsd-nmea-bridge" "
|
||||
exec socat -U UNIX-LISTEN:\${RUNTIME_DIRECTORY}/nmea.sock,fork,reuseaddr,mode=777 SYSTEM:'gpspipe -Br | stdbuf -oL tail -n+4'
|
||||
";
|
||||
};
|
||||
};
|
||||
services.gpsd.enable = lib.mkIf cfg.gpsdBridge true;
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user