Sorted some stuff in configuration

This commit is contained in:
Aleksandr Lebedev 2024-12-19 01:09:26 +01:00
parent 6599e23992
commit 5e05a1e5c1
36 changed files with 210 additions and 216 deletions

View file

@ -0,0 +1,29 @@
{ pkgs, lib, ... }:
let
in
{
#nixpkgs.overlays = [
# (import ./widevine-overlay.nix)
#];
#nixpkgs.config.allowUnsupportedSystem = true;
imports = [
#./apple-silicon-support
];
hardware.asahi = {
peripheralFirmwareDirectory = ./firmware;
useExperimentalGPUDriver = true;
#experimentalGPUInstallMode = "overlay";
setupAsahiSound = true;
};
#powerManagement = {
# enable = true;
# powertop.enable = true;
#};
#hardware.graphics.enable32Bit = lib.mkForce false;
environment.systemPackages = with pkgs; [mesa mesa.drivers
#widevine-cdm
#widevinecdm-aarch64
];
}

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,24 @@
{pkgs, ...}:
{
programs.firefox.profiles.default.settings = {
"media.gmp-widevinecdm.version" = pkgs.widevinecdm-aarch64.version;
"media.gmp-widevinecdm.visible" = true;
"media.gmp-widevinecdm.enabled" = true;
"media.gmp-widevinecdm.autoupdate" = false;
"media.eme.enabled" = true;
"media.eme.encrypted-media-encryption-scheme.enabled" = true;
};
home.file."firefox-widevinecdm" = {
enable = true;
target = ".mozilla/firefox/default/gmp-widevinecdm";
source = pkgs.runCommandLocal "firefox-widevinecdm" { } ''
out=$out/${pkgs.widevinecdm-aarch64.version}
mkdir -p $out
ln -s ${pkgs.widevinecdm-aarch64}/manifest.json $out/manifest.json
ln -s ${pkgs.widevinecdm-aarch64}/libwidevinecdm.so $out/libwidevinecdm.so
'';
recursive = true;
};
}

View file

@ -0,0 +1,6 @@
prev: final:
{
widevinecdm-aarch64 = import ./widevine.nix {
inherit (final) stdenvNoCC fetchFromGitHub fetchurl python3 squashfsTools nspr;
};
}

View file

@ -0,0 +1,43 @@
{ stdenvNoCC
, fetchFromGitHub
, fetchurl
, python3
, squashfsTools
, nspr
}:
let
widevine-installer = fetchFromGitHub {
owner = "AsahiLinux";
repo = "widevine-installer";
rev = "7a3928fe1342fb07d96f61c2b094e3287588958b";
sha256 = "sha256-XI1y4pVNpXS+jqFs0KyVMrxcULOJ5rADsgvwfLF6e0Y=";
};
lacros-image = fetchurl {
url =
let
distfiles_base = "https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles";
lacros_name = "chromeos-lacros-arm64-squash-zstd";
lacrosVersion = "120.0.6098.0";
in
"${distfiles_base}/${lacros_name}-${lacrosVersion}";
hash = "sha256-OKV8w5da9oZ1oSGbADVPCIkP9Y0MVLaQ3PXS3ZBLFXY=";
};
in
stdenvNoCC.mkDerivation {
name = "widevine";
version = "4.10.2662.3";
dontUnpack = true;
dontBuild = true;
buildInputs = [ python3 squashfsTools ];
installPhase = ''
mkdir $out
unsquashfs -q ${lacros-image} 'WidevineCdm/*'
python3 ${widevine-installer}/widevine_fixup.py squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so $out/libwidevinecdm.so
mv squashfs-root/WidevineCdm/manifest.json $out/
mv squashfs-root/WidevineCdm/LICENSE $out/
patchelf --add-rpath ${nspr}/lib $out/libwidevinecdm.so
'';
}

47
nixos/hardware/nvidia.nix Normal file
View file

@ -0,0 +1,47 @@
{ config, pkgs, ... }:
{
boot.kernelPackages = pkgs.linuxPackages_latest;
hardware = {
graphics = {
enable = true;
extraPackages = with pkgs; [
nvidia-vaapi-driver
];
};
nvidia = {
# https://nixos.wiki/wiki/Nvidia
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = true;#false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = true;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.beta;
};
logitech.wireless.enable = true;
};
services.xserver.videoDrivers = [ "nvidia" ];
}