Compare commits

..

6 Commits

13 changed files with 257 additions and 183 deletions

258
flake.lock generated
View File

@ -20,11 +20,11 @@
]
},
"locked": {
"lastModified": 1759499898,
"narHash": "sha256-UNzYHLWfkSzLHDep5Ckb5tXc0fdxwPIrT+MY4kpQttM=",
"lastModified": 1762356719,
"narHash": "sha256-qwd/xdoOya1m8FENle+4hWnydCtlXUWLAW/Auk6WL7s=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "655e067f96fd44b3f5685e17f566b0e4d535d798",
"rev": "6d0b3567584691bf9d8fedb5d0093309e2f979c7",
"type": "github"
},
"original": {
@ -41,11 +41,11 @@
]
},
"locked": {
"lastModified": 1759439824,
"narHash": "sha256-bOmAhQG3Ek2ZpNcnkFo3yiGeSmklk1uLm09BwDdnpWM=",
"lastModified": 1762547735,
"narHash": "sha256-uJb+4GjFynnDQdDstcmdccx7kIYIf9STk3XymMKEJfs=",
"owner": "polygon",
"repo": "audio.nix",
"rev": "8595d27a844a11bd14819de330ce6c9f724923bb",
"rev": "46b42efb0c382daca6f1184a1060ffa0636a22a6",
"type": "github"
},
"original": {
@ -82,11 +82,11 @@
},
"locked": {
"dir": "pkgs/firefox-addons",
"lastModified": 1760846615,
"narHash": "sha256-ept30QIKVAx/f7fHBGIfCPhPdZNd4yaBTq2Frz1LkFM=",
"lastModified": 1762920261,
"narHash": "sha256-VuUg2EP2Y0QrDTsDP6/3kN3Hurn6HfyMW3rGzdruhW8=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "afeaf06f6cbc7fd65e8cdbe53ddf3f3c643b36d1",
"rev": "8cd76837f50debe28b51820adb00b522df8ade91",
"type": "gitlab"
},
"original": {
@ -216,11 +216,11 @@
]
},
"locked": {
"lastModified": 1759490292,
"narHash": "sha256-T6iWzDOXp8Wv0KQOCTHpBcmAOdHJ6zc/l9xaztW6Ivc=",
"lastModified": 1762462052,
"narHash": "sha256-6roLYzcDf4V38RUMSqycsOwAnqfodL6BmhRkUtwIgdA=",
"owner": "hyprwm",
"repo": "hyprgraphics",
"rev": "9431db625cd9bb66ac55525479dce694101d6d7a",
"rev": "ffc999d980c7b3bca85d3ebd0a9fbadf984a8162",
"type": "github"
},
"original": {
@ -234,8 +234,8 @@
"aquamarine": "aquamarine",
"hyprcursor": "hyprcursor",
"hyprgraphics": "hyprgraphics",
"hyprland-guiutils": "hyprland-guiutils",
"hyprland-protocols": "hyprland-protocols",
"hyprland-qtutils": "hyprland-qtutils",
"hyprlang": "hyprlang",
"hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner",
@ -247,11 +247,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1760874867,
"narHash": "sha256-w2JettCPyqWKMYoJRCTc5/nsSvGrSV9jG4kbn8Q0pZk=",
"lastModified": 1762987426,
"narHash": "sha256-MTW2FfSP1gqjzL3nVKuz/RfvlextYjlgQPHEZbZI5cM=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "59ff7b2f891d06f4097128faf7027a3863542167",
"rev": "b77cbad50251f0506b61d834b025247dcf74dddf",
"type": "github"
},
"original": {
@ -260,6 +260,52 @@
"type": "github"
}
},
"hyprland-guiutils": {
"inputs": {
"aquamarine": [
"hyprland",
"aquamarine"
],
"hyprgraphics": [
"hyprland",
"hyprgraphics"
],
"hyprlang": [
"hyprland",
"hyprlang"
],
"hyprtoolkit": "hyprtoolkit",
"hyprutils": [
"hyprland",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1762755186,
"narHash": "sha256-ZjjETUHtoEhVN7JI1Cbt3p/KcXpK8ZQaPHx7UkG1OgA=",
"owner": "hyprwm",
"repo": "hyprland-guiutils",
"rev": "66356e20a8ed348aa49c1b9ceace786e224225b3",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-guiutils",
"type": "github"
}
},
"hyprland-plugins": {
"inputs": {
"hyprland": [
@ -277,11 +323,11 @@
]
},
"locked": {
"lastModified": 1760659005,
"narHash": "sha256-wyS6tXYJuzbwckOeaCoRtT4qIG2UZ0YvSZx7EBNjTV0=",
"lastModified": 1762989208,
"narHash": "sha256-NBTbKW0MVIMFCjAqeoJWkg5iUucAZ9jS4Lbyax6rIBE=",
"owner": "hyprwm",
"repo": "hyprland-plugins",
"rev": "a5a6f93d72d5fb37e78b98c756cfd8b340e71a19",
"rev": "befb2670803cf7c1b9f0323449c8d9ccdaa485e2",
"type": "github"
},
"original": {
@ -302,11 +348,11 @@
]
},
"locked": {
"lastModified": 1749046714,
"narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=",
"lastModified": 1759610243,
"narHash": "sha256-+KEVnKBe8wz+a6dTLq8YDcF3UrhQElwsYJaVaHXJtoI=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330",
"rev": "bd153e76f751f150a09328dbdeb5e4fab9d23622",
"type": "github"
},
"original": {
@ -315,74 +361,6 @@
"type": "github"
}
},
"hyprland-qt-support": {
"inputs": {
"hyprlang": [
"hyprland",
"hyprland-qtutils",
"hyprlang"
],
"nixpkgs": [
"hyprland",
"hyprland-qtutils",
"nixpkgs"
],
"systems": [
"hyprland",
"hyprland-qtutils",
"systems"
]
},
"locked": {
"lastModified": 1749154592,
"narHash": "sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE=",
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"rev": "4c8053c3c888138a30c3a6c45c2e45f5484f2074",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qt-support",
"type": "github"
}
},
"hyprland-qtutils": {
"inputs": {
"hyprland-qt-support": "hyprland-qt-support",
"hyprlang": [
"hyprland",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprland-qtutils",
"hyprlang",
"hyprutils"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
],
"systems": [
"hyprland",
"systems"
]
},
"locked": {
"lastModified": 1759080228,
"narHash": "sha256-RgDoAja0T1hnF0pTc56xPfLfFOO8Utol2iITwYbUhTk=",
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"rev": "629b15c19fa4082e4ce6be09fdb89e8c3312aed7",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"type": "github"
}
},
"hyprlang": {
"inputs": {
"hyprutils": [
@ -412,6 +390,58 @@
"type": "github"
}
},
"hyprtoolkit": {
"inputs": {
"aquamarine": [
"hyprland",
"hyprland-guiutils",
"aquamarine"
],
"hyprgraphics": [
"hyprland",
"hyprland-guiutils",
"hyprgraphics"
],
"hyprlang": [
"hyprland",
"hyprland-guiutils",
"hyprlang"
],
"hyprutils": [
"hyprland",
"hyprland-guiutils",
"hyprutils"
],
"hyprwayland-scanner": [
"hyprland",
"hyprland-guiutils",
"hyprwayland-scanner"
],
"nixpkgs": [
"hyprland",
"hyprland-guiutils",
"nixpkgs"
],
"systems": [
"hyprland",
"hyprland-guiutils",
"systems"
]
},
"locked": {
"lastModified": 1762463729,
"narHash": "sha256-2fYkU/mdz8WKY3dkDPlE/j6hTxIwqultsx4gMMsMns0=",
"owner": "hyprwm",
"repo": "hyprtoolkit",
"rev": "88483bdee5329ec985f0c8f834c519cd18cfe532",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprtoolkit",
"type": "github"
}
},
"hyprutils": {
"inputs": {
"nixpkgs": [
@ -424,11 +454,11 @@
]
},
"locked": {
"lastModified": 1759619523,
"narHash": "sha256-r1ed7AR2ZEb2U8gy321/Xcp1ho2tzn+gG1te/Wxsj1A=",
"lastModified": 1762387740,
"narHash": "sha256-gQ9zJ+pUI4o+Gh4Z6jhJll7jjCSwi8ZqJIhCE2oqwhQ=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "3df7bde01efb3a3e8e678d1155f2aa3f19e177ef",
"rev": "926689ddb9c0a8787e58c02c765a62e32d63d1f7",
"type": "github"
},
"original": {
@ -506,11 +536,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1760106635,
"narHash": "sha256-2GoxVaKWTHBxRoeUYSjv0AfSOx4qw5CWSFz2b+VolKU=",
"lastModified": 1762847253,
"narHash": "sha256-BWWnUUT01lPwCWUvS0p6Px5UOBFeXJ8jR+ZdLX8IbrU=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "9ed85f8afebf2b7478f25db0a98d0e782c0ed903",
"rev": "899dc449bc6428b9ee6b3b8f771ca2b0ef945ab9",
"type": "github"
},
"original": {
@ -554,11 +584,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1760524057,
"narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=",
"lastModified": 1762844143,
"narHash": "sha256-SlybxLZ1/e4T2lb1czEtWVzDCVSTvk9WLwGhmxFmBxI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5",
"rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4",
"type": "github"
},
"original": {
@ -570,11 +600,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1760580664,
"narHash": "sha256-/YdfibIrnqXAL8p5kqCU345mzpHoOtuVIkMiI2pF4Dc=",
"lastModified": 1762756533,
"narHash": "sha256-HiRDeUOD1VLklHeOmaKDzf+8Hb7vSWPVFcWwaTrpm+U=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "98ff3f9af2684f6136c24beef08f5e2033fc5389",
"rev": "c2448301fb856e351aab33e64c33a3fc8bcf637d",
"type": "github"
},
"original": {
@ -594,11 +624,11 @@
]
},
"locked": {
"lastModified": 1759321049,
"narHash": "sha256-8XkU4gIrLT2DJZWQyvsP5woXGZF5eE/7AnKfwQkiwYU=",
"lastModified": 1762784320,
"narHash": "sha256-odsk96Erywk5hs0dhArF38zb7Oe0q6LZ70gXbxAPKno=",
"owner": "pjones",
"repo": "plasma-manager",
"rev": "205dcfd4a30d4a5d1b4f28defee69daa7c7252cd",
"rev": "7911a0f8a44c7e8b29d031be3149ee8943144321",
"type": "github"
},
"original": {
@ -617,11 +647,11 @@
]
},
"locked": {
"lastModified": 1758108966,
"narHash": "sha256-ytw7ROXaWZ7OfwHrQ9xvjpUWeGVm86pwnEd1QhzawIo=",
"lastModified": 1762441963,
"narHash": "sha256-j+rNQ119ffYUkYt2YYS6rnd6Jh/crMZmbqpkGLXaEt0=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "54df955a695a84cd47d4a43e08e1feaf90b1fd9b",
"rev": "8e7576e79b88c16d7ee3bbd112c8d90070832885",
"type": "github"
},
"original": {
@ -674,11 +704,11 @@
]
},
"locked": {
"lastModified": 1760845571,
"narHash": "sha256-PwGzU3EOU65Ef1VvuNnVLie+l+P0g/fzf/PGUG82KbM=",
"lastModified": 1762812535,
"narHash": "sha256-A91a+K0Q9wfdPLwL06e/kbHeAWSzPYy2EGdTDsyfb+s=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "9c9a9798be331ed3f4b2902933d7677d0659ee61",
"rev": "d75e4f89e58fdda39e4809f8c52013caa22483b7",
"type": "github"
},
"original": {
@ -730,11 +760,11 @@
]
},
"locked": {
"lastModified": 1755354946,
"narHash": "sha256-zdov5f/GcoLQc9qYIS1dUTqtJMeDqmBmo59PAxze6e4=",
"lastModified": 1761431178,
"narHash": "sha256-xzjC1CV3+wpUQKNF+GnadnkeGUCJX+vgaWIZsnz9tzI=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "a10726d6a8d0ef1a0c645378f983b6278c42eaa0",
"rev": "4b8801228ff958d028f588f0c2b911dbf32297f9",
"type": "github"
},
"original": {

View File

@ -213,7 +213,7 @@
};
devShells.${system} = {
transcode-davinci-resolve = (import ./pkgs/transcode-davinci-resolve/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};};
bulk-transcode = (import ./pkgs/bulk-transcode/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};};
spotify-shortcuts = (import ./pkgs/spotify-shortcuts/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};};
};

View File

@ -107,11 +107,19 @@
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
# gc settings
# gc settings and binary caches
nix = {
settings = {
substituters = [
"https://aseipp-nix-cache.freetls.fastly.net"
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true;
trusted-users = [
"@wheel"
];
};
gc = {
automatic = true;

View File

@ -29,9 +29,14 @@
key = "adminPassword";
};
# Configure nix and garbage collection
# gc settings and binary caches
nix = {
settings = {
substituters = [
"https://aseipp-nix-cache.freetls.fastly.net"
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true;
};

View File

@ -202,9 +202,14 @@
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
# gc settings
# gc settings and binary caches
nix = {
settings = {
substituters = [
"https://aseipp-nix-cache.freetls.fastly.net"
"https://nix-community.cachix.org"
"https://cache.nixos.org/"
];
experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true;
};

View File

@ -63,10 +63,10 @@ in {
hdrmerge
hugin
]
++ lib.optionals cfg.video-editing-light [ffmpeg losslesscut-bin]
++ lib.optionals cfg.video-editing-light [ffmpeg losslesscut-bin avidemux]
++ lib.optionals cfg.video-editing-heavy [
davinci-resolve
hive.transcode-davinci-resolve
hive.bulk-transcode
kdePackages.kdenlive
]
++ lib.optional cfg.daws bitwig-studio-latest;

View File

@ -0,0 +1 @@
use flake ../../#bulk-transcode --show-trace

View File

@ -0,0 +1,83 @@
#!/usr/bin/env bash
declare -rA presets=(
[davinci-resolve]="-c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a pcm_s16le"
[instagram]="-vf scale='if(gte(iw/ih,1),1920,-1)':'if(gte(iw/ih,1),-1,1920)' -pix_fmt yuv420p -c:v h264_nvenc -b:v 3500k -b:a 128k -c:a aac -movflags +faststart"
[web-generic]="-vf scale='if(gte(iw/ih,1),1920,-1)':'if(gte(iw/ih,1),-1,1920)' -pix_fmt yuv420p -c:v h264_nvenc -crf 23 -preset medium -c:a aac -b:a 128k -movflags +faststart"
[storage]="-c:v hevc_nvenc -preset p7 -b:v 0 -spatial-aq 1 -rc vbr_hq -c:a copy"
)
declare -rA containers=(
[davinci-resolve]="mov"
[instagram]="mp4"
[web-generic]="mp4"
[storage]="mp4"
)
where="${1:-.}"
dest="${2:-$where}"
selection=$(find "$where" -type f | fzf --multi --preview 'ffprobe -v error -show_format -show_streams {}' --preview-window=up:wrap)
preset=$(
printf '%s\n' "${!presets[@]}" | \
fzf --multi --prompt "Select a preset"
)
flags="${presets[$preset]}"
container="${containers[$preset]}"
output_dir=$(find "$dest" -type d ! -name '.*' ! -path '*/.*/*' | fzf --preview 'tree -C {}' --preview-window=up:wrap --prompt "Select output directory: ")
if gum confirm "Flatten the directory structure?";
then
flatten=true
else
flatten=false
fi
function transcode_job {
local ifile="$1"
local output_dir="$2"
local flatten="$3"
local where="$4"
local flags="$5"
local container="$6"
local fname=$(basename "$ifile")
local segment=$(realpath --relative-to="$where" "$ifile")
if [ "$flatten" = true ]; then
output_file="$output_dir/$fname.$container"
else
output_file="$output_dir/$segment.$container"
fi
tmp_file=$(mktemp)
echo "Running Command: ffmpeg -y -i $ifile $flags $output_file" >> "$tmp_file"
mkdir -p "$(dirname "$output_file")"
if ffmpeg -y -i "$ifile" $(echo -n "$flags") "$output_file" 2>> "$tmp_file";
then
rm -f "$tmp_file"
else
# gum log "Failed to transcode $ifile. Check ./error.log for details."
cat "$tmp_file" >> error.log
rm -f "$tmp_file"
fi
}
export -f transcode_job
mapfile -t files <<< "$selection"
len=${#files[@]}
i=1
for file in "${files[@]}"; do
if [[ -f "$file" ]]; then
gum spin --spinner dot --title "[$i/$len] Transcoding $file" -- bash -c "source <(declare -f transcode_job); transcode_job \"$file\" \"$output_dir\" \"$flatten\" \"$where\" \"$flags\" \"$container\""
else
echo "Skipping invalid file: $file" >&2
fi
((i++))
done

View File

@ -12,7 +12,7 @@
...
}:
stdenv.mkDerivation (finalAttrs: {
name = "transcode-davinci-resolve";
name = "bulk-transcode";
src = ./.;
buildInputs = [
@ -27,9 +27,9 @@ stdenv.mkDerivation (finalAttrs: {
];
installPhase = ''
install -Dm755 transcode-davinci-resolve.sh $out/bin/transcode-davinci-resolve
install -Dm755 bulk-transcode.sh $out/bin/bulk-transcode
wrapProgram $out/bin/transcode-davinci-resolve \
wrapProgram $out/bin/bulk-transcode \
--set PATH "${lib.makeBinPath finalAttrs.buildInputs}"
'';
})

View File

@ -2,6 +2,6 @@
bin = pkgs.callPackage ./default.nix {};
in
pkgs.mkShell {
name = "transcode-davinci-resolve";
name = "bulk-transcode";
inputsFrom = [bin];
}

View File

@ -1,7 +1,7 @@
final: _: {
hive = {
crossover = final.callPackage ./crossover.nix {};
transcode-davinci-resolve = final.callPackage ./transcode-davinci-resolve {};
bulk-transcode = final.callPackage ./bulk-transcode {};
spotify-shortcuts = final.callPackage ./spotify-shortcuts {};
layan-qt6 = final.kdePackages.callPackage ./layan-qt6.nix {};
};

View File

@ -1 +0,0 @@
use flake ../../#transcode-davinci-resolve --show-trace

View File

@ -1,57 +0,0 @@
#!/usr/bin/env bash
where="${1:-.}"
selection=$(find "$where" -type f | fzf --multi --preview 'ffprobe -v error -show_format -show_streams {}' --preview-window=up:wrap)
output_dir=$(find $HOME -type d ! -name '.*' ! -path '*/.*/*' | fzf --preview 'tree -C {}' --preview-window=up:wrap --prompt "Select output directory: ")
if gum confirm "Flatten the directory structure?";
then
flatten=true
else
flatten=false
fi
function transcode_job {
local ifile="$1"
local output_dir="$2"
local flatten="$3"
local where="$4"
local fname=$(basename "$ifile")
local segment=$(realpath --relative-to="$where" "$ifile")
if [ "$flatten" = true ]; then
output_file="$output_dir/$fname.mov"
else
output_file="$output_dir/$segment.mov"
fi
tmp_file=$(mktemp)
mkdir -p "$(dirname "$output_file")"
if ffmpeg -y -i "$ifile" -c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a pcm_s16le "$output_file" 2>> "$tmp_file";
then
rm -f "$tmp_file"
else
# gum log "Failed to transcode $ifile. Check ./error.log for details."
cat "$tmp_file" >> error.log
rm -f "$tmp_file"
fi
}
export -f transcode_job
mapfile -t files <<< "$selection"
len=${#files[@]}
i=1
for file in "${files[@]}"; do
if [[ -f "$file" ]]; then
gum spin --spinner dot --title "[$i/$len] Transcoding $file" -- bash -c "source <(declare -f transcode_job); transcode_job \"$file\" \"$output_dir\" \"$flatten\" \"$where\""
else
echo "Skipping invalid file: $file" >&2
fi
((i++))
done