Separated some settings

This commit is contained in:
Aleksandr Lebedev 2024-11-20 20:33:42 +01:00
parent 24a3ba6f99
commit 2147766e07
6 changed files with 148 additions and 57 deletions

View file

@ -21,26 +21,27 @@
outputs = { self, nixpkgs, stylix, nix-flatpak, ... }@inputs: outputs = { self, nixpkgs, stylix, nix-flatpak, ... }@inputs:
let let
system = "x86_64-linux"; #system = "x86_64-linux";
pkgs = import nixpkgs { #pkgs = import nixpkgs {
inherit system; # inherit system;
config = { # config = {
allowUnfree = true; # allowUnfree = true;
# };
}; #};
};
in in
{ {
nixosConfigurations = { nixosConfigurations = {
homepc = nixpkgs.lib.nixosSystem { homepc = nixpkgs.lib.nixosSystem {
specialArgs = { inherit system; inherit inputs; }; specialArgs = { hostname = "nixosbtw"; system = "x86_64-linux"; inherit inputs; };
modules = [ modules = [
#nur.nixosModules.nur #nur.nixosModules.nur
./nixos/configuration.nix ./nixos/configuration.nix
./nixos/nvidia.nix
./nixos/homepc-hardware-conf.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
stylix.nixosModules.stylix stylix.nixosModules.stylix
nix-flatpak.nixosModules.default #nix-flatpak.nixosModules.default
]; ];
}; };
}; };

View file

@ -2,22 +2,22 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, stylix, inputs, ... }: { config, pkgs, stylix, hostname, inputs, ... }:
{ {
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
./firefox.nix ./firefox.nix
./libvirt.nix
]; ];
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = if hostname == "nixosbtw" then true else false;
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
networking.hostName = "nixosbtw"; # Define your hostname. networking.hostName = hostname;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary # Configure network proxy if necessary
@ -151,8 +151,8 @@
vscode-fhs vscode-fhs
# development # development
clang_18 #clang_18
dotnetCorePackages.sdk_8_0_3xx #dotnetCorePackages.sdk_8_0_3xx
]; ];
programs.kdeconnect.enable = true; programs.kdeconnect.enable = true;
programs.kdeconnect.package = pkgs.kdePackages.kdeconnect-kde; programs.kdeconnect.package = pkgs.kdePackages.kdeconnect-kde;
@ -193,45 +193,9 @@
hardware = { hardware = {
graphics = { graphics = {
enable = true; enable = true;
extraPackages = with pkgs; [
nvidia-vaapi-driver
];
}; };
nvidia = {
# https://nixos.wiki/wiki/Nvidia
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = true;#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 = true;
# 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;
};
logitech.wireless.enable = true; logitech.wireless.enable = true;
}; };
services.xserver.videoDrivers = [ "nvidia" ];
security.polkit.enable = true; security.polkit.enable = true;
@ -264,7 +228,7 @@
}; };
home-manager = { home-manager = {
extraSpecialArgs = {inherit pkgs; inherit inputs;}; extraSpecialArgs = {inherit pkgs; inherit hostname; inherit inputs;};
users = { users = {
"kylekrein" = import ./home.nix; "kylekrein" = import ./home.nix;
}; };

View file

@ -0,0 +1,41 @@
# 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")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/10040de2-c5df-42c9-94fa-d6d9d76397f4";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/9973-FDA6";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/88d26139-5a1c-4ced-bd0f-a0f118d7e773"; }
];
# 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.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,4 +1,4 @@
{ pkgs, lib, ... }: { pkgs, lib, hostname, ... }:
let let
toggle_monitors = ./toggle_monitors.sh; toggle_monitors = ./toggle_monitors.sh;
wallpaper-image = ./wallpaper.jpg; wallpaper-image = ./wallpaper.jpg;
@ -13,10 +13,10 @@ in
enable = true; enable = true;
xwayland.enable = true; xwayland.enable = true;
settings = { settings = {
monitor = [ monitor = if hostname == "nixosbtw" then [
"DP-1,2560x1440@75,1600x0,1.6" "DP-1,2560x1440@75,1600x0,1.6"
"DP-3,2560x1440@75,0x0,1.6" "DP-3,2560x1440@75,0x0,1.6"
]; ] else ",auto,auto,1.6";
xwayland = { xwayland = {
force_zero_scaling = true; force_zero_scaling = true;

39
nixos/libvirt.nix Normal file
View file

@ -0,0 +1,39 @@
{ pkgs, ... }:
let
username = "kylekrein";
in
{
virtualisation = {
libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
swtpm.enable = true;
ovmf.enable = true;
ovmf.packages = [ pkgs.OVMFFull.fd ];
};
};
spiceUSBRedirection.enable = true;
};
users.users.${username}.extraGroups = [ "libvirtd" ];
environment.systemPackages = with pkgs; [
spice
spice-gtk
spice-protocol
virt-viewer
#virtio-win
#win-spice
];
programs.virt-manager.enable = true;
home-manager.users.${username} = {
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
};
};
};
}

46
nixos/nvidia.nix Normal file
View file

@ -0,0 +1,46 @@
{ config, pkgs, ... }:
{
hardware = {
graphics = {
enable = true;
extraPackages = with pkgs; [
nvidia-vaapi-driver
];
};
nvidia = {
# https://nixos.wiki/wiki/Nvidia
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
# Enable this if you have graphical corruption issues or application crashes after waking
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
# of just the bare essentials.
powerManagement.enable = true;#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 = true;
# 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;
};
logitech.wireless.enable = true;
};
services.xserver.videoDrivers = [ "nvidia" ];
}