From ad155dd5c004be07c76143334fd130497dc1dc2c Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sat, 11 Sep 2021 19:31:36 +0200 Subject: [PATCH] removed crossLists warning --- modules/programs/ffmpeg.nix | 68 +++++++++++++++++++++---------------- system/desktop/packages.nix | 10 +++--- 2 files changed, 44 insertions(+), 34 deletions(-) diff --git a/modules/programs/ffmpeg.nix b/modules/programs/ffmpeg.nix index a613d22..fbd47ba 100644 --- a/modules/programs/ffmpeg.nix +++ b/modules/programs/ffmpeg.nix @@ -77,30 +77,6 @@ let -hide_banner ''; - ffmpegDescriptive = profile: preset: - ffmpegTemplate "${profile}-${preset}-720p" { inherit profile preset; }; - - ffmpegDescriptive1080p = profile: preset: - ffmpegTemplate "${profile}-${preset}-1080p" { - inherit profile preset; - height = 1080; - width = 1920; - resolution = "1080p"; - }; - - ffmpegDescriptiveTune = profile: preset: tune: - ffmpegTemplate "${profile}-${preset}-${tune}-720p" { - inherit profile preset tune; - }; - - ffmpegDescriptiveTune1080p = profile: preset: tune: - ffmpegTemplate "${profile}-${preset}-${tune}-720p" { - inherit profile preset tune; - height = 1080; - width = 1920; - resolution = "1080p"; - }; - # https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles profiles = [ "baseline" @@ -123,12 +99,46 @@ let ]; tunes = [ "film" "animation" "grain" "stillimage" "fastdecode" ]; - ffmpegs = (lib.crossLists ffmpegDescriptive [ profiles presets ]) - ++ (lib.crossLists ffmpegDescriptive1080p [ profiles presets ]); + ffmpegs = let - ffmpegsTune = - (lib.crossLists ffmpegDescriptiveTune [ profiles presets tunes ]) - ++ (lib.crossLists ffmpegDescriptiveTune1080p [ profiles presets tunes ]); + configurations = lib.cartesianProductOfSets { + profile = profiles; + preset = presets; + }; + + p720 = { profile, preset }: + ffmpegTemplate "${profile}-${preset}-720p" { inherit profile preset; }; + + p1080 = { profile, preset }: + ffmpegTemplate "${profile}-${preset}-1080p" { + inherit profile preset; + height = 1080; + width = 1920; + resolution = "1080p"; + }; + in (map p720 configurations) ++ (map p1080 configurations); + + ffmpegsTune = let + configurations = lib.cartesianProductOfSets { + profile = profiles; + preset = presets; + tune = tunes; + }; + + p720 = { profile, preset, tune }: + ffmpegTemplate "${profile}-${preset}-${tune}-720p" { + inherit profile preset tune; + }; + + p1080 = { profile, preset, tune }: + ffmpegTemplate "${profile}-${preset}-${tune}-1080p" { + inherit profile preset tune; + height = 1080; + width = 1920; + resolution = "1080p"; + }; + + in (map p720 configurations) ++ (map p1080 configurations); in { diff --git a/system/desktop/packages.nix b/system/desktop/packages.nix index 7aee776..9545cd3 100644 --- a/system/desktop/packages.nix +++ b/system/desktop/packages.nix @@ -63,7 +63,7 @@ let mv "$1.backup" "$1" ''; - pandocScript = inputFormat: outputFormat: + pandocScript = { inputFormat, outputFormat }: pkgs.writers.writeDashBin "pandoc-from-${inputFormat}-to-${outputFormat}" '' ${pkgs.pandoc}/bin/pandoc \ --from ${inputFormat} \ @@ -390,10 +390,10 @@ in { (map (host: "rsync -avLz ${host}.private:/etc/info/ ~/.etc_info") (attrNames config.module.cluster.services.tinc."private".hosts)))) - ] ++ (lib.crossLists pandocScript [ - [ "man" "markdown" "mediawiki" ] - [ "mediawiki" "docbook5" "html5" "man" ] - ]) # ++ (map (search: + ] ++ (map pandocScript (lib.cartesianProductOfSets { + inputFormat = [ "man" "markdown" "mediawiki" ]; + outputFormat = [ "mediawiki" "docbook5" "html5" "man" ]; + })) # ++ (map (search: #pkgs.writers.writeDashBin "reddit-${search}" '' # ${unstablePkgs.tuir}/bin/tuir -s ${search} "$@" #'') [ "nixos" "systemdUltras" "terraform" ])