From dfc4b5cf940b2d98c371f24a9ec085e4f4f6c36d Mon Sep 17 00:00:00 2001 From: DashieTM Date: Wed, 28 Aug 2024 00:59:01 +0200 Subject: [PATCH] Solve doc kernel issue --- base/common_hardware.nix | 3 +-- docs/default.nix | 3 ++- docs/src/README.md | 2 +- modules/conf.nix | 25 +++++++++++-------------- modules/programs/gaming.nix | 1 + modules/programs/git.nix | 16 +++++++++++++--- modules/programs/teams.nix | 2 +- result | 2 +- 8 files changed, 31 insertions(+), 23 deletions(-) diff --git a/base/common_hardware.nix b/base/common_hardware.nix index 4f3378c..5bbd1e3 100644 --- a/base/common_hardware.nix +++ b/base/common_hardware.nix @@ -24,8 +24,7 @@ in plymouth = { enable = true; }; - #kernelPackages = config.conf.kernel; - kernelPackages = pkgs.linuxPackages_latest; + kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; initrd = { verbose = false; availableKernelModules = [ diff --git a/docs/default.nix b/docs/default.nix index bed38b7..fd0b6f5 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -13,7 +13,8 @@ let option // { visible = - option.visible + builtins.elemAt option.loc 0 != "kernel" + && option.visible && (builtins.elemAt option.loc 0 == "conf" || builtins.elemAt option.loc 0 == "mods"); }; }; diff --git a/docs/src/README.md b/docs/src/README.md index 5f2681b..23c3b22 100644 --- a/docs/src/README.md +++ b/docs/src/README.md @@ -116,7 +116,7 @@ Here is a minimal required configuration.nix (the TODOs mention a required chang After logging in the first time, your password will be set to "firstlogin", please change this to whatever you like. -## Modules +## Nixos and Home-manager Modules You can add additional modules or remove all of them by overriding parameters to the build_systems command: diff --git a/modules/conf.nix b/modules/conf.nix index 3ed8442..f1f2b34 100644 --- a/modules/conf.nix +++ b/modules/conf.nix @@ -93,14 +93,15 @@ }; }; - #kernel = lib.mkOption { - # default = pkgs.linuxPackages_latest; - # example = pkgs.linuxPackages_xanmod_latest; - # type = with lib.types; nullOr attrs; - # description = '' - # kernel to be used - # ''; - #}; + kernelOverride = lib.mkOption { + default = null; + type = with lib.types; nullOr package; + description = '' + kernel to be used + Has no examples as doc complains... + #example = pkgs.linuxPackages_xanmod_latest; + ''; + }; hostname = lib.mkOption { default = "nixos"; @@ -202,12 +203,8 @@ }; config = - { - # conf.kernel = lib.mkIf ( - # config.mods.gaming.enable && config.mods.gaming.kernel - # ) pkgs.linuxPackages_xanmod_latest; - } - // (lib.optionalAttrs (options ? system.stateVersion) { + (lib.optionalAttrs (options ? system.stateVersion) { + boot.kernelPackages = lib.mkIf (config.conf.kernelOverride != null) config.conf.kernel; system.stateVersion = config.conf.systemStateVersion; }) // (lib.optionalAttrs (options ? home.stateVersion) { diff --git a/modules/programs/gaming.nix b/modules/programs/gaming.nix index 52c7af3..29ea71c 100644 --- a/modules/programs/gaming.nix +++ b/modules/programs/gaming.nix @@ -60,6 +60,7 @@ config = lib.mkIf config.mods.gaming.enable ( lib.optionalAttrs (options ? environment.systemPackages) { environment.systemPackages = config.mods.gaming.tools; + boot.kernelPackages = lib.mkForce pkgs.linuxPackages_xanmod_latest; programs = { steam.enable = config.mods.gaming.steam; diff --git a/modules/programs/git.nix b/modules/programs/git.nix index 22688f0..e105cb7 100644 --- a/modules/programs/git.nix +++ b/modules/programs/git.nix @@ -22,12 +22,22 @@ ssh_config = lib.mkOption { default = '' Host github.com - ${if (config ? sops.secrets ? hub.path) then "IdentityFile ${config.sops.secrets.hub.path}" else ""} + ${ + if (config ? sops.secrets && config.sops.secrets ? hub.path) then + "IdentityFile ${config.sops.secrets.hub.path}" + else + "" + } Host gitlab.com - ${if (config ? sops.secrets ? lab.path) then "IdentityFile ${config.sops.secrets.lab.path}" else ""} + ${ + if (config ? sops.secrets && config.sops.secrets ? lab.path) then + "IdentityFile ${config.sops.secrets.lab.path}" + else + "" + } Host dashie.org ${ - if (config ? sops.secrets ? dashie.path) then + if (config ? sops.secrets && config.sops.secrets ? dashie.path) then "IdentityFile ${config.sops.secrets.dashie.path}" else "" diff --git a/modules/programs/teams.nix b/modules/programs/teams.nix index 8555303..15b8748 100644 --- a/modules/programs/teams.nix +++ b/modules/programs/teams.nix @@ -29,7 +29,7 @@ in } // (lib.optionalAttrs (options ? boot.kernelModules) { boot = { - extraModulePackages = [ pkgs.linuxKernel.packages.linux_xanmod_latest.v4l2loopback ]; + extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; kernelModules = [ "v4l2loopback" ]; extraModprobeConfig = '' options v4l2loopback exclusive_caps=1 card_label="Virtual Camera" diff --git a/result b/result index c06014d..b09d584 120000 --- a/result +++ b/result @@ -1 +1 @@ -/nix/store/0fpgnkzjnwbjykdvbk4p2h3c7isb9sz9-dashNix-book \ No newline at end of file +/nix/store/cp42vzpzj6jls43xf40m6hp7w07sg1xr-dashNix-book \ No newline at end of file