feat: add custom scripts.

This commit is contained in:
CronyAkatsuki 2025-03-18 18:20:13 +01:00
parent 84bf820b93
commit f1c37c598f
4 changed files with 48 additions and 0 deletions

View File

@ -12,6 +12,7 @@
./hyprland.nix
./browsers
./shell.nix
./scripts.nix
];
crony.mangohud.enable = lib.mkDefault true;
@ -26,4 +27,5 @@
crony.hyprland.enable = lib.mkDefault true;
crony.browsers.enable = lib.mkDefault true;
crony.shell.enable = lib.mkDefault true;
crony.scripts.enable = lib.mkDefault true;
}

View File

@ -0,0 +1,16 @@
{
config,
pkgs,
lib,
...
}: {
options = {
crony.scripts.enable = lib.mkEnableOption "Enable my custom scripts";
};
config = lib.mkIf config.crony.scripts.enable {
home.packages = with pkgs; [
(callPackage ./scripts {inherit pkgs;})
];
};
}

View File

@ -0,0 +1,7 @@
#!/usr/bin/env sh
for File in *.cue; do
[ -f "$File" ] || continue
chdman createcd -i "$File" -o "${File%.cue}.chd"
rm -v "$File" "${File%.cue}"*.bin
done

View File

@ -0,0 +1,23 @@
{pkgs, ...}:
with pkgs;
stdenv.mkDerivation {
pname = "scripts";
version = "1";
src = ./bin;
nativeBuildInputs = [makeWrapper];
installPhase = ''
mkdir -p $out/bin
# move scripts to bin
mv ./* $out/bin
# Fix shebangs for scripts
patchShebangs $out/bin
# Add dependencies to the runtime for my cue2chd script
wrapProgram $out/bin/cue2chd \
--prefix PATH : ${lib.makeBinPath [mame-tools]}
'';
}