No description
Find a file
2022-07-25 20:05:15 +01:00
.github/workflows Add CI workflow 👷 2022-06-15 15:24:05 +01:00
modules Install Swaylock settings using Home Manager 🏗️ 2022-07-25 20:05:15 +01:00
palette-generator Log fitness values 🔊 2022-07-16 00:30:00 +01:00
stylix Improve option description for stylix.palette 💡 2022-07-22 23:08:50 +01:00
flake.lock Update base16.nix ⬆️ 2022-07-24 17:11:09 +01:00
flake.nix Add Swaylock overlay 2022-07-24 20:17:42 +01:00
LICENSE Add MIT license 2020-12-21 13:58:20 +00:00
README.md Add Alacritty to README 📝 2022-07-22 17:46:12 +01:00

Stylix

Stylix is a NixOS module which applies a standard colourscheme and font to every supported application, including:

  • Everything which uses GTK: notably Firefox and the GNOME apps
  • Text editors: Vim, NeoVim and Helix
  • Terminals: Alacritty, Kitty and Foot
  • The Linux console
  • The Plymouth boot screen
  • The GRUB bootloader

It also exports functions and values which make it easy to use the theme elsewhere within your NixOS configuration.

The colours used are generated from a background image, using a homemade genetic algorithm.
Fonts are selected by the user via a NixOS option, choosing from any of the font packages available in Nixpkgs.

Stylix builds upon base16.nix to manage the installation of themes into the appropriate location, as required by the application which is being themed.
base16.nix uses templates from Base16.

Installation

Stylix can be installed using the experimental flakes feature:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    stylix.url = "github:danth/stylix";
  };

  outputs = { self, nixpkgs, home-manager, stylix }: {
    nixosConfigurations."<hostname>" = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        home-manager.nixosModules.home-manager
        stylix.nixosModules.stylix
      ];
    };
  };
}

Stylix relies on Home Manager to install a lot of its theming. This requires Home Manager to be installed as a NixOS module; how to do this is shown in the example above.

Configuration

{ pkgs, ... }:

{
  # A colorscheme will be chosen automatically based on your wallpaper.
  stylix.image = ./wallpaper.png;

  # Use this option to force a light or dark theme to be chosen.
  stylix.polarity = "light";

  # You can override parts of the scheme by hand:
  stylix.palette = {
    base00 = "eeeeee";
    base05 = "111111";
  };

  # Or replace it with a scheme from base16:
  stylix.base16Scheme = "${base16-schemes}/gruvbox-dark-hard.yaml";

  # Select your preferred fonts, or use these defaults:
  stylix.fonts = {
    serif = {
      package = pkgs.dejavu_fonts;
      name = "DejaVu Serif";
    };
    sansSerif = {
      package = pkgs.dejavu_fonts;
      name = "DejaVu Sans";
    };
    monospace = {
      package = pkgs.dejavu_fonts;
      name = "DejaVu Sans Mono";
    };
    emoji = {
      package = pkgs.noto-fonts-emoji;
      name = "Noto Color Emoji";
    };
  };
}