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

View file

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

View file

@ -10,7 +10,7 @@
};
# 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 = {
inherit inputs outputs desktop hostname username stateVersion;
};
@ -29,4 +29,4 @@
"aarch64-darwin"
"x86_64-darwin"
];
}
}

View file

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

View file

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