start versioning current setup

This commit is contained in:
LordGrimmauld 2023-11-28 23:24:43 +01:00
commit 53f4c9cb29
20 changed files with 510 additions and 0 deletions

70
configuration.nix Normal file
View file

@ -0,0 +1,70 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./modules/sway.nix
./modules/localisation.nix
./modules/users.nix
./modules/tlp.nix
./modules/printing.nix
./modules/network.nix
./modules/xdg.nix
./modules/fonts.nix
./modules/polkit.nix
./modules/sound.nix
./modules/tabletdriver.nix
./modules/xserver.nix
./modules/system-packages.nix
./modules/mypackaegsstayinstoreffs.nix
./modules/opengl.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
# Enable flatpaks
services.flatpak.enable = true;
environment.sessionVariables = {
NIXPKGS_ALLOW_UNFREE="1";
OMP_NUM_THREADS = "12";
MOZ_ENABLE_WAYLAND="1";
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "unstable"; # "23.05"; # Did you read the comment?
programs.dconf.enable = true;
}

View file

@ -0,0 +1,33 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
./modules/nvidia.nix
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "quiet" ]; # no more explicit modeset since 545
fileSystems."/" =
{ device = "/dev/disk/by-uuid/3a4a7076-98e7-4ecd-bb07-7e182a04ceac";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/D20D-B5B0";
fsType = "vfat";
};
swapDevices = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

13
modules/fonts.nix Normal file
View file

@ -0,0 +1,13 @@
with import <nixpkgs> {};
{
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk
font-awesome
noto-fonts-emoji
roboto
liberation_ttf
];
fonts.fontDir.enable = true;
}

26
modules/localisation.nix Normal file
View file

@ -0,0 +1,26 @@
with import <nixpkgs> {};
{
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
console.keyMap = "de";
services.xserver = {
layout = "de";
xkbVariant = "";
};
}

View file

@ -0,0 +1,13 @@
with import <nixpkgs> {};
{
users.extraUsers.mypackaegsstayinstoreffs = {
isNormalUser = true;
description = "dummy user to prevent nix gc from clearing out large packages";
packages = with pkgs; [
jetbrains.clion
jetbrains.pycharm-community
jetbrains.idea-community
cudatoolkit_11
];
};
}

43
modules/network.nix Normal file
View file

@ -0,0 +1,43 @@
with import <nixpkgs> {};
{
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp3s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
networking.hostName = "grimmauld-nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Bluetooth
services.blueman.enable = true;
hardware.bluetooth.enable = true;
systemd.user.services.mpris-proxy = {
description = "Mpris proxy";
after = [ "network.target" "sound.target" ];
wantedBy = [ "default.target" ];
serviceConfig.ExecStart = "${pkgs.bluez}/bin/mpris-proxy";
};
environment.systemPackages = with pkgs; [
wireguard-tools
];
}

49
modules/nvidia.nix Normal file
View file

@ -0,0 +1,49 @@
{ config, pkgs, lib, ... }:
{
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
hardware.nvidia.prime = {
sync.enable = true;
# Make sure to use the correct Bus ID values for your system!
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
specialisation = {
on-the-go.configuration = {
system.nixos.tags = [ "on-the-go" ];
powerManagement.cpuFreqGovernor = lib.mkForce "powersave";
hardware.nvidia = {
prime.offload.enable = lib.mkForce true;
prime.offload.enableOffloadCmd = lib.mkForce true;
prime.sync.enable = lib.mkForce false;
};
};
};
}

19
modules/opengl.nix Normal file
View file

@ -0,0 +1,19 @@
with import <nixpkgs> {};
{
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
];
};
environment.sessionVariables = {
__GL_LOG_MAX_ANISO = "0";
__GL_SHADER_DISK_CACHE = "1";
__GL_SYNC_TO_VBLANK = "0";
__GL_THREADED_OPTIMIZATIONS = "1";
__GL_VRR_ALLOWED = "1";
};
}

19
modules/polkit.nix Normal file
View file

@ -0,0 +1,19 @@
with import <nixpkgs> {};
{
security.polkit.enable = true;
systemd.user.services.polkit-kde-authentication-agent-1 = {
enable = true;
description = "polkit-kde-authentication-agent-1";
wantedBy = [ "graphical-session.target" ];
wants = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
Restart = "on-failure";
RestartSec = 1;
TimeoutStopSec = 10;
};
};
}

18
modules/printing.nix Normal file
View file

@ -0,0 +1,18 @@
with import <nixpkgs> {};
{
imports =
[ # Include the results of the hardware scan.
<nixpkgs/nixos/modules/services/hardware/sane_extra_backends/brscan4.nix>
];
# Enable CUPS to print documents.
services.printing.enable = true;
services.printing.drivers = with pkgs; [ brgenml1lpr brgenml1cupswrapper ];
services.avahi = {
enable = true;
nssmdns = true;
openFirewall = true;
};
hardware.sane.brscan4.enable = true; # enables support for SANE scanners
}

22
modules/sound.nix Normal file
View file

@ -0,0 +1,22 @@
with import <nixpkgs> {};
{
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true; # osu uses jack
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
environment.systemPackages = with pkgs; [
pavucontrol
];
}

53
modules/sway.nix Normal file
View file

@ -0,0 +1,53 @@
{ config, lib, pkgs, modulesPath, inputs, system, ... }:
{
nixpkgs.overlays = [ (final: prev: { sway-unwrapped = prev.sway-unwrapped.overrideAttrs (old: {
src = pkgs.fetchFromGitHub {
owner = "WillPower3309";
repo = "swayfx";
rev = "7c75b21933215348f28a2c788b174901ef13e267";
sha256 = "sha256-SlfJ34TR+QdFPnTpyo/UON9RDxS3MfLU9tOabWHkknQ=";
};
patches =
let
removePatches = [
"LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM.patch"
];
in
builtins.filter
(patch: !builtins.elem (patch.name or null) removePatches)
(old.patches or [ ]);
});})
];
programs.sway = {
enable = true;
wrapperFeatures = {
gtk = true;
base = true;
};
extraPackages = with pkgs; [
swaylock
swayidle
wl-clipboard
wf-recorder
waybar
dmenu
wmenu
];
extraOptions = [
"--unsupported-gpu"
];
extraSessionCommands = ''
export XDG_CURRENT_DESKTOP=sway
export SDL_VIDEODRIVER=wayland
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION="1"
export _JAVA_AWT_WM_NONREPARENTING=1
export MOZ_ENABLE_WAYLAND=1
'';
};
}

View file

@ -0,0 +1,22 @@
with import <nixpkgs> {};
{
environment.systemPackages = with pkgs; [
wget
xonsh
tree
git
file
kate
git-lfs
util-linux
btop
kitty
polkit-kde-agent
skanpage
cached-nix-shell
ffmpeg-full
imagemagick
(import ../scripts.nix)
];
}

18
modules/tabletdriver.nix Normal file
View file

@ -0,0 +1,18 @@
with import <nixpkgs> {};
{
systemd.services.otd-daemon = {
description = "opentabletdriver daemon, a user service to make the gui work";
after = [ "graphical-session.target" ];
wantedBy = [ "xdg-desktop-autostart.target" ];
serviceConfig = {
ExecStart = "${pkgs.opentabletdriver}/bin/otd-daemon";
Type = "simple";
};
};
environment.systemPackages = with pkgs; [
opentabletdriver
];
hardware.opentabletdriver.enable = true;
}

4
modules/template.nix Normal file
View file

@ -0,0 +1,4 @@
with import <nixpkgs> {};
{
}

24
modules/tlp.nix Normal file
View file

@ -0,0 +1,24 @@
with import <nixpkgs> {};
{
services.power-profiles-daemon.enable = false;
services.tlp = {
enable = true;
settings = {
USB_AUTOSUSPEND=1;
USB_EXCLUDE_BTUSB=1;
USB_EXCLUDE_PHONE=1;
SOUND_POWER_SAVE_ON_AC=0;
SOUND_POWER_SAVE_ON_BAT=1;
SATA_LINKPWR_ON_AC="max_performance";
SATA_LINKPWR_ON_BAT="min_power";
MAX_LOST_WORK_SECS_ON_BAT=15;
CPU_ENERGY_PERF_POLICY_ON_AC="performance";
CPU_ENERGY_PERF_POLICY_ON_BAT="power";
CPU_BOOST_ON_AC=1;
CPU_BOOST_ON_BAT=0;
RUNTIME_PM_ON_AC="on";
RUNTIME_PM_ON_BAT="auto";
};
};
}

20
modules/users.nix Normal file
View file

@ -0,0 +1,20 @@
with import <nixpkgs> {};
{
users.users.grimmauld = {
isNormalUser = true;
description = "grimmauld";
extraGroups = [ "networkmanager" "wheel" "input" "video" "lp" "scanner" ];
packages = with pkgs; [
webcord
heroic
plasma-browser-integration
pdfarranger
kwrited
gparted
nmap
ghidra
firefox-esr
spicetify-cli
];
};
}

16
modules/xdg.nix Normal file
View file

@ -0,0 +1,16 @@
with import <nixpkgs> {};
{
xdg.portal = {
enable = true;
wlr.enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-kde
xdg-desktop-portal-gtk
];
};
environment.sessionVariables = {
XDG_CONFIG_HOME = "$HOME/.config";
};
}

19
modules/xserver.nix Normal file
View file

@ -0,0 +1,19 @@
with import <nixpkgs> {};
{
# Enable the X11 windowing system.
services.xserver = {
enable = true;
videoDrivers = ["nvidia"];
displayManager = {
sddm.enable = true;
defaultSession = "plasmawayland";
};
desktopManager = {
plasma5.enable = true;
xfce.enable = true;
};
};
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
}

9
scripts.nix Normal file
View file

@ -0,0 +1,9 @@
with import <nixpkgs> {};
writeShellScriptBin "primerun" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"
''