when python meets nixos

This commit is contained in:
Aram Markarov
2026-02-14 17:03:35 +01:00
parent c5959c4d8e
commit 4286122a97
2 changed files with 63 additions and 56 deletions
+8 -5
View File
@@ -18,7 +18,12 @@
in { in {
formatter = forAllSystems (pkgs: pkgs.nixfmt); formatter = forAllSystems (pkgs: pkgs.nixfmt);
packages = forAllSystems (pkgs: rec { packages = forAllSystems (pkgs: let
pythonEnv = pkgs.python3.withPackages (ps: [
ps.pillow
ps.materialyoucolor
]);
in rec {
zshell = pkgs.callPackage ./nix { zshell = pkgs.callPackage ./nix {
rev = self.rev or self.dirtyRev; rev = self.rev or self.dirtyRev;
stdenv = pkgs.clangStdenv; stdenv = pkgs.clangStdenv;
@@ -27,6 +32,8 @@
withI3 = false; withI3 = false;
}; };
app2unit = pkgs.callPackage ./nix/app2unit.nix {inherit pkgs;}; app2unit = pkgs.callPackage ./nix/app2unit.nix {inherit pkgs;};
inherit pythonEnv;
}; };
default = zshell; default = zshell;
@@ -45,10 +52,6 @@
material-symbols material-symbols
rubik rubik
nerd-fonts.caskaydia-cove nerd-fonts.caskaydia-cove
(pkgs.python3.withPackages (python-pkgs: [
python-pkgs.pillow
python-pkgs.materialyoucolor
]))
]; ];
}; };
}); });
+55 -51
View File
@@ -21,11 +21,12 @@
cmake, cmake,
ninja, ninja,
pkg-config, pkg-config,
}: pythonEnv,
let }: let
version = "1.0.0"; version = "1.0.0";
runtimeDeps = [ runtimeDeps = [
pythonEnv
app2unit app2unit
networkmanager networkmanager
swappy swappy
@@ -65,6 +66,7 @@ let
pkg-config pkg-config
]; ];
buildInputs = [ buildInputs = [
pythonEnv
qt6.qtbase qt6.qtbase
qt6.qtdeclarative qt6.qtdeclarative
libqalculate libqalculate
@@ -73,61 +75,63 @@ let
]; ];
dontWrapQtApps = true; dontWrapQtApps = true;
cmakeFlags = [ cmakeFlags =
(lib.cmakeFeature "ENABLE_MODULES" "plugin") [
(lib.cmakeFeature "INSTALL_QMLDIR" qt6.qtbase.qtQmlPrefix) (lib.cmakeFeature "ENABLE_MODULES" "plugin")
] (lib.cmakeFeature "INSTALL_QMLDIR" qt6.qtbase.qtQmlPrefix)
++ cmakeVersionFlags; ]
++ cmakeVersionFlags;
}; };
in in
stdenv.mkDerivation { stdenv.mkDerivation {
inherit version cmakeBuildType; inherit version cmakeBuildType;
pname = "zshell"; pname = "zshell";
src = ./..; src = ./..;
nativeBuildInputs = [ nativeBuildInputs = [
cmake cmake
ninja ninja
makeWrapper makeWrapper
qt6.wrapQtAppsHook qt6.wrapQtAppsHook
]; ];
buildInputs = [ buildInputs = [
quickshell quickshell
plugin plugin
qt6.qtbase qt6.qtbase
qt6.qtwayland qt6.qtwayland
]; ];
propagatedBuildInputs = runtimeDeps; propagatedBuildInputs = runtimeDeps;
cmakeFlags = [ cmakeFlags =
(lib.cmakeFeature "ENABLE_MODULES" "shell") [
(lib.cmakeFeature "INSTALL_QSCONFDIR" "${placeholder "out"}/share/ZShell") (lib.cmakeFeature "ENABLE_MODULES" "shell")
] (lib.cmakeFeature "INSTALL_QSCONFDIR" "${placeholder "out"}/share/ZShell")
++ cmakeVersionFlags; ]
++ cmakeVersionFlags;
prePatch = '' prePatch = ''
substituteInPlace shell.qml \ substituteInPlace shell.qml \
--replace-fail 'ShellRoot {' 'ShellRoot { settings.watchFiles: false' --replace-fail 'ShellRoot {' 'ShellRoot { settings.watchFiles: false'
''; '';
postInstall = '' postInstall = ''
makeWrapper ${quickshell}/bin/qs $out/bin/zshell \ makeWrapper ${quickshell}/bin/qs $out/bin/zshell \
--prefix PATH : "${lib.makeBinPath runtimeDeps}" \ --prefix PATH : "${lib.makeBinPath runtimeDeps}" \
--set FONTCONFIG_FILE "${fontconfig}" \ --set FONTCONFIG_FILE "${fontconfig}" \
--add-flags "-p $out/share/ZShell" --add-flags "-p $out/share/ZShell"
echo "$out" echo "$out"
mkdir -p $out/lib mkdir -p $out/lib
''; '';
passthru = { passthru = {
inherit plugin; inherit plugin;
}; };
meta = { meta = {
description = "A very segsy desktop shell"; description = "A very segsy desktop shell";
homepage = "https://github.com/Zacharias-Brohn/z-bar-qt"; homepage = "https://github.com/Zacharias-Brohn/z-bar-qt";
license = lib.licenses.gpl3Only; license = lib.licenses.gpl3Only;
mainProgram = "zshell"; mainProgram = "zshell";
}; };
} }