From 594078f84ff75caa99a48e13094b98a6eaaba6e2 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 31 Jul 2024 10:24:55 -0500 Subject: [PATCH] Conditional on options as a mechanism for ensuring compatibility across NixOS versions? --- flake.nix | 27 +-------------------------- modules/nixos/default.nix | 29 ++++++++++++++++++++++------- 2 files changed, 23 insertions(+), 33 deletions(-) diff --git a/flake.nix b/flake.nix index 64dd6d7..c5af357 100644 --- a/flake.nix +++ b/flake.nix @@ -233,32 +233,7 @@ flakeInputs = self.inputs; }; - nixosConfigurations = let - system = { - nixpkgsInput, - modules ? [], - system ? "x86_64-linux", - }: - nixpkgsInput.lib.nixosSystem { - inherit system; - modules = modules ++ [nixosModules.common]; - }; - stableSystem = { - modules, - system ? "x86_64-linux", - }: - system { - nixpkgsInput = nixpkgs; - modules = modules ++ [nixosModules.stableCommon]; - }; - unstableSystem = { - modules, - system ? "x86_64-linux", - }: - nixpkgs-unstable.lib.nixosSystem { -nixosModules.stableCommon - }; - in { + nixosConfigurations = { beefcake = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = with nixosModules; [ diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index a755a22..d219468 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -419,7 +419,13 @@ }; }; - graphical-workstation = {pkgs, ...}: { + graphical-workstation = { + pkgs, + lib, + options, + config, + ... + }: { imports = with nixosModules; [ plasma6 enable-flatpaks-and-appimages @@ -431,13 +437,22 @@ xdg.portal.enable = true; - hardware = { - graphics = { - enable = true; - # driSupport32Bit = true; - # driSupport = true; + hardware = + if builtins.hasAttr "enable" options.hardware.graphics + then { + graphics = { + enable = true; + # driSupport32Bit = true; + # driSupport = true; + }; + } + else { + opengl = { + enable = true; + driSupport32Bit = true; + driSupport = true; + }; }; - }; environment = { systemPackages = with pkgs; [ libnotify