System Gen44 @ 2025-05-28-00:12:05 by jonas@monolith

This commit is contained in:
Jonas Röger 2025-05-28 00:12:06 +02:00
parent 0591f6f740
commit f8fc20953f
8 changed files with 98 additions and 8 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
*.log *.log
**/.direnv/

View File

@ -37,6 +37,7 @@
}; };
outputs = { outputs = {
self,
nixpkgs, nixpkgs,
nixpkgs-unstable, nixpkgs-unstable,
nixos-hardware, nixos-hardware,
@ -60,7 +61,7 @@
isHM = false; isHM = false;
}; };
modules = [ modules = [
({...}: {nixpkgs.overlays = [overlay-unstable];}) ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default];})
({...}: {nixpkgs.config.allowUnfree = true;}) ({...}: {nixpkgs.config.allowUnfree = true;})
nixos-hardware.nixosModules.msi-b550-a-pro nixos-hardware.nixosModules.msi-b550-a-pro
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
@ -75,7 +76,7 @@
isHM = false; isHM = false;
}; };
modules = [ modules = [
({...}: {nixpkgs.overlays = [overlay-unstable];}) ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default];})
({...}: { ({...}: {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nixpkgs.config.nvidia.acceptLicense = true; nixpkgs.config.nvidia.acceptLicense = true;
@ -100,7 +101,7 @@
isHM = false; isHM = false;
}; };
modules = [ modules = [
({...}: {nixpkgs.overlays = [overlay-unstable];}) ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default];})
({...}: {nixpkgs.config.allowUnfree = true;}) ({...}: {nixpkgs.config.allowUnfree = true;})
inputs.sops-nix.nixosModules.sops inputs.sops-nix.nixosModules.sops
./modules ./modules
@ -123,7 +124,7 @@
# Specify your home configuration modules here, for example, # Specify your home configuration modules here, for example,
# the path to your home.nix. # the path to your home.nix.
modules = [ modules = [
({...}: {nixpkgs.overlays = [overlay-unstable];}) ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default];})
({...}: {nixpkgs.config.allowUnfree = true;}) ({...}: {nixpkgs.config.allowUnfree = true;})
inputs.plasma-manager.homeManagerModules.plasma-manager inputs.plasma-manager.homeManagerModules.plasma-manager
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
@ -144,7 +145,7 @@
# Specify your home configuration modules here, for example, # Specify your home configuration modules here, for example,
# the path to your home.nix. # the path to your home.nix.
modules = [ modules = [
({...}: {nixpkgs.overlays = [overlay-unstable];}) ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default];})
({...}: {nixpkgs.config.allowUnfree = true;}) ({...}: {nixpkgs.config.allowUnfree = true;})
inputs.plasma-manager.homeManagerModules.plasma-manager inputs.plasma-manager.homeManagerModules.plasma-manager
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
@ -165,7 +166,7 @@
# Specify your home configuration modules here, for example, # Specify your home configuration modules here, for example,
# the path to your home.nix. # the path to your home.nix.
modules = [ modules = [
({...}: {nixpkgs.overlays = [overlay-unstable];}) ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default];})
({...}: {nixpkgs.config.allowUnfree = true;}) ({...}: {nixpkgs.config.allowUnfree = true;})
inputs.plasma-manager.homeManagerModules.plasma-manager inputs.plasma-manager.homeManagerModules.plasma-manager
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
@ -186,7 +187,7 @@
# Specify your home configuration modules here, for example, # Specify your home configuration modules here, for example,
# the path to your home.nix. # the path to your home.nix.
modules = [ modules = [
({...}: {nixpkgs.overlays = [overlay-unstable];}) ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default];})
({...}: {nixpkgs.config.allowUnfree = true;}) ({...}: {nixpkgs.config.allowUnfree = true;})
inputs.plasma-manager.homeManagerModules.plasma-manager inputs.plasma-manager.homeManagerModules.plasma-manager
inputs.sops-nix.homeManagerModules.sops inputs.sops-nix.homeManagerModules.sops
@ -201,6 +202,13 @@
isHM = true; isHM = true;
}; };
}; };
devShells.${system} = {
transcode-davinci-resolve = (import ./pkgs/transcode-davinci-resolve/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};};
};
overlays.default = import ./pkgs;
templates = { templates = {
rust = { rust = {
path = ./templates/rust; path = ./templates/rust;

View File

@ -97,6 +97,7 @@
ranger ranger
sops sops
spotify spotify
transcode-davinci-resolve
vim vim
vlc vlc
vscode vscode

3
pkgs/default.nix Normal file
View File

@ -0,0 +1,3 @@
_: prev: {
transcode-davinci-resolve = prev.callPackage ./transcode-davinci-resolve {};
}

View File

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

View File

@ -0,0 +1,25 @@
{
bash,
ffmpeg,
fzf,
gum,
stdenv,
tree,
...
}:
stdenv.mkDerivation {
name = "transcode-davinci-resolve";
src = ./.;
buildInputs = [
bash
ffmpeg
fzf
gum
tree
];
installPhase = ''
install -Dm755 transcode-davinci-resolve.sh $out/bin/transcode-davinci-resolve
'';
}

View File

@ -0,0 +1,7 @@
{pkgs ? import <nixpkgs> {}}: let
bin = pkgs.callPackage ./default.nix {};
in
pkgs.mkShell {
name = "transcode-davinci-resolve";
inputsFrom = [bin];
}

View File

@ -0,0 +1,44 @@
#!/usr/bin/env bash
set -e
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 file="$1"
local output_dir="$2"
local flatten="$3"
local where=$4
local fname=$(basename "$file")
local segment=$(realpath --relative-to="$where" "$file")
if [ "$flatten" = true ]; then
output_file="$output_dir/$fname.mov"
else
output_file="$output_dir/$segment.mov"
fi
mkdir -p "$(dirname "$output_file")" >> log.txt
ffmpeg -i "$file" -c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a pcm_s16le "$output_file" || true
}
export -f transcode_job
i=1
len=$(echo "$selection" | wc -l)
while IFS= read -r file; do
gum spin --spinner dot --title "[$i/$len] Transcoding $file" -- bash -c "source <(declare -f transcode_job); transcode_job \"$file\" \"$output_dir\" \"$flatten\" \"$where\""
((i++))
done <<< "$selection"