Switch to nix-rice
This commit is contained in:
parent
5f960fc2ca
commit
98e4871193
12 changed files with 31 additions and 537 deletions
|
|
@ -1,16 +1,16 @@
|
||||||
{ lib
|
{ lib
|
||||||
, stdenv
|
, stdenv
|
||||||
, extra
|
, rice
|
||||||
, roboto
|
, roboto
|
||||||
, i3lock-color
|
, i3lock-color
|
||||||
, update-background
|
, update-background
|
||||||
, writeScript
|
, writeScript
|
||||||
, font ? { package = roboto; name = "Roboto"; }
|
, font ? { package = roboto; name = "Roboto"; }
|
||||||
, palette ? extra.palette.palette {}
|
, palette ? rice.palette.palette {}
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
strPalette = extra.palette.toRGBAHex palette;
|
strPalette = rice.palette.toRGBAHex palette;
|
||||||
in
|
in
|
||||||
writeScript "lockscreen.sh" ''
|
writeScript "lockscreen.sh" ''
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
|
||||||
|
|
@ -1,303 +0,0 @@
|
||||||
{ pkgs, lib ? pkgs.lib, hex, float, ... }:
|
|
||||||
let
|
|
||||||
inherit (builtins) isInt isString isFloat trace div isAttrs hasAttr;
|
|
||||||
inherit (lib.trivial) min max;
|
|
||||||
inherit (lib.lists) head tail drop last;
|
|
||||||
inherit (lib.strings) concatMapStrings fixedWidthString match toLower toInt;
|
|
||||||
|
|
||||||
## OPERATORS
|
|
||||||
# Module operator implementation for floats
|
|
||||||
div' = n: d: float.floor (div (float.ensureFloat n) (float.ensureFloat d));
|
|
||||||
mod' = n: d:
|
|
||||||
let
|
|
||||||
f = div' n d;
|
|
||||||
in
|
|
||||||
n - (float.fromInt f) * d;
|
|
||||||
|
|
||||||
# Absolute operator implementation
|
|
||||||
_abs = v: if v < 0 then (-v) else v;
|
|
||||||
|
|
||||||
# Check if `v` is between `a` and `b`
|
|
||||||
_inRange = a: b: v: (v <= max a b) && (v >= min a b);
|
|
||||||
|
|
||||||
# Clamp `v` between `a` and `v`
|
|
||||||
_clamp = a: b: v: min (max v (min a b)) (max a b);
|
|
||||||
|
|
||||||
## 8BIT
|
|
||||||
# Check if `v` is in 8Bit format
|
|
||||||
_is8Bit = v: _inRange 0.0 255.0 v;
|
|
||||||
|
|
||||||
# Clamp 8bit value
|
|
||||||
_clamp8Bit = _clamp 0.0 255.0;
|
|
||||||
|
|
||||||
# Apply function to 8bit value and clamp the result
|
|
||||||
_tclamp8Bit = f: v: _clamp8Bit (f v);
|
|
||||||
|
|
||||||
## UNARY
|
|
||||||
# Check if input is in [0, 1]
|
|
||||||
_isUnary = _inRange 0.0 1.0;
|
|
||||||
|
|
||||||
# Clamp input to [0, 1]
|
|
||||||
_clampUnary = _clamp 0.0 1.0;
|
|
||||||
|
|
||||||
# Apply function to unary value and clamp the result
|
|
||||||
_tclampUnary = f: v: _clampUnary (f v);
|
|
||||||
|
|
||||||
|
|
||||||
# Check if input is in [0, 360]
|
|
||||||
_isHue = _inRange 0.0 360.0;
|
|
||||||
|
|
||||||
# Apply function to hue value and map the result in [0, 360)
|
|
||||||
_tHue = f: v: mod' (f v) 360.0;
|
|
||||||
|
|
||||||
# RGB constructor
|
|
||||||
_rgba = { r, g, b, a ? 255.0 }:
|
|
||||||
assert (_is8Bit r);
|
|
||||||
assert (_is8Bit g);
|
|
||||||
assert (_is8Bit b);
|
|
||||||
{ inherit r g b a; };
|
|
||||||
|
|
||||||
# HSLA constructor
|
|
||||||
_hsla = { h, l, s ? 1.0, a ? 255.0 }:
|
|
||||||
assert (_inRange 0.0 360.0 h);
|
|
||||||
assert (_isUnary s);
|
|
||||||
assert (_isUnary l);
|
|
||||||
assert (_isUnary a);
|
|
||||||
{ inherit h s l a; };
|
|
||||||
|
|
||||||
in
|
|
||||||
rec {
|
|
||||||
|
|
||||||
inherit div' mod' _abs _inRange _clamp _is8Bit _clamp8Bit _tclamp8Bit _isUnary _clampUnary _tclampUnary _tHue _rgba _hsla;
|
|
||||||
|
|
||||||
rgba = _rgba;
|
|
||||||
|
|
||||||
isRgba = c: if isAttrs c && hasAttr "r" c && hasAttr "g" c && hasAttr "b" c && hasAttr "a" c then
|
|
||||||
0 <= c.r && c.r <= 255 && 0 <= c.g && c.g <= 255 && 0 <= c.b && c.b <= 255 && 0 <= c.a && c.a <= 255
|
|
||||||
else false;
|
|
||||||
|
|
||||||
hsla = _hsla;
|
|
||||||
|
|
||||||
isHsla = c: if isAttrs c hasAttr "h" c && hasAttr "s" c && hasAttr "l" c && hasAttr "a" c then
|
|
||||||
0 <= c.h && c.h <= 255 && 0 <= c.s && c.s <= 255 && 0 <= c.l && c.l <= 255 && 0 <= c.a && c.a <= 255
|
|
||||||
else false;
|
|
||||||
|
|
||||||
## CONVERSION
|
|
||||||
# RGB to HSL
|
|
||||||
rgbaToHsla = color:
|
|
||||||
let
|
|
||||||
c_color = _rgba color;
|
|
||||||
r = c_color.r / 255.0;
|
|
||||||
g = c_color.g / 255.0;
|
|
||||||
b = c_color.b / 255.0;
|
|
||||||
a = c_color.a / 255.0;
|
|
||||||
c_min = min (min r g) b;
|
|
||||||
c_max = max (max r g) b;
|
|
||||||
delta = c_max - c_min;
|
|
||||||
|
|
||||||
hue = (
|
|
||||||
if delta == 0.0 then 0.0 else
|
|
||||||
if r == c_max then (mod' (((g - b) / delta) + 6) 6) else
|
|
||||||
if g == c_max then (b - r) / delta + 2 else
|
|
||||||
assert b == c_max; (r - g) / delta + 4
|
|
||||||
) * 60;
|
|
||||||
lightness = (c_min + c_max) / 2.0;
|
|
||||||
saturation =
|
|
||||||
if delta == 0.0 then 0.0 else
|
|
||||||
delta / (1 - _abs (2.0 * lightness - 1.0));
|
|
||||||
in
|
|
||||||
assert (isRgba color);
|
|
||||||
_hsla {
|
|
||||||
l = _clampUnary lightness;
|
|
||||||
s = _clampUnary saturation;
|
|
||||||
h = mod' hue 360.0;
|
|
||||||
a = _clampUnary a;
|
|
||||||
};
|
|
||||||
|
|
||||||
# HSL to RGB
|
|
||||||
hslToRgb = color:
|
|
||||||
let
|
|
||||||
# check if `v` is in [a, b)
|
|
||||||
_checkRange = a: b: v: a <= v && v < b;
|
|
||||||
c_color = _hsla color;
|
|
||||||
h = c_color.h;
|
|
||||||
s = c_color.s;
|
|
||||||
l = c_color.l;
|
|
||||||
a = c_color.a;
|
|
||||||
c = (1 - (_abs (2 * l - 1))) * s;
|
|
||||||
x = c * (1 - _abs ((mod' (h / 60) 2) - 1));
|
|
||||||
m = l - (c / 2.0);
|
|
||||||
|
|
||||||
r' = if _inRange 120 240 h then 0 else
|
|
||||||
if _inRange 60 300 h then x else
|
|
||||||
c;
|
|
||||||
g' = if _inRange 60 180 h then c else
|
|
||||||
if _inRange 0 240 h then x else
|
|
||||||
0;
|
|
||||||
b' = if _inRange 180 300 h then c else
|
|
||||||
if _inRange 120 360 h then x else
|
|
||||||
0;
|
|
||||||
in
|
|
||||||
assert (isHsla);
|
|
||||||
_rgba {
|
|
||||||
r = _clamp8Bit ((r' + m) * 255.0);
|
|
||||||
g = _clamp8Bit ((g' + m) * 255.0);
|
|
||||||
b = _clamp8Bit ((b' + m) * 255.0);
|
|
||||||
a = _clamp8Bit (a * 255.0);
|
|
||||||
};
|
|
||||||
|
|
||||||
## TRANSFORM
|
|
||||||
|
|
||||||
tRedRgba = f: color: assert (isRgba color); color // { r = _tclamp8Bit f color.r; };
|
|
||||||
tGreenRgba = f: color: assert (isRgba color); color // { g = _tclamp8Bit f color.g; };
|
|
||||||
tBlueRgba = f: color: assert (isRgba color); color // { b = _tclamp8Bit f color.b; };
|
|
||||||
tAlphaRgba = f: color: assert (isRgba color); color // { a = _tclamp8Bit f color.a; };
|
|
||||||
|
|
||||||
setRedRgba = r: color: tGreenRgba (v: r) color;
|
|
||||||
setGreenRgba = g: color: tBlueRgba (v: g) color;
|
|
||||||
setBlueRgba = b: color: tAlphaRgba (v: b) color;
|
|
||||||
setAlphaRgba = a: color: tRedRgba (v: a) color;
|
|
||||||
|
|
||||||
tRedHsla = f: color: assert (isHsla color); color // { h = _tHue f color.h; };
|
|
||||||
tGreenHsla = f: color: assert (isHsla color); color // { s = _tclampUnary f color.s; };
|
|
||||||
tBlueHsla = f: color: assert (isHsla color); color // { l = _tclampUnary f color.l; };
|
|
||||||
tAlphaHsla = f: color: assert (isHsla color); color // { a = _tclampUnary f color.a; };
|
|
||||||
|
|
||||||
setRedHsla = h: color: tGreenHsla (v: h) color;
|
|
||||||
setGreenHsla = s: color: tBlueHsla (v: s) color;
|
|
||||||
setBlueHsla = l: color: tAlphaHsla (v: l) color;
|
|
||||||
setAlphaHsla = a: color: tRedHsla (v: a) color;
|
|
||||||
|
|
||||||
## RGB TRANSFORM
|
|
||||||
# Add brightness value as integer value or percent value
|
|
||||||
brighten = color: value:
|
|
||||||
let
|
|
||||||
directValue = if isInt value || isFloat value then value else null;
|
|
||||||
positiveMatches = match "([[:digit:]]+)%" value;
|
|
||||||
negativeMatches = match "-([[:digit:]]+)%" value;
|
|
||||||
percentValue =
|
|
||||||
if positiveMatches != null then toInt (head positiveMatches)
|
|
||||||
else if negativeMatches != null then (-toInt (head negativeMatches))
|
|
||||||
else null;
|
|
||||||
valueTransform = v:
|
|
||||||
if directValue != null then _clamp8Bit (v + directValue)
|
|
||||||
else _clamp8Bit (v * (100.0 + percentValue) / 100.0);
|
|
||||||
in
|
|
||||||
tBlueRgba valueTransform (tGreenRgba valueTransform (tRedRgba valueTransform color));
|
|
||||||
|
|
||||||
darken = color: value:
|
|
||||||
let
|
|
||||||
directValue = if isInt value || isFloat value then value else null;
|
|
||||||
positiveMatches = match "([[:digit:]]+)%" value;
|
|
||||||
negativeMatches = match "-([[:digit:]]+)%" value;
|
|
||||||
percentValue =
|
|
||||||
if positiveMatches != null then toInt (head positiveMatches)
|
|
||||||
else if negativeMatches != null then (-toInt (head negativeMatches))
|
|
||||||
else null;
|
|
||||||
valueTransform = v:
|
|
||||||
if directValue != null then _clamp8Bit (v - directValue)
|
|
||||||
else _clamp8Bit (v * (100.0 - percentValue) / 100.0);
|
|
||||||
in
|
|
||||||
tBlueRgba valueTransform (tGreenRgba valueTransform (tRedRgba valueTransform color));
|
|
||||||
|
|
||||||
## DESERIALIZATION
|
|
||||||
# Parse a hex color string to a RGBA color
|
|
||||||
hexToRgba = s:
|
|
||||||
let
|
|
||||||
rgba = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
|
|
||||||
rgb = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
|
|
||||||
hex_list = (if isNull rgb then rgba else rgb ++ [ "FF" ]);
|
|
||||||
values = map (s: float.fromInt (hex.toDec s)) hex_list;
|
|
||||||
in
|
|
||||||
_rgba {
|
|
||||||
r = head values;
|
|
||||||
g = head (tail values);
|
|
||||||
b = head (drop 2 values);
|
|
||||||
a = last values;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Parse a hex color string to a HSLA color
|
|
||||||
hexToHsla = s:
|
|
||||||
let
|
|
||||||
hsla = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
|
|
||||||
hsl = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
|
|
||||||
hex_list = (if isNull hsl then hsla else hsl ++ [ "FF" ]);
|
|
||||||
values = map (s: float.fromInt (hex.toDec s)) hex_list;
|
|
||||||
in
|
|
||||||
_hsla {
|
|
||||||
h = head values;
|
|
||||||
s = head (tail values);
|
|
||||||
l = head (drop 2 values);
|
|
||||||
a = last values;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
## SERIALIZATION
|
|
||||||
# Print RGB color as uppercase hex string
|
|
||||||
toRGBHex = color:
|
|
||||||
let
|
|
||||||
inherit (color) r g b;
|
|
||||||
in
|
|
||||||
assert (isRgba color);
|
|
||||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ r g b ]}'';
|
|
||||||
|
|
||||||
# Print RGBA color as uppercase hex string
|
|
||||||
toRGBAHex = color:
|
|
||||||
let
|
|
||||||
inherit (color) r g b a;
|
|
||||||
in
|
|
||||||
assert (isRgba color);
|
|
||||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ r g b a ]}'';
|
|
||||||
|
|
||||||
# Print RGBA color as uppercase hex string in the form ARGB (Polybar uses this format)
|
|
||||||
toARGBHex = color:
|
|
||||||
let
|
|
||||||
inherit (color) r g b a;
|
|
||||||
in
|
|
||||||
assert (isRgba color);
|
|
||||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ a r g b ]}'';
|
|
||||||
|
|
||||||
|
|
||||||
# Print RGB color as lowercase hex string
|
|
||||||
toRgbHex = color: toLower (toRGBHex color);
|
|
||||||
|
|
||||||
# Print RGBA color as lowercase hex string
|
|
||||||
toRgbaHex = color: toLower (toRGBAHex color);
|
|
||||||
|
|
||||||
# Print RGBA color as lowercase hex string in the form argb (Polybar uses this format)
|
|
||||||
toArgbHex = color: toLower (toArgbHex color);
|
|
||||||
|
|
||||||
# Print RGB color as uppercase hex string
|
|
||||||
toHSLHex = color:
|
|
||||||
let
|
|
||||||
inherit (color) h s l;
|
|
||||||
in
|
|
||||||
assert (isHsla color);
|
|
||||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ h s l ]}'';
|
|
||||||
|
|
||||||
# Print HSLA color as uppercase hex string
|
|
||||||
toHSLAHex = color:
|
|
||||||
let
|
|
||||||
inherit (color) h s l a;
|
|
||||||
in
|
|
||||||
assert (isHsla color);
|
|
||||||
''#${concatMapStrings (v: fixedWidthString 2 "0" (hex.fromDec (float.round v))) [ h s l a ]}'';
|
|
||||||
|
|
||||||
# Print HSL color as lowercase hex string
|
|
||||||
toHslHex = color: toLower (toHSLHex color);
|
|
||||||
|
|
||||||
# Print HSLA color as lowercase hex string
|
|
||||||
toHslaHex = color: toLower (toHSLAHex color);
|
|
||||||
|
|
||||||
|
|
||||||
## CONSTANTS
|
|
||||||
black = hexToRgba "#000000"; # RGB (0,0,0) HSL (0°,0%,0%)
|
|
||||||
white = hexToRgba "#FFFFFF"; # RGB (255,255,255) HSL (0°,0%,100%)
|
|
||||||
red = hexToRgba "#FF0000"; # RGB (255,0,0) HSL (0°,100%,50%)
|
|
||||||
green = hexToRgba "#00FF00"; # RGB (0,255,0) HSL (120°,100%,50%)
|
|
||||||
blue = hexToRgba "#0000FF"; # RGB (0,0,255) HSL (240°,100%,50%)
|
|
||||||
yellow = hexToRgba "#FFFF00"; # RGB (255,255,0) HSL (60°,100%,50%)
|
|
||||||
cyan = hexToRgba "#00FFFF"; # RGB (0,255,255) HSL (180°,100%,50%)
|
|
||||||
magenta = hexToRgba "#FF00FF"; # RGB (255,0,255) HSL (300°,100%,50%)
|
|
||||||
transparent = hexToRgba "#00000000"; # RGBA (0,0,0,0) HSLA (0°,0%,0%,0%)
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
{ system ? builtins.currentSystem
|
|
||||||
, pkgs ? import <nixpkgs> {}
|
|
||||||
, lib ? pkgs.lib
|
|
||||||
, ...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
callPackage = lib.callPackageWith (pkgs // self);
|
|
||||||
self = rec {
|
|
||||||
float = callPackage ./float {};
|
|
||||||
hex = callPackage ./hex {};
|
|
||||||
color = callPackage ./color {};
|
|
||||||
palette = callPackage ./palette {};
|
|
||||||
};
|
|
||||||
in
|
|
||||||
(self)
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
{ pkgs, lib ? pkgs.lib, ... }:
|
|
||||||
let
|
|
||||||
inherit (builtins) head tail isFloat isInt;
|
|
||||||
inherit (lib.strings) toInt match splitString;
|
|
||||||
floatComponents = f: splitString "." (toString f);
|
|
||||||
in
|
|
||||||
rec {
|
|
||||||
|
|
||||||
# Force a number to be a float (hacky but works)
|
|
||||||
ensureFloat = v:
|
|
||||||
assert (isInt v || isFloat v);
|
|
||||||
v + 0.1 - 0.1;
|
|
||||||
|
|
||||||
# Convert integer to float (hacky but it works)
|
|
||||||
fromInt = i:
|
|
||||||
assert isInt i;
|
|
||||||
ensureFloat i;
|
|
||||||
|
|
||||||
# Round float to upper integer
|
|
||||||
ceil = f:
|
|
||||||
let
|
|
||||||
comp = floatComponents f;
|
|
||||||
int = toInt (head comp);
|
|
||||||
inc = if match "[1-9][[:digit:]]*" (head (tail comp)) != null then 1 else 0;
|
|
||||||
in
|
|
||||||
assert(isFloat f);
|
|
||||||
int + inc;
|
|
||||||
|
|
||||||
# Round float to lower integer
|
|
||||||
floor = f:
|
|
||||||
let
|
|
||||||
int = toInt (head (floatComponents f));
|
|
||||||
in
|
|
||||||
assert(isFloat f);
|
|
||||||
int;
|
|
||||||
|
|
||||||
# Round float to closest integer
|
|
||||||
round = f:
|
|
||||||
let
|
|
||||||
comp = floatComponents (ensureFloat f);
|
|
||||||
int = toInt (head comp);
|
|
||||||
inc = if match "[5-9][[:digit:]]*" (head (tail comp)) != null then 1 else 0;
|
|
||||||
in
|
|
||||||
int + inc;
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
{ pkgs, lib ? pkgs.lib, ... }:
|
|
||||||
let
|
|
||||||
inherit (lib.trivial) toHexString;
|
|
||||||
inherit (lib.strings) match toUpper stringToCharacters;
|
|
||||||
inherit (lib.lists) foldl;
|
|
||||||
|
|
||||||
# Parse a single hexadecimal digit to an integer
|
|
||||||
_parseDigit = c:
|
|
||||||
let
|
|
||||||
v = toUpper c;
|
|
||||||
in
|
|
||||||
assert(match "[0-9A-F]" v != null);
|
|
||||||
{
|
|
||||||
"0" = 0;
|
|
||||||
"1" = 1;
|
|
||||||
"2" = 2;
|
|
||||||
"3" = 3;
|
|
||||||
"4" = 4;
|
|
||||||
"5" = 5;
|
|
||||||
"6" = 6;
|
|
||||||
"7" = 7;
|
|
||||||
"8" = 8;
|
|
||||||
"9" = 9;
|
|
||||||
"A" = 10;
|
|
||||||
"B" = 11;
|
|
||||||
"C" = 12;
|
|
||||||
"D" = 13;
|
|
||||||
"E" = 14;
|
|
||||||
"F" = 15;
|
|
||||||
}."${v}";
|
|
||||||
|
|
||||||
in
|
|
||||||
rec {
|
|
||||||
|
|
||||||
# Convert an hexadecimal string to an integer
|
|
||||||
toDec = s:
|
|
||||||
let
|
|
||||||
characters = stringToCharacters s;
|
|
||||||
values = map _parseDigit characters;
|
|
||||||
in
|
|
||||||
foldl (acc: n: acc * 16 + n) 0 values;
|
|
||||||
|
|
||||||
# Convert an integer to a decimal string
|
|
||||||
fromDec = toHexString;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
||||||
{ pkgs, color, lib, ... }:
|
|
||||||
let
|
|
||||||
inherit (builtins) isString;
|
|
||||||
inherit (lib.attrsets) mapAttrsRecursiveCond;
|
|
||||||
in
|
|
||||||
rec{
|
|
||||||
|
|
||||||
# Palette constructor
|
|
||||||
# Produces a palette of colors starting from sane defaults
|
|
||||||
# Override the inputs with your favorite colors
|
|
||||||
palette =
|
|
||||||
{ black ? color.black
|
|
||||||
, red ? color.red
|
|
||||||
, green ? color.green
|
|
||||||
, yellow ? color.yellow
|
|
||||||
, blue ? color.blue
|
|
||||||
, magenta ? color.magenta
|
|
||||||
, cyan ? color.cyan
|
|
||||||
, white ? color.white
|
|
||||||
, bright-black ? color.brighten black "10%"
|
|
||||||
, bright-red ? color.brighten red "10%"
|
|
||||||
, bright-green ? color.brighten green "10%"
|
|
||||||
, bright-yellow ? color.brighten yellow "10%"
|
|
||||||
, bright-blue ? color.brighten blue "10%"
|
|
||||||
, bright-magenta ? color.brighten magenta "10%"
|
|
||||||
, bright-cyan ? color.brighten cyan "10%"
|
|
||||||
, bright-white ? color.brighten white "10%"
|
|
||||||
, dim-black ? color.darken black "10%"
|
|
||||||
, dim-red ? color.darken red "10%"
|
|
||||||
, dim-green ? color.darken green "10%"
|
|
||||||
, dim-yellow ? color.darken yellow "10%"
|
|
||||||
, dim-blue ? color.darken blue "10%"
|
|
||||||
, dim-magenta ? color.darken magenta "10%"
|
|
||||||
, dim-cyan ? color.darken cyan "10%"
|
|
||||||
, dim-white ? color.darken white "10%"
|
|
||||||
, primary-background ? black
|
|
||||||
, primary-foreground ? white
|
|
||||||
, primary-dim_foreground ? color.darken primary-foreground "10%"
|
|
||||||
, cursor-text ? primary-background
|
|
||||||
, cursor-cursor ? primary-foreground
|
|
||||||
, vi-cursor-text ? cursor-text
|
|
||||||
, vi-cursor-cursor ? cursor-cursor
|
|
||||||
}: {
|
|
||||||
normal = {
|
|
||||||
black = assert(color.isRgba black); black;
|
|
||||||
red = assert(color.isRgba red); red;
|
|
||||||
green = assert(color.isRgba green); green;
|
|
||||||
yellow = assert(color.isRgba yellow); yellow;
|
|
||||||
blue = assert(color.isRgba blue); blue;
|
|
||||||
magenta = assert(color.isRgba magenta); magenta;
|
|
||||||
cyan = assert(color.isRgba cyan); cyan;
|
|
||||||
white = assert(color.isRgba white); white;
|
|
||||||
};
|
|
||||||
bright = {
|
|
||||||
black = assert(color.isRgba bright-black); bright-black;
|
|
||||||
red = assert(color.isRgba bright-red); bright-red;
|
|
||||||
green = assert(color.isRgba bright-green); bright-green;
|
|
||||||
yellow = assert(color.isRgba bright-yellow); bright-yellow;
|
|
||||||
blue = assert(color.isRgba bright-blue); bright-blue;
|
|
||||||
magenta = assert(color.isRgba bright-magenta); bright-magenta;
|
|
||||||
cyan = assert(color.isRgba bright-cyan); bright-cyan;
|
|
||||||
white = assert(color.isRgba bright-white); bright-white;
|
|
||||||
};
|
|
||||||
dim = {
|
|
||||||
black = assert(color.isRgba dim-black); dim-black;
|
|
||||||
red = assert(color.isRgba dim-red); dim-red;
|
|
||||||
green = assert(color.isRgba dim-green); dim-green;
|
|
||||||
yellow = assert(color.isRgba dim-yellow); dim-yellow;
|
|
||||||
blue = assert(color.isRgba dim-blue); dim-blue;
|
|
||||||
magenta = assert(color.isRgba dim-magenta); dim-magenta;
|
|
||||||
cyan = assert(color.isRgba dim-cyan); dim-cyan;
|
|
||||||
white = assert(color.isRgba dim-white); dim-white;
|
|
||||||
};
|
|
||||||
primary = {
|
|
||||||
background = assert(color.isRgba primary-background); primary-background;
|
|
||||||
foreground = assert(color.isRgba primary-foreground); primary-foreground;
|
|
||||||
dim_foreground = assert(color.isRgba primary-dim_foreground);primary-dim_foreground;
|
|
||||||
};
|
|
||||||
cursor = {
|
|
||||||
cursor = assert(color.isRgba cursor-cursor); cursor-cursor;
|
|
||||||
text = assert(color.isRgba cursor-text); cursor-text;
|
|
||||||
};
|
|
||||||
vi_mode_cursor = {
|
|
||||||
cursor = assert(color.isRgba cursor-cursor); cursor-cursor;
|
|
||||||
text = assert(color.isRgba cursor-text); cursor-text;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
## TRANSFORM
|
|
||||||
tPalette = f: p: mapAttrsRecursiveCond (v: !color.isRgba v) (a: v: f v) p;
|
|
||||||
|
|
||||||
## SERIALIZATION
|
|
||||||
# Try to convert input colors to a lowercase hex encoded RGBA color
|
|
||||||
toRgbaHex = tPalette color.toRgbaHex;
|
|
||||||
|
|
||||||
# Try to convert input colors to a uppercase hex encoded RGBA color
|
|
||||||
toRGBAHex = tPalette color.toRGBAHex;
|
|
||||||
|
|
||||||
# Try to convert input colors to a lowercase hex encoded RGB color
|
|
||||||
toRgbHex = tPalette color.toRgbHex;
|
|
||||||
|
|
||||||
# Try to convert input colors to a lowercase hex encoded RGB color
|
|
||||||
toRGBHex = tPalette color.toRGBHex;
|
|
||||||
|
|
||||||
# Try to convert input colors to a uppercase hex encoded RGB color in the form ARGB (Polybar uses this format)
|
|
||||||
toARGBHex = tPalette color.toARGBHex;
|
|
||||||
|
|
||||||
# Try to convert input colors to a lowercase hex encoded RGB color in the form argb (Polybar uses this format)
|
|
||||||
toArgbHex = tPalette color.toArgbHex;
|
|
||||||
}
|
|
||||||
15
home.nix
15
home.nix
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
nixpkgs = import <nixpkgs> {};
|
nixpkgs = import <nixpkgs> {};
|
||||||
|
nix-rice = fetchTarball {
|
||||||
|
url = "https://github.com/bertof/nix-rice/archive/refs/tags/v0.1.0.tar.gz";
|
||||||
|
sha256 = "0am3fnn8lqbi0mhz8jxqskchw1phy5s7kkmrk6jw519dasqq6an7";
|
||||||
|
};
|
||||||
callPackage = pkgs.lib.callPackageWith pkgs;
|
callPackage = pkgs.lib.callPackageWith pkgs;
|
||||||
nord = import ./themes/nord.nix;
|
nord = import ./themes/nord.nix;
|
||||||
onedark = import ./themes/onedark.nix;
|
onedark = import ./themes/onedark.nix;
|
||||||
|
|
@ -12,12 +16,12 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
nixpkgs.overlays = [
|
||||||
(final: prev: { extra = (prev.lib.callPackageWith prev) ./extra/default.nix {}; }) # Custom library
|
(final: prev: { rice = (prev.lib.callPackageWith prev) nix-rice {}; }) # Custom library
|
||||||
(final: prev: (prev.lib.callPackageWith prev) ./custom/default.nix {}) # Custom packges
|
(final: prev: (prev.lib.callPackageWith prev) ./custom/default.nix {}) # Custom packges
|
||||||
(
|
(
|
||||||
final: prev: rec {
|
final: prev: rec {
|
||||||
extra = prev.extra // {
|
rice = prev.rice // {
|
||||||
colorPalette = with pkgs.extra; palette.palette {
|
colorPalette = with pkgs.rice; palette.palette {
|
||||||
black = color.hexToRgba nord.n0;
|
black = color.hexToRgba nord.n0;
|
||||||
red = color.hexToRgba nord.n11;
|
red = color.hexToRgba nord.n11;
|
||||||
green = color.hexToRgba nord.n14;
|
green = color.hexToRgba nord.n14;
|
||||||
|
|
@ -41,8 +45,8 @@ in
|
||||||
(
|
(
|
||||||
final: prev: {
|
final: prev: {
|
||||||
lockscreen = prev.lockscreen.override {
|
lockscreen = prev.lockscreen.override {
|
||||||
palette = prev.extra.colorPalette;
|
palette = prev.rice.colorPalette;
|
||||||
font = prev.extra.font.normal;
|
font = prev.rice.font.normal;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
@ -103,6 +107,7 @@ in
|
||||||
tdesktop
|
tdesktop
|
||||||
teams
|
teams
|
||||||
transmission-gtk
|
transmission-gtk
|
||||||
|
virt-manager
|
||||||
wineFull
|
wineFull
|
||||||
wireguard
|
wireguard
|
||||||
xclip
|
xclip
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
{ pkgs, lib, ... }:
|
{ pkgs, lib, ... }:
|
||||||
{
|
{
|
||||||
# Include fonts packages
|
# Include fonts packages
|
||||||
home.packages = [ pkgs.extra.font.monospace.package ];
|
home.packages = [ pkgs.rice.font.monospace.package ];
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
env.TERM = "xterm-256color";
|
env.TERM = "xterm-256color";
|
||||||
scrolling.history = 3000;
|
scrolling.history = 3000;
|
||||||
font = {
|
font = {
|
||||||
normal.family = pkgs.extra.font.monospace.name;
|
normal.family = pkgs.rice.font.monospace.name;
|
||||||
size = 9.0;
|
size = 9.0;
|
||||||
};
|
};
|
||||||
background_opacity = 0.95;
|
background_opacity = 0.95;
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
hints.modifiers = "Control";
|
hints.modifiers = "Control";
|
||||||
};
|
};
|
||||||
|
|
||||||
colors = with pkgs.extra; {
|
colors = with pkgs.rice; {
|
||||||
|
|
||||||
primary = palette.toRgbHex colorPalette.primary;
|
primary = palette.toRgbHex colorPalette.primary;
|
||||||
cursor = palette.toRgbHex colorPalette.cursor;
|
cursor = palette.toRgbHex colorPalette.cursor;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
monitorPages = [ "I" "II" "III" "IV" "V" "VI" "VII" "VIII" "IX" "X" ];
|
monitorPages = [ "I" "II" "III" "IV" "V" "VI" "VII" "VIII" "IX" "X" ];
|
||||||
strPalette = pkgs.extra.palette.toRGBHex pkgs.extra.colorPalette;
|
strPalette = pkgs.rice.palette.toRGBHex pkgs.rice.colorPalette;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
xsession.windowManager.bspwm = {
|
xsession.windowManager.bspwm = {
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ let
|
||||||
rofi_dmenu = "${pkgs.rofi} -dmenu";
|
rofi_dmenu = "${pkgs.rofi} -dmenu";
|
||||||
firefox = "${pkgs.firefox}/bin/firefox";
|
firefox = "${pkgs.firefox}/bin/firefox";
|
||||||
dmenu = "${pkgs.dmenu}/bin/dmenu";
|
dmenu = "${pkgs.dmenu}/bin/dmenu";
|
||||||
palette = pkgs.extra.palette.toRGBHex pkgs.extra.colorPalette;
|
palette = pkgs.rice.palette.toRGBHex pkgs.rice.colorPalette;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [ dunst extra.font.normal.package ];
|
home.packages = with pkgs; [ dunst rice.font.normal.package ];
|
||||||
services.dunst = {
|
services.dunst = {
|
||||||
enable = true;
|
enable = true;
|
||||||
iconTheme = {
|
iconTheme = {
|
||||||
|
|
@ -31,7 +31,7 @@ in
|
||||||
sort = "yes";
|
sort = "yes";
|
||||||
idle_threshold = 120;
|
idle_threshold = 120;
|
||||||
|
|
||||||
font = "${pkgs.extra.font.normal.name} 10";
|
font = "${pkgs.rice.font.normal.name} 10";
|
||||||
line_height = 0;
|
line_height = 0;
|
||||||
markup = "full";
|
markup = "full";
|
||||||
format = "<b>%s</b>\\n%b";
|
format = "<b>%s</b>\\n%b";
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,9 @@ let
|
||||||
pkill = "${pkgs.procps}/bin/pkill";
|
pkill = "${pkgs.procps}/bin/pkill";
|
||||||
playerCtl = "${pkgs.playerctl}/bin/playerctl";
|
playerCtl = "${pkgs.playerctl}/bin/playerctl";
|
||||||
playerStatus = "${playerCtl} -f '{{emoji(status)}} {{title}} - {{artist}}' metadata | ${head} -c 60";
|
playerStatus = "${playerCtl} -f '{{emoji(status)}} {{title}} - {{artist}}' metadata | ${head} -c 60";
|
||||||
colors = with pkgs.extra; palette.toARGBHex rec {
|
alacritty = "${pkgs.alacritty}/bin/alacritty";
|
||||||
|
btm = "${pkgs.bottom}/bin/btm";
|
||||||
|
colors = with pkgs.rice; palette.toARGBHex rec {
|
||||||
|
|
||||||
normal = {
|
normal = {
|
||||||
foreground = colorPalette.normal.white;
|
foreground = colorPalette.normal.white;
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,14 @@
|
||||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
users.users.bertof = {
|
users.users.bertof = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = [ "wheel" "input" "usb" "network" "audio" ]; # Enable ‘sudo’ for the user.
|
extraGroups = [
|
||||||
|
"audio"
|
||||||
|
"input"
|
||||||
|
"libvirtd"
|
||||||
|
"network"
|
||||||
|
"usb"
|
||||||
|
"wheel"
|
||||||
|
];
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue