dotfiles/bin/default.nix

33 lines
1.1 KiB
Nix
Raw Permalink Normal View History

2021-05-29 18:05:31 +02:00
{ pkgs ? import <nixpkgs> { } }:
2016-09-17 15:09:53 +02:00
#{ writeScript ? pkgs.writeScript, lib ? pkgs.lib, stdenv ? pkgs.stdenv }:
with pkgs;
let
2021-05-29 18:05:31 +02:00
compileShell = src: buildInputs: name:
stdenv.mkDerivation {
inherit name src;
buildInputs = buildInputs ++ [ makeWrapper ];
unpackPhase = "true";
installPhase = ''
mkdir -p $out/bin && cp $src $out/bin/${name}
wrapProgram $out/bin/${name} --suffix PATH : ${
lib.makeSearchPath "bin" buildInputs
}
'';
};
2022-04-16 09:59:10 +02:00
makeWrap = cmd: executable: name:
pkgs.runCommand name { buildInputs = [ makeWrapper ]; } ''
makeWrapper ${executable} $out/bin/${name} --add-flags ${cmd}
'';
2016-09-17 15:09:53 +02:00
in lib.mapAttrs (k: f: f k) {
2021-05-29 18:05:31 +02:00
backup = compileShell ./backup.sh (with pkgs; [ utillinux duplicity ]);
screenshot_public =
compileShell ./screenshot_public.sh (with pkgs; [ scrot xclip rsync ]);
2022-04-16 09:59:10 +02:00
# impure
2022-05-15 14:35:03 +02:00
y-cal-widget = makeWrap ./cal.py "${
2022-04-16 09:59:10 +02:00
python3.withPackages (p: [ (p.toPythonModule gcalcli) p.i3ipc ])
}/bin/python";
2023-01-18 21:30:31 +01:00
absorb = makeWrap ./absorb.py "${
python3.withPackages (p: [ p.requests ])
}/bin/python";
2016-09-17 15:09:53 +02:00
}