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
{
nixosConfigurations = import ./hosts { inherit self prefs; };
homeConfigurations = import ./profiles { inherit self prefs; };
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
let pkgs = prefs.nixpkgs system; in {
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; };
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!

View File

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

View File

@ -22,18 +22,6 @@
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 = [
{
device = "/swap";

View File

@ -8,9 +8,6 @@
../../modules/nixos/bluetooth.nix
../../modules/nixos/greetd.nix
../../modules/nixos/audio.nix
# Apps & services
../../modules/nixos/nordvpn.nix
];
modules.fingerprint.enable = true;
@ -25,7 +22,6 @@
};
services = {
tlp.enable = false;
gvfs.enable = true;
upower.enable = true;
power-profiles-daemon.enable = true;
@ -34,22 +30,17 @@
enable = true;
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 = {
adb.enable = true;
dconf.enable = true;
light.enable = true;
thunar.enable = true;
hyprland.enable = true;
thunar.plugins = with pkgs.xfce; [
thunar-archive-plugin
thunar-volman
];
light.enable = true;
};
}

View File

@ -10,4 +10,6 @@ in
networking.wireless.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"
"plugdev"
"adbusers"
] ++ optional config.modules.nordvpn.enable [ "nordvpn" ];
] ++ optional (config.modules ? nordvpn && config.modules.nordvpn.enable) [ "nordvpn" ];
ignoreShellProgramCheck = true;
shell = preferredShell pkgs;
};

View File

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

View File

@ -4,19 +4,28 @@
options.modules.nvidia.enable = lib.mkEnableOption "Enable NVIDIA kernel and modprobe configurations.";
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" ];
boot.kernelParams = ["nvidia.NVreg_PreserveVideoMemoryAllocations=1"];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
powerManagement.finegrained = true;
prime = {
sync.enable = true;
offload.enable = true;
intelBusId = prefs.hosts.hulk.intelBusId;
nvidiaBusId = prefs.hosts.hulk.nvidiaBusId;
};
nvidiaSettings = true;
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 = {
hulk = {
insecure = [
nixpkgs = system: import inputs.nixpkgs {
inherit system;
overlays = [ (import ./overlay.nix inputs) ];
config = {
nvidia.acceptLicense = true;
permittedInsecurePackages = [
"fluffychat-linux-1.22.1"
"olm-3.2.16"
];
unfree = [
allowUnfreePredicate = pkg: builtins.elem (inputs.nixpkgs.lib.getName pkg) [
"davinci-resolve"
"anydesk"
"nvidia-settings"
"nvidia-x11"
"nordvpn"
"hplip"
];
};
};
@ -30,6 +38,6 @@
};
homes = {
sadorowo = ./profiles/hulk;
sadorowo = ./profiles/sadorowo;
};
}

View File

@ -1,18 +1,17 @@
{
self,
prefs,
inputs,
impurity,
...
}:
{
home-manager = {
backupFileExtension = "bak";
extraSpecialArgs = {
inherit inputs self prefs impurity;
};
let
inherit (self) inputs;
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 = {
inherit (prefs.users.hulk) username homeDirectory;
stateVersion = "24.11";
packages = import ./packages.nix { inherit pkgs inputs; };
};
nixpkgs.config = {
permittedInsecurePackages = prefs.pkgs.hulk.insecure;
allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) prefs.pkgs.hulk.unfree;
stateVersion = "24.11";
};
programs.home-manager.enable = true;

View File

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

View File

@ -18,7 +18,7 @@ with pkgs;
element-desktop
thunderbird-bin
libreoffice-qt6-fresh
gimp
gimp3
git
anydesk
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
android = pkgs.callPackage android-nixpkgs { };
androidSdk = android.sdk (
androidSdk = pkgs.android-sdk.sdk (
sdkPkgs: with sdkPkgs; [
cmdline-tools-latest
build-tools-35-0-0
@ -10,9 +9,7 @@ let
platforms-android-35
]
);
in
pkgs.mkShell rec {
in pkgs.mkShell rec {
buildInputs = with pkgs; [
androidSdk
jdk17