This commit is contained in:
notgne2 2021-03-29 15:22:47 -07:00
commit d78da97be7
No known key found for this signature in database
GPG key ID: BB661E172B42A7F8
35 changed files with 6762 additions and 0 deletions

View file

@ -0,0 +1,370 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.colors;
pow = n: i: if i == 1 then n else if i == 0 then 1 else n * pow n (i - 1);
alf = [ "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f" ];
fil = c: lib.imap0 (n: x: if (lib.toLower x) == c then n else null) alf;
fin = c: builtins.elemAt (builtins.filter (x: x != null) (fil c)) 0;
add = l: lib.foldr ({ n, x }: c: (x * (pow 16 n)) + c) 0 (lib.imap0 (n: x: { inherit n x; }) l);
calc = s: add (builtins.map fin (builtins.filter (x: builtins.isString x && builtins.stringLength x == 1) (builtins.split "" s)));
hexToRgb = c:
let
s' = builtins.match "(..)(..)(..)|(.)(.)(.)" c;
ss = builtins.elemAt s';
o = if ss 0 == null then 3 else 0;
in
builtins.mapAttrs (_: calc) {
r = ss (0 + o);
g = ss (1 + o);
b = ss (2 + o);
};
in
{
options.colors = {
enable = mkEnableOption "Enable automatic colors";
i3BarColors = mkOption {
description = "Exported color attrset for i3bar/swaybar";
default = { };
};
waybarCss = mkOption {
description = "Exported CSS for waybar";
default = "";
};
base16Rgb = mkOption {
readOnly = true;
type = types.attrsOf (types.attrsOf types.int);
};
base16 = mkOption {
readOnly = true;
type = types.attrsOf types.str;
};
favColors = mkOption {
description = "Your favourite color scheme";
default = { };
type = types.submodule {
options = {
name = mkOption {
type = types.str;
default = "Monokai";
description = "Name of your color scheme";
};
base16 = mkOption {
type = types.attrsOf types.str;
default = {
base00 = "272822";
base01 = "383830";
base02 = "49483e";
base03 = "75715e";
base04 = "a59f85";
base05 = "f8f8f2";
base06 = "f5f4f1";
base07 = "f9f8f5";
base08 = "f92672";
base09 = "fd971f";
base0A = "f4bf75";
base0B = "a6e22e";
base0C = "a1efe4";
base0D = "66d9ef";
base0E = "ae81ff";
base0F = "cc6633";
};
description = "BASE16 color scheme";
};
};
};
};
};
config =
let
i3config = {
config = {
colors = {
background = "#${cfg.favColors.base16.base07}";
focused = {
border = "#${cfg.favColors.base16.base05}";
background = "#${cfg.favColors.base16.base0D}";
text = "#${cfg.favColors.base16.base00}";
indicator = "#${cfg.favColors.base16.base0D}";
childBorder = "#${cfg.favColors.base16.base0D}";
};
focusedInactive = {
border = "#${cfg.favColors.base16.base01}";
background = "#${cfg.favColors.base16.base01}";
text = "#${cfg.favColors.base16.base05}";
indicator = "#${cfg.favColors.base16.base03}";
childBorder = "#${cfg.favColors.base16.base01}";
};
unfocused = {
border = "#${cfg.favColors.base16.base01}";
background = "#${cfg.favColors.base16.base00}";
text = "#${cfg.favColors.base16.base05}";
indicator = "#${cfg.favColors.base16.base01}";
childBorder = "#${cfg.favColors.base16.base01}";
};
urgent = {
border = "#${cfg.favColors.base16.base08}";
background = "#${cfg.favColors.base16.base08}";
text = "#${cfg.favColors.base16.base00}";
indicator = "#${cfg.favColors.base16.base08}";
childBorder = "#${cfg.favColors.base16.base08}";
};
placeholder = {
border = "#${cfg.favColors.base16.base00}";
background = "#${cfg.favColors.base16.base00}";
text = "#${cfg.favColors.base16.base05}";
indicator = "#${cfg.favColors.base16.base00}";
childBorder = "#${cfg.favColors.base16.base00}";
};
};
};
};
elementTheme = {
name = "Nix colors 11";
is_dark = true;
colors = {
"accent-color" = "#${cfg.favColors.base16.base02}";
"primary-color" = "#${cfg.favColors.base16.base08}";
"warning-color" = "#${cfg.favColors.base16.base0F}";
"sidebar-color" = "#${cfg.favColors.base16.base01}";
"roomlist-background-color" = "#${cfg.favColors.base16.base00}";
"roomlist-text-color" = "#${cfg.favColors.base16.base05}";
"roomlist-text-secondary-color" = "${cfg.favColors.base16.base06}";
"roomlist-highlights-color" = "#${cfg.favColors.base16.base02}";
"roomlist-separator-color" = "#${cfg.favColors.base16.base05}";
"timeline-background-color" = "#${cfg.favColors.base16.base00}";
"timeline-text-color" = "#${cfg.favColors.base16.base07}";
"timeline-text-secondary-color" = "#${cfg.favColors.base16.base05}";
"timeline-highlights-color" = "#${cfg.favColors.base16.base02}";
"reaction-row-button-selected-bg-color" = "#${cfg.favColors.base16.base0B}";
};
};
elementConfig = {
settingDefaults.custom_themes = [ elementTheme ];
settingDefaults.theme = "custom-${elementTheme.name}";
default_theme = "custom-${elementTheme.name}";
showLabsSettings = true;
};
in
mkIf cfg.enable {
# Read only utility attributes
colors.base16 = cfg.favColors.base16;
colors.base16Rgb = builtins.map hexToRgb cfg.favColors.base16;
# Element
xdg.configFile."Riot/config.json".text = builtins.toJSON elementConfig;
xdg.configFile."Element/config.json".text = builtins.toJSON elementConfig;
xdg.configFile."element_theme.json".text = builtins.toJSON elementTheme;
# Mako
programs.mako = {
backgroundColor = "#${cfg.favColors.base16.base00}";
textColor = "#${cfg.favColors.base16.base07}";
borderColor = "#${cfg.favColors.base16.base08}";
progressColor = "over #${cfg.favColors.base16.base0D}";
};
# I3/sway
wayland.windowManager.sway = i3config;
xsession.windowManager.i3 = i3config;
colors.i3BarColors = {
background = "#${cfg.favColors.base16.base00}";
separator = "#${cfg.favColors.base16.base01}";
statusline = "#${cfg.favColors.base16.base04}";
focusedWorkspace = {
border = "#${cfg.favColors.base16.base05}";
background = "#${cfg.favColors.base16.base0D}";
text = "#${cfg.favColors.base16.base00}";
};
activeWorkspace = {
border = "#${cfg.favColors.base16.base05}";
background = "#${cfg.favColors.base16.base03}";
text = "#${cfg.favColors.base16.base00}";
};
inactiveWorkspace = {
border = "#${cfg.favColors.base16.base03}";
background = "#${cfg.favColors.base16.base01}";
text = "#${cfg.favColors.base16.base05}";
};
urgentWorkspace = {
border = "#${cfg.favColors.base16.base08}";
background = "#${cfg.favColors.base16.base08}";
text = "#${cfg.favColors.base16.base00}";
};
bindingMode = {
border = "#${cfg.favColors.base16.base00}";
background = "#${cfg.favColors.base16.base0A}";
text = "#${cfg.favColors.base16.base00}";
};
};
# Waybar
colors.waybarCss =
"\n" + (
(import ../data/waybar-base16.nix)
cfg.favColors.name
cfg.base16
);
# Dunst
services.dunst = {
settings = {
global = {
frame_color = "#${cfg.favColors.base16.base09}";
separator_color = "#${cfg.favColors.base16.base05}";
};
urgency_low = {
background = "#${cfg.favColors.base16.base01}";
foreground = "#${cfg.favColors.base16.base03}";
};
urgency_normal = {
background = "#${cfg.favColors.base16.base02}";
foreground = "#${cfg.favColors.base16.base05}";
};
urgency_critical = {
background = "#${cfg.favColors.base16.base08}";
foreground = "#${cfg.favColors.base16.base06}";
};
};
};
# Rofi
programs.rofi = {
theme = (
pkgs.writeText "rofi-base16-config"
(
(import ../data/rofi-base16.nix)
cfg.favColors.name
cfg.favColors.base16
)
).outPath;
};
# Kitty
programs.kitty.extraConfig =
let
kittyColors =
pkgs.writeText
"favcolors-kitty-${cfg.favColors.name}.conf"
(
(import ../data/kitty-base16.nix)
cfg.favColors.name
cfg.favColors.base16
);
in
''
include ${kittyColors}
'';
# neovim
xdg.configFile."nvim/colors/base16.vim".text = import ../data/vim-base16.nix cfg.favColors.name cfg.favColors.base16;
programs.neovim.extraConfig = ''
colorscheme base16
set termguicolors
'';
# GTK
gtk = {
enable = true;
theme =
let
materia_colors = pkgs.writeText "gtk-generated-colors" ''
BG=${cfg.favColors.base16.base00}
FG=${cfg.favColors.base16.base07}
BTN_BG=${cfg.favColors.base16.base00}
BTN_FG=${cfg.favColors.base16.base07}
MENU_BG=${cfg.favColors.base16.base00}
MENU_FG=${cfg.favColors.base16.base07}
ACCENT_BG=${cfg.favColors.base16.base02}
SEL_BG=${cfg.favColors.base16.base0D}
SEL_FG=${cfg.favColors.base16.base00}
TXT_BG=${cfg.favColors.base16.base00}
TXT_FG=${cfg.favColors.base16.base07}
HDR_BTN_BG=${cfg.favColors.base16.base00}
HDR_BTN_FG=${cfg.favColors.base16.base07}
WM_BORDER_FOCUS=${cfg.favColors.base16.base02}
WM_BORDER_UNFOCUS=${cfg.favColors.base16.base01}
MATERIA_STYLE_COMPACT=True
MATERIA_COLOR_VARIANT=dark
UNITY_DEFAULT_LAUNCHER_STYLE=False
NAME=generated
'';
generated-gtk-theme = pkgs.stdenv.mkDerivation {
name = "generated-gtk-theme";
src = pkgs.materia-theme.src;
buildInputs = with pkgs; [ sassc bc which inkscape optipng ];
installPhase = ''
HOME=/build
chmod 777 -R .
patchShebangs .
mkdir -p $out/share/themes
substituteInPlace change_color.sh --replace "\$HOME/.themes" "$out/share/themes"
echo "Changing colours:"
./change_color.sh -o Generated ${materia_colors}
chmod 555 -R .
'';
};
in
{
name = "Generated";
package = generated-gtk-theme;
};
gtk2.extraConfig = (
(import ../data/gtk2-base16.nix)
cfg.favColors.name
cfg.favColors.base16
);
};
# Codium/VSCODE
programs.vscode.userSettings = {
"workbench.colorTheme" = "nix colors";
};
home.file = lib.mkMerge
[
(mkIf config.programs.vscode.enable {
".vscode-oss/extensions/base16-1.0.0/themes/nix-colors.json".text = (import ../data/codium-base16.nix) cfg.favColors.name cfg.favColors.base16;
".vscode-oss/extensions/base16-1.0.0/package.json".text = builtins.toJSON {
name = "nix colors";
displayName = "Automatic Nix-generated base16 colors";
version = "1.0.0";
publisher = "colors";
author = {
name = "ezpc usr";
email = "usr@ezpc";
};
engines.vscode = "^1.11.1";
categories = "Themes";
contributes.themes = [
{
label = "nix colors";
uiTheme = "vs-dark";
path = "./themes/nix-colors.json";
}
];
};
})
];
};
}

View file

@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
{
imports = [
(lib.mkAliasOptionModule [ "ezpcusr" "favColors" ] [ "colors" "favColors" ])
(lib.mkAliasOptionModule [ "ezpcusr" "favFont" ] [ "fonts" "favFont" ])
(lib.mkAliasOptionModule [ "ezpcusr" "waybarCss" ] [ "programs" "waybar" "style" ])
./ezpcusr.nix
./ezchromium.nix
./ezcodium.nix
./colors.nix
./fonts.nix
];
}

View file

@ -0,0 +1,128 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.ez.chromium;
in
{
options.ez.chromium = {
enable = mkEnableOption "Enable simple Chromium config";
extensions = mkOption {
description = "List of extensions to be automatically installed";
type = types.listOf (types.submodule {
options = {
id = mkOption {
description = "ID of the extension on the store";
type = types.str;
};
hash = mkOption {
description = "Hash of the extension file";
type = types.nullOr types.str;
default = null;
};
name = mkOption {
description = "Name of the extension (in path form)";
type = types.str;
};
url = mkOption {
description = "URL of the extension if not on the chrome store";
type = types.nullOr types.str;
default = null;
};
};
}
);
};
};
config = mkIf cfg.enable {
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium.override {
commandLineArgs = "--enable-features=VaapiVideoDecoder";
};
};
home.file =
let
splitVersion = builtins.splitVersion pkgs.ungoogled-chromium.version;
basicVersion = "${elemAt splitVersion 0}.${elemAt splitVersion 1}";
extensionJson = ext: {
name = "${config.xdg.configHome}/chromium/External Extensions/${ext.id}.json";
value.text = builtins.toJSON (({
external_version = "0.420.69";
}) // (if ext.hash == null then {
external_update_url = "https://clients2.google.com/service/update2/crx";
} else {
external_crx = builtins.fetchurl {
name = "${ext.name}";
url = if ext.url != null then ext.url else "https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx2,crx3&prodversion=${basicVersion}&x=id%3D${ext.id}%26installsource%3Dondemand%26uc";
sha256 = ext.hash;
};
}));
};
in
listToAttrs (map extensionJson cfg.extensions);
ez.chromium.extensions = [
{
id = "plfoiobmoplmhebmdiofljgnbekcdjan";
hash = "1ml5f3nc6g07idvj85yk2bgkqpgbgd1a78g2zb0vqrmv211vqnzb";
name = "ruffle";
url = "https://github.com/ruffle-rs/ruffle/releases/download/nightly-2021-02-21/ruffle_nightly_2021_02_21_extension.zip";
}
{
id = "cjpalhdlnbpafiamejdnhcphjbkeiagm";
# hash = "0klh5js0bpf21fqasx56kqipsv6dj29fz1jxjl49pwzk16bz8p1v";
name = "ublock-origin";
}
{
id = "eimadpbcbfnmbkopoojfekhnkhdbieeh";
# hash = "085ysd0xxp1dpw6q4cngplnj51m1l1k3xkbf433hxrpaxlm0vafr";
name = "dark-reader";
}
{
id = "nngceckbapebfimnlniiiahkandclblb";
# hash = "0gi23wy5a1l22hbln4mfvwa6f6c0cbzbaj9nvv8fkv97d1m5nlca";
name = "bitwarden";
}
{
url = "https://github.com/NeverDecaf/chromium-web-store/releases/download/v1.2.3/Chromium.Web.Store.crx";
id = "ocaahdebbfolfmndjeplogmgcagdmblk";
hash = "1v1c8q43y2gmsygacvri0cshfjgybxsasaf0c7cxwgnsx2kf98xh";
name = "chromium-web-store";
}
{
id = "lanfdkkpgfjfdikkncbnojekcppdebfp";
# hash = "02dhazdxl1jm6nx8dkxk9dc0l0kqyfypj3sl1vmic1sqgib0nb5v";
name = "canvas-fingerprint-defend";
}
{
id = "fhkphphbadjkepgfljndicmgdlndmoke";
# hash = "05yf2677s2scr3w8f6x93gv83cssy62h4v18gc2yigpgr2y3df7g";
name = "font-fingerprint-defend";
}
{
id = "olnbjpaejebpnokblkepbphhembdicik";
# hash = "088gc2is92nkn5yrjc65657w0vvkkhks371c92ndz6w5mrc39xmw";
name = "webgl-fingerprint-defend";
}
{
id = "pcbjiidheaempljdefbdplebgdgpjcbe";
# hash = "06rirbbp037yd6d3xsrc383k0n2y5rh7j69zax6mpzjx3zyvzkmn";
name = "audio-fingerprint-defend";
}
# {
# id = "npeicpdbkakmehahjeeohfdhnlpdklia";
# hash = "1sfwfa28lrkq3df3r1645vy1qih9qc8x764bc5x2i2hrmg2vb8wp";
# name = "webrtc-network-limiter";
# }
{
id = "dhdgffkkebhmkfjojejmpbldmpobfkfo";
# hash = "06acbcwwp3l9c6d178rq6my2pspl9gvqgp8l81al8pbbmwkfyjqv";
name = "tampermonkey";
}
];
};
}

View file

@ -0,0 +1,73 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.ez.codium;
in
{
options.ez.codium = {
enable = mkEnableOption "Enable simple codium config";
};
config = mkIf cfg.enable {
programs.vscode.package = lib.mkDefault pkgs.vscodium;
programs.vscode.extensions = with pkgs.vscode-extensions; [ vscodevim.vim bbenoist.Nix llvm-org.lldb-vscode ms-python.python ms-vscode-remote.remote-ssh redhat.vscode-yaml skyapps.fish-vscode ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
# programs.vscode.extensions = with pkgs.vscode-extensions; [ vscodevim.vim bbenoist.Nix llvm-org.lldb-vscode matklad.rust-analyzer ms-python.python ms-vscode-remote.remote-ssh redhat.vscode-yaml skyapps.fish-vscode ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [
{
name = "bracket-pair-colorizer";
publisher = "CoenraadS";
version = "1.0.61";
sha256 = "0r3bfp8kvhf9zpbiil7acx7zain26grk133f0r0syxqgml12i652";
}
{
name = "vscode-direnv";
publisher = "Rubymaniac";
version = "0.0.2";
sha256 = "1gml41bc77qlydnvk1rkaiv95rwprzqgj895kxllqy4ps8ly6nsd";
}
{
name = "nixpkgs-fmt";
publisher = "B4dM4n";
version = "0.0.1";
sha256 = "1gvjqy54myss4w1x55lnyj2l887xcnxc141df85ikmw1gr9s8gdz";
}
{
name = "elm-ls-vscode";
publisher = "Elmtooling";
version = "1.3.0";
sha256 = "0h0pibjq1rk7ji4f342vqky2zbq3f4fg1y260rig7y6x3z4007h3";
}
];
programs.vscode.userSettings = {
"editor.selectionClipboard" = "native";
"editor.emptySelectionClipboard" = true;
"editor.dragAndDrop" = false;
"editor.renderWhitespace" = "all";
"editor.tabSize" = 2;
"editor.wordWrap" = "on";
"telemetry.enableTelemetry" = false;
"telemetry.enableCrashReporter" = false;
"window.titleBarStyle" = "native";
"window.menuBarVisibility" = "toggle";
"explorer.confirmDragAndDrop" = false;
"git.enableSmartCommit" = true;
"git.autofetch" = true;
"workbench.startupEditor" = "newUntitledFile";
"vim.easymotion" = true;
"vim.camelCaseMotion.enable" = true;
"vim.useSystemClipboard" = true;
"editor.formatOnSave" = true;
"elmLS.elmPath" = "${pkgs.elmPackages.elm}/bin/elm";
"elmLS.elmFormatPath" = "${pkgs.elmPackages.elm-format}/bin/elm-format";
"elmLS.elmAnalyseTrigger" = "change";
};
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,64 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.fonts;
in
{
options.fonts = {
enable = mkEnableOption "Enable automatic fonts";
favFont = mkOption {
description = "Your favourite font";
default = { };
type = types.submodule {
options = {
name = mkOption {
type = types.str;
default = "Monoid Nerd Font Mono";
description = "Name of your font";
};
package = mkOption {
type = types.package;
default = pkgs.nerdfonts.override { fonts = [ "Hack" "Monoid" "Hermit" ]; };
description = "Package for your font";
};
size = mkOption {
type = types.int;
default = 10;
description = "Size for your font";
};
};
};
};
};
config =
mkIf cfg.enable {
home.packages = [ cfg.favFont.package ];
programs.vscode.userSettings = {
"editor.fontFamily" = "\"${cfg.favFont.name}\"";
};
gtk.font = {
package = cfg.favFont.package;
name = "${cfg.favFont.name} ${toString cfg.favFont.size}";
};
programs.kitty.settings = {
font_family = cfg.favFont.name;
font_size = cfg.favFont.size;
};
programs.rofi.font = "${cfg.favFont.name} ${toString cfg.favFont.size}";
programs.mako.font = "${cfg.favFont.name} ${toString cfg.favFont.size}";
wayland.windowManager.sway.config.fonts = [ cfg.favFont.name ];
xsession.windowManager.i3.config.fonts = [ cfg.favFont.name ];
programs.neovim.extraConfig = ''
set guifont=${lib.replaceChars [ " " ] [ "\\ " ] cfg.favFont.name}:h${toString (cfg.favFont.size + 0.5)}
'';
};
}