84 lines
2.3 KiB
Nix
Raw Normal View History

2025-01-10 22:54:32 -05:00
{
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";
});
2025-02-08 16:06:57 -05:00
kernel_version_check = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.12";
nixos_version_check = lib.versionAtLeast (lib.versions.majorMinor lib.version) "25.05";
2025-01-10 22:54:32 -05:00
in
{
imports = [ ];
2025-01-23 21:06:11 -05:00
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 (
2025-01-10 22:54:32 -05:00
lib.mkMerge [
{
environment.systemPackages = with pkgs; [
ffmpeg
2025-02-08 16:06:57 -05:00
libva-utils # for vainfo
vdpauinfo
2025-01-10 22:54:32 -05:00
];
}
(lib.mkIf config.me.graphical {
environment.systemPackages = with pkgs; [
mpv
evince
gimp
2025-01-18 12:16:11 -05:00
# 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
2025-01-10 22:54:32 -05:00
];
2025-01-23 21:06:11 -05:00
home-manager.users.talexander =
{ pkgs, ... }:
{
home.file.".config/mpv/mpv.conf" = {
source = ./files/mpv.conf;
};
};
2025-01-10 22:54:32 -05:00
})
2025-01-23 19:09:59 -05:00
(lib.mkIf (config.me.graphics_card_type == "amd" || config.me.graphics_card_type == "intel") {
2025-01-10 22:54:32 -05:00
environment.systemPackages = with pkgs; [
cast_file_vaapi
];
})
2025-02-08 16:06:57 -05:00
(lib.mkIf (config.me.graphics_card_type == "amd") {
environment.sessionVariables = {
VDPAU_DRIVER = "radeonsi";
};
})
(lib.mkIf (config.me.graphics_card_type == "intel") {
hardware.graphics.extraPackages = with pkgs; [
intel-media-driver
libvdpau-va-gl # Support vdpau applications using va-api
];
environment.sessionVariables = {
VDPAU_DRIVER = "va_gl";
};
})
2025-01-10 22:54:32 -05:00
]
);
}