pulsebert: add ledfx

This commit is contained in:
Sandro - 2023-04-15 02:37:31 +02:00
parent db211ae2fa
commit 009780d093
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
3 changed files with 90 additions and 56 deletions

View File

@ -328,11 +328,11 @@
]
},
"locked": {
"lastModified": 1681493503,
"narHash": "sha256-MDvaEks31Gy5mzDp6KDg3L6rX4wIsyDZbZqdkPNPgkc=",
"lastModified": 1681503602,
"narHash": "sha256-4QbGS4tghgSFNn0E06qR2ygcej0IDPxZeQ8WvqWapq4=",
"owner": "astro",
"repo": "microvm.nix",
"rev": "79348ff0bd850606d8c6c438ea1af8078494c559",
"rev": "d578ed45d3528c42ab4b12edf6d1512a7bd35714",
"type": "github"
},
"original": {
@ -385,11 +385,11 @@
},
"nixos": {
"locked": {
"lastModified": 1681496784,
"narHash": "sha256-snebCSMpgzD2iFp4KTq/aJ93yyJuDMslcVbcGyXJDk4=",
"lastModified": 1681515794,
"narHash": "sha256-DF5pVSJU9Wd7v91j9AJ1yRgsY11JG0HELzoTcHfqzcQ=",
"owner": "SuperSandro2000",
"repo": "nixpkgs",
"rev": "752e461c4d93b12ea7ec622a4eb780968c324e62",
"rev": "50ac6d359a4fa22230fd39afc8b5d08829554d7c",
"type": "github"
},
"original": {
@ -844,11 +844,11 @@
]
},
"locked": {
"lastModified": 1680737870,
"narHash": "sha256-JHHuBUN8M1worLTM0ucp6PqkScmVJyjsCk7JTl10Pjo=",
"lastModified": 1681500882,
"narHash": "sha256-D7x+w5TR/S93tNerDP//Z8/kzopOAtPsGuS55em8JIo=",
"ref": "refs/heads/master",
"rev": "3069e4c5b952daa7866a0077cc763835c9d3f43e",
"revCount": 1761,
"rev": "dd75dcd8e496953b833fe5fa5376f7e8a501a803",
"revCount": 1763,
"type": "git",
"url": "https://gitea.c3d2.de/zentralwerk/network.git"
},

View File

@ -37,20 +37,42 @@
pkgs.makeModulesClosure (x // { allowMissing = true; });
};
nixpkgs.overlays = [
(final: prev: {
python3 = prev.python3.override {
packageOverrides = python-final: python-prev: {
aiohttp = python-prev.aiohttp.overrideAttrs ({ nativeBuildInputs ? [],... }: {
nativeBuildInputs = nativeBuildInputs ++ [python-final.setuptools];
doCheck = false;
doInstallCheck = false;
});
pystray = python-prev.pystray.overrideAttrs (_: {
doCheck = false;
doInstallCheck = false;
});
samplerate = python-prev.samplerate.overrideAttrs (_: {
dontUseSetuptoolsCheck = true;
});
};
};
python3Packages = final.python3.pkgs;
})
];
networking = {
domain = "hq.c3d2.de";
firewall = {
allowedTCPPorts = [
# pulseaudio/pipewire network sync
4713
# llmnr
5355
4713 # pulseaudio/pipewire network sync
5355 # llmnr
8888 # ledfx
];
allowedUDPPorts = [
# mdns
5353
# llmnr
5355
5353 # mdns
5355 # llmnr
];
};
hostName = "pulsebert";
@ -68,39 +90,41 @@
# https://github.com/dump-dvb/nix-config/blob/310ceedca5ab2d5c22070bd73c603926b6100a74/hardware/configuration-rpi-3b.nix#L16
sdImage = lib.mkForce {
populateFirmwareCommands = let
configTxt = pkgs.writeText "config.txt" ''
[pi3]
kernel=u-boot-rpi3.bin
hdmi_force_hotplug=1
[pi02]
kernel=u-boot-rpi3.bin
[pi4]
kernel=u-boot-rpi4.bin
enable_gic=1
armstub=armstub8-gic.bin
# Otherwise the resolution will be weird in most cases, compared to
# what the pi3 firmware does by default.
disable_overscan=1
# Supported in newer board revisions
arm_boost=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]
# Boot in 64-bit mode.
arm_64bit=1
# U-Boot needs this to work, regardless of whether UART is actually used or not.
# Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still
# a requirement in the future.
enable_uart=1
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
# when attempting to show low-voltage or overtemperature warnings.
avoid_warnings=1
'';
in ''
populateFirmwareCommands =
let
configTxt = pkgs.writeText "config.txt" ''
[pi3]
kernel=u-boot-rpi3.bin
hdmi_force_hotplug=1
[pi02]
kernel=u-boot-rpi3.bin
[pi4]
kernel=u-boot-rpi4.bin
enable_gic=1
armstub=armstub8-gic.bin
# Otherwise the resolution will be weird in most cases, compared to
# what the pi3 firmware does by default.
disable_overscan=1
# Supported in newer board revisions
arm_boost=1
[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]
# Boot in 64-bit mode.
arm_64bit=1
# U-Boot needs this to work, regardless of whether UART is actually used or not.
# Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still
# a requirement in the future.
enable_uart=1
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
# when attempting to show low-voltage or overtemperature warnings.
avoid_warnings=1
'';
in
''
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
# Add the config
cp ${configTxt} firmware/config.txt
@ -128,12 +152,8 @@
};
};
users.users = lib.optionalAttrs config.services.octoprint.enable {
# Allow access to printer serial port and GPIO
"${config.services.octoprint.user}".extraGroups = [ "dialout" ];
};
services = {
avahi.nssmdns = true;
# Do not log to flash but also breaks journalctl --user
# journald.extraConfig = ''
# Storage=volatile
@ -183,4 +203,17 @@
};
system.stateVersion = "22.11";
systemd.user.services.ledfx = {
after = [ "pipewire.target" ];
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = "${pkgs.ledfx}/bin/ledfx --host 0.0.0.0";
};
};
users.users = lib.optionalAttrs config.services.octoprint.enable {
# Allow access to printer serial port and GPIO
"${config.services.octoprint.user}".extraGroups = [ "dialout" ];
};
}

View File

@ -43,6 +43,7 @@
services.pipewire = {
enable = true;
alsa.enable = true; # required for ledfx
config.pipewire-pulse =
let
default-pipewire-pulse = lib.importJSON (pkgs.path + "/nixos/modules/services/desktops/pipewire/daemon/pipewire-pulse.conf.json");