Hi all
I’m new to NixOS and I can’t find a way of playing blu rays through VLC. I have installed, libbluray, libbdplus and libaacs and have also downloaded the aacs file and placed in ~/.aacs but I still get the following error:
" Blu-ray error:
This Blu-ray Disc needs a library for AACS decoding, and your system does not have it.
Your input can’t be opened:
VLC is unable to open the MRL ‘bluray:///dev/sr0’. Check the log for details"
Am I missing something?
libbluray
is already included in the nixpkgs version of vlc, but you probably need to override it to include aacs support like the solution here suggests: VLC needs libaacs for encrypted Blu Ray · Issue #63641 · NixOS/nixpkgs · GitHub
And remove those from your system packages, they’re not doing anything for you here. Installing libraries this way will not help programs see them on NixOS.
Thanks, I tried to implement the system-wide version with
let
libbluray = pkgs.libbluray.override {
withAACS = true;
withBDPlus = true;
};
vlc = pkgs.vlc.override { inherit libbluray; };
in
{
environment.systemPackages = [ vlc ];
}
But got an error about the ‘let’ part when I tried rebuilding. Is my syntax wrong?
Here’s the full config (it’s basically a default one with only a slight addition) - openSUSE Paste
Could you please point out where I’m going wrong?
Thanks
So, configuration.nix
is one big Nix expression that defines a function (starting with its parameters in line 5), and returns one single attribute set (everything between the opening brace in line 7 and the closing brace in line 153).
Each item in that large attribute set must be of key = value;
format, so you can neither drop a let-in
expression in it just like that, nor can you make a child attrset out of the blue (unless it is a value for a key, e.g. foo = { bar = true; baz = false; }
.
The correct syntax would be one of:
Option 1: pull let-in outside the top-level attrset
{ config, pkgs, ... }:
let
libbluray = pkgs.libbluray.override {
withAACS = true;
withBDPlus = true;
};
myVlc = pkgs.vlc.override { inherit libbluray; }; # renamed this to avoid potential shadowing by `with pkgs;`
in
{
# ... other stuff
environment.systemPackages = [ myVlc ];
Option 2: pull let-in into the value of environment.systemPackages = ...
key-value pair. This is fine because we form an actual key = value;
pair where value is expression (albeit a more complex one!), and not just drop a single expression inside an attribute set.
{ config, pkgs, ... }:
{
# ... other stuff
environment.systemPackages = let
libbluray = pkgs.libbluray.override {
withAACS = true;
withBDPlus = true;
};
myVlc = pkgs.vlc.override { inherit libbluray; }; # renamed this to avoid potential shadowing by `with pkgs;`
in [
myVlc
someOtherPackage
];
}
One more issue is that you already have a key named environment.systemPackages
in line 121 and you can not define duplicate keys. So you should put myVlc
into that (currently empty) list.
I’m aware example like these are confusing - they are not directly copy-pastable, you have to adapt it to syntax of your configuration file. But I guess people do that so that the example forms a valid Nix expression - just key = value;
can not stand on its own.
1 Like
Thank you so much for your help, I’ve moved the additional packages (only wget at the moment) towards the top. Is it possible to put this list of additional packages to install into another file, say myPackages.nix and then import it at the top and if so, what would the file look like? would I start it with something like environment.myPackages = with pkgs; [ vim wget yakuake ];
type or paste code here# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
boot.loader.grub.useOSProber = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/London";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_GB.UTF-8";
LC_IDENTIFICATION = "en_GB.UTF-8";
LC_MEASUREMENT = "en_GB.UTF-8";
LC_MONETARY = "en_GB.UTF-8";
LC_NAME = "en_GB.UTF-8";
LC_NUMERIC = "en_GB.UTF-8";
LC_PAPER = "en_GB.UTF-8";
LC_TELEPHONE = "en_GB.UTF-8";
LC_TIME = "en_GB.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "gb";
variant = "";
};
# Configure console keymap
console.keyMap = "uk";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.vbox = {
isNormalUser = true;
description = "vbox";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
kdePackages.kate
wget
# thunderbird
];
};
# Enable automatic login for the user.
services.xserver.displayManager.autoLogin.enable = true;
services.xserver.displayManager.autoLogin.user = "vbox";
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = let
libbluray = pkgs.libbluray.override {
withAACS = true;
withBDplus = true;
};
myVlc = pkgs.vlc.override { inherit libbluray; }; # renamed this to avoid potential shadowing by `with pkgs;`
in [
myVlc
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
}
Yes, that’s just basic modularization of the config.
Your configuration.nix
could, for example, look like this:
{ config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
./additional-packages.nix
];
environment.systemPackages = with pkgs; [ package1 ];
}
And then additional-packages.nix
could be e.g.:
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [ package2 ];
}
The NixOS module system merges the set option values where it makes sense (that includes lists). In this case, the result would be both package1
and package2
in your PATH
.
That’s fantastic! Thank you so much, that’s what I was trying to do at the start but I couldn’t get it working properly so I fell back to the basic config and tried building it back up.
This is my current configuration.nix
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./myPackages.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/vda";
boot.loader.grub.useOSProber = true;
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/London";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_GB.UTF-8";
LC_IDENTIFICATION = "en_GB.UTF-8";
LC_MEASUREMENT = "en_GB.UTF-8";
LC_MONETARY = "en_GB.UTF-8";
LC_NAME = "en_GB.UTF-8";
LC_NUMERIC = "en_GB.UTF-8";
LC_PAPER = "en_GB.UTF-8";
LC_TELEPHONE = "en_GB.UTF-8";
LC_TIME = "en_GB.UTF-8";
};
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver.xkb = {
layout = "gb";
variant = "";
};
# Configure console keymap
console.keyMap = "uk";
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.vbox = {
isNormalUser = true;
description = "vbox";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [
kdePackages.kate
# thunderbird
];
};
# Enable automatic login for the user.
services.xserver.displayManager.autoLogin.enable = true;
services.xserver.displayManager.autoLogin.user = "vbox";
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = let
libbluray = pkgs.libbluray.override {
withAACS = true;
withBDplus = true;
};
myVlc = pkgs.vlc.override { inherit libbluray; }; # renamed this to avoid potential shadowing by `with pkgs;`
in [
myVlc
];
# Enable bluray/dvd
boot.kernelModules = [ "sg" ];
# Enable fonts
fonts.packages = with pkgs; [ nerdfonts ];
# Enable Steam
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
};
# Steam cursor fix
programs.steam.package = pkgs.steam.override {
extraPkgs = p: [
p.kdePackages.breeze
];
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.11"; # Did you read the comment?
}
and this is myPackages.nix
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
wget
yakuake
];
}
Thank you for all your help, I think I’ve got a better understanding of it now and my rebuild worked this time. Thanks again