Modularize hardware config and remove specific nix folder

This commit is contained in:
DashieTM 2024-07-20 01:56:54 +02:00
parent a5042bb645
commit 9ac5b25036
72 changed files with 322 additions and 100 deletions

92
override/cambalache.nix Normal file
View file

@ -0,0 +1,92 @@
{ stdenv
, lib
, pkgs
, fetchFromGitLab
, nix-update-script
}:
pkgs.python3.pkgs.buildPythonApplication rec {
pname = "cambalache";
version = "0.90.1";
format = "other";
# Did not fetch submodule since it is only for tests we don't run.
src = fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "jpu";
repo = pname;
rev = version;
sha256 = "sha256-YuRxqrGJvhMMZApD/tQSWkUg/nZnp/xryBJSjXCXO4w=";
};
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
gobject-introspection # for setup hook
desktop-file-utils # for update-desktop-database
shared-mime-info # for update-mime-database
wrapGAppsHook
];
pythonPath = with pkgs.python3.pkgs; [
pygobject3
lxml
];
buildInputs = with pkgs; [
glib
gtk3
gtk4
gtksourceview4
gtksourceview5
webkitgtk_4_1
webkitgtk_6_0
# For extra widgets support.
libadwaita
libhandy
];
# Prevent double wrapping.
dontWrapGApps = true;
postPatch = ''
patchShebangs postinstall.py
# those programs are used at runtime not build time
# https://gitlab.gnome.org/jpu/cambalache/-/blob/0.12.1/meson.build#L79-80
substituteInPlace ./meson.build \
--replace "find_program('broadwayd', required: true)" "" \
--replace "find_program('gtk4-broadwayd', required: true)" ""
'';
preFixup = ''
# Let python wrapper use GNOME flags.
makeWrapperArgs+=(
# For broadway daemons
--prefix PATH : "${lib.makeBinPath [ pkgs.gtk3 pkgs.gtk4 ]}"
"''${gappsWrapperArgs[@]}"
)
'';
postFixup = ''
# Wrap a helper script in an unusual location.
wrapPythonProgramsIn "$out/${pkgs.python3.sitePackages}/cambalache/priv/merengue" "$out $pythonPath"
'';
passthru = {
updateScript = nix-update-script { };
};
meta = with lib; {
homepage = "https://gitlab.gnome.org/jpu/cambalache";
description = "RAD tool for GTK 4 and 3 with data model first philosophy";
mainProgram = "cambalache";
maintainers = teams.gnome.members;
license = with licenses; [
lgpl21Only # Cambalache
gpl2Only # tools
];
platforms = platforms.unix;
};
}

106
override/streamdeck.nix Normal file
View file

@ -0,0 +1,106 @@
{ lib
, pkgs
, python3Packages
, fetchFromGitHub
, writeText
, makeDesktopItem
}:
python3Packages.buildPythonApplication rec {
pname = "streamdeck-ui";
version = "4.1.2";
src = fetchFromGitHub {
repo = "streamdeck-linux-gui";
owner = "streamdeck-linux-gui";
rev = "v${version}";
sha256 = "sha256-CSsFPGnKVQUCND6YOA9kfO41KS85C57YL9LcrWlQRKo=";
};
patches = [
# nixpkgs has a newer pillow version
./streamdeck.patch
];
desktopItems =
let
common = {
name = "streamdeck-ui";
desktopName = "Stream Deck UI";
icon = "streamdeck-ui";
exec = "streamdeck";
comment = "UI for the Elgato Stream Deck";
categories = [ "Utility" ];
};
in
builtins.map makeDesktopItem [
common
(common // {
name = "${common.name}-noui";
exec = "${common.exec} --no-ui";
noDisplay = true;
})
];
postInstall =
let
udevRules = ''
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fd9", TAG+="uaccess"
'';
in
''
mkdir -p $out/lib/systemd/user
substitute scripts/streamdeck.service $out/lib/systemd/user/streamdeck.service \
--replace '<path to streamdeck>' $out/bin/streamdeck
mkdir -p "$out/etc/udev/rules.d"
cp ${writeText "70-streamdeck.rules" udevRules} $out/etc/udev/rules.d/70-streamdeck.rules
mkdir -p "$out/share/pixmaps"
cp streamdeck_ui/logo.png $out/share/pixmaps/streamdeck-ui.png
'';
dontWrapQtApps = true;
dontWrapGApps = true;
makeWrapperArgs = [ "\${qtWrapperArgs[@]}" "\${gappsWrapperArgs[@]}" ];
format = "pyproject";
nativeBuildInputs = [
pkgs.python3Packages.poetry-core
pkgs.copyDesktopItems
pkgs.qt6.wrapQtAppsHook
pkgs.wrapGAppsHook
];
propagatedBuildInputs = with pkgs.python3Packages; [
importlib-metadata
setuptools
filetype
cairosvg
pillow
pynput
pyside6
streamdeck
xlib
] ++ lib.optionals stdenv.isLinux [
pkgs.qt6.qtwayland
];
nativeCheckInputs = [
pkgs.xvfb-run
pkgs.python3Packages.pytest
];
# checkPhase = ''
# xvfb-run pytest tests
# '';
meta = with lib; {
description = "Linux compatible UI for the Elgato Stream Deck";
homepage = "https://streamdeck-linux-gui.github.io/streamdeck-linux-gui/";
license = licenses.mit;
mainProgram = "streamdeck";
maintainers = with maintainers; [ majiir ];
};
}

18
override/streamdeck.patch Normal file
View file

@ -0,0 +1,18 @@
diff --git a/pyproject.toml b/pyproject.toml
index 54a8c19..0b95fb3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -14,11 +14,11 @@ packages = [
[tool.poetry.dependencies]
python = ">=3.8,<3.13"
streamdeck = "^0.9.5"
-pillow = "10.2.0"
+pillow = "^10.2.0"
pyside6 = "^6.4.2"
CairoSVG = "^2.5.2"
filetype = "^1.0.10"
-importlib-metadata = "^6.8.0"
+importlib-metadata = "^7.0.0"
evdev = "^1.6.1"
[tool.poetry.group.docs.dependencies]