add some library functions

This commit is contained in:
randomuser 2024-04-06 16:49:24 -05:00
parent 7759241d99
commit fa17d83cb2
2 changed files with 47 additions and 12 deletions

View File

@ -1,16 +1,23 @@
{ lib, config, pkgs, ...}: { lib, config, pkgs, ...}:
{ let
home.packages = with pkgs; [ plib = import ../lib { inherit pkgs; };
xclip in {
xcape home.packages = [
xscreensaver pkgs.xclip
mpv pkgs.xcape
sxiv pkgs.xscreensaver
xwallpaper pkgs.mpv
xbrightness pkgs.sxiv
xdotool pkgs.xwallpaper
pkgs.xbrightness
brave pkgs.xdotool
] ++ [
(plib.mkPackageWrapper
pkgs.brave
"export HOME=$HOME/.cache/brave"
""
"--args --disable-frame-rate-limit"
)
]; ];
} }

28
lib/default.nix Normal file
View File

@ -0,0 +1,28 @@
{ pkgs ? import <nixpkgs> {} }:
let
getPkgName =
pkg:
builtins.elemAt (builtins.split "-" pkg.name) 0;
in {
mkPackageWrapper =
pkg:
environ:
prefix:
postfix:
pkgs.writeScriptBin
(getPkgName pkg)
''
#! ${pkgs.bash}/bin/bash
${environ}
exec ${prefix} ${pkg}/bin/${getPkgName pkg} ${postfix} "$@"
'';
mkQuarantinedPackage =
pkg:
pkgs.writeScriptBin
(getPkgName pkg)
''
#! ${pkgs.bash}/bin/bash
export HOME=$HOME/.local/${getPkgName pkg}
exec ${pkg}/bin/${getPkgName pkg}
'';
}