feat: separate HM and NixOS configs; try to fix NVIDIA drivers again

This commit is contained in:
Franek 2025-06-01 16:17:52 +02:00
parent 25a86c0458
commit a918e1e2ae
21 changed files with 113 additions and 109 deletions

View File

@ -34,14 +34,13 @@
in in
{ {
nixosConfigurations = import ./hosts { inherit self prefs; }; nixosConfigurations = import ./hosts { inherit self prefs; };
homeConfigurations = import ./profiles { inherit self prefs; };
devShells = forAllSystems ( devShells = forAllSystems (
system: system:
let let pkgs = prefs.nixpkgs system; in {
pkgs = nixpkgs.legacyPackages.${system};
in
{
ddt4all = import ./shells/ddt4all.nix { inherit pkgs; }; ddt4all = import ./shells/ddt4all.nix { inherit pkgs; };
android = import ./shells/android.nix { inherit pkgs android-nixpkgs; }; android = import ./shells/android.nix { inherit pkgs; };
dioxus = import ./shells/dioxus.nix { inherit pkgs; }; dioxus = import ./shells/dioxus.nix { inherit pkgs; };
rust = import ./shells/rust.nix { inherit pkgs; }; rust = import ./shells/rust.nix { inherit pkgs; };
} }

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, prefs, pkgs, ... }:
{ {
# DO NOT change this unless you know what you're doing! # DO NOT change this unless you know what you're doing!

View File

@ -2,9 +2,7 @@
let let
inherit (self) inputs; inherit (self) inputs;
lib = inputs.nixpkgs.lib; lib = inputs.nixpkgs.lib;
hmProfiles = self + /profiles;
mkSystem = mkSystem =
{ {
@ -12,15 +10,20 @@ let
hostname, hostname,
useHomeManager ? true, useHomeManager ? true,
modules ? [ ], modules ? [ ],
}: }: let pkgs = prefs.nixpkgs system; in lib.nixosSystem {
lib.nixosSystem { inherit pkgs;
specialArgs = { inherit inputs prefs; }; specialArgs = { inherit inputs prefs; };
modules = modules modules = modules
++ lib.lists.optionals useHomeManager [ inputs.home-manager.nixosModules.default ]
++ [ ++ [
./base-configuration.nix ./base-configuration.nix
./${hostname} ./${hostname}
hmProfiles ] ++ lib.lists.optionals useHomeManager [
{ environment.systemPackages = [ pkgs.home-manager ]; }
inputs.home-manager.nixosModules.default {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
]; ];
}; };
in in

View File

@ -22,18 +22,6 @@
options = "--delete-older-than 7d"; options = "--delete-older-than 7d";
}; };
nixpkgs.config = {
nvidia.acceptLicense = true;
allowUnfreePredicate =
pkg:
builtins.elem (pkgs.lib.getName pkg) [
"nvidia-settings"
"nvidia-x11"
"nordvpn"
"hplip"
];
};
swapDevices = [ swapDevices = [
{ {
device = "/swap"; device = "/swap";

View File

@ -8,9 +8,6 @@
../../modules/nixos/bluetooth.nix ../../modules/nixos/bluetooth.nix
../../modules/nixos/greetd.nix ../../modules/nixos/greetd.nix
../../modules/nixos/audio.nix ../../modules/nixos/audio.nix
# Apps & services
../../modules/nixos/nordvpn.nix
]; ];
modules.fingerprint.enable = true; modules.fingerprint.enable = true;
@ -25,7 +22,6 @@
}; };
services = { services = {
tlp.enable = false;
gvfs.enable = true; gvfs.enable = true;
upower.enable = true; upower.enable = true;
power-profiles-daemon.enable = true; power-profiles-daemon.enable = true;
@ -34,22 +30,17 @@
enable = true; enable = true;
drivers = with pkgs; [ hplipWithPlugin ]; drivers = with pkgs; [ hplipWithPlugin ];
}; };
udev.extraRules = ''
SUBSYSTEM=="backlight", KERNEL=="intel_backlight", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness"
'';
}; };
programs = { programs = {
adb.enable = true; adb.enable = true;
dconf.enable = true;
light.enable = true;
thunar.enable = true; thunar.enable = true;
hyprland.enable = true;
thunar.plugins = with pkgs.xfce; [ thunar.plugins = with pkgs.xfce; [
thunar-archive-plugin thunar-archive-plugin
thunar-volman thunar-volman
]; ];
light.enable = true;
}; };
} }

View File

@ -10,4 +10,6 @@ in
networking.wireless.enable = pkgs.lib.mkIf wirelessEnabled true; networking.wireless.enable = pkgs.lib.mkIf wirelessEnabled true;
networking.wireless.userControlled.enable = pkgs.lib.mkIf wirelessEnabled true; networking.wireless.userControlled.enable = pkgs.lib.mkIf wirelessEnabled true;
boot.kernel.sysctl."net.ipv4.ip_forward" = 0;
} }

View File

@ -25,7 +25,7 @@ in
"networkmanager" "networkmanager"
"plugdev" "plugdev"
"adbusers" "adbusers"
] ++ optional config.modules.nordvpn.enable [ "nordvpn" ]; ] ++ optional (config.modules ? nordvpn && config.modules.nordvpn.enable) [ "nordvpn" ];
ignoreShellProgramCheck = true; ignoreShellProgramCheck = true;
shell = preferredShell pkgs; shell = preferredShell pkgs;
}; };

View File

@ -40,19 +40,18 @@
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
xwayland.enable = true;
plugins = config.modules.hyprland.plugins; plugins = config.modules.hyprland.plugins;
settings = config.modules.hyprland.additionalConfig; settings = config.modules.hyprland.additionalConfig;
}; };
xdg.portal = { xdg.portal = {
extraPortals = with pkgs; [ xdg-desktop-portal-wlr ]; extraPortals = with pkgs; [ xdg-desktop-portal-wlr ];
config.hyprland = { config.hyprland = {
"default" = [ "hyprland" "wlr" ]; "default" = [ "hyprland" "wlr" ];
"org.freedesktop.impl.portal.ScreenCast" = "wlr"; "org.freedesktop.impl.portal.ScreenCast" = "wlr";
"org.freedesktop.impl.portal.Screenshot" = "wlr"; "org.freedesktop.impl.portal.Screenshot" = "wlr";
#"org.freedesktop.impl.portal.Settings" = "darkman"; "org.freedesktop.impl.portal.Settings" = "darkman";
}; };
}; };
systemd.user.services.authentication-agent = { systemd.user.services.authentication-agent = {

View File

@ -4,19 +4,28 @@
options.modules.nvidia.enable = lib.mkEnableOption "Enable NVIDIA kernel and modprobe configurations."; options.modules.nvidia.enable = lib.mkEnableOption "Enable NVIDIA kernel and modprobe configurations.";
config = lib.mkIf config.modules.nvidia.enable { config = lib.mkIf config.modules.nvidia.enable {
boot.kernelPackages = pkgs.linuxPackages_6_1; # LTS environment.systemPackages = with pkgs; [
libva
nvidia-vaapi-driver
];
hardware.graphics = {
enable = true;
enable32Bit = true;
};
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = [ "nvidia" ];
boot.kernelParams = ["nvidia.NVreg_PreserveVideoMemoryAllocations=1"];
hardware.nvidia = { hardware.nvidia = {
modesetting.enable = true; modesetting.enable = true;
powerManagement.enable = true; powerManagement.finegrained = true;
prime = { prime = {
sync.enable = true; offload.enable = true;
intelBusId = prefs.hosts.hulk.intelBusId; intelBusId = prefs.hosts.hulk.intelBusId;
nvidiaBusId = prefs.hosts.hulk.nvidiaBusId; nvidiaBusId = prefs.hosts.hulk.nvidiaBusId;
}; };
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.legacy_470; package = config.boot.kernelPackages.nvidiaPackages.legacy_470;
}; };
}; };

10
overlay.nix Normal file
View File

@ -0,0 +1,10 @@
inputs: final: prev: {
android-sdk = prev.callPackage inputs.android-sdk {};
vscodium-wayland = prev.vscodium.override {
commandLineArgs = [
"--enable-features=UseOzonePlatform"
"--ozone-platform-hint=auto"
"--ozone-platform=wayland"
];
};
}

View File

@ -9,15 +9,23 @@
}; };
}; };
pkgs = { nixpkgs = system: import inputs.nixpkgs {
hulk = { inherit system;
insecure = [ overlays = [ (import ./overlay.nix inputs) ];
config = {
nvidia.acceptLicense = true;
permittedInsecurePackages = [
"fluffychat-linux-1.22.1" "fluffychat-linux-1.22.1"
"olm-3.2.16" "olm-3.2.16"
]; ];
unfree = [
allowUnfreePredicate = pkg: builtins.elem (inputs.nixpkgs.lib.getName pkg) [
"davinci-resolve" "davinci-resolve"
"anydesk" "anydesk"
"nvidia-settings"
"nvidia-x11"
"nordvpn"
"hplip"
]; ];
}; };
}; };
@ -30,6 +38,6 @@
}; };
homes = { homes = {
sadorowo = ./profiles/hulk; sadorowo = ./profiles/sadorowo;
}; };
} }

View File

@ -1,18 +1,17 @@
{ {
self, self,
prefs, prefs,
inputs,
impurity,
... ...
}: }:
{ let
home-manager = { inherit (self) inputs;
backupFileExtension = "bak";
extraSpecialArgs = {
inherit inputs self prefs impurity;
};
users = prefs.homes; mkHome = system: profile: inputs.home-manager.lib.homeManagerConfiguration {
pkgs = prefs.nixpkgs system;
extraSpecialArgs = { inherit self inputs prefs; };
modules = [ profile ];
}; };
in {
sadorowo = mkHome "x86_64-linux" ./sadorowo;
} }

View File

@ -1,32 +0,0 @@
{
webcopy = ''
set -l domain (string trim $argv)
wget --recursive \
--level 5 \
--no-clobber \
--page-requisites \
--adjust-extension \
--span-hosts \
--convert-links \
--domains $domain \
--no-parent \
$domain
'';
venv = ''
if [ -d .venv ]; then
source .venv/bin/activate.fish
else
python -m venv .venv
source .venv/bin/activate.fish
fi
'';
thunderbird = ''
if pgrep -x birdtray > /dev/null
birdtray -s
else
birdtray &
end
'';
}

View File

@ -0,0 +1,32 @@
{
webcopy = ''
set -l domain (string trim $argv)
wget --recursive \
--level 5 \
--no-clobber \
--page-requisites \
--adjust-extension \
--span-hosts \
--convert-links \
--domains $domain \
--no-parent \
$domain
'';
venv = ''
if [ -d .venv ]; then
source .venv/bin/activate.fish
else
python -m venv .venv
source .venv/bin/activate.fish
fi
'';
thunderbird = ''
if pgrep -x birdtray > /dev/null
birdtray -s
else
birdtray &
end
'';
}

View File

@ -10,14 +10,8 @@
home = { home = {
inherit (prefs.users.hulk) username homeDirectory; inherit (prefs.users.hulk) username homeDirectory;
stateVersion = "24.11";
packages = import ./packages.nix { inherit pkgs inputs; }; packages = import ./packages.nix { inherit pkgs inputs; };
}; stateVersion = "24.11";
nixpkgs.config = {
permittedInsecurePackages = prefs.pkgs.hulk.insecure;
allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) prefs.pkgs.hulk.unfree;
}; };
programs.home-manager.enable = true; programs.home-manager.enable = true;

View File

@ -37,6 +37,11 @@
"~/.config/hypr/config/workspaces.conf" "~/.config/hypr/config/workspaces.conf"
]; ];
additionalConfig.env = [
"LIBVA_DRIVER_NAME,nvidia"
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
];
additionalConfig = { additionalConfig = {
"$terminal" = "alacritty"; "$terminal" = "alacritty";
"$fileManager" = "thunar"; "$fileManager" = "thunar";
@ -83,7 +88,7 @@
programs.vscode = { programs.vscode = {
enable = true; enable = true;
package = pkgs.vscodium; package = pkgs.vscodium-wayland;
profiles.default.extensions = with pkgs.vscode-extensions; [ profiles.default.extensions = with pkgs.vscode-extensions; [
rust-lang.rust-analyzer rust-lang.rust-analyzer
bbenoist.nix bbenoist.nix

View File

@ -18,7 +18,7 @@ with pkgs;
element-desktop element-desktop
thunderbird-bin thunderbird-bin
libreoffice-qt6-fresh libreoffice-qt6-fresh
gimp gimp3
git git
anydesk anydesk
fastfetch fastfetch

View File

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

Before

Width:  |  Height:  |  Size: 2.4 MiB

After

Width:  |  Height:  |  Size: 2.4 MiB

View File

@ -1,8 +1,7 @@
{ pkgs, android-nixpkgs }: { pkgs }:
let let
android = pkgs.callPackage android-nixpkgs { }; androidSdk = pkgs.android-sdk.sdk (
androidSdk = android.sdk (
sdkPkgs: with sdkPkgs; [ sdkPkgs: with sdkPkgs; [
cmdline-tools-latest cmdline-tools-latest
build-tools-35-0-0 build-tools-35-0-0
@ -10,9 +9,7 @@ let
platforms-android-35 platforms-android-35
] ]
); );
in pkgs.mkShell rec {
in
pkgs.mkShell rec {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
androidSdk androidSdk
jdk17 jdk17