apple/t2: add tiny-dfr service
This commit is contained in:
parent
17ad09c30c
commit
7e3a3f3170
|
@ -24,6 +24,8 @@ let
|
|||
|
||||
pipewirePackage = overrideAudioFiles pkgs.pipewire "spa/plugins/";
|
||||
|
||||
tiny-dfrPackage = pkgs.callPackage ./pkgs/tiny-dfr.nix { };
|
||||
|
||||
apple-set-os-loader-installer = pkgs.stdenv.mkDerivation {
|
||||
name = "apple-set-os-loader-installer-1.0";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
|
@ -60,9 +62,10 @@ in
|
|||
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.callPackage ./pkgs/linux-t2.nix { });
|
||||
boot.initrd.kernelModules = [ "apple-bce" ];
|
||||
|
||||
services.udev.packages = [ audioFilesUdevRules tiny-dfrPackage ];
|
||||
|
||||
# For audio
|
||||
boot.kernelParams = [ "pcie_ports=compat" "intel_iommu=on" "iommu=pt" ];
|
||||
services.udev.packages = [ audioFilesUdevRules ];
|
||||
|
||||
hardware.pulseaudio.package = overrideAudioFiles pkgs.pulseaudio "src/modules/";
|
||||
|
||||
|
@ -71,6 +74,22 @@ in
|
|||
pipewire = pipewirePackage;
|
||||
};
|
||||
|
||||
# For tiny-dfr
|
||||
systemd.services.tiny-dfr = {
|
||||
enable = true;
|
||||
description = "Tiny Apple silicon touch bar daemon";
|
||||
after = [ "systemd-user-sessions.service" "getty@tty1.service" "plymouth-quit.service" "systemd-logind.service" ];
|
||||
bindsTo = [ "dev-tiny_dfr_display.device" "dev-tiny_dfr_backlight.device" ];
|
||||
startLimitIntervalSec = 30;
|
||||
startLimitBurst = 2;
|
||||
script = "${tiny-dfrPackage}/bin/tiny-dfr";
|
||||
restartTriggers = [ tiny-dfrPackage ];
|
||||
};
|
||||
|
||||
environment.etc."tiny-dfr/config.toml" = {
|
||||
source = "${tiny-dfrPackage}/share/tiny-dfr/config.toml";
|
||||
};
|
||||
|
||||
# Make sure post-resume.service exists
|
||||
powerManagement.enable = true;
|
||||
|
||||
|
|
51
apple/t2/pkgs/tiny-dfr.nix
Normal file
51
apple/t2/pkgs/tiny-dfr.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{ pkgs, fetchFromGitHub, rustPlatform, ... }:
|
||||
|
||||
let
|
||||
repo = fetchFromGitHub {
|
||||
owner = "kekrby";
|
||||
repo = "tiny-dfr";
|
||||
rev = "8a5d413cb1dbe2a25b77a9e7f3cb5b9c88ef3ffb";
|
||||
hash = "sha256-l4D7aePz/CYpkRorrvsgIYrvSzoZl59OGcFGJqqJftk=";
|
||||
};
|
||||
|
||||
in
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "tiny-dfr";
|
||||
version = repo.rev;
|
||||
|
||||
src = repo;
|
||||
|
||||
cargoLock.lockFile = "${src}/Cargo.lock";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
udev
|
||||
glib
|
||||
pango
|
||||
cairo
|
||||
gdk-pixbuf
|
||||
libxml2
|
||||
libinput
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/main.rs --replace "/usr/share/tiny-dfr/" "$out/share/tiny-dfr/"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/etc $out/share
|
||||
|
||||
cp -r etc/udev $out/etc/
|
||||
cp -r share/tiny-dfr $out/share/
|
||||
'';
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = "The most basic dynamic function row daemon possible";
|
||||
homepage = "https://github.com/kekrby/tiny-dfr";
|
||||
license = with licenses; [ asl20 bsd3 cc0 isc lgpl21Plus mit mpl20 unicode-dfs-2016 asl20 asl20-llvm mit unlicense ];
|
||||
maintainers = [];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue