2023-05-17 07:16:03 +07:00
|
|
|
{ lib
|
|
|
|
, pkgs
|
|
|
|
, config
|
2023-12-18 08:48:49 +07:00
|
|
|
, inputs
|
2023-05-17 07:16:03 +07:00
|
|
|
, ... }:
|
|
|
|
|
2023-06-24 13:07:42 +07:00
|
|
|
/*
|
2023-05-10 16:42:56 +07:00
|
|
|
# for old kernel versions
|
2023-12-18 08:48:49 +07:00
|
|
|
zenKernels = pkgs.callPackage "${pkgs.path}/pkgs/os-specific/linux/kernel/zen-kernels.nix";
|
2023-05-10 16:42:56 +07:00
|
|
|
zenKernel = (version: sha256: (zenKernels {
|
|
|
|
kernelPatches = [
|
|
|
|
pkgs.linuxKernel.kernelPatches.bridge_stp_helper
|
|
|
|
pkgs.linuxKernel.kernelPatches.request_key_helper
|
|
|
|
];
|
|
|
|
argsOverride = {
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "zen-kernel";
|
|
|
|
repo = "zen-kernel";
|
|
|
|
rev = "v${version}-zen1";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
inherit version;
|
|
|
|
modDirVersion = lib.versions.pad 3 "${version}-zen1";
|
|
|
|
};
|
|
|
|
}).zen);
|
|
|
|
zenKernelPackages = version: sha256: pkgs.linuxPackagesFor (zenKernel version sha256);
|
2023-06-24 13:07:42 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
{
|
2023-12-18 08:48:49 +07:00
|
|
|
imports = [ inputs.nix-gaming.nixosModules.pipewireLowLatency ];
|
|
|
|
|
2023-01-24 02:24:40 +07:00
|
|
|
system.stateVersion = "22.11";
|
|
|
|
|
|
|
|
### SECTION 1: HARDWARE/BOOT PARAMETERS ###
|
2023-04-11 00:58:02 +07:00
|
|
|
|
2023-01-24 02:24:40 +07:00
|
|
|
boot = {
|
2023-01-24 15:42:51 +07:00
|
|
|
kernel.sysctl = {
|
|
|
|
"vm.dirty_ratio" = 4;
|
|
|
|
"vm.dirty_background_ratio" = 2;
|
|
|
|
"vm.swappiness" = 40;
|
|
|
|
};
|
2024-08-15 09:06:06 +07:00
|
|
|
# TODO: switch back to latest
|
2024-10-08 21:58:58 +07:00
|
|
|
kernelPackages = pkgs.linuxPackages_latest;
|
2023-05-10 16:42:56 +07:00
|
|
|
/*kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";*/
|
2023-01-24 02:24:40 +07:00
|
|
|
};
|
2023-04-11 00:58:02 +07:00
|
|
|
|
|
|
|
# for testing different zen kernel versions:
|
2023-05-10 16:42:56 +07:00
|
|
|
# specialisation = {
|
|
|
|
# zen619.configuration.boot.kernelPackages = zenKernelPackages "6.1.9" "0fsmcjsawxr32fxhpp6sgwfwwj8kqymy0rc6vh4qli42fqmwdjgv";
|
2023-02-13 21:56:34 +07:00
|
|
|
# };
|
2023-04-11 00:58:02 +07:00
|
|
|
|
2023-07-12 03:26:50 +07:00
|
|
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
|
|
|
"steam-original"
|
|
|
|
];
|
2023-01-24 02:24:40 +07:00
|
|
|
hardware = {
|
2024-08-09 01:51:08 +07:00
|
|
|
opentabletdriver.enable = true;
|
2023-01-24 02:24:40 +07:00
|
|
|
steam-hardware.enable = true;
|
2024-08-24 17:39:25 +07:00
|
|
|
graphics.enable32Bit = true;
|
2023-04-11 00:58:02 +07:00
|
|
|
# needed for sway WLR_RENDERER=vulkan
|
2024-08-24 17:39:25 +07:00
|
|
|
graphics.extraPackages = with pkgs; [ vulkan-validation-layers ];
|
2023-02-03 13:07:57 +07:00
|
|
|
};
|
|
|
|
|
2023-04-12 16:04:07 +07:00
|
|
|
# see modules/vfio.nix
|
2023-01-24 02:24:40 +07:00
|
|
|
vfio.enable = true;
|
2023-05-17 07:16:03 +07:00
|
|
|
vfio.libvirtdGroup = [ config.common.mainUsername ];
|
2023-04-12 16:04:07 +07:00
|
|
|
|
|
|
|
# because libvirtd's nat is broken for some reason...
|
|
|
|
networking.nat = {
|
|
|
|
enable = true;
|
|
|
|
internalInterfaces = [ "virbr0" ];
|
|
|
|
externalInterface = "enp7s0f4u1c2";
|
|
|
|
};
|
2023-01-24 02:24:40 +07:00
|
|
|
|
|
|
|
### SECTION 2: SYSTEM CONFIG/ENVIRONMENT ###
|
2023-04-11 00:58:02 +07:00
|
|
|
|
2023-01-24 02:24:40 +07:00
|
|
|
networking.useDHCP = true;
|
|
|
|
# networking.firewall.enable = false;
|
2023-04-11 00:58:02 +07:00
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
27015
|
|
|
|
25565
|
|
|
|
7777
|
2023-06-24 07:12:11 +07:00
|
|
|
9887
|
|
|
|
];
|
2024-10-21 13:29:32 +07:00
|
|
|
networking.firewall.allowedUDPPorts = [ 27015 ];
|
2023-04-11 00:58:02 +07:00
|
|
|
# kde connect
|
2023-06-24 07:12:11 +07:00
|
|
|
networking.firewall.allowedTCPPortRanges = [
|
|
|
|
{ from = 1714; to = 1764; }
|
|
|
|
];
|
|
|
|
networking.firewall.allowedUDPPortRanges = [
|
|
|
|
{ from = 1714; to = 1764; }
|
|
|
|
];
|
2023-01-24 02:24:40 +07:00
|
|
|
networking.wireless.iwd.enable = true;
|
|
|
|
|
2023-04-11 00:58:02 +07:00
|
|
|
services.ratbagd.enable = true;
|
|
|
|
|
2023-01-24 02:24:40 +07:00
|
|
|
services.mullvad-vpn.enable = true;
|
|
|
|
services.mullvad-vpn.package = pkgs.mullvad-vpn;
|
|
|
|
|
2023-04-11 00:58:02 +07:00
|
|
|
# System76 scheduler (not actually a scheduler, just a renice daemon) for improved responsiveness
|
2023-05-30 10:02:36 +07:00
|
|
|
/*services.dbus.packages = [ pkgs.system76-scheduler ];
|
2023-08-09 23:43:17 +07:00
|
|
|
systemd.services.system76-scheduler = {
|
2023-05-26 06:22:33 +07:00
|
|
|
description = "Automatically configure CPU scheduler for responsiveness on AC";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "dbus";
|
|
|
|
BusName= "com.system76.Scheduler";
|
|
|
|
ExecStart = "${pkgs.system76-scheduler}/bin/system76-scheduler daemon";
|
|
|
|
ExecReload = "${pkgs.system76-scheduler}/bin/system76-scheduler daemon reload";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
environment.etc."system76-scheduler/assignments.ron".source =
|
|
|
|
"${pkgs.system76-scheduler}/etc/system76-scheduler/assignments.ron";
|
|
|
|
environment.etc."system76-scheduler/config.ron".source =
|
|
|
|
"${pkgs.system76-scheduler}/etc/system76-scheduler/config.ron";
|
|
|
|
environment.etc."system76-scheduler/exceptions.ron".source =
|
2023-05-30 10:02:36 +07:00
|
|
|
"${pkgs.system76-scheduler}/etc/system76-scheduler/exceptions.ron";*/
|
|
|
|
services.system76-scheduler.enable = true;
|
2023-06-12 20:12:15 +07:00
|
|
|
services.system76-scheduler.assignments = {
|
|
|
|
games.matchers = [ "osu!" ];
|
|
|
|
};
|
2023-04-11 00:58:02 +07:00
|
|
|
|
2023-07-12 03:26:50 +07:00
|
|
|
common.minimal = false;
|
2023-05-13 20:32:35 +07:00
|
|
|
common.gettyAutologin = true;
|
|
|
|
# programs.firejail.enable = true;
|
2023-05-10 16:42:56 +07:00
|
|
|
# doesn't work:
|
|
|
|
# programs.wireshark.enable = true;
|
2023-07-12 03:26:50 +07:00
|
|
|
# users.groups.wireshark.members = [ config.common.mainUsername ];
|
2023-01-24 02:24:40 +07:00
|
|
|
services.printing.enable = true;
|
2023-08-24 18:27:05 +07:00
|
|
|
services.printing.drivers = [ pkgs.hplip ];
|
2023-12-18 08:48:49 +07:00
|
|
|
# from nix-gaming
|
|
|
|
services.pipewire.lowLatency = {
|
|
|
|
enable = false;
|
|
|
|
# 96 is mostly fine but has some xruns
|
|
|
|
# 128 has xruns every now and then too
|
|
|
|
quantum = 128;
|
|
|
|
rate = 48000;
|
2023-07-12 03:26:50 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
programs.sway.enable = true;
|
|
|
|
xdg.portal = {
|
2023-02-19 19:09:38 +07:00
|
|
|
enable = true;
|
2024-08-15 09:06:06 +07:00
|
|
|
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
|
2023-02-19 19:09:38 +07:00
|
|
|
};
|
2023-01-24 02:24:40 +07:00
|
|
|
|
2023-02-19 19:09:38 +07:00
|
|
|
programs.ccache.enable = true;
|
2023-06-11 18:02:38 +07:00
|
|
|
services.sshd.enable = true;
|
2024-09-13 23:02:23 +07:00
|
|
|
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
2023-10-18 19:34:55 +07:00
|
|
|
users.users.hydra-builder = {
|
|
|
|
uid = 1001;
|
|
|
|
isNormalUser = true;
|
|
|
|
};
|
2023-07-28 09:59:47 +07:00
|
|
|
nix.settings = {
|
2023-10-18 19:34:55 +07:00
|
|
|
trusted-users = [ "hydra-builder" ];
|
2023-08-09 23:43:17 +07:00
|
|
|
trusted-substituters = [
|
|
|
|
"https://nix-community.cachix.org"
|
|
|
|
"https://nix-gaming.cachix.org"
|
|
|
|
"https://nixpkgs-wayland.cachix.org"
|
2023-07-28 09:59:47 +07:00
|
|
|
];
|
|
|
|
trusted-public-keys = [
|
2023-08-09 23:43:17 +07:00
|
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
|
|
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
|
|
|
|
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
2023-07-28 09:59:47 +07:00
|
|
|
];
|
|
|
|
};
|
2024-07-02 23:05:56 +07:00
|
|
|
nix.buildMachines = [
|
|
|
|
{
|
|
|
|
hostName = "darwin-build-box.nix-community.org";
|
|
|
|
protocol = "ssh-ng";
|
|
|
|
systems = [ "aarch64-darwin" "x86_64-darwin" ];
|
|
|
|
supportedFeatures = inputs.nix-community-infra.darwinConfigurations.darwin01.config.nix.settings.system-features;
|
|
|
|
sshKey = "/secrets/community-builder-key";
|
|
|
|
sshUser = "chayleaf";
|
|
|
|
publicHostKey = "c3NoLWVkMjU1MTkgQUFBQUMzTnphQzFsWkRJMU5URTVBQUFBSUZ6OEZYU1ZFZGY4RnZETWZib3hoQjVWalNlN3kyV2dTYTA5cTFMNHQwOTkgCg==";
|
|
|
|
}
|
|
|
|
];
|
2023-07-12 03:26:50 +07:00
|
|
|
services.udev.packages = [
|
|
|
|
pkgs.android-udev-rules
|
|
|
|
];
|
2023-08-24 18:27:05 +07:00
|
|
|
services.avahi.enable = true;
|
2024-03-19 15:30:38 +07:00
|
|
|
services.avahi.nssmdns4 = true;
|
2023-07-12 03:26:50 +07:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
comma
|
|
|
|
neovim
|
|
|
|
man-pages man-pages-posix
|
|
|
|
];
|
|
|
|
documentation.dev.enable = true;
|
2023-07-12 20:01:14 +07:00
|
|
|
|
2023-07-28 09:59:47 +07:00
|
|
|
impermanence.directories = [
|
|
|
|
/secrets
|
|
|
|
];
|
2023-01-24 02:24:40 +07:00
|
|
|
}
|