feat: move scripts to cross-platform

This commit is contained in:
CronyAkatsuki 2025-03-30 18:51:48 +02:00
parent 7a20e3c6ac
commit b47f4adb76
6 changed files with 2 additions and 2 deletions

View file

@ -2,6 +2,7 @@
imports = [
./neovim.nix
./shell.nix
./scripts.nix
./tmux.nix
./zsh.nix
];
@ -10,4 +11,5 @@
crony.shell.enable = lib.mkDefault true;
crony.tmux.enable = lib.mkDefault true;
crony.zsh.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,7 @@
#!/usr/bin/env sh
for File in *.iso; do
[ -f "$File" ] || continue
chdman createdvd -i "$File" -o "${File%.iso}.chd"
rm -v "$File"
done

View file

@ -0,0 +1,27 @@
{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]}
# Add dependencies to the runtime for my iso2chd script
wrapProgram $out/bin/cue2chd \
--prefix PATH : ${lib.makeBinPath [mame-tools]}
'';
}