Add media role.
This commit is contained in:
74
nix/configuration/roles/media/default.nix
Normal file
74
nix/configuration/roles/media/default.nix
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
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.graphicsCardType = lib.mkOption {
|
||||
type = lib.types.nullOr (
|
||||
lib.types.enum [
|
||||
"amd"
|
||||
"intel"
|
||||
"nvidia"
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
example = "amd";
|
||||
description = "What graphics card type is in the computer.";
|
||||
};
|
||||
|
||||
options.me.graphical = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install graphical programs.";
|
||||
};
|
||||
|
||||
config = (
|
||||
lib.mkMerge [
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
ffmpeg
|
||||
];
|
||||
|
||||
home-manager.users.talexander =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.file.".config/mpv/mpv.conf" = {
|
||||
source = ./files/mpv.conf;
|
||||
};
|
||||
};
|
||||
}
|
||||
(lib.mkIf config.me.graphical {
|
||||
environment.systemPackages = with pkgs; [
|
||||
mpv
|
||||
evince
|
||||
gimp
|
||||
imv
|
||||
];
|
||||
})
|
||||
(lib.mkIf (config.me.graphicsCardType == "amd" || config.me.graphicsCardType == "intel") {
|
||||
environment.systemPackages = with pkgs; [
|
||||
cast_file_vaapi
|
||||
];
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user