I have been trying for hours to get this working. I can get stylix working everywhere but neovim. I don’t configure neovim with nix, so I’m trying to create a lua file with the stylix colors in it. When I import this file into my home.nix I get the errors below it.
{ pkgs, config, ... }:
{
target = "/home/dot/.config/nvim/lua/dot/plugins/mini.base16.lua";
text = ''
return {
"nvim-mini/mini.base16",
version = "*",
config = {
palette = {
base00 = "#${config.lib.stylix.colors.base00}",
base01 = "#${config.lib.stylix.colors.base01}",
base02 = "#${config.lib.stylix.colors.base02}",
base03 = "#${config.lib.stylix.colors.base03}",
base04 = "#${config.lib.stylix.colors.base04}",
base05 = "#${config.lib.stylix.colors.base05}",
base06 = "#${config.lib.stylix.colors.base06}",
base07 = "#${config.lib.stylix.colors.base07}",
base08 = "#${config.lib.stylix.colors.base08}",
base09 = "#${config.lib.stylix.colors.base09}",
base0A = "#${config.lib.stylix.colors.base0A}",
base0B = "#${config.lib.stylix.colors.base0B}",
base0C = "#${config.lib.stylix.colors.base0C}",
base0D = "#${config.lib.stylix.colors.base0D}",
base0E = "#${config.lib.stylix.colors.base0E}",
base0F = "#${config.lib.stylix.colors.base0F}",
},
use_cterm = true,
plugins = { default = true },
},
}
'';
}
here’s the end of the output from running sudo nixos-rebuild switch --flake . --show-trace
… while evaluating the attribute 'value'
at /nix/store/dij35qckkzfiqry7jrsq34qvc5xxp90q-source/lib/modules.nix:1083:7:
1082| // {
1083| value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
1084| inherit (res.defsFinal') highestPrio;
… while evaluating the option `home-manager.users.dot.home.file.nvimColors.text':
(10 duplicate frames omitted)
… while evaluating definitions from `/nix/store/dij35qckkzfiqry7jrsq34qvc5xxp90q-source/flake.nix':
… from call site
at /nix/store/dij35qckkzfiqry7jrsq34qvc5xxp90q-source/lib/modules.nix:1109:80:
1108| }
1109| ) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value))
| ^
1110| ) defs;
… while calling 'dischargeProperties'
at /nix/store/dij35qckkzfiqry7jrsq34qvc5xxp90q-source/lib/modules.nix:1202:5:
1201| dischargeProperties =
1202| def:
| ^
1203| if def._type or "" == "merge" then
… while evaluating a branch condition
at /nix/store/dij35qckkzfiqry7jrsq34qvc5xxp90q-source/lib/modules.nix:1203:5:
1202| def:
1203| if def._type or "" == "merge" then
| ^
1204| concatMap dischargeProperties def.contents
… while evaluating the attribute 'value'
at /nix/store/dij35qckkzfiqry7jrsq34qvc5xxp90q-source/lib/modules.nix:770:21:
769| inherit (module) file;
770| inherit value;
| ^
771| }) module.config
error: attribute 'lib' missing
at /nix/store/f6wdnqi6gjmf95yj3gcqirxcwyka4qvs-source/config/nvimColors.nix:10:24:
9| palette = {
10| base00 = "#${config.lib.stylix.colors.base00}",
| ^
11| base01 = "#${config.lib.stylix.colors.base01}",
here’s my flake:
{
description = "dottie's a flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
home-manager.url = "github:nix-community/home-manager/release-25.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.url = "github:Mic92/sops-nix";
stylix = {
url = "github:nix-community/stylix/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{
# self,
nixpkgs,
nixpkgs-unstable,
nixos-hardware,
home-manager,
sops-nix,
stylix,
...
}: {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
inherit inputs;
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfree = true;
# config.allowUnfreePredicate = pkg: true;
};
};
modules = [
# Import the previous configuration.nix we used,
# so the old configuration file still takes effect
./configuration.nix
stylix.nixosModules.stylix
nixos-hardware.nixosModules.framework-13th-gen-intel
home-manager.nixosModules.home-manager
sops-nix.nixosModules.sops
{
nixpkgs.config.allowUnfree = true;
home-manager.sharedModules = [
sops-nix.homeManagerModules.sops
stylix.homeModules.stylix
];
# home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.dot.imports = [
({ config, ... }: import ./home.nix {
pkgs = import nixpkgs {
system = "x86_64-linux";
config.allowUnfree = true;
};
unstable = import nixpkgs-unstable {
system = "x86_64-linux";
config.allowUnfree = true;
};
inherit config inputs nixpkgs nixpkgs-unstable stylix;
})
];
}
];
};
};
}