modules: Add mkHost
This commit is contained in:
parent
488dd977d1
commit
7445d7c5c0
104
hosts/ayame.nix
104
hosts/ayame.nix
@ -1,38 +1,41 @@
|
|||||||
{ 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
|
|
||||||
../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
|
|
||||||
];
|
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
# Unstable, NUR, ...
|
|
||||||
(import ../overlays/unstable.nix pkgs)
|
|
||||||
(import ../overlays/nur.nix pkgs)
|
|
||||||
(import ../overlays/custom.nix pkgs)
|
|
||||||
];
|
|
||||||
|
|
||||||
environment = {
|
|
||||||
systemPackages = with pkgs; [
|
|
||||||
unstable.firmwareLinuxNonfree
|
|
||||||
sof-firmware
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
in mkHost {
|
||||||
# Disable dhcpcd as NetworkManager will do it for us
|
userName = "alexander";
|
||||||
networking = {
|
|
||||||
interfaces.wlan0.useDHCP = false;
|
|
||||||
hostName = "ayame";
|
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" ];
|
||||||
|
extraPackages = pkgs: with pkgs; [
|
||||||
|
unstable.firmwareLinuxNonFree unstable.sof-firmware
|
||||||
|
];
|
||||||
|
fileSystems = {
|
||||||
|
"/" = {
|
||||||
|
device = "/dev/disk/by-label/root";
|
||||||
|
fsType = "btrfs";
|
||||||
};
|
};
|
||||||
|
"/boot" = {
|
||||||
|
device = "/dev/disk/by-label/boot";
|
||||||
|
fsType = "vfat";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
swapDevices = [
|
||||||
|
{ device = "/dev/disk/by-uuid/cf3b1e1c-c245-4452-ad49-68ac72369e77"; }
|
||||||
|
];
|
||||||
|
extraOptions = old: {
|
||||||
boot = {
|
boot = {
|
||||||
loader = {
|
loader = {
|
||||||
|
systemd-boot.enable = false;
|
||||||
efi.canTouchEfiVariables = false;
|
efi.canTouchEfiVariables = false;
|
||||||
grub = {
|
grub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -57,40 +60,17 @@
|
|||||||
kernelPackages = pkgs.linuxPackages_zen;
|
kernelPackages = pkgs.linuxPackages_zen;
|
||||||
};
|
};
|
||||||
|
|
||||||
hardware = {
|
/*systemd.services = {
|
||||||
opengl = {
|
rfkill-workaround = {
|
||||||
extraPackages = with pkgs; [ vaapiIntel intel-media-driver ];
|
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";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};*/
|
||||||
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";
|
|
||||||
fsType = "btrfs";
|
|
||||||
};
|
|
||||||
"/boot" = {
|
|
||||||
device = "/dev/disk/by-label/boot";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
swapDevices = [
|
|
||||||
{ device = "/dev/disk/by-uuid/cf3b1e1c-c245-4452-ad49-68ac72369e77"; }
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
@ -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";
|
|
||||||
}
|
|
169
hosts/miku.nix
169
hosts/miku.nix
@ -1,88 +1,38 @@
|
|||||||
{ 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
|
|
||||||
../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
|
|
||||||
];
|
|
||||||
|
|
||||||
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;
|
lib = lib;
|
||||||
})
|
pkgs = pkgs;
|
||||||
|
|
||||||
# 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 mkHost {
|
||||||
});
|
userName = "alexander";
|
||||||
in {
|
hostName = "miku";
|
||||||
mpv = prev.wrapMpv mpv-git {
|
overlays = [ "nur" "steam" "unstable" "simple" "custom" "emacs" ];
|
||||||
# Prevent the need for prefixing mpv with DRI_PRIME=1
|
hardwareImports = [ "amdgpu" ];
|
||||||
extraMakeWrapperArgs = [
|
programImports = [
|
||||||
"--set" "DRI_PRIME" "1"
|
"zsh" "git" "mpv" "tmux" "emacs" "firefox" "gnome-terminal" "gnome" "i18n" "gamemode" "nonvm"
|
||||||
|
"distributed-build/builder.nix"
|
||||||
|
"music"
|
||||||
];
|
];
|
||||||
|
extraImports = [ "virtualisation/gaming.nix" ];
|
||||||
|
fileSystems = {
|
||||||
|
"/" = {
|
||||||
|
device = "/dev/disk/by-label/root";
|
||||||
|
fsType = "btrfs";
|
||||||
};
|
};
|
||||||
|
"/boot" = {
|
||||||
gajim = prev.gajim.overrideAttrs (old: {
|
device = "/dev/disk/by-label/boot";
|
||||||
# Enable notification sounds
|
fsType = "vfat";
|
||||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [ prev.gsound ];
|
};
|
||||||
});
|
"/mnt/Storage" = {
|
||||||
|
device = "/dev/disk/by-label/storage";
|
||||||
animedl = prev.animedl.overrideAttrs (old: {
|
fsType = "ext4";
|
||||||
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 = {
|
|
||||||
systemPackages = with pkgs; [
|
|
||||||
emacsPgtkGcc
|
emacsPgtkGcc
|
||||||
unstable.firmwareLinuxNonfree
|
|
||||||
gajim
|
gajim
|
||||||
virt-manager unstable.qemu scream
|
virt-manager unstable.qemu scream
|
||||||
gamemode # Custom package
|
gamemode # Custom package
|
||||||
@ -95,26 +45,16 @@
|
|||||||
discord-wrapper # Custom package
|
discord-wrapper # Custom package
|
||||||
superpaper # Custom package
|
superpaper # Custom package
|
||||||
mumble
|
mumble
|
||||||
|
piper
|
||||||
];
|
];
|
||||||
};
|
extraOptions = old: {
|
||||||
|
|
||||||
programs.mpv.primaryScreen = "C27F398";
|
programs.mpv.primaryScreen = "C27F398";
|
||||||
|
|
||||||
networking = {
|
# TODO: Move to virtualisation/gaming.nix
|
||||||
interfaces.enp6s0.useDHCP = false;
|
|
||||||
hostName = "miku";
|
|
||||||
# Nix otherwise has a conflict with this option
|
|
||||||
wireless.enable = lib.mkForce false;
|
|
||||||
|
|
||||||
# Allow scream to connect to this host
|
# Allow scream to connect to this host
|
||||||
firewall.allowedUDPPorts = [ 4010 ];
|
networking.firewall.allowedUDPPorts = [ 4010 ];
|
||||||
};
|
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
loader = {
|
|
||||||
systemd-boot.enable = true;
|
|
||||||
efi.canTouchEfiVariables = true;
|
|
||||||
};
|
|
||||||
extraModprobeConfig = ''
|
extraModprobeConfig = ''
|
||||||
options kvm_amd nested=1
|
options kvm_amd nested=1
|
||||||
options vfio-pci ids=1002:67df,1002:aaf0
|
options vfio-pci ids=1002:67df,1002:aaf0
|
||||||
@ -137,20 +77,16 @@
|
|||||||
"fbcon=rotate:1"
|
"fbcon=rotate:1"
|
||||||
"quiet"
|
"quiet"
|
||||||
];
|
];
|
||||||
kernelModules = [];
|
|
||||||
extraModulePackages = [ pkgs.linuxPackages.vendor-reset ];
|
extraModulePackages = [ pkgs.linuxPackages.vendor-reset ];
|
||||||
# NOTE: A regression appears to have happend between 5.10 and 5.12
|
# 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
|
# which leads to the RX590 to have the fence fallback timer on
|
||||||
# sdma0 time out (whatever this means). Maybe bisect?
|
# sdma0 time out (whatever this means). Maybe bisect?
|
||||||
#kernelPackages = pkgs.linuxPackages_zen;
|
#kernelPackages = pkgs.linuxPackages_zen;
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
# NOTE: key-mapper has a dbus policy file that we need to include
|
ratbagd.enable = true;
|
||||||
dbus.packages = [ pkgs.key-mapper ];
|
|
||||||
emacs.package = pkgs.emacsPgtkGcc;
|
|
||||||
flatpak.enable = true;
|
flatpak.enable = true;
|
||||||
xserver.videoDrivers = [ "amdgpu" ];
|
# TODO: Move to hardware/ and the respective custom package
|
||||||
udev.extraRules = ''
|
udev.extraRules = ''
|
||||||
KERNEL=="uinput", GROUP="input"
|
KERNEL=="uinput", GROUP="input"
|
||||||
|
|
||||||
@ -160,16 +96,27 @@
|
|||||||
# 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 = {
|
security = {
|
||||||
services = {
|
pam.loginLimits = [
|
||||||
NetworkManager-wait-online.enable = false;
|
{
|
||||||
|
domain = "@gamemode";
|
||||||
|
item = "-";
|
||||||
|
type = "nice";
|
||||||
|
value = "-10";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
wrappers = {
|
||||||
|
gamemoded = {
|
||||||
|
source = "${pkgs.gamemode}/bin/gamemoded";
|
||||||
|
capabilities = "cap_sys_nice+ep";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
user.services = {
|
# 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 =
|
client_id = ${funkwhale.client_id}
|
||||||
client_secret =
|
client_secret = ${funkwhale.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