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, ...}:
{
home.packages = with pkgs; [
xclip
xcape
xscreensaver
mpv
sxiv
xwallpaper
xbrightness
xdotool
brave
let
plib = import ../lib { inherit pkgs; };
in {
home.packages = [
pkgs.xclip
pkgs.xcape
pkgs.xscreensaver
pkgs.mpv
pkgs.sxiv
pkgs.xwallpaper
pkgs.xbrightness
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}
'';
}