From f7f109cb140953a0d3053e5f15129535defd223a Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Tue, 27 Aug 2024 17:37:10 +0530 Subject: flake/nixos-hardware: init --- flake.lock | 17 +++++++++++++++++ flake.nix | 5 ++++- home/wayland/modules/sway/home.nix | 2 +- os/cez/hardware-configuration.nix | 26 ++++++++++++++++++++++++-- os/pc/modules/wayland.nix | 6 +++++- 5 files changed, 51 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 2d607dc..dd0ce78 100644 --- a/flake.lock +++ b/flake.lock @@ -21,6 +21,22 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1724575805, + "narHash": "sha256-OB/kEL3GAhUZmUfkbPfsPhKs0pRqJKs0EEBiLfyKZw8=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "9fc19be21f0807d6be092d70bf0b1de0c00ac895", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1723637854, @@ -56,6 +72,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "sops-nix": "sops-nix" } diff --git a/flake.nix b/flake.nix index f88e5d0..caee568 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,7 @@ inputs = { nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; sops-nix = { url = "github:Mic92/sops-nix"; @@ -15,7 +16,7 @@ }; }; - outputs = { self, nixpkgs, sops-nix, home-manager }: let + outputs = { self, nixpkgs, sops-nix, home-manager, nixos-hardware }: let lib = nixpkgs.lib; makeGlobalImports = host: [ @@ -30,6 +31,8 @@ makeNixos = host: system: lib.nixosSystem { inherit system; + specialArgs = { inherit nixos-hardware; }; + modules = [ sops-nix.nixosModules.sops diff --git a/home/wayland/modules/sway/home.nix b/home/wayland/modules/sway/home.nix index 5c2fb47..893fec1 100644 --- a/home/wayland/modules/sway/home.nix +++ b/home/wayland/modules/sway/home.nix @@ -37,7 +37,7 @@ in { programs.bash.profileExtra = '' case "$(tty)" in - */tty1) exec sway ;; + */tty1) exec sway --unsupported-gpu ;; esac ''; diff --git a/os/cez/hardware-configuration.nix b/os/cez/hardware-configuration.nix index e6ade24..a9dd37b 100644 --- a/os/cez/hardware-configuration.nix +++ b/os/cez/hardware-configuration.nix @@ -1,7 +1,29 @@ -{ modulesPath, ... }: +{ modulesPath, nixos-hardware, lib, ... }: { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + imports = [ + nixos-hardware.nixosModules.lenovo-ideapad-16ach6 + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + # override nixos-hardware values + hardware.nvidia.prime.offload.enable = false; + services.xserver.videoDrivers = [ "modesetting" ]; + + specialisation.nvidia.configuration = { + hardware.nvidia = { + open = true; + nvidiaSettings = false; + prime.sync.enable = true; + }; + + services = { + xserver.videoDrivers = [ "nvidia" ]; + tlp.settings.PLATFORM_PROFILE_ON_AC = lib.mkForce "performance"; + }; + nixpkgs.config.allowUnfreePredicate = + pkg: builtins.elem (lib.getName pkg) [ "nvidia-x11" ]; + }; boot = { loader.systemd-boot.enable = true; diff --git a/os/pc/modules/wayland.nix b/os/pc/modules/wayland.nix index e488f24..7380e71 100644 --- a/os/pc/modules/wayland.nix +++ b/os/pc/modules/wayland.nix @@ -31,6 +31,10 @@ in { }; }; - hardware.graphics.enable = true; + hardware.graphics = { + enable = true; + enable32Bit = true; + }; + security.pam.services.swaylock = {}; } -- cgit v1.2.3