add video card selector

This commit is contained in:
albert 2023-08-24 09:56:55 +09:00
parent 83763dfc08
commit 57b4b60731
5 changed files with 37 additions and 54 deletions

View file

@ -80,7 +80,7 @@
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"unstable-nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
@ -104,7 +104,7 @@
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"nixpkgs": [ "nixpkgs": [
"unstable-nixpkgs" "nixpkgs"
], ],
"pre-commit-hooks-nix": "pre-commit-hooks-nix" "pre-commit-hooks-nix": "pre-commit-hooks-nix"
}, },
@ -122,36 +122,19 @@
"type": "github" "type": "github"
} }
}, },
"nixos-hardware": {
"locked": {
"lastModified": 1691871742,
"narHash": "sha256-6yDNjfbAMpwzWL4y75fxs6beXHRANfYX8BNSPjYehck=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "430a56dd16fe583a812b2df44dca002acab2f4f6",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1691853136, "lastModified": 1692638711,
"narHash": "sha256-wTzDsRV4HN8A2Sl0SVQY0q8ILs90CD43Ha//7gNZE+E=", "narHash": "sha256-J0LgSFgJVGCC1+j5R2QndadWI1oumusg6hCtYAzLID4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "f0451844bbdf545f696f029d1448de4906c7f753", "rev": "91a22f76cd1716f9d0149e8a5c68424bb691de15",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "id": "nixpkgs",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable",
"repo": "nixpkgs", "type": "indirect"
"type": "github"
} }
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
@ -186,6 +169,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1691853136,
"narHash": "sha256-wTzDsRV4HN8A2Sl0SVQY0q8ILs90CD43Ha//7gNZE+E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f0451844bbdf545f696f029d1448de4906c7f753",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1692070330, "lastModified": 1692070330,
@ -236,15 +235,14 @@
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs",
"nur": "nur", "nur": "nur",
"sops-nix": "sops-nix", "sops-nix": "sops-nix"
"unstable-nixpkgs": "unstable-nixpkgs"
} }
}, },
"sops-nix": { "sops-nix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2",
"nixpkgs-stable": "nixpkgs-stable_2" "nixpkgs-stable": "nixpkgs-stable_2"
}, },
"locked": { "locked": {
@ -275,21 +273,6 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"unstable-nixpkgs": {
"locked": {
"lastModified": 1691990649,
"narHash": "sha256-gMbKOiX1HwClRP9lADaaV/lnZr93NEaOFe4ApDx/zd8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6e287913f7b1ef537c97aa301b67c34ea46b640f",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-unstable",
"type": "indirect"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -19,8 +19,8 @@
libx = import ./lib { inherit inputs outputs stateVersion hmStateVersion; }; libx = import ./lib { inherit inputs outputs stateVersion hmStateVersion; };
in { in {
nixosConfigurations = { nixosConfigurations = {
nixos-laptop = libx.mkHost { hostname = "nixos-laptop"; username = "albert"; desktop = "hyprland"; }; nixos-laptop = libx.mkHost { hostname = "nixos-laptop"; username = "albert"; desktop = "hyprland"; graphics="intel" };
nixos-desktop = libx.mkHost { hostname = "nixos-desktop"; username = "albert"; desktop = "gnome"; }; nixos-desktop = libx.mkHost { hostname = "nixos-desktop"; username = "albert"; desktop = "gnome"; graphics="nvidia" };
}; };
homeConfigurations = { homeConfigurations = {
"albert@nixos-laptop" = libx.mkHome { hostname = "nixos-laptop"; username = "albert"; desktop = "hyprland"; }; "albert@nixos-laptop" = libx.mkHome { hostname = "nixos-laptop"; username = "albert"; desktop = "hyprland"; };

View file

@ -10,7 +10,7 @@
}; };
# Helper function for generating host configs # Helper function for generating host configs
mkHost = { hostname, username, desktop ? null, installer ? null }: inputs.nixpkgs.lib.nixosSystem { mkHost = { hostname, username, desktop ? null, installer ? null, graphics ? "nvidia" }: inputs.nixpkgs.lib.nixosSystem {
specialArgs = { specialArgs = {
inherit inputs outputs desktop hostname username stateVersion; inherit inputs outputs desktop hostname username stateVersion;
}; };

View file

@ -1,4 +1,4 @@
{ lib, config, pkgs, hostname, ... }: { { lib, config, pkgs, hostname, graphics, ... }: {
# Enable sound with pipewire. # Enable sound with pipewire.
sound.enable = true; sound.enable = true;
hardware.pulseaudio.enable = false; hardware.pulseaudio.enable = false;
@ -17,7 +17,7 @@
xkbVariant = ""; xkbVariant = "";
autorun = true; autorun = true;
# When you play games, change this to nvidia # When you play games, change this to nvidia
videoDrivers = [ "intel" ]; videoDrivers = [ "${graphics}" ];
}; };
##### disable nvidia, very nice battery life. ##### disable nvidia, very nice battery life.

View file

@ -1,5 +1,5 @@
{pkgs, ...}: { {pkgs, graphics, ...}: {
services.xserver.videoDrivers = ["nvidia"]; services.xserver.videoDrivers = [ "${graphics}" ];
# tuigreet # tuigreet
services.greetd = { services.greetd = {