Misterio77 / nix-colors

Modules and schemes to make theming with Nix awesome.
GNU General Public License v3.0
465 stars 38 forks source link

Error: The option `colorScheme' does not exist #35

Closed QingyaoLin closed 1 year ago

QingyaoLin commented 1 year ago

I use nix-colors in the standalone home manager, but the home manager says there is no colorScheme option.

error: The option `colorScheme' does not exist. Definition values:

I don't know what I missed. I have checked my configuration in detail.

Here is my relevant sample file:

# flake.nix
{
  description = "QingyaoLin's nix config";

  inputs = {
    # Nixpkgs
    nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
    # You can access packages and modules from different nixpkgs revs
    # at the same time. Here's an working example:
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
    # Also see the 'unstable-packages' overlay at 'overlays/default.nix'.

    # Home manager
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";

    # TODO: Add any other flake you might need
    # hardware.url = "github:nixos/nixos-hardware";

    # Shameless plug: looking for a way to nixify your themes and make
    # everything match nicely? Try nix-colors!
    nix-colors.url = "github:misterio77/nix-colors";
    picom.url = "github:yaocccc/picom";
  };

  outputs = { self, nixpkgs, home-manager, ... }@inputs:
    let
      inherit (self) outputs;
      forAllSystems = nixpkgs.lib.genAttrs [
        "x86_64-linux"
      ];
    in
    rec {
      # Your custom packages
      # Acessible through 'nix build', 'nix shell', etc
      packages = forAllSystems (system:
        let pkgs = nixpkgs.legacyPackages.${system};
        in import ./pkgs { inherit pkgs; }
      );
      # Devshell for bootstrapping
      # Acessible through 'nix develop' or 'nix-shell' (legacy)
      devShells = forAllSystems (system:
        let pkgs = nixpkgs.legacyPackages.${system};
        in import ./shell.nix { inherit pkgs; }
      );

      # Your custom packages and modifications, exported as overlays
      overlays = import ./overlays { inherit inputs; };
      # Reusable nixos modules you might want to export
      # These are usually stuff you would upstream into nixpkgs
      nixosModules = import ./modules/nixos;
      # Reusable home-manager modules you might want to export
      # These are usually stuff you would upstream into home-manager
      homeManagerModules = import ./modules/home-manager;

      # NixOS configuration entrypoint
      # Available through 'nixos-rebuild --flake .#NixOS'
      nixosConfigurations = {
        "NixOS" = nixpkgs.lib.nixosSystem {
          specialArgs = { inherit inputs outputs; };
          modules = [
            # > Our main NixOS configuration file <
            ./nixos/configuration.nix
          ];
        };
      };

      # Standalone home-manager configuration entrypoint
      # Available through 'home-manager --flake .#lqy@NixOS'
      homeConfigurations = {
        "lqy@NixOS" = home-manager.lib.homeManagerConfiguration {
          pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
          extraSpecialArgs = { inherit inputs outputs; };
          modules = [
            # > Our main home-manager configuration file <
            ./home-manager/home.nix
          ];
        };
      };
    };
}
# home-manager/home.nix
{ inputs, outputs, lib, config, pkgs, ... }:
{
  imports = [
    inputs.nix-colors.homeManagerModules
  ];
  nixpkgs = {
    # You can add overlays here
    overlays = [
      # Add overlays your own flake exports (from overlays and pkgs dir):
      outputs.overlays.additions
      outputs.overlays.modifications
      outputs.overlays.unstable-packages

      # You can also add overlays exported from other flakes:
      # neovim-nightly-overlay.overlays.default
      inputs.picom.overlays.default

      # Or define it inline, for example:
      # (final: prev: {
      #   hi = final.hello.overrideAttrs (oldAttrs: {
      #     patches = [ ./change-hello-to-hi.patch ];
      #   });
      # })
    ];
    # Configure your nixpkgs instance
    config = {
      # Disable if you don't want unfree packages
      allowUnfree = true;
      # Workaround for https://github.com/nix-community/home-manager/issues/2942
      allowUnfreePredicate = (_: true);
    };
  };

  # Set your username
  home = {
    username = "lqy";
    homeDirectory = "/home/lqy";
  };

  # Add stuff for your user as you see fit:
  home.packages = with pkgs; [
    microsoft-edge
    pavucontrol
    gnome.gucharmap
    tdesktop
    papirus-icon-theme
    wget
    (nerdfonts.override { fonts = [
      "FiraCode"
        "Hack"
        "JetBrainsMono"
    ]; })
  ];

  # Enable home-manager and git
  programs.home-manager.enable = true;

  # Nicely reload system units when changing configs
  systemd.user.startServices = "sd-switch";

  # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
  home.stateVersion = "22.11";
}
# colors.nix
{ inputs, lib, config, pkgs, ... }:
{
  colorScheme = inputs.nix-colors.colorSchemes.catppuccin-frappe;
}
QingyaoLin commented 1 year ago

@Misterio77

Misterio77 commented 1 year ago

Hey!

You tried to import inputs.nix-colors.homeManagerModules, this is an attribute set of modules, not a module:

$ nix eval github:misterio77/nix-colors#homeManagerModules
{ colorScheme = { imports = [ /nix/store/yrphffvjp2dmq7vrycq1p6ziibj6cygz-source/module/colorscheme.nix ]; }; colorscheme = «repeated»; default = «repeated»; }

You should instead import inputs.nix-colors.homeManagerModules.colorScheme, or inputs.nix-colors.homeManagerModules.default (they're both the same thing).

Misterio77 commented 1 year ago

By the way, any arbitrary attribute sets are technically modules; so that's why the error message didn't point that out.

QingyaoLin commented 1 year ago

Hey!

You tried to import inputs.nix-colors.homeManagerModules, this is an attribute set of modules, not a module:

$ nix eval github:misterio77/nix-colors#homeManagerModules
{ colorScheme = { imports = [ /nix/store/yrphffvjp2dmq7vrycq1p6ziibj6cygz-source/module/colorscheme.nix ]; }; colorscheme = «repeated»; default = «repeated»; }

You should instead import inputs.nix-colors.homeManagerModules.colorScheme, or inputs.nix-colors.homeManagerModules.default (they're both the same thing).

Thanks. But in the introduction to the use of nix-colors, it is still inputs.nix-colors.homeManagerModules, which misleads me.

With that done, move on to your home manager configuration. You should import the nix-colors.homeManagerModule, and set the option colorScheme to your preferred scheme, such as nix-colors.colorSchemes.dracula

Misterio77 commented 1 year ago

Thanks for the heads up. Do note it's actually singular homeManagerModule (which is a "deprecated" alias to homeManagerModules.default.

QingyaoLin commented 1 year ago

Thanks again for your help and dedication, nix is ​​wonderful because of you.