{ config, lib, pkgs, ... }: let cast_file_vaapi = (pkgs.writeScriptBin "cast_file" (builtins.readFile ./files/cast_file_vaapi)).overrideAttrs (old: { buildCommand = "${old.buildCommand}\n patchShebangs $out"; }); cast_file_nvidia = (pkgs.writeScriptBin "cast_file" (builtins.readFile ./files/cast_file_nvidia)).overrideAttrs (old: { buildCommand = "${old.buildCommand}\n patchShebangs $out"; }); in { imports = [ ]; options.me = { media.enable = lib.mkOption { type = lib.types.bool; default = false; example = true; description = "Whether we want to install media."; }; }; config = lib.mkIf config.me.media.enable ( lib.mkMerge [ { environment.systemPackages = with pkgs; [ ffmpeg ]; } (lib.mkIf config.me.graphical { environment.systemPackages = with pkgs; [ mpv evince gimp # So far I prefer imv over swayimg because imv supports the 'p' hotkey to print the currently-viewed file to stdout (useful for pipelines) and afaik doesn't support the exec:// protocol which seems like a massive risk. imv ]; home-manager.users.talexander = { pkgs, ... }: { home.file.".config/mpv/mpv.conf" = { source = ./files/mpv.conf; }; }; }) (lib.mkIf (config.me.graphics_card_type == "amd" || config.me.graphics_card_type == "intel") { environment.systemPackages = with pkgs; [ cast_file_vaapi ]; }) ] ); }