Hi everyone I am beginner of nixos
I can’t install unfree package
in .config/nixpkgs/config.nix
{
allowUnfree = true;
}
and in configuration.nix
nixpkgs.config.allowUnfree = true;
what shoud I do?
Sorry for my poor English
Hi everyone I am beginner of nixos
I can’t install unfree package
in .config/nixpkgs/config.nix
{
allowUnfree = true;
}
and in configuration.nix
nixpkgs.config.allowUnfree = true;
what shoud I do?
Sorry for my poor English
Can you share what command you’re running that fails to install an unfree package, and what error message you’re getting?
thank you for your reply
$ sudo nixos-rebuild switch
building Nix...
building the system configuration...
error:
… while calling the 'head' builtin
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1575:11:
1574| || pred here (elemAt values 1) (head values) then
1575| head values
| ^
1576| else
… while evaluating the attribute 'value'
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:809:9:
808| in warnDeprecation opt //
809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
810| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: Package ‘zoom-6.0.2.4680’ in /nix/store/4vfim1qajqp056drin5dpfibbqkrlm88-nixos-24.05/nixos/pkgs/applications/networking/instant-messengers/zoom-us/default.nix:195 has an unfree license (‘unfree’), refusing to evaluate.
a) To temporarily allow unfree packages, you can use an environment variable
for a single invocation of the nix tools.
$ export NIXPKGS_ALLOW_UNFREE=1
Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
then pass `--impure` in order to allow use of environment variables.
b) For `nixos-rebuild` you can set
{ nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.
Alternatively you can configure a predicate to allow specific packages:
{ nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"zoom"
];
}
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.
This should have been sufficient, if nixpkgs.pkgs
isn’t set. Can you share your full configuration.nix
?
Thank you for your reply. Sorry for being messy. This is my file
configuration.nix
{ config, pkgs, ... }:
{
imports =
[
./wm/xmonad.nix
./hardware-configuration.nix
<home-manager/nixos>
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
time.timeZone = "Asia/Tokyo";
networking.networkmanager.enable = true;
programs.light.enable = true;
programs.vim.defaultEditor = true;
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
environment.variables = {
VISUAL = "vim";
EDITOR = "vim";
};
environment.sessionVariables = rec {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
};
hardware.bluetooth.enable = true;
services.blueman.enable = true;
fonts.packages = with pkgs; [
carlito
dejavu_fonts
ipafont
kochi-substitute
source-code-pro
ttf_bitstream_vera
ricty
];
fonts.fontconfig.defaultFonts = {
monospace = [
"DejaVu Sans Mono"
"IPAGothic"
];
sansSerif = [
"DejaVu Sans"
"IPAPGothic"
];
serif = [
"DejaVu Serif"
"IPAPMincho"
];
};
nixpkgs.config.allowUnfree = true;
networking.extraHosts = ''
127.0.0.1 www.youtube.com
#127.0.0.2 www.amazon.co.jp
#127.0.0.2 twitter.com
127.0.0.2 www.nicovideo.jp
#127.0.0.2 boardgamearena.com
127.0.0.2 togetter.com
127.0.0.2 w.atwiki.jp
127.0.0.2 shonenjumpplus.com
'';
services.usbmuxd.enable = true;
services.logind.lidSwitch = "lock";
virtualisation.docker.enable = true;
sound.enable = true;
nix.settings.auto-optimise-store = true;
services.pcscd.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
i18n.defaultLocale = "ja_JP.UTF-8";
#services.usbguard.enable = true;
# boot.kernel.sysctl = {
# "kernel.sysrq" = 1;
#};
#services.usbguard.rules = import /home/tilt/.rule.nix;
virtualisation.libvirtd.enable = true;
environment.systemPackages = with pkgs; [
vim
firefox
xorg.xev
git
haskellPackages.xmobar
gnupg
pinentry
(pass.withExtensions (ext: with ext; [ pass-import pass-update pass-otp pass-tomb ]))
];
services.urxvtd.enable = true;
#hardware.pulseaudio.support32Bit = true;
#hardware.pulseaudio.enable = true;
programs.adb.enable = true;
#services.usbguard.IPCAllowedUsers = ["root" "tilt"];
#services.usbguard.IPCAllowedGroups = [ "wheel" ];
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
services.xserver.displayManager.sessionCommands =
''
xmodmap ~/.Xmodmap
${pkgs.xorg.xrdb}/bin/xrdb -merge <<EOF
URxvt.scrollBar: false
URxvt.foreground: black
URxvt.background: white
EOF
'';
nixpkgs.config.packageOverrides = pkgs: {
steam = pkgs.steam.override {
extraPkgs = pkgs: with pkgs; [
libpng
];
};
};
services.dbus.enable = true;
#fileSystems = {
#"/".device = "/dev/sda1";
#"/mnt/sd".device = "/dev/mmcblk0p1";
#};
users.users.tilt = {
isNormalUser = true;
home = "/home/tilt";
extraGroups = ["audio" "sound" "wheel" "libvirtd" "adbusers" "docker" "bluetooth"];
};
home-manager.users.tilt = import ./home.nix;
system.stateVersion = "24.05";
}
home.nix
{ config, pkgs, ... }:
with pkgs;
let
python-default = python3.withPackages (py-p:
with py-p; [
pycryptodome
selenium
]);
in
{
home.username = "tilt";
home.homeDirectory = "/home/tilt";
home.packages = with pkgs; [
xsel
xorg.xmodmap
imagemagick # picture
cmus # music
#discord # SNS
feh # image viewer
#freeoffice
monero-gui
sane-backends
#slack
gimp
man-pages
man-pages-posix
mpv
cabal-install
mullvad # VPN
#ghostscript # Tex.liveとのnamecollisionが解決できなかったため取っている
maim
bashmount
usbmuxd
libimobiledevice
ifuse
niv
zathura
tldr
tree
usbutils
#citrix_workspace
cryptsetup
pavucontrol
wine
unar # 日本語の名前のzipの解凍に便利
texlive.combined.scheme-full
sage
openconnect # VPN(school)
ranger #file manager textの整理に便利
python-default
pandoc
gcc
geckodriver
joplin-desktop
zoom-us
#ciscoPacketTracer8 #cisco network learning
];
programs.ssh = {
enable = true;
matchBlocks = {
mac = {
hostname = "hostname";
user = "user";
identityFile = "identityfile";
};
};
};
programs.git = {
enable = true;
userName = "username";
userEmail = "userEmail";
};
/*
programs.vscode = {
enable = true;
extensions = with pkgs.vscode-extensions; [
haskell.haskell
vscodevim.vim
justusadam.language-haskell
james-yu.latex-workshop
#ms-vscode.hexeditor
yzhang.markdown-all-in-one
];
};
*/
programs.bash.bashrcExtra = "for (( i=1; i<=$LINES; i++ )); do echo; done; clear\n";
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
fcitx5-mozc
fcitx5-gtk
];
};
home.stateVersion = "24.05";
programs.home-manager.enable = true;
}
By default, home-manager does not use the same nixpkgs instance as the system. So when you change the nixpkgs configuration of your system, it doesn’t affect home-manager.
You can either make home-manager configure its nixpkgs to allow unfree packages, or you can make them share the configuration. I prefer the latter. To do that, add this to your home-manager module config:
home-manager = {
useGlobalPkgs = true;
users.tilt = import ./home.nix;
};
Thank you very much for your help. It went well!!