mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Packages + Hardware] Add aviallon.programs.allowUnfreeList to whitelist unfree packages (and add Nvidia-related things in it)
This commit is contained in:
parent
ecc636d64b
commit
34b6b977f6
2 changed files with 15 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
hardwareCfg = config.aviallon.hardware;
|
cfg = config.aviallon.hardware;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
|
@ -10,24 +10,25 @@ in
|
||||||
|
|
||||||
options.aviallon.hardware.useProprietary = mkEnableOption "nvidia proprietary drivers";
|
options.aviallon.hardware.useProprietary = mkEnableOption "nvidia proprietary drivers";
|
||||||
|
|
||||||
config = mkIf (hardwareCfg.gpuVendor == "nvidia") {
|
config = mkIf (cfg.gpuVendor == "nvidia") {
|
||||||
boot.initrd.kernelModules = if hardwareCfg.useProprietary then [
|
boot.initrd.kernelModules = if cfg.useProprietary then [
|
||||||
"nvidia"
|
"nvidia"
|
||||||
"nvidia_drm"
|
"nvidia_drm"
|
||||||
"nvidia_uvm"
|
"nvidia_uvm"
|
||||||
"nvidia_modeset"
|
"nvidia_modeset"
|
||||||
] else [ "nouveau" ];
|
] else [ "nouveau" ];
|
||||||
# boot.blacklistedKernelModules = optional hardwareCfg.useProprietary "nouveau";
|
# boot.blacklistedKernelModules = optional cfg.useProprietary "nouveau";
|
||||||
services.xserver.videoDrivers = optional hardwareCfg.useProprietary "nvidia";
|
services.xserver.videoDrivers = optional cfg.useProprietary "nvidia";
|
||||||
hardware.opengl.driSupport32Bit = true;
|
hardware.opengl.driSupport32Bit = true;
|
||||||
hardware.nvidia = {
|
hardware.nvidia = {
|
||||||
powerManagement.enable = true;
|
powerManagement.enable = true;
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.config.allowUnfreePredicate = mkIf (hardwareCfg.useProprietary) (pkg: builtins.elem (lib.getName pkg) [
|
aviallon.programs.allowUnfreeList = mkIf (cfg.useProprietary) [
|
||||||
"nvidia-x11"
|
"nvidia-x11"
|
||||||
]);
|
"nvidia-settings"
|
||||||
|
];
|
||||||
|
|
||||||
hardware.opengl.extraPackages = with pkgs; [
|
hardware.opengl.extraPackages = with pkgs; [
|
||||||
libvdpau-va-gl
|
libvdpau-va-gl
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,12 @@ in
|
||||||
description = "Add specific compile flags";
|
description = "Add specific compile flags";
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
};
|
};
|
||||||
|
allowUnfreeList = mkOption {
|
||||||
|
default = [ ];
|
||||||
|
example = [ "nvidia-x11" "steam" ];
|
||||||
|
description = "Allow specific unfree software to be installed";
|
||||||
|
type = types.listOf types.str;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
@ -50,6 +56,7 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) cfg.allowUnfreeList;
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; with libsForQt5; [
|
environment.systemPackages = with pkgs; with libsForQt5; [
|
||||||
vim
|
vim
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue