All Projects → bertof → nix-rice

bertof / nix-rice

Licence: MIT license
A library to functionally define your configuration and theme (rice) with Nix

Programming Languages

Nix
1067 projects

Projects that are alternatives of or similar to nix-rice

dotfiles
My NixOS dotfiles
Stars: ✭ 21 (-51.16%)
Mutual labels:  nix, nixos, home-manager
base16.nix
Quickly theme programs in your favourite base16 colorscheme
Stars: ✭ 61 (+41.86%)
Mutual labels:  nix, nixos, home-manager
dotnix
Shackled within an elaborate prison of my own design.
Stars: ✭ 35 (-18.6%)
Mutual labels:  nix, nixos, home-manager
nyx
⚙️Nix[OS] Configuration
Stars: ✭ 50 (+16.28%)
Mutual labels:  nix, nixos, home-manager
impermanence
Modules to help you handle persistent state on systems with ephemeral root storage [maintainer=@talyz]
Stars: ✭ 401 (+832.56%)
Mutual labels:  nix, nixos, home-manager
dotfiles
No place like ~. Nix. All. The. Things.
Stars: ✭ 48 (+11.63%)
Mutual labels:  nix, nixos, home-manager
dconf2nix
🐾 Convert Dconf files (e.g. Gnome Shell) to Nix, as expected by Home Manager
Stars: ✭ 51 (+18.6%)
Mutual labels:  nix, nixos, home-manager
dotfiles
NixOS system config & Home-Manager user config
Stars: ✭ 43 (+0%)
Mutual labels:  nix, nixos, home-manager
nix-config
A collection of my system configs and dotfiles
Stars: ✭ 35 (-18.6%)
Mutual labels:  nix, nixos, home-manager
nix-xdg
[WIP] Nix overlay for making programs xdg compliant
Stars: ✭ 18 (-58.14%)
Mutual labels:  nix, nixos, home-manager
homeage
runtime decrypted age secrets for nix home manager
Stars: ✭ 43 (+0%)
Mutual labels:  nix, nixos, home-manager
elemental
Elemental, the component parts of a Nix/OS development system.
Stars: ✭ 44 (+2.33%)
Mutual labels:  nix, nixos, home-manager
system
Declarative NixOS system configuration for all my machines
Stars: ✭ 14 (-67.44%)
Mutual labels:  nix, nixos, home-manager
nix-configs
My Nix{OS} configuration files
Stars: ✭ 54 (+25.58%)
Mutual labels:  nix, nixos, home-manager
dotfiles-nix
Configuration files for my NixOS machine, declared by home-manager
Stars: ✭ 137 (+218.6%)
Mutual labels:  nix, rice, nixos
nix-home
A Nix Home Manager setup. I've now moved to a new configuration system at hugoreeves/elemental
Stars: ✭ 60 (+39.53%)
Mutual labels:  nix, nixos, home-manager
nix2container
An archive-less dockerTools.buildImage implementation
Stars: ✭ 133 (+209.3%)
Mutual labels:  nix, nixos
flake-utils-plus
Use Nix flakes without any fluff.
Stars: ✭ 280 (+551.16%)
Mutual labels:  nix, nixos
digga
A flake utility library to craft shell-, home-, and hosts- environments.
Stars: ✭ 818 (+1802.33%)
Mutual labels:  nix, nixos
nixops-tutorial
Tutorial for practical deployments with NixOps
Stars: ✭ 93 (+116.28%)
Mutual labels:  nix, nixos

nix-rice

Bring ricing to Nix!

Why

Nix standard library does not have direct support for colors and their hexadecimal representation, commonly used in package configurations. This library tries to solve this by adding:

  • Support to common float operations
  • Support to color definitions and transformations (RGBA and HSLA)
  • Color serialisation and deserialisation as hexadecimal strings
  • Color palette definitions and transformations

How to use it

An example integration to a home-manager configuration is shown inside the home-manager folder. The library is built using only builtin functions and the standard nix library and can be easily used even in single derivations as an overlay.

final: prev:
let
  # Fetch library
  nix-rice = final.callPackage (
    fetchTarball {
      url = "https://github.com/bertof/nix-rice/archive/refs/tags/v0.2.1.tar.gz";
      sha256 = "1is70gjf59sxccwhz1hl9hdxsd4z8vqsr2rdk3imnmxj9n3jf6j8";
    }
  ) {};
  # Parse theme
  nord = with nix-rice; palette.tPalette color.hexToRgba (import ../themes/nord.nix);
in
(
  rec {
    # Build a derivation to hold the ricing
    rice = nix-rice // {
      # Define the color palette
      # You can use any form of map you prefere
      # Palette transform functions are applied recursively, including serialisation and deserialisation
      colorPalette = with nix-rice; rec {
        normal = {
          black = nord.n1;
          blue = nord.n10;
          cyan = nord.n8;
          green = nord.n14;
          magenta = nord.n15;
          red = nord.n11;
          white = nord.n5;
          yellow = nord.n13;
        };
        # Use a generated brighter palette and override some colors
        bright = palette.brighten 10 normal // {
          blue = nord.n9;
          black = nord.n2;
          red = nord.n12;
          white = nord.n6;
        };
        dark = palette.darken 10 normal // {
          black = nord.n0;
          blue = nord.n3;
          cyan = nord.n7;
          white = nord.n4;
        };
      };
      # Font configurations uses the same pattern in home-manager
      font = {
        normal = {
          name = "Cantarell";
          package = final.cantarell-fonts;
          size = 10;
        };
        monospace = {
          name = "FuraCode Nerd Font Mono";
          package = (
            final.nerdfonts.override {
              fonts = [ "FiraCode" ];
            }
          );
          size = 10;
        };
      };
      # The ricing may contain any kind of information you want to pass to your configurations
      opacity = 0.95;
    };
  }
)

While the library interface is mostly set, it might change in the future (new transformations, palette generation, conversion to specific programs configurations). It is therefore suggested to use a pinned version like in the example above.

Contributions

Feel free to modify this library as you please: addition and fixes are welcome. Want to include your favourite theme? Add a new transformation? Send a PR.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].