modules: Add mkHost
This commit is contained in:
parent
488dd977d1
commit
7445d7c5c0
138
hosts/ayame.nix
138
hosts/ayame.nix
@ -1,85 +1,24 @@
|
|||||||
{ config, pkgs, modulesPath, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
{
|
let
|
||||||
imports = [
|
mkHost = import ../modules/host.nix {
|
||||||
./generic.nix
|
config = config;
|
||||||
../modules/hardware/generic.nix ../modules/hardware/bluetooth.nix ../modules/hardware/wifi.nix ../modules/hardware/video.nix ../modules/hardware/mobile.nix
|
lib = lib;
|
||||||
../modules/fonts.nix
|
pkgs = pkgs;
|
||||||
../modules/users
|
};
|
||||||
../modules/users/alexander.nix
|
in mkHost {
|
||||||
../modules/programs/zsh ../modules/programs/mpv ../modules/programs/git ../modules/programs/tmux ../modules/programs/firefox ../modules/programs/gnome-terminal ../modules/programs/gnome ../modules/programs/nonvm
|
userName = "alexander";
|
||||||
../modules/programs/distributed-build/offload.nix
|
hostName = "ayame";
|
||||||
|
wireless = true;
|
||||||
|
overlays = [ "nur" "unstable" ];
|
||||||
|
hardwareImports = [ "intel" "wifi" "mobile" ];
|
||||||
|
programImports = [
|
||||||
|
"zsh" "mpv" "git" "tmux" "firefox" "gnome-terminal" "gnome" "nonvm"
|
||||||
];
|
];
|
||||||
|
extraImports = [ "distributed-build/offload.nix" ];
|
||||||
nixpkgs.overlays = [
|
extraPackages = pkgs: with pkgs; [
|
||||||
# Unstable, NUR, ...
|
unstable.firmwareLinuxNonFree unstable.sof-firmware
|
||||||
(import ../overlays/unstable.nix pkgs)
|
|
||||||
(import ../overlays/nur.nix pkgs)
|
|
||||||
(import ../overlays/custom.nix pkgs)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
environment = {
|
|
||||||
systemPackages = with pkgs; [
|
|
||||||
unstable.firmwareLinuxNonfree
|
|
||||||
sof-firmware
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Disable dhcpcd as NetworkManager will do it for us
|
|
||||||
networking = {
|
|
||||||
interfaces.wlan0.useDHCP = false;
|
|
||||||
hostName = "ayame";
|
|
||||||
};
|
|
||||||
|
|
||||||
boot = {
|
|
||||||
loader = {
|
|
||||||
efi.canTouchEfiVariables = false;
|
|
||||||
grub = {
|
|
||||||
enable = true;
|
|
||||||
efiInstallAsRemovable = true;
|
|
||||||
device = "nodev";
|
|
||||||
efiSupport = true;
|
|
||||||
# The UEFI is pretty wonky
|
|
||||||
forcei686 = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
extraModprobeConfig = "";
|
|
||||||
initrd = {
|
|
||||||
availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_acpi" ];
|
|
||||||
kernelModules = [
|
|
||||||
"kvm-intel" "i915"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
# This spams the console and takes up so much CPU time
|
|
||||||
kernelParams = [ "modprobe.blacklist=arizona_spi" ];
|
|
||||||
kernelModules = [];
|
|
||||||
extraModulePackages = [];
|
|
||||||
kernelPackages = pkgs.linuxPackages_zen;
|
|
||||||
};
|
|
||||||
|
|
||||||
hardware = {
|
|
||||||
opengl = {
|
|
||||||
extraPackages = with pkgs; [ vaapiIntel intel-media-driver ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
|
||||||
xserver.videoDrivers = [ "modesetting" "fbdev" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
#systemd.services = {
|
|
||||||
# rfkill-workaround = {
|
|
||||||
# enable = true;
|
|
||||||
# description = "Work around rfkill having the Wifi blocked at boot";
|
|
||||||
# before = [ "network.target" ];
|
|
||||||
# wantedBy = [ "multi-user.target" ];
|
|
||||||
# serviceConfig = {
|
|
||||||
# Type = "oneshot";
|
|
||||||
# ExecStart = "rfkill unblock all";
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
#};
|
|
||||||
|
|
||||||
fileSystems = {
|
fileSystems = {
|
||||||
"/" = {
|
"/" = {
|
||||||
device = "/dev/disk/by-label/root";
|
device = "/dev/disk/by-label/root";
|
||||||
@ -93,4 +32,45 @@
|
|||||||
swapDevices = [
|
swapDevices = [
|
||||||
{ device = "/dev/disk/by-uuid/cf3b1e1c-c245-4452-ad49-68ac72369e77"; }
|
{ device = "/dev/disk/by-uuid/cf3b1e1c-c245-4452-ad49-68ac72369e77"; }
|
||||||
];
|
];
|
||||||
|
extraOptions = old: {
|
||||||
|
boot = {
|
||||||
|
loader = {
|
||||||
|
systemd-boot.enable = false;
|
||||||
|
efi.canTouchEfiVariables = false;
|
||||||
|
grub = {
|
||||||
|
enable = true;
|
||||||
|
efiInstallAsRemovable = true;
|
||||||
|
device = "nodev";
|
||||||
|
efiSupport = true;
|
||||||
|
# The UEFI is pretty wonky
|
||||||
|
forcei686 = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraModprobeConfig = "";
|
||||||
|
initrd = {
|
||||||
|
availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_acpi" ];
|
||||||
|
kernelModules = [
|
||||||
|
"kvm-intel" "i915"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
# This spams the console and takes up so much CPU time
|
||||||
|
kernelParams = [ "modprobe.blacklist=arizona_spi" ];
|
||||||
|
kernelModules = [];
|
||||||
|
extraModulePackages = [];
|
||||||
|
kernelPackages = pkgs.linuxPackages_zen;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*systemd.services = {
|
||||||
|
rfkill-workaround = {
|
||||||
|
enable = true;
|
||||||
|
description = "Work around rfkill having the Wifi blocked at boot";
|
||||||
|
before = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = "rfkill unblock all";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};*/
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,85 +0,0 @@
|
|||||||
{ config, lib, pkgs, python3Packages, ... }:
|
|
||||||
|
|
||||||
let
|
|
||||||
home-manager = builtins.fetchGit {
|
|
||||||
url = "https://github.com/nix-community/home-manager.git";
|
|
||||||
rev = "35a24648d155843a4d162de98c17b1afd5db51e4";
|
|
||||||
ref = "release-21.05";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# Install home-manager
|
|
||||||
imports = [
|
|
||||||
"${home-manager}/nixos"
|
|
||||||
../modules/users # For system.singleUser
|
|
||||||
];
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
|
|
||||||
time.timeZone = "Europe/Berlin";
|
|
||||||
|
|
||||||
networking = {
|
|
||||||
useDHCP = false; # Done by the network manager
|
|
||||||
networkmanager.enable = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
i18n.defaultLocale = "en_GB.UTF-8";
|
|
||||||
console = {
|
|
||||||
font = "Lat2-Terminus16";
|
|
||||||
keyMap = "de";
|
|
||||||
};
|
|
||||||
|
|
||||||
users = {
|
|
||||||
mutableUsers = false;
|
|
||||||
|
|
||||||
extraUsers = {
|
|
||||||
root = {
|
|
||||||
# Disable root login
|
|
||||||
hashedPassword = "*";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Users configured in vm.nix, nishimiya.nix or miku.nix
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
environment = {
|
|
||||||
systemPackages = with pkgs; [
|
|
||||||
htop
|
|
||||||
firejail
|
|
||||||
vim
|
|
||||||
git # Otherwise we cannot install home-manager
|
|
||||||
git-crypt
|
|
||||||
gnupg
|
|
||||||
python3
|
|
||||||
];
|
|
||||||
|
|
||||||
sessionVariables = {
|
|
||||||
# Prevent us from having to always type it out
|
|
||||||
NIXOS_CONFIG = "/home/${config.system.singleUser}/Development/Personal/nixos-config/hosts/${config.networking.hostName}.nix";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# We don't tolerate non-free software, except for Steam and Linux firmware
|
|
||||||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "firmwareLinuxNonfree" "steam" "steam-original" "steam-runtime" "discord" ];
|
|
||||||
|
|
||||||
services = {
|
|
||||||
connman = {
|
|
||||||
enable = true;
|
|
||||||
extraFlags = [ "--nodnsproxy" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: Is this correct? Maybe run once
|
|
||||||
timesyncd.enable = false;
|
|
||||||
|
|
||||||
printing.enable = lib.mkDefault false;
|
|
||||||
avahi.enable = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
# To allow users to use firejail
|
|
||||||
programs.firejail.enable = true;
|
|
||||||
|
|
||||||
security.sudo.extraConfig = ''
|
|
||||||
Defaults env_keep += "NIXOS_CONFIG"
|
|
||||||
'';
|
|
||||||
|
|
||||||
system.stateVersion = "21.05";
|
|
||||||
}
|
|
271
hosts/miku.nix
271
hosts/miku.nix
@ -1,157 +1,93 @@
|
|||||||
{ config, pkgs, modulesPath, lib, fetchGit, fetchFromGitHub, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
{
|
let
|
||||||
imports = [
|
mkHost = import ../modules/host.nix {
|
||||||
./generic.nix
|
config = config;
|
||||||
../modules/hardware/generic.nix ../modules/hardware/video.nix ../modules/hardware/desktop.nix
|
lib = lib;
|
||||||
../modules/fonts.nix
|
pkgs = pkgs;
|
||||||
../modules/users/alexander.nix
|
};
|
||||||
../modules/programs/zsh ../modules/programs/git ../modules/programs/mpv ../modules/programs/tmux ../modules/programs/emacs ../modules/programs/firefox ../modules/programs/gnome-terminal ../modules/programs/gnome ../modules/programs/i18n.nix ../modules/programs/gamemode ../modules/programs/nonvm
|
in mkHost {
|
||||||
../modules/virtualisation/gaming.nix
|
userName = "alexander";
|
||||||
../modules/programs/distributed-build/builder.nix
|
hostName = "miku";
|
||||||
../modules/programs/music
|
overlays = [ "nur" "steam" "unstable" "simple" "custom" "emacs" ];
|
||||||
|
hardwareImports = [ "amdgpu" ];
|
||||||
|
programImports = [
|
||||||
|
"zsh" "git" "mpv" "tmux" "emacs" "firefox" "gnome-terminal" "gnome" "i18n" "gamemode" "nonvm"
|
||||||
|
"distributed-build/builder.nix"
|
||||||
|
"music"
|
||||||
];
|
];
|
||||||
|
extraImports = [ "virtualisation/gaming.nix" ];
|
||||||
nixpkgs.overlays = [
|
fileSystems = {
|
||||||
(import (builtins.fetchGit {
|
"/" = {
|
||||||
url = "https://github.com/nix-community/emacs-overlay.git";
|
device = "/dev/disk/by-label/root";
|
||||||
ref = "master";
|
fsType = "btrfs";
|
||||||
rev = "ce0e9482d53d69bedc8416d8a984d00e17607826";
|
};
|
||||||
}))
|
"/boot" = {
|
||||||
|
device = "/dev/disk/by-label/boot";
|
||||||
# Steam overlay
|
fsType = "vfat";
|
||||||
(import ../overlays/steam.nix {
|
};
|
||||||
pkgs = pkgs;
|
"/mnt/Storage" = {
|
||||||
lib = lib;
|
device = "/dev/disk/by-label/storage";
|
||||||
})
|
fsType = "ext4";
|
||||||
|
|
||||||
# Simple overrides
|
|
||||||
(final: prev: let
|
|
||||||
# NOTE: For some reason --fs-screen-name and --screen-name are not in
|
|
||||||
# 0.33.1. So wait and then remove this.
|
|
||||||
mpv-git = prev.mpv-unwrapped.overrideAttrs (old: {
|
|
||||||
version = "0.34.0";
|
|
||||||
src = builtins.fetchGit {
|
|
||||||
url = "https://github.com/mpv-player/mpv.git";
|
|
||||||
ref = "master";
|
|
||||||
rev = "0b56e1c00a57fdb767674462c299a5c973a9e373";
|
|
||||||
};
|
|
||||||
patches = [];
|
|
||||||
});
|
|
||||||
in {
|
|
||||||
mpv = prev.wrapMpv mpv-git {
|
|
||||||
# Prevent the need for prefixing mpv with DRI_PRIME=1
|
|
||||||
extraMakeWrapperArgs = [
|
|
||||||
"--set" "DRI_PRIME" "1"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
gajim = prev.gajim.overrideAttrs (old: {
|
|
||||||
# Enable notification sounds
|
|
||||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [ prev.gsound ];
|
|
||||||
});
|
|
||||||
|
|
||||||
animedl = prev.animedl.overrideAttrs (old: {
|
|
||||||
extraPkgs = pkgs: with pkgs; [ mpv ];
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
# Unstable, NUR, ...
|
|
||||||
(import ../overlays/unstable.nix pkgs)
|
|
||||||
(import ../overlays/nur.nix pkgs)
|
|
||||||
(import ../overlays/custom.nix pkgs)
|
|
||||||
];
|
|
||||||
|
|
||||||
security = {
|
|
||||||
pam.loginLimits = [
|
|
||||||
{
|
|
||||||
domain = "@gamemode";
|
|
||||||
item = "-";
|
|
||||||
type = "nice";
|
|
||||||
value = "-10";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
wrappers = {
|
|
||||||
gamemoded = {
|
|
||||||
source = "${pkgs.gamemode}/bin/gamemoded";
|
|
||||||
capabilities = "cap_sys_nice+ep";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
extraPackages = pkgs: with pkgs; [
|
||||||
environment = {
|
emacsPgtkGcc
|
||||||
systemPackages = with pkgs; [
|
gajim
|
||||||
emacsPgtkGcc
|
virt-manager unstable.qemu scream
|
||||||
unstable.firmwareLinuxNonfree
|
gamemode # Custom package
|
||||||
gajim
|
key-mapper # Custom package
|
||||||
virt-manager unstable.qemu scream
|
replaysorcery # Custom package
|
||||||
gamemode # Custom package
|
evdev-proxy # Custom package
|
||||||
key-mapper # Custom package
|
vfio-isolate # Custom Package
|
||||||
replaysorcery # Custom package
|
steam
|
||||||
evdev-proxy # Custom package
|
discord-system-electron-wrapped # Custom package
|
||||||
vfio-isolate # Custom Package
|
discord-wrapper # Custom package
|
||||||
steam
|
superpaper # Custom package
|
||||||
discord-system-electron-wrapped # Custom package
|
mumble
|
||||||
discord-wrapper # Custom package
|
piper
|
||||||
superpaper # Custom package
|
];
|
||||||
mumble
|
extraOptions = old: {
|
||||||
];
|
programs.mpv.primaryScreen = "C27F398";
|
||||||
};
|
|
||||||
|
|
||||||
programs.mpv.primaryScreen = "C27F398";
|
|
||||||
|
|
||||||
networking = {
|
|
||||||
interfaces.enp6s0.useDHCP = false;
|
|
||||||
hostName = "miku";
|
|
||||||
# Nix otherwise has a conflict with this option
|
|
||||||
wireless.enable = lib.mkForce false;
|
|
||||||
|
|
||||||
|
# TODO: Move to virtualisation/gaming.nix
|
||||||
# Allow scream to connect to this host
|
# Allow scream to connect to this host
|
||||||
firewall.allowedUDPPorts = [ 4010 ];
|
networking.firewall.allowedUDPPorts = [ 4010 ];
|
||||||
};
|
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
loader = {
|
extraModprobeConfig = ''
|
||||||
systemd-boot.enable = true;
|
options kvm_amd nested=1
|
||||||
efi.canTouchEfiVariables = true;
|
options vfio-pci ids=1002:67df,1002:aaf0
|
||||||
};
|
'';
|
||||||
extraModprobeConfig = ''
|
initrd = {
|
||||||
options kvm_amd nested=1
|
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" "vendor-reset" ];
|
||||||
options vfio-pci ids=1002:67df,1002:aaf0
|
kernelModules = [
|
||||||
'';
|
"amdgpu" # GPU (duh)
|
||||||
initrd = {
|
"kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" # Virt
|
||||||
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" "vendor-reset" ];
|
"uinput" # key-mapper
|
||||||
kernelModules = [
|
"vendor-reset"
|
||||||
"amdgpu" # GPU (duh)
|
];
|
||||||
"kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" # Virt
|
};
|
||||||
"uinput" # key-mapper
|
kernelParams = [
|
||||||
"vendor-reset"
|
"amd_iommu=on"
|
||||||
|
"iommu=pt"
|
||||||
|
"sysrq_always_enabled=1"
|
||||||
|
"kvm.ignore_msrs=1"
|
||||||
|
"kvm.report_ignored_msrs=N"
|
||||||
|
"fbcon=rotate:1"
|
||||||
|
"quiet"
|
||||||
];
|
];
|
||||||
|
extraModulePackages = [ pkgs.linuxPackages.vendor-reset ];
|
||||||
|
# NOTE: A regression appears to have happend between 5.10 and 5.12
|
||||||
|
# which leads to the RX590 to have the fence fallback timer on
|
||||||
|
# sdma0 time out (whatever this means). Maybe bisect?
|
||||||
|
#kernelPackages = pkgs.linuxPackages_zen;
|
||||||
};
|
};
|
||||||
kernelParams = [
|
services = {
|
||||||
"amd_iommu=on"
|
ratbagd.enable = true;
|
||||||
"iommu=pt"
|
flatpak.enable = true;
|
||||||
"sysrq_always_enabled=1"
|
# TODO: Move to hardware/ and the respective custom package
|
||||||
"kvm.ignore_msrs=1"
|
udev.extraRules = ''
|
||||||
"kvm.report_ignored_msrs=N"
|
|
||||||
"fbcon=rotate:1"
|
|
||||||
"quiet"
|
|
||||||
];
|
|
||||||
kernelModules = [];
|
|
||||||
extraModulePackages = [ pkgs.linuxPackages.vendor-reset ];
|
|
||||||
# NOTE: A regression appears to have happend between 5.10 and 5.12
|
|
||||||
# which leads to the RX590 to have the fence fallback timer on
|
|
||||||
# sdma0 time out (whatever this means). Maybe bisect?
|
|
||||||
#kernelPackages = pkgs.linuxPackages_zen;
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
|
||||||
# NOTE: key-mapper has a dbus policy file that we need to include
|
|
||||||
dbus.packages = [ pkgs.key-mapper ];
|
|
||||||
emacs.package = pkgs.emacsPgtkGcc;
|
|
||||||
flatpak.enable = true;
|
|
||||||
xserver.videoDrivers = [ "amdgpu" ];
|
|
||||||
udev.extraRules = ''
|
|
||||||
KERNEL=="uinput", GROUP="input"
|
KERNEL=="uinput", GROUP="input"
|
||||||
|
|
||||||
# This rule allows the input group to access /dev/uinput device to create virtual input devices
|
# This rule allows the input group to access /dev/uinput device to create virtual input devices
|
||||||
@ -159,17 +95,28 @@
|
|||||||
|
|
||||||
# Create rules for your virtual devices to get persistent names
|
# Create rules for your virtual devices to get persistent names
|
||||||
KERNEL=="event*", SUBSYSTEM=="input", ATTRS{name}=="EvdevProxy*", SYMLINK+="input/by-id/virtual-event-$attr{name}"
|
KERNEL=="event*", SUBSYSTEM=="input", ATTRS{name}=="EvdevProxy*", SYMLINK+="input/by-id/virtual-event-$attr{name}"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
sshd.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd = {
|
|
||||||
services = {
|
|
||||||
NetworkManager-wait-online.enable = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
user.services = {
|
security = {
|
||||||
|
pam.loginLimits = [
|
||||||
|
{
|
||||||
|
domain = "@gamemode";
|
||||||
|
item = "-";
|
||||||
|
type = "nice";
|
||||||
|
value = "-10";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
wrappers = {
|
||||||
|
gamemoded = {
|
||||||
|
source = "${pkgs.gamemode}/bin/gamemoded";
|
||||||
|
capabilities = "cap_sys_nice+ep";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Move into modules
|
||||||
|
systemd.user.services = {
|
||||||
scream = {
|
scream = {
|
||||||
description = "Audio receiver for the Scream virtual network sound card";
|
description = "Audio receiver for the Scream virtual network sound card";
|
||||||
#wantedBy = [ "default.target" ];
|
#wantedBy = [ "default.target" ];
|
||||||
@ -237,20 +184,4 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems = {
|
|
||||||
"/" = {
|
|
||||||
device = "/dev/disk/by-label/root";
|
|
||||||
fsType = "btrfs";
|
|
||||||
};
|
|
||||||
"/boot" = {
|
|
||||||
device = "/dev/disk/by-label/boot";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
"/mnt/Storage" = {
|
|
||||||
device = "/dev/disk/by-label/storage";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
swapDevices = [ ];
|
|
||||||
}
|
}
|
||||||
|
11
modules/hardware/amdgpu.nix
Normal file
11
modules/hardware/amdgpu.nix
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
pkgs, ...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
unstable.mesa
|
||||||
|
unstable.firmwareLinuxNonfree
|
||||||
|
];
|
||||||
|
services.xserver.videoDrivers = [ "amdgpu" ];
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
hardware.bluetooth.enable = true;
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
environment.systemPackages = with pkgs; [ piper ];
|
|
||||||
|
|
||||||
services.ratbagd.enable = true;
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
{ lib, pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
environment.systemPackages = [ pkgs.rtkit ];
|
|
||||||
# NOTE: This assumes that the devices are x86_64 (cough i686 UEFI cough)
|
|
||||||
hardware = {
|
|
||||||
enableRedistributableFirmware = true;
|
|
||||||
# This is a Pipewire household!
|
|
||||||
pulseaudio.enable = false;
|
|
||||||
|
|
||||||
opengl = {
|
|
||||||
enable = true;
|
|
||||||
driSupport32Bit = true;
|
|
||||||
driSupport = true;
|
|
||||||
extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Only a subset of my devices have bluetooth
|
|
||||||
#bluetooth.enable = lib.mkDefault false;
|
|
||||||
};
|
|
||||||
|
|
||||||
services = {
|
|
||||||
# Everyone needs sound
|
|
||||||
pipewire = {
|
|
||||||
enable = true;
|
|
||||||
pulse.enable = true;
|
|
||||||
alsa.enable = true;
|
|
||||||
alsa.support32Bit = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# On desktop: Monitor keyboards, mice, ...
|
|
||||||
# On portable devices: Monitor their battery
|
|
||||||
upower.enable = true;
|
|
||||||
|
|
||||||
# What generated entropy?
|
|
||||||
haveged.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
9
modules/hardware/intel.nix
Normal file
9
modules/hardware/intel.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
pkgs, ...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
hardware.opengl.extraPackages = with pkgs; [ vaapiIntel intel-media-driver ];
|
||||||
|
# TODO: Remove?
|
||||||
|
services.xserver.videoDrivers = [ "modesetting" "fbdev" ];
|
||||||
|
}
|
@ -1,5 +0,0 @@
|
|||||||
{ pkgs, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
environment.systemPackages = with pkgs; [ unstable.mesa ];
|
|
||||||
}
|
|
Binary file not shown.
168
modules/host.nix
Normal file
168
modules/host.nix
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
userName
|
||||||
|
, hostName
|
||||||
|
, wireless ? false
|
||||||
|
, overlays ? []
|
||||||
|
, hardwareImports ? [ "generic" ]
|
||||||
|
, programImports ? []
|
||||||
|
, extraImports ? []
|
||||||
|
, fileSystems
|
||||||
|
, swapDevices ? []
|
||||||
|
, extraPackages ? pkgs: []
|
||||||
|
, extraOptions ? old: {}
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
overlaysSet = import ../overlays { pkgs = pkgs; lib = lib; };
|
||||||
|
home-manager = builtins.fetchGit {
|
||||||
|
url = "https://github.com/nix-community/home-manager.git";
|
||||||
|
rev = "35a24648d155843a4d162de98c17b1afd5db51e4";
|
||||||
|
ref = "release-21.05";
|
||||||
|
};
|
||||||
|
baseConfig = {
|
||||||
|
# Install home-manager
|
||||||
|
imports = [
|
||||||
|
"${home-manager}/nixos"
|
||||||
|
./users # For system.singleUser
|
||||||
|
(./users + "/${userName}.nix")
|
||||||
|
] ++ (map (item: ./programs + "/${item}") programImports)
|
||||||
|
++ (map (item: ./hardware + "/${item}.nix") hardwareImports)
|
||||||
|
++ (map (item: ./. + "/${item}") extraImports);
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
|
||||||
|
nixpkgs.overlays = (map (item: lib.getAttr item overlaysSet) overlays);
|
||||||
|
|
||||||
|
time.timeZone = "Europe/Berlin";
|
||||||
|
networking = {
|
||||||
|
useDHCP = false; # Done by the network manager
|
||||||
|
networkmanager.enable = false;
|
||||||
|
|
||||||
|
#interfaces.*.useDHCP = false;
|
||||||
|
|
||||||
|
hostName = hostName;
|
||||||
|
wireless.enable = (if wireless then true else lib.mkForce false);
|
||||||
|
};
|
||||||
|
|
||||||
|
i18n.defaultLocale = "en_GB.UTF-8";
|
||||||
|
console = {
|
||||||
|
font = "Lat2-Terminus16";
|
||||||
|
keyMap = "de";
|
||||||
|
};
|
||||||
|
|
||||||
|
users = {
|
||||||
|
mutableUsers = false;
|
||||||
|
|
||||||
|
extraUsers = {
|
||||||
|
root = {
|
||||||
|
# Disable root login
|
||||||
|
hashedPassword = "*";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
systemPackages = with pkgs; [
|
||||||
|
htop
|
||||||
|
vim
|
||||||
|
git # Otherwise we cannot install home-manager
|
||||||
|
git-crypt
|
||||||
|
gnupg
|
||||||
|
python3
|
||||||
|
|
||||||
|
# CJK fonts
|
||||||
|
source-han-sans source-han-serif
|
||||||
|
|
||||||
|
# RT scheduling
|
||||||
|
rtkit
|
||||||
|
] ++ extraPackages pkgs;
|
||||||
|
|
||||||
|
sessionVariables = {
|
||||||
|
# Prevent us from having to always type it out
|
||||||
|
NIXOS_CONFIG = "/home/${config.system.singleUser}/Development/Personal/nixos-config/hosts/${config.networking.hostName}.nix";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# We don't tolerate non-free software, except for Steam and Linux firmware
|
||||||
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
||||||
|
"firmwareLinuxNonfree"
|
||||||
|
"steam" "steam-original" "steam-runtime"
|
||||||
|
"discord"
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
connman = {
|
||||||
|
enable = true;
|
||||||
|
extraFlags = [ "--nodnsproxy" ];
|
||||||
|
|
||||||
|
wifi = lib.mkIf wireless {
|
||||||
|
# TODO: Maybe try out iwd
|
||||||
|
backend = "wpa_supplicant";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Is this correct? Maybe run once
|
||||||
|
timesyncd.enable = false;
|
||||||
|
|
||||||
|
# Everyone needs sound
|
||||||
|
pipewire = {
|
||||||
|
enable = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
alsa.support32Bit = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# On desktop: Monitor keyboards, mice, ...
|
||||||
|
# On portable devices: Monitor their battery
|
||||||
|
upower.enable = true;
|
||||||
|
|
||||||
|
# What generated entropy?
|
||||||
|
haveged.enable = true;
|
||||||
|
|
||||||
|
printing.enable = lib.mkDefault false;
|
||||||
|
avahi.enable = false;
|
||||||
|
|
||||||
|
# For debugging.
|
||||||
|
# TODO: Lock to known IPs and keys
|
||||||
|
sshd.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Don't wait for a network connection
|
||||||
|
systemd.services.NetworkManager-wait-online.enable = false;
|
||||||
|
|
||||||
|
security.sudo.extraConfig = ''
|
||||||
|
Defaults env_keep += "NIXOS_CONFIG"
|
||||||
|
'';
|
||||||
|
|
||||||
|
hardware = {
|
||||||
|
enableRedistributableFirmware = true;
|
||||||
|
# This is a Pipewire household!
|
||||||
|
pulseaudio.enable = false;
|
||||||
|
|
||||||
|
opengl = {
|
||||||
|
enable = true;
|
||||||
|
driSupport32Bit = true;
|
||||||
|
driSupport = true;
|
||||||
|
extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Only a subset of my devices have bluetooth
|
||||||
|
bluetooth = lib.mkIf wireless {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
loader = {
|
||||||
|
systemd-boot.enable = true;
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems = fileSystems;
|
||||||
|
swapDevices = swapDevices;
|
||||||
|
|
||||||
|
system.stateVersion = "21.05";
|
||||||
|
};
|
||||||
|
in lib.attrsets.recursiveUpdate baseConfig (extraOptions baseConfig)
|
@ -1,7 +1,9 @@
|
|||||||
{ config, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config.home-manager.users."${config.system.singleUser}".home.file = {
|
services.emacs.package = pkgs.emacsPgtkGcc;
|
||||||
|
|
||||||
|
home-manager.users."${config.system.singleUser}".home.file = {
|
||||||
".emacs".source = ./dotemacs;
|
".emacs".source = ./dotemacs;
|
||||||
".emacs.d/early-init.el".source = ./early-init.el;
|
".emacs.d/early-init.el".source = ./early-init.el;
|
||||||
".emacs.d/mu4e.el".source = ./mu4e.el;
|
".emacs.d/mu4e.el".source = ./mu4e.el;
|
||||||
|
@ -259,12 +259,29 @@
|
|||||||
(setq mode-line-format saved-mode-line-format)
|
(setq mode-line-format saved-mode-line-format)
|
||||||
(redraw-display))))
|
(redraw-display))))
|
||||||
|
|
||||||
|
;; Development
|
||||||
|
(use-package tide
|
||||||
|
:straight t
|
||||||
|
:config
|
||||||
|
(defun setup-tide-mode ()
|
||||||
|
(interactive)
|
||||||
|
(tide-setup)
|
||||||
|
(tide-hl-identifier-mode +1))
|
||||||
|
(add-hook 'typescript-mode-hook #'setup-tide-mode)
|
||||||
|
(add-hook 'web-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(when (string-equal "tsx" (file-name-extension buffer-file-name))
|
||||||
|
(setup-tide-mode))))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode)))
|
||||||
(use-package nix-mode
|
(use-package nix-mode
|
||||||
:straight t)
|
:straight t)
|
||||||
|
|
||||||
(use-package json-mode
|
(use-package json-mode
|
||||||
:straight t)
|
:straight t)
|
||||||
|
|
||||||
|
(use-package rust-mode
|
||||||
|
:straight t)
|
||||||
|
|
||||||
;; Debugging
|
;; Debugging
|
||||||
(use-package explain-pause-mode
|
(use-package explain-pause-mode
|
||||||
:straight
|
:straight
|
||||||
|
@ -1,24 +1,28 @@
|
|||||||
{ pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
let
|
||||||
environment.systemPackages = with pkgs; [
|
secrets = import ../../../secrets;
|
||||||
mpdevil
|
funkwhale = secrets.funkwhale.applications."${config.networking.hostName}";
|
||||||
mopidy mopidy-mpd mopidy-funkwhale
|
in {
|
||||||
];
|
config = {
|
||||||
|
environment.systemPackages = with pkgs; [ cantata ];
|
||||||
|
|
||||||
# TODO
|
services.mopidy = {
|
||||||
services.mopidy = {
|
#enable = true;
|
||||||
enable = true;
|
configuration = ''
|
||||||
configuration = ''
|
[funkwhale]
|
||||||
[funkwhale]
|
enabled = true
|
||||||
enabled = true
|
url = https://audio.polynom.me
|
||||||
url = https://audio.polynom.me
|
client_id = ${funkwhale.client_id}
|
||||||
client_id =
|
client_secret = ${funkwhale.client_secret}
|
||||||
client_secret =
|
cache_duration = 600
|
||||||
cache_duration = 600
|
|
||||||
|
[mpd]
|
||||||
|
enabled = true;
|
||||||
'';
|
'';
|
||||||
extensionPackages = with pkgs; [
|
extensionPackages = with pkgs; [
|
||||||
mopidy-mpd mopidy-funkwhale
|
mopidy-mpd mopidy-funkwhale
|
||||||
];
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
17
overlays/default.nix
Normal file
17
overlays/default.nix
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
pkgs
|
||||||
|
, lib
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
emacs = import (builtins.fetchGit {
|
||||||
|
url = "https://github.com/nix-community/emacs-overlay.git";
|
||||||
|
ref = "master";
|
||||||
|
rev = "ce0e9482d53d69bedc8416d8a984d00e17607826";
|
||||||
|
});
|
||||||
|
steam = import ./steam.nix { pkgs = pkgs; lib = lib; };
|
||||||
|
nur = import ./nur.nix pkgs;
|
||||||
|
unstable = import ./unstable.nix pkgs;
|
||||||
|
custom = import ./custom.nix pkgs;
|
||||||
|
simple = import ./simple.nix pkgs;
|
||||||
|
}
|
31
overlays/simple.nix
Normal file
31
overlays/simple.nix
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
pkgs: final: prev:
|
||||||
|
|
||||||
|
let
|
||||||
|
# NOTE: For some reason --fs-screen-name and --screen-name are not in
|
||||||
|
# 0.33.1. So wait and then remove this.
|
||||||
|
mpv-git = prev.mpv-unwrapped.overrideAttrs (old: {
|
||||||
|
version = "0.34.0";
|
||||||
|
src = builtins.fetchGit {
|
||||||
|
url = "https://github.com/mpv-player/mpv.git";
|
||||||
|
ref = "master";
|
||||||
|
rev = "0b56e1c00a57fdb767674462c299a5c973a9e373";
|
||||||
|
};
|
||||||
|
patches = [];
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
mpv = prev.wrapMpv mpv-git {
|
||||||
|
# Prevent the need for prefixing mpv with DRI_PRIME=1
|
||||||
|
extraMakeWrapperArgs = [
|
||||||
|
"--set" "DRI_PRIME" "1"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
gajim = prev.gajim.overrideAttrs (old: {
|
||||||
|
# Enable notification sounds
|
||||||
|
propagatedBuildInputs = old.propagatedBuildInputs ++ [ prev.gsound ];
|
||||||
|
});
|
||||||
|
|
||||||
|
animedl = prev.animedl.overrideAttrs (old: {
|
||||||
|
extraPkgs = pkgs: with pkgs; [ mpv ];
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user