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, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./generic.nix
|
||||
../modules/hardware/generic.nix ../modules/hardware/bluetooth.nix ../modules/hardware/wifi.nix ../modules/hardware/video.nix ../modules/hardware/mobile.nix
|
||||
../modules/fonts.nix
|
||||
../modules/users
|
||||
../modules/users/alexander.nix
|
||||
../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
|
||||
../modules/programs/distributed-build/offload.nix
|
||||
let
|
||||
mkHost = import ../modules/host.nix {
|
||||
config = config;
|
||||
lib = lib;
|
||||
pkgs = pkgs;
|
||||
};
|
||||
in mkHost {
|
||||
userName = "alexander";
|
||||
hostName = "ayame";
|
||||
wireless = true;
|
||||
overlays = [ "nur" "unstable" ];
|
||||
hardwareImports = [ "intel" "wifi" "mobile" ];
|
||||
programImports = [
|
||||
"zsh" "mpv" "git" "tmux" "firefox" "gnome-terminal" "gnome" "nonvm"
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
# Unstable, NUR, ...
|
||||
(import ../overlays/unstable.nix pkgs)
|
||||
(import ../overlays/nur.nix pkgs)
|
||||
(import ../overlays/custom.nix pkgs)
|
||||
extraImports = [ "distributed-build/offload.nix" ];
|
||||
extraPackages = pkgs: with pkgs; [
|
||||
unstable.firmwareLinuxNonFree unstable.sof-firmware
|
||||
];
|
||||
|
||||
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 = {
|
||||
"/" = {
|
||||
device = "/dev/disk/by-label/root";
|
||||
@ -93,4 +32,45 @@
|
||||
swapDevices = [
|
||||
{ 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, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./generic.nix
|
||||
../modules/hardware/generic.nix ../modules/hardware/video.nix ../modules/hardware/desktop.nix
|
||||
../modules/fonts.nix
|
||||
../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
|
||||
../modules/virtualisation/gaming.nix
|
||||
../modules/programs/distributed-build/builder.nix
|
||||
../modules/programs/music
|
||||
let
|
||||
mkHost = import ../modules/host.nix {
|
||||
config = config;
|
||||
lib = lib;
|
||||
pkgs = pkgs;
|
||||
};
|
||||
in mkHost {
|
||||
userName = "alexander";
|
||||
hostName = "miku";
|
||||
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"
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(import (builtins.fetchGit {
|
||||
url = "https://github.com/nix-community/emacs-overlay.git";
|
||||
ref = "master";
|
||||
rev = "ce0e9482d53d69bedc8416d8a984d00e17607826";
|
||||
}))
|
||||
|
||||
# Steam overlay
|
||||
(import ../overlays/steam.nix {
|
||||
pkgs = pkgs;
|
||||
lib = lib;
|
||||
})
|
||||
|
||||
# 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";
|
||||
};
|
||||
extraImports = [ "virtualisation/gaming.nix" ];
|
||||
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";
|
||||
};
|
||||
};
|
||||
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
emacsPgtkGcc
|
||||
unstable.firmwareLinuxNonfree
|
||||
gajim
|
||||
virt-manager unstable.qemu scream
|
||||
gamemode # Custom package
|
||||
key-mapper # Custom package
|
||||
replaysorcery # Custom package
|
||||
evdev-proxy # Custom package
|
||||
vfio-isolate # Custom Package
|
||||
steam
|
||||
discord-system-electron-wrapped # Custom package
|
||||
discord-wrapper # Custom package
|
||||
superpaper # Custom package
|
||||
mumble
|
||||
];
|
||||
};
|
||||
|
||||
programs.mpv.primaryScreen = "C27F398";
|
||||
|
||||
networking = {
|
||||
interfaces.enp6s0.useDHCP = false;
|
||||
hostName = "miku";
|
||||
# Nix otherwise has a conflict with this option
|
||||
wireless.enable = lib.mkForce false;
|
||||
extraPackages = pkgs: with pkgs; [
|
||||
emacsPgtkGcc
|
||||
gajim
|
||||
virt-manager unstable.qemu scream
|
||||
gamemode # Custom package
|
||||
key-mapper # Custom package
|
||||
replaysorcery # Custom package
|
||||
evdev-proxy # Custom package
|
||||
vfio-isolate # Custom Package
|
||||
steam
|
||||
discord-system-electron-wrapped # Custom package
|
||||
discord-wrapper # Custom package
|
||||
superpaper # Custom package
|
||||
mumble
|
||||
piper
|
||||
];
|
||||
extraOptions = old: {
|
||||
programs.mpv.primaryScreen = "C27F398";
|
||||
|
||||
# TODO: Move to virtualisation/gaming.nix
|
||||
# Allow scream to connect to this host
|
||||
firewall.allowedUDPPorts = [ 4010 ];
|
||||
};
|
||||
networking.firewall.allowedUDPPorts = [ 4010 ];
|
||||
|
||||
boot = {
|
||||
loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
extraModprobeConfig = ''
|
||||
options kvm_amd nested=1
|
||||
options vfio-pci ids=1002:67df,1002:aaf0
|
||||
'';
|
||||
initrd = {
|
||||
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" "vendor-reset" ];
|
||||
kernelModules = [
|
||||
"amdgpu" # GPU (duh)
|
||||
"kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" # Virt
|
||||
"uinput" # key-mapper
|
||||
"vendor-reset"
|
||||
boot = {
|
||||
extraModprobeConfig = ''
|
||||
options kvm_amd nested=1
|
||||
options vfio-pci ids=1002:67df,1002:aaf0
|
||||
'';
|
||||
initrd = {
|
||||
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" "amdgpu" "vendor-reset" ];
|
||||
kernelModules = [
|
||||
"amdgpu" # GPU (duh)
|
||||
"kvm-amd" "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" # Virt
|
||||
"uinput" # key-mapper
|
||||
"vendor-reset"
|
||||
];
|
||||
};
|
||||
kernelParams = [
|
||||
"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 = [
|
||||
"amd_iommu=on"
|
||||
"iommu=pt"
|
||||
"sysrq_always_enabled=1"
|
||||
"kvm.ignore_msrs=1"
|
||||
"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 = ''
|
||||
services = {
|
||||
ratbagd.enable = true;
|
||||
flatpak.enable = true;
|
||||
# TODO: Move to hardware/ and the respective custom package
|
||||
udev.extraRules = ''
|
||||
KERNEL=="uinput", GROUP="input"
|
||||
|
||||
# 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
|
||||
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 = {
|
||||
description = "Audio receiver for the Scream virtual network sound card";
|
||||
#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.d/early-init.el".source = ./early-init.el;
|
||||
".emacs.d/mu4e.el".source = ./mu4e.el;
|
||||
|
@ -259,12 +259,29 @@
|
||||
(setq mode-line-format saved-mode-line-format)
|
||||
(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
|
||||
:straight t)
|
||||
|
||||
(use-package json-mode
|
||||
:straight t)
|
||||
|
||||
(use-package rust-mode
|
||||
:straight t)
|
||||
|
||||
;; Debugging
|
||||
(use-package explain-pause-mode
|
||||
:straight
|
||||
|
@ -1,24 +1,28 @@
|
||||
{ pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
mpdevil
|
||||
mopidy mopidy-mpd mopidy-funkwhale
|
||||
];
|
||||
let
|
||||
secrets = import ../../../secrets;
|
||||
funkwhale = secrets.funkwhale.applications."${config.networking.hostName}";
|
||||
in {
|
||||
config = {
|
||||
environment.systemPackages = with pkgs; [ cantata ];
|
||||
|
||||
# TODO
|
||||
services.mopidy = {
|
||||
enable = true;
|
||||
configuration = ''
|
||||
[funkwhale]
|
||||
enabled = true
|
||||
url = https://audio.polynom.me
|
||||
client_id =
|
||||
client_secret =
|
||||
cache_duration = 600
|
||||
services.mopidy = {
|
||||
#enable = true;
|
||||
configuration = ''
|
||||
[funkwhale]
|
||||
enabled = true
|
||||
url = https://audio.polynom.me
|
||||
client_id = ${funkwhale.client_id}
|
||||
client_secret = ${funkwhale.client_secret}
|
||||
cache_duration = 600
|
||||
|
||||
[mpd]
|
||||
enabled = true;
|
||||
'';
|
||||
extensionPackages = with pkgs; [
|
||||
mopidy-mpd mopidy-funkwhale
|
||||
];
|
||||
extensionPackages = with pkgs; [
|
||||
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