attempt to use pkgs for unfree predicate

still not working
This commit is contained in:
Noah Masur 2023-03-10 21:22:07 -05:00
parent d4fa322fb1
commit 8ab86428ec
8 changed files with 13 additions and 11 deletions

View File

@ -11,7 +11,7 @@
config = lib.mkIf config = lib.mkIf
(config.gui.enable && config._1password.enable && pkgs.stdenv.isLinux) { (config.gui.enable && config._1password.enable && pkgs.stdenv.isLinux) {
unfreePackages = [ "1password" "_1password-gui" ]; unfreePackages = with pkgs; [ _1password _1password-gui ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ _1password-gui ]; home.packages = with pkgs; [ _1password-gui ];
}; };

View File

@ -10,7 +10,7 @@
}; };
config = lib.mkIf (config.gui.enable && config.discord.enable) { config = lib.mkIf (config.gui.enable && config.discord.enable) {
unfreePackages = [ "discord" ]; unfreePackages = [ pkgs.discord ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ discord ]; home.packages = with pkgs; [ discord ];
xdg.configFile."discord/settings.json".text = '' xdg.configFile."discord/settings.json".text = ''

View File

@ -13,9 +13,9 @@
config = lib.mkIf (config.gui.enable && config.firefox.enable) { config = lib.mkIf (config.gui.enable && config.firefox.enable) {
unfreePackages = [ unfreePackages = with pkgs.nur.repos.rycee.firefox-addons; [
(lib.mkIf config._1password.enable "onepassword-password-manager") (lib.mkIf config._1password.enable onepassword-password-manager)
"okta-browser-plugin" okta-browser-plugin
]; ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {

View File

@ -10,7 +10,7 @@
}; };
config = lib.mkIf (config.gui.enable && config.obsidian.enable) { config = lib.mkIf (config.gui.enable && config.obsidian.enable) {
unfreePackages = [ "obsidian" ]; unfreePackages = [ pkgs.obsidian ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ obsidian ]; home.packages = with pkgs; [ obsidian ];
}; };

View File

@ -10,7 +10,7 @@
}; };
config = lib.mkIf (config.gui.enable && config.slack.enable) { config = lib.mkIf (config.gui.enable && config.slack.enable) {
unfreePackages = [ "slack" ]; unfreePackages = [ pkgs.slack ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ slack ]; home.packages = with pkgs; [ slack ];
}; };

View File

@ -68,7 +68,7 @@
description = "Link to dotfiles repository."; description = "Link to dotfiles repository.";
}; };
unfreePackages = lib.mkOption { unfreePackages = lib.mkOption {
type = lib.types.listOf lib.types.str; type = lib.types.listOf lib.types.package;
description = "List of unfree packages to allow."; description = "List of unfree packages to allow.";
default = [ ]; default = [ ];
}; };
@ -113,8 +113,10 @@
# Allow specified unfree packages (identified elsewhere) # Allow specified unfree packages (identified elsewhere)
# Retrieves package object based on string name # Retrieves package object based on string name
# Idea: https://discourse.nixos.org/t/how-to-use-packages-directly-in-allowunfreepredicate/22455/6
nixpkgs.config.allowUnfreePredicate = pkg: nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) config.unfreePackages; builtins.elem (pkg.name or (builtins.parseDrvName pkg.pname).name)
(map lib.getName config.unfreePackages);
# Pin a state version to prevent warnings # Pin a state version to prevent warnings
home-manager.users.${config.user}.home.stateVersion = stateVersion; home-manager.users.${config.user}.home.stateVersion = stateVersion;

View File

@ -14,7 +14,7 @@ in {
config = lib.mkIf config.gaming.minecraft-server.enable { config = lib.mkIf config.gaming.minecraft-server.enable {
unfreePackages = [ "minecraft-server" ]; unfreePackages = [ pkgs.minecraft-server ];
services.minecraft-server = { services.minecraft-server = {
enable = true; enable = true;

View File

@ -4,7 +4,7 @@
config = lib.mkIf (config.gaming.steam.enable && pkgs.stdenv.isLinux) { config = lib.mkIf (config.gaming.steam.enable && pkgs.stdenv.isLinux) {
hardware.steam-hardware.enable = true; hardware.steam-hardware.enable = true;
unfreePackages = [ "steam" "steam-original" "steamcmd" "steam-run" ]; unfreePackages = with pkgs; [ steam steamcmd steam-run ];
programs.steam = { programs.steam = {
enable = true; enable = true;