diff options
| author | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-08-29 03:45:10 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-08-29 03:50:33 +0530 |
| commit | 1a39cf221e3f647df0767c88d89a54e3813e7019 (patch) | |
| tree | b3df1afb0bcc0942a364f267f993ed1a9bfb9434 /modules/desktop/eww | |
| parent | e9e375f5f5263964fe89479a2610081000959774 (diff) | |
| download | home-manager-config-1a39cf221e3f647df0767c88d89a54e3813e7019.tar.gz home-manager-config-1a39cf221e3f647df0767c88d89a54e3813e7019.zip | |
refactor: adding explicit options to enable scripts
- some scripts that are not critical to the functioning of other
options, can be enabled/disabled
Diffstat (limited to 'modules/desktop/eww')
| -rw-r--r-- | modules/desktop/eww/yuck.nix | 56 |
1 files changed, 53 insertions, 3 deletions
diff --git a/modules/desktop/eww/yuck.nix b/modules/desktop/eww/yuck.nix index 0efc0f1..1fde829 100644 --- a/modules/desktop/eww/yuck.nix +++ b/modules/desktop/eww/yuck.nix @@ -4,13 +4,63 @@ pkgs, ... }: -let - inherit ((import ../../lib/script.nix { inherit lib pkgs; })) mkPythonScript; -in { config = lib.mkIf config.desktop.enable { programs.eww.yuckConfig = let + mkPythonScript = + { + name, + path, + description ? "", + python ? pkgs.python3, + pythonPackages ? (ps: [ ]), + deps ? [ ], + gobjectIntrospection ? false, + }: + let + pythonEnv = python.withPackages pythonPackages; + pathPrefix = lib.concatStringsSep ":" ( + [ "${pythonEnv}/bin" ] ++ map (p: "${lib.getBin p}/bin") deps + ); + in + pkgs.stdenv.mkDerivation { + pname = name; + version = "0.1.0"; + src = path; + dontUnpack = true; + meta = lib.optionalAttrs (description != "") { inherit description; } // { + mainProgram = name; + }; + + nativeBuildInputs = + lib.optionals gobjectIntrospection [ + pkgs.wrapGAppsHook3 + pkgs.gobject-introspection + ] + ++ lib.optional (!gobjectIntrospection) pkgs.makeWrapper; + buildInputs = lib.optionals gobjectIntrospection [ pkgs.gtk3 ]; + + installPhase = '' + mkdir -p $out/bin + install -m755 $src $out/bin/${name} + patchShebangs $out/bin/${name} + ''; + + # wrapGAppsHook3 wraps every executable in $out/bin automatically, + # setting GI_TYPELIB_PATH etc. from buildInputs' closure. With + # gobjectIntrospection = false a plain wrapProgram only extends PATH. + preFixup = + if gobjectIntrospection then + '' + gappsWrapperArgs+=(--prefix PATH : "${pathPrefix}") + '' + else + '' + wrapProgram $out/bin/${name} --prefix PATH : "${pathPrefix}" + ''; + }; + system-stats = mkPythonScript { name = "eww-system-stats"; path = ./system-stats.py; |
