NixOS 24.05: unfree packages fix

This commit is contained in:
Daniel Langbein 2024-08-13 14:46:55 +02:00
parent 6d57d99da3
commit 4a19d57765
16 changed files with 62 additions and 32 deletions

View File

@ -5,6 +5,7 @@
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/home-manager.nix ../../modules/home-manager.nix
../../modules/nur-and-unstable.nix ../../modules/nur-and-unstable.nix
../../modules/unfree.nix
../../modules/base.nix ../../modules/base.nix
../../modules/base-bios.nix ../../modules/base-bios.nix
../../modules/power-management.nix ../../modules/power-management.nix

View File

@ -6,6 +6,7 @@
./host-specific.nix ./host-specific.nix
../../modules/home-manager.nix ../../modules/home-manager.nix
../../modules/nur-and-unstable.nix ../../modules/nur-and-unstable.nix
../../modules/unfree.nix
../../modules/base.nix ../../modules/base.nix
../../modules/base-efi.nix ../../modules/base-efi.nix
../../modules/headless.nix ../../modules/headless.nix

View File

@ -6,6 +6,7 @@
./host-specific.nix ./host-specific.nix
../../modules/home-manager.nix ../../modules/home-manager.nix
../../modules/nur-and-unstable.nix ../../modules/nur-and-unstable.nix
../../modules/unfree.nix
../../modules/base.nix ../../modules/base.nix
../../modules/base-efi.nix ../../modules/base-efi.nix
../../modules/headless.nix ../../modules/headless.nix

View File

@ -5,6 +5,7 @@
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/home-manager.nix ../../modules/home-manager.nix
../../modules/nur-and-unstable.nix ../../modules/nur-and-unstable.nix
../../modules/unfree.nix
../../modules/base.nix ../../modules/base.nix
../../modules/base-efi.nix ../../modules/base-efi.nix
../../modules/xdg.nix ../../modules/xdg.nix

View File

@ -5,6 +5,7 @@
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/home-manager.nix ../../modules/home-manager.nix
../../modules/nur-and-unstable.nix ../../modules/nur-and-unstable.nix
../../modules/unfree.nix
../../modules/base.nix ../../modules/base.nix
../../modules/base-efi.nix ../../modules/base-efi.nix
../../modules/xdg.nix ../../modules/xdg.nix
@ -26,7 +27,8 @@
../../modules/gnome-base.nix ../../modules/gnome-base.nix
../../modules/gnome-config.nix ../../modules/gnome-config.nix
../../modules/gnome-extensions.nix ../../modules/gnome-extensions.nix
../../modules/gnome-fractional-scaling.nix # TODO currently broken
#../../modules/gnome-fractional-scaling.nix
../../modules/fwupd-gnome.nix ../../modules/fwupd-gnome.nix
../../modules/gnome-wallpaper.nix ../../modules/gnome-wallpaper.nix

View File

@ -6,6 +6,7 @@
./host-specific.nix ./host-specific.nix
../../modules/home-manager.nix ../../modules/home-manager.nix
../../modules/nur-and-unstable.nix ../../modules/nur-and-unstable.nix
../../modules/unfree.nix
../../modules/base.nix ../../modules/base.nix
../../modules/base-efi.nix ../../modules/base-efi.nix
../../modules/headless.nix ../../modules/headless.nix

View File

@ -11,7 +11,8 @@
# Defaults to `config.hardware.enableAllFirmware`. # Defaults to `config.hardware.enableAllFirmware`.
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
# Allow unfree packages. # Allow **all** unfree packages.
# To whitelist individual unfree packages, see ./unfree.nix
nixpkgs.config.allowUnfree = false; nixpkgs.config.allowUnfree = false;
# Enables wireless support via wpa_supplicant. # Enables wireless support via wpa_supplicant.

View File

@ -20,9 +20,9 @@
# https://unknown-horizons.org/ (A 2D realtime strategy simulation with an emphasis on economy and city building.) # https://unknown-horizons.org/ (A 2D realtime strategy simulation with an emphasis on economy and city building.)
# https://github.com/mgerdes/Open-Golf # https://github.com/mgerdes/Open-Golf
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ allowUnfree = [
"SpaceCadetPinball" "SpaceCadetPinball"
"osu-lazer-bin-2023.1114.1" "osu-lazer-bin"
"warsow" "warsow"
"assaultcube" "assaultcube"
"ut2004-demo" "ut2004-demo"

View File

@ -51,8 +51,8 @@
]); ]);
# Configure keymap in X11. # Configure keymap in X11.
services.xserver = { services.xserver.xkb = {
layout = "de"; layout = "de";
xkbVariant = "nodeadkeys"; variant = "nodeadkeys";
}; };
} }

View File

@ -43,9 +43,9 @@
}; };
# Configure keymap in X11. # Configure keymap in X11.
services.xserver = { services.xserver.xkb = {
layout = "de"; layout = "de";
xkbVariant = "nodeadkeys"; variant = "nodeadkeys";
}; };
# Enable Bluetooth support # Enable Bluetooth support

View File

@ -83,8 +83,8 @@
enable = true; enable = true;
# Sets SSH_AUTH_SOCK environment variable. # Sets SSH_AUTH_SOCK environment variable.
enableSSHSupport = true; enableSSHSupport = true;
#pinentryFlavor = "curses"; #pinentryPackage = pkgs.pinentry-curses;
pinentryFlavor = "gnome3"; pinentryPackage = pkgs.pinentry-gnome3;
}; };
}; };

View File

@ -20,14 +20,14 @@
# https://github.com/NixOS/nixpkgs/issues/69347#issuecomment-534573461 # https://github.com/NixOS/nixpkgs/issues/69347#issuecomment-534573461
config = { config = {
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ # allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
# Required for unstable.obsidian (see obsidan.nix) # # Required for unstable.obsidian (see obsidan.nix)
"obsidian" # "obsidian"
]; # ];
permittedInsecurePackages = [ # permittedInsecurePackages = [
# Required for unstable.obsidian (see obsidan.nix) # # Required for unstable.obsidian (see obsidan.nix)
"electron-25.9.0" # "electron-25.9.0"
]; # ];
}; };
}; };

View File

@ -6,13 +6,13 @@
# This `config` is only for "stable" `nixpkgs`, not for "unstable". # This `config` is only for "stable" `nixpkgs`, not for "unstable".
# See nur-and-unstable.nix for how to configure "unstable" `nixpkgs`. # See nur-and-unstable.nix for how to configure "unstable" `nixpkgs`.
# nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ allowUnfree = [
# "obsidian" "obsidian"
# ]; ];
users.users.yoda = { users.users.yoda = {
packages = with pkgs; [ packages = with pkgs; [
unstable.obsidian # Markdown notes obsidian # Markdown notes
]; ];
}; };

22
modules/unfree.nix Normal file
View File

@ -0,0 +1,22 @@
{ config, lib, ... }:
# See also: ./nur-and-unstable.nix to allow unfree packages from "unstable".
# See also: ./base.nix for unfree firmware.
# This file adds the ability to whitelist unfree packages in different .nix config files.
# Example: Instead of
# nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
# "obsidian"
# ];
# add the following
# allowUnfree = [ "obsidian" ];
let
inherit (builtins) elem;
inherit (lib) getName mkOption;
inherit (lib.types) listOf str;
in
{
options.allowUnfree = mkOption { type = listOf str; default = [ ]; };
config.nixpkgs.config.allowUnfreePredicate = p: elem (getName p) config.allowUnfree;
}

View File

@ -7,7 +7,7 @@
# Alternatively, run Veracrypt with # Alternatively, run Veracrypt with
# NIXPKGS_ALLOW_UNFREE=1 nix-shell -p veracrypt # NIXPKGS_ALLOW_UNFREE=1 nix-shell -p veracrypt
# https://nixos.wiki/wiki/Unfree_Software # https://nixos.wiki/wiki/Unfree_Software
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ allowUnfree = [
"veracrypt" "veracrypt"
]; ];

View File

@ -5,10 +5,10 @@
"homepage": "https://nur.nix-community.org/", "homepage": "https://nur.nix-community.org/",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "f9b13b99b4e7d7f462a5291969bedbcba0b5b7c9", "rev": "8511e95dfec45e3c770bd2528f5eb90fc8947e75",
"sha256": "0si2qy8fzysvcb7rj6yihb1b1dwaf9crfyl22vqz3pqwwj1afgyz", "sha256": "1d8rgywwi1x7nj03i18mqa7qp24djyicxl99w611wdxppy9853v9",
"type": "tarball", "type": "tarball",
"url": "https://github.com/nix-community/NUR/archive/f9b13b99b4e7d7f462a5291969bedbcba0b5b7c9.tar.gz", "url": "https://github.com/nix-community/NUR/archive/8511e95dfec45e3c770bd2528f5eb90fc8947e75.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}, },
"home-manager": { "home-manager": {
@ -29,10 +29,10 @@
"homepage": null, "homepage": null,
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a046c1202e11b62cbede5385ba64908feb7bfac4", "rev": "a781ff33ae258bbcfd4ed6e673860c3e923bf2cc",
"sha256": "10y8ccyv76i9zhd3s8x792g58p5iw16xy3qz4f6gqk0svwlgwr09", "sha256": "1s0cb03j3rwgpgnl4jy1bjmx4gh70iin8h1kn84gw0x5lgavscm1",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/a046c1202e11b62cbede5385ba64908feb7bfac4.tar.gz", "url": "https://github.com/NixOS/nixpkgs/archive/a781ff33ae258bbcfd4ed6e673860c3e923bf2cc.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}, },
"unstable": { "unstable": {
@ -41,10 +41,10 @@
"homepage": "", "homepage": "",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6794d064edc69918bb0fc0e0eda33ece324be17a", "rev": "154bcb95ad51bc257c2ce4043a725de6ca700ef6",
"sha256": "1rfl5c9dj7wlzbk9bg8b99qqqfv7d3ak2yxw459gblja4zn1qv6b", "sha256": "0gv8wgjqldh9nr3lvpjas7sk0ffyahmvfrz5g4wd8l2r15wyk67f",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/6794d064edc69918bb0fc0e0eda33ece324be17a.tar.gz", "url": "https://github.com/NixOS/nixpkgs/archive/154bcb95ad51bc257c2ce4043a725de6ca700ef6.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
} }
} }