Enable mopidy and virtualisation via QEMU/KVM

This commit is contained in:
coolneng 2020-05-11 06:40:41 +02:00
parent 3147727b77
commit ce494aa7a2
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
3 changed files with 83 additions and 7 deletions

View File

@ -5,14 +5,15 @@
boot = { boot = {
kernelPackages = pkgs.linuxPackages_latest; kernelPackages = pkgs.linuxPackages_latest;
kernelParams = [ "zfs.zfs_arc_max=536870912" ]; kernelParams = [ "zfs.zfs_arc_max=536870912" ];
kernelModules = [ "i915" "acpi_call" ]; kernelModules = [ "i915" "acpi_call" "kvm-intel" ];
extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; extraModulePackages = with config.boot.kernelPackages; [ acpi_call ];
supportedFilesystems = [ "zfs" ]; supportedFilesystems = [ "zfs" ];
zfs.requestEncryptionCredentials = true; zfs.requestEncryptionCredentials = true;
}; };
# Intel CPU tweaks # Intel CPU tweaks
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.opengl.extraPackages = with pkgs; [ hardware.opengl.extraPackages = with pkgs; [
vaapiIntel vaapiIntel
@ -70,8 +71,24 @@
users.users.coolneng = { users.users.coolneng = {
isNormalUser = true; isNormalUser = true;
home = "/home/coolneng"; home = "/home/coolneng";
extraGroups = [ "wheel" "video" "audio" ]; extraGroups = [ "wheel" "video" "audio" "libvirtd" ];
shell = "/run/current-system/sw/bin/fish"; shell = pkgs.fish;
};
# Set fish shell for root user
users.users.root = {
shell = pkgs.fish;
openssh.authorizedKeys.keys = [
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC9mMwf7yXwtiEABwq5zkNEXgveUhNEPfqa3VLdnG2UYArB6f2l2aFM+MkGc8s84T8cj7JDF2N1pEBvilGMNWmLT32IBfwjyJov/38/PTpWb3301hCck5EOWmykGWMXdRlIEj6vsR4UqeRFwbr8QBlxv2dTPe9wTrCLvkKOuaPWMyMgtEwnNHvB8e7eqUZZYVmRSQkWCqYmK7a6TCvHUg3XsmjQU3OSmTH+eXJEUL4OiSFKxd9eO5QU04uYDbX8f8jY/slReoEWbuJ/InSWFbPs6L3bUYQrl3ht/7DR9FqzcOpAN4AcrJFyIJzot8inpp6f5IsVVjy0dhNUGWtXMkOgNf6lmylokqFBb1Jcy/lJbgUtJZ5ZNjlJFCbjXHe6J0q7bYKJgMQKuY1N3rexhZIMsBXi8aYaSKaGqX7TPnBEPlr1hXda2lGm2l6jQq5Lj2U5aj5aBa/BYmKFGVxcMpRFlsWfYPyQ/2wxRcpNcDiJt0eWP70mhu8OcupPO9kxGw0= coolneng@panacea"
];
};
# Enable localhost SSH
services.openssh = {
enable = true;
permitRootLogin = "yes";
passwordAuthentication = false;
openFirewall = false;
}; };
# Import other configuration modules # Import other configuration modules

View File

@ -1,10 +1,10 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
# Enable ALSA # Enable ALSA
sound.enable = true; sound.enable = true;
# Configure PulseAudio with mopidy tweaks # Configure PulseAudio with mopidy tweaks
hardware.pulseaudio = { hardware.pulseaudio = {
enable = true; enable = true;
tcp = { tcp = {
@ -12,4 +12,60 @@
anonymousClients.allowedIpRanges = [ "127.0.0.1" ]; anonymousClients.allowedIpRanges = [ "127.0.0.1" ];
}; };
}; };
# Set up Mopidy
services.mopidy = {
enable = true;
extensionPackages =
[ pkgs.mopidy-mpd pkgs.mopidy-soundcloud pkgs.mopidy-youtube ];
configuration = ''
[core]
cache_dir = $XDG_CACHE_DIR/cache/mopidy
config_dir = $XDG_CONFIG_DIR/mopidy
data_dir = $XDG_DATA_DIR/lib/mopidy
[logging]
config_file = $XDG_CONFIG_DIR/mopidy/logging.conf
[audio]
mixer = software
mixer_volume =
output = pulsesink server=127.0.0.1
visualizer =
[file]
enabled = true
media_dirs = /home/coolneng/Music
excluded_file_extensions =
.directory
.html
.jpeg
.jpg
.log
.nfo
.png
.txt
[mpd]
enabled = true
hostname = 127.0.0.1
port = 6600
password =
max_connections = 20
zeroconf = ""
[http]
enabled = false
[soundcloud]
enabled = false
[m3u]
playlists_dir = /home/coolneng/.config/mpd/playlists
base_dir = /home/coolneng/Music
'';
};
# Give permissions to mopidy user
users.users.mopidy = { extraGroups = [ "audio" ]; };
} }

View File

@ -3,4 +3,7 @@
{ {
# Improve nix-shell and direnv integration # Improve nix-shell and direnv integration
services.lorri.enable = true; services.lorri.enable = true;
# Enable virtualization
virtualisation.libvirtd.enable = true;
} }