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

View File

@ -37,20 +37,42 @@
pkgs.makeModulesClosure (x // { allowMissing = true; }); 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 = { networking = {
domain = "hq.c3d2.de"; domain = "hq.c3d2.de";
firewall = { firewall = {
allowedTCPPorts = [ allowedTCPPorts = [
# pulseaudio/pipewire network sync 4713 # pulseaudio/pipewire network sync
4713 5355 # llmnr
# llmnr 8888 # ledfx
5355
]; ];
allowedUDPPorts = [ allowedUDPPorts = [
# mdns 5353 # mdns
5353 5355 # llmnr
# llmnr
5355
]; ];
}; };
hostName = "pulsebert"; hostName = "pulsebert";
@ -68,39 +90,41 @@
# https://github.com/dump-dvb/nix-config/blob/310ceedca5ab2d5c22070bd73c603926b6100a74/hardware/configuration-rpi-3b.nix#L16 # https://github.com/dump-dvb/nix-config/blob/310ceedca5ab2d5c22070bd73c603926b6100a74/hardware/configuration-rpi-3b.nix#L16
sdImage = lib.mkForce { sdImage = lib.mkForce {
populateFirmwareCommands = let populateFirmwareCommands =
configTxt = pkgs.writeText "config.txt" '' let
[pi3] configTxt = pkgs.writeText "config.txt" ''
kernel=u-boot-rpi3.bin [pi3]
hdmi_force_hotplug=1 kernel=u-boot-rpi3.bin
[pi02] hdmi_force_hotplug=1
kernel=u-boot-rpi3.bin [pi02]
[pi4] kernel=u-boot-rpi3.bin
kernel=u-boot-rpi4.bin [pi4]
enable_gic=1 kernel=u-boot-rpi4.bin
armstub=armstub8-gic.bin enable_gic=1
# Otherwise the resolution will be weird in most cases, compared to armstub=armstub8-gic.bin
# what the pi3 firmware does by default. # Otherwise the resolution will be weird in most cases, compared to
disable_overscan=1 # what the pi3 firmware does by default.
# Supported in newer board revisions disable_overscan=1
arm_boost=1 # Supported in newer board revisions
[cm4] arm_boost=1
# Enable host mode on the 2711 built-in XHCI USB controller. [cm4]
# This line should be removed if the legacy DWC2 controller is required # Enable host mode on the 2711 built-in XHCI USB controller.
# (e.g. for USB device mode) or if USB support is not required. # This line should be removed if the legacy DWC2 controller is required
otg_mode=1 # (e.g. for USB device mode) or if USB support is not required.
[all] otg_mode=1
# Boot in 64-bit mode. [all]
arm_64bit=1 # Boot in 64-bit mode.
# U-Boot needs this to work, regardless of whether UART is actually used or not. arm_64bit=1
# Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still # U-Boot needs this to work, regardless of whether UART is actually used or not.
# a requirement in the future. # Look in arch/arm/mach-bcm283x/Kconfig in the U-Boot tree to see if this is still
enable_uart=1 # a requirement in the future.
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel enable_uart=1
# when attempting to show low-voltage or overtemperature warnings. # Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
avoid_warnings=1 # when attempting to show low-voltage or overtemperature warnings.
''; avoid_warnings=1
in '' '';
in
''
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/) (cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
# Add the config # Add the config
cp ${configTxt} firmware/config.txt 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 = { services = {
avahi.nssmdns = true;
# Do not log to flash but also breaks journalctl --user # Do not log to flash but also breaks journalctl --user
# journald.extraConfig = '' # journald.extraConfig = ''
# Storage=volatile # Storage=volatile
@ -183,4 +203,17 @@
}; };
system.stateVersion = "22.11"; 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 = { services.pipewire = {
enable = true; enable = true;
alsa.enable = true; # required for ledfx
config.pipewire-pulse = config.pipewire-pulse =
let let
default-pipewire-pulse = lib.importJSON (pkgs.path + "/nixos/modules/services/desktops/pipewire/daemon/pipewire-pulse.conf.json"); default-pipewire-pulse = lib.importJSON (pkgs.path + "/nixos/modules/services/desktops/pipewire/daemon/pipewire-pulse.conf.json");