diff --git a/docs/src/tricks.md b/docs/src/tricks.md index c25e34859..4121a2ef8 100644 --- a/docs/src/tricks.md +++ b/docs/src/tricks.md @@ -57,3 +57,28 @@ Which is neatly implemented as a single function in `lib.stylix.pixel`: }; } ``` + +## Completely disabling some stylix targets + +Nixpkgs module system sometime works in non-intuitive ways, e.g. parts +of the configuration guarded by `lib.mkIf` are still being descended +into. This means that every **loaded** (and not enabled) module must +be compatible with others - in the sense that **every** option that is +mentioned in the disabled parts of the configuratin still needs to be +defined somewhere. + +Sometimes that can be a problem, when your particular configuration +diverges enough from what stylix expects. In that case you can try +stubbing all the missing options in your configuration. + +Or in a much clearer fashion you can just disable offending stylix targets +by adding the following `disableModules` line next to importing stylix +itself: + +```nix + imports = [ + flake.inputs.stylix.nixosModules.stylix + ]; + disabledModules = [ "${flake.inputs.stylix}/modules//nixos.nix" ]; + +``` diff --git a/stylix/autoload.nix b/stylix/autoload.nix index bfb2fe687..8610ebcac 100644 --- a/stylix/autoload.nix +++ b/stylix/autoload.nix @@ -1,4 +1,4 @@ -{ lib }: +{ lib, inputs }: # string -> [ path ] # List include path for either nixos modules or hm modules @@ -8,7 +8,7 @@ for: (path: kind: if kind == "directory" then let - file = "${../modules}/${path}/${for}.nix"; + file = "${inputs.self}/modules/${path}/${for}.nix"; in if builtins.pathExists file then [ file ] else [ ] else [ ]) - (builtins.readDir ../modules)) + (builtins.readDir "${inputs.self}/modules")) diff --git a/stylix/darwin/default.nix b/stylix/darwin/default.nix index 19e7c6e12..a4eca70ca 100644 --- a/stylix/darwin/default.nix +++ b/stylix/darwin/default.nix @@ -3,7 +3,7 @@ inputs: { lib, ... }: let - autoload = import ../autoload.nix { inherit lib; } "darwin"; + autoload = import ../autoload.nix { inherit lib inputs; } "darwin"; in { imports = [ ../pixel.nix diff --git a/stylix/hm/default.nix b/stylix/hm/default.nix index a5cae1774..225ea275d 100644 --- a/stylix/hm/default.nix +++ b/stylix/hm/default.nix @@ -3,7 +3,7 @@ inputs: { lib, ... }: let - autoload = import ../autoload.nix { inherit lib; } "hm"; + autoload = import ../autoload.nix { inherit lib inputs; } "hm"; in { imports = [ ../pixel.nix diff --git a/stylix/nixos/default.nix b/stylix/nixos/default.nix index 56c4741b5..eba040588 100644 --- a/stylix/nixos/default.nix +++ b/stylix/nixos/default.nix @@ -3,7 +3,7 @@ inputs: { lib, ... }: let - autoload = import ../autoload.nix { inherit lib; } "nixos"; + autoload = import ../autoload.nix { inherit lib inputs; } "nixos"; in { imports = [ ../pixel.nix