nix-config

My personal nixos and home-manager configuration
Log | Files | Refs | README

commit bc9123f63efbf0f2fab8a2557065c83196644ecf
parent c46aab59193accebd0675da6a0cc771cc8e68b08
Author: Benjamin Paul <bpaul848@gmail.com>
Date:   Sun,  9 May 2021 20:21:10 +1000

stuff

Diffstat:
Acustomize.nix | 9+++++++++
Mflake.nix | 9+++++++++
Mhome/home.nix | 10++--------
Mhome/modules/alacritty.nix | 72++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mhome/modules/default.nix | 1+
Mhome/modules/neovim/default.nix | 26++++++++++++++++++++------
Mhome/modules/polybar/default.nix | 54++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mhome/modules/polybar/settings.nix | 76+++++++++++++++++++++++-----------------------------------------------------
Ahome/modules/zathura.nix | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Ahome/themes/dracula/default.nix | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ahome/themes/gruvbox/default.nix | 102+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11 files changed, 400 insertions(+), 69 deletions(-)

diff --git a/customize.nix b/customize.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: + +pkgs.writeShellScriptBin "customize" '' + + +echo 'Pick a colour scheme' +theme=$(echo -e 'gruvbox\ndracula' | ${pkgs.fzf}/bin/fzf --reverse --height 10%) +somehow import home/themes/$theme in home flake +'' diff --git a/flake.nix b/flake.nix @@ -37,6 +37,15 @@ } ]; }; + + packages.x86_64-linux.customize = + with import nixpkgs { system = "x86_64-linux"; }; + pkgs.callPackage ./customize.nix { }; + + defaultApp.x86_64-linux = { + type = "app"; + program = "${self.packages.x86_64-linux.customize}/bin/customize"; + }; apps.x86_64-linux.home = { type = "app"; program = "${self.home.activationPackage}/activate"; diff --git a/home/home.nix b/home/home.nix @@ -5,12 +5,14 @@ imports = [ ./modules + ./themes/gruvbox ]; alacritty.enable = true; neovim.enable = true; polybar.enable = true; starship.enable = true; + zathura.enable = true; xinit = { enable = true; config = '' @@ -33,12 +35,4 @@ pkgs.i3lock-color pkgs.tree-sitter ]; - -# gtk = { -# enable = true; -# theme = { -# package = pkgs.gruvbox-dark-gtk; -# name = "Gruvbox Dark"; -# }; -# }; } diff --git a/home/modules/alacritty.nix b/home/modules/alacritty.nix @@ -2,9 +2,54 @@ with lib; +let + mkColourOption = name: default: mkOption { + type = types.str; + default = default; + example = "#123456"; + description = "Colour value for ${name}."; + }; + +in { options.alacritty = { enable = mkEnableOption "Alacritty"; + + font = mkOption { + type = types.str; + default = "Hack"; + example = "Hack"; + description = "Font used"; + }; + + colours = { + bg = mkColourOption "bg" "#1d1f21"; + fg = mkColourOption "fg" "#c5c8c6"; + + black = mkColourOption "black" "#1d1f21"; + black-bright = mkColourOption "black-bright" "#666666"; + + red = mkColourOption "red" "#cc6666"; + red-bright = mkColourOption "red-bright" "#d54e53"; + + green = mkColourOption "green" "#b5bd68"; + green-bright = mkColourOption "green-bright" "#b9ca4a"; + + yellow = mkColourOption "yellow" "#f0c674"; + yellow-bright = mkColourOption "yellow-bright" "#e7c547"; + + blue = mkColourOption "blue" "#81a2be"; + blue-bright = mkColourOption "blue-bright" "#7aa6da"; + + magenta = mkColourOption "magenta" "#b294bb"; + magenta-bright = mkColourOption "magenta-bright" "#c397d8"; + + cyan = mkColourOption "cyan" "#8abeb7"; + cyan-bright = mkColourOption "cyan-bright" "#70c0b1"; + + white = mkColourOption "white" "#c5c8c6"; + white-bright = mkColourOption "white-bright" "#eaeaea"; + }; }; config = mkIf config.alacritty.enable { @@ -31,6 +76,33 @@ with lib; style = "Bold Italic"; }; }; + + colors = { + primary = { + background = config.alacritty.colours.bg; + foreground = config.alacritty.colours.fg; + }; + normal = { + black = config.alacritty.colours.black; + red = config.alacritty.colours.red; + green = config.alacritty.colours.green; + yellow = config.alacritty.colours.yellow; + blue = config.alacritty.colours.blue; + magenta = config.alacritty.colours.magenta; + cyan = config.alacritty.colours.cyan; + white = config.alacritty.colours.white; + }; + bright = { + black-bright = config.alacritty.colours.black-bright; + red-bright = config.alacritty.colours.red-bright; + green-bright = config.alacritty.colours.green-bright; + yellow-bright = config.alacritty.colours.yellow-bright; + blue-bright = config.alacritty.colours.blue-bright; + magenta-bright = config.alacritty.colours.magenta-bright; + cyan-bright = config.alacritty.colours.cyan-bright; + white-bright = config.alacritty.colours.white-bright; + }; + }; }; }; }; diff --git a/home/modules/default.nix b/home/modules/default.nix @@ -3,6 +3,7 @@ ./alacritty.nix ./starship.nix ./xinit.nix + ./zathura.nix ./zsh.nix ./neovim ./polybar diff --git a/home/modules/neovim/default.nix b/home/modules/neovim/default.nix @@ -5,6 +5,20 @@ with lib; { options.neovim = { enable = mkEnableOption "Neovim"; + + colourSchemePackage = mkOption { + type = types.package; + default = pkgs.vimPlugins.gruvbox; + example = pkgs.vimPlugins.dracula-vim; + description = "Package of the vim colour scheme used."; + }; + + colourScheme = mkOption { + type = types.str; + default = "gruvbox"; + example = "blue"; + description = "What you would type in the colorscheme vim command (e.g. `colorscheme gruvbox`)."; + }; }; config = mkIf config.neovim.enable { @@ -33,12 +47,12 @@ with lib; au BufEnter *.lua lua lua() au BufEnter *.tex lua tex() ''; - plugins = with pkgs.vimPlugins; [ - { plugin = vim-nix; } - { plugin = idris2-vim; } - { plugin = gruvbox; config = "colorscheme gruvbox"; } - { plugin = nvim-lspconfig; } - { plugin = nvim-treesitter; config = "lua require'nvim-treesitter.configs'.setup{highlight={enable=true}}"; } + plugins = [ + { plugin = pkgs.vimPlugins.vim-nix; } + { plugin = pkgs.vimPlugins.idris2-vim; } + { plugin = config.neovim.colourSchemePackage; config = "colorscheme ${config.neovim.colourScheme}"; } + { plugin = pkgs.vimPlugins.nvim-lspconfig; } + { plugin = pkgs.vimPlugins.nvim-treesitter; config = "lua require'nvim-treesitter.configs'.setup{highlight={enable=true}}"; } ]; }; }; diff --git a/home/modules/polybar/default.nix b/home/modules/polybar/default.nix @@ -1,10 +1,60 @@ -{ config, pkgs, lib, ...}: +{ config, pkgs, lib, ... }: with lib; { options.polybar = { enable = mkEnableOption "Polybar"; + colours = { + background = mkOption { + type = types.str; + default = "#222"; + example = "#123456"; + description = "The background colour of the bar."; + }; + background-alt = mkOption { + type = types.str; + default = "#444"; + example = "#123456"; + description = "A colour that replaces the background in some modules."; + }; + foreground = mkOption { + type = types.str; + default = "#dfdfdf"; + example = "#123456"; + description = "The foreground (text) colour of the bar."; + }; + foreground-alt = mkOption { + type = types.str; + default = "#555"; + example = "#123456"; + description = "A colour that replaces the foreground in some modules."; + }; + alert = mkOption { + type = types.str; + default = "#bd2c40"; + example = "#123456"; + description = "A colour used when an alert happens (usually wm modules I think)."; + }; + wm-underline = mkOption { + type = types.str; + default = "#ffb52a"; + example = "#123456"; + description = "The colour used for underlining the wm module"; + }; + date-underline = mkOption { + type = types.str; + default = "#ffb52a"; + example = "#123456"; + description = "The colour used for underlining the date module"; + }; + battery-underline = mkOption { + type = types.str; + default = "#ffb52a"; + example = "#123456"; + description = "The colour used for underlining the battery module"; + }; + }; }; config = mkIf config.polybar.enable { @@ -23,7 +73,7 @@ with lib; polybar -rq bar & ''; - settings = import ./settings.nix; + settings = import ./settings.nix { inherit config; }; }; }; } diff --git a/home/modules/polybar/settings.nix b/home/modules/polybar/settings.nix @@ -1,14 +1,14 @@ +{ config, ... }: + let - #background = "\${xrdb:background}"; - background = "#222"; - background-alt = "#444"; - #foreground = "\${xrdb:background}"; - foreground = "#dfdfdf"; - foreground-alt = "#555"; - primary = "#ffb52a"; - secondary = "#e60053"; - alert = "#bd2c40"; -in { + background = config.polybar.colours.background; + background-alt = config.polybar.colours.background-alt; + foreground = config.polybar.colours.foreground; + foreground-alt = config.polybar.colours.foreground-alt; + alert = config.polybar.colours.alert; + +in +{ # Bars "bar/bar" = { font-0 = "HackNerdFont:size=10:antialias=true#3"; @@ -25,7 +25,7 @@ in { modules-left = "bspwm"; modules-center = "date"; - modules-right = "battery powermenu"; + modules-right = "battery"; }; # Modules @@ -35,7 +35,7 @@ in { label-focused = "%index%"; #label-focused = ""; label-focused-background = background-alt; - label-focused-underline= primary; + label-focused-underline = config.polybar.colours.wm-underline; label-focused-padding = 2; label-occupied = "%index%"; @@ -70,7 +70,7 @@ in { format = " <label>"; #format-background = background-alt; - format-underline = primary; + format-underline = config.polybar.colours.date-underline; format-padding = 2; }; @@ -82,17 +82,17 @@ in { format-charging = "<ramp-capacity> <label-charging>"; #format-charging-background = background-alt; - format-charging-underline = primary; + format-charging-underline = config.polybar.colours.battery-underline; format-charging-padding = 2; format-discharging = "<ramp-capacity> <label-discharging>"; #format-discharging-background = background-alt; - format-discharging-underline = primary; + format-discharging-underline = config.polybar.colours.battery-underline; format-discharging-padding = 2; format-full = "<ramp-capacity> <label-full>"; #format-full-background = background-alt; - format-full-underline = primary; + format-full-underline = config.polybar.colours.battery-underline; format-full-padding = 2; ramp-capacity-0 = " "; @@ -102,48 +102,18 @@ in { ramp-capacity-4 = " "; }; - "module/powermenu" = { - type = "custom/menu"; - - expand-right = "true"; - - format-spacing = 1; - - label-open = ""; - label-open-foreground = secondary; - label-close = " cancel"; - label-close-foreground = secondary; - label-separator = "|"; - label-separator-foreground = foreground-alt; - - menu-0-0 = "reboot"; - menu-0-0-exec = "menu-open-1"; - menu-0-1 = "power off"; - menu-0-1-exec = "menu-open-2"; - - menu-1-0 = "cancel"; - menu-1-0-exec = "menu-open-0"; - menu-1-1 = "reboot"; - menu-1-1-exec = "sudo reboot"; - - menu-2-0 = "power off"; - menu-2-0-exec = "sudo poweroff"; - menu-2-1 = "cancel"; - menu-2-1-exec = "menu-open-0"; - }; - "settings" = { - screenchange-reload = true; - #compositing-background = xor - #compositing-background = screen - #compositing-foreground = source - #compositing-border = over - #pseudo-transparency = false + screenchange-reload = true; + #compositing-background = xor + #compositing-background = screen + #compositing-foreground = source + #compositing-border = over + #pseudo-transparency = false }; "global/wm" = { margin-top = 5; margin-bottom = 5; }; -# vim:ft=dosini + # vim:ft=dosini } diff --git a/home/modules/zathura.nix b/home/modules/zathura.nix @@ -0,0 +1,50 @@ +{ config, pkgs, lib, ... }: + +with lib; + +{ + options.zathura = { + enable = mkEnableOption "Zathura"; + + colours = { + bg = mkOption { + type = types.str; + default = "#000000"; + example = "#123456"; + description = "Background colour"; + }; + bg2 = mkOption { + type = types.str; + default = "#000000"; + example = "#123456"; + description = "Alternative background colour"; + }; + fg = mkOption { + type = types.str; + default = "#ffffff"; + example = "#123456"; + description = "Foreground colour"; + }; + }; + }; + + config = mkIf config.zathura.enable { + programs.zathura = { + enable = true; + + options = { + selection-clipboard = "clipboard"; + recolor = "true"; + + statusbar-bg = config.zathura.colours.bg2; + statusbar-fg = config.zathura.colours.fg; + + default-bg = config.zathura.colours.bg; + recolor-lightcolor = config.zathura.colours.bg; + + default-fg = config.zathura.colours.fg; + recolor-darkcolor = config.zathura.colours.fg; + }; + }; + }; +} diff --git a/home/themes/dracula/default.nix b/home/themes/dracula/default.nix @@ -0,0 +1,60 @@ +{ pkgs, ... }: + +{ + home.stateVersion = "20.09"; + + imports = [ ../../modules ]; + + alacritty.colours = { + bg = "#282a36"; + fg = "#f8f8f2"; + + black = "#000000"; + black-bright = "#4d4d4d"; + + red = "#ff5555"; + red-bright = "#ff6e67"; + + green = "#50fa7b"; + green-bright = "#5af78e"; + + yellow = "#f1fa8c"; + yellow-bright = "#f4f99d"; + + blue = "#bd93f9"; + blue-bright = "#caa9fa"; + + magenta = "#ff79c6"; + magenta-bright = "#ff92d0"; + + cyan = "#8be9fd"; + cyan-bright = "#9aedfe"; + + white = "#bfbfbf"; + white-bright = "#e6e6e6"; + }; + + polybar.colours = { + background = "#282a36"; + background-alt = "#44475a"; + foreground = "#f8f8f2"; + foreground-alt = "#44475a"; + alert = "#ff5555"; + wm-underline = "#bd93f9"; + date-underline = "#f1fa8c"; + battery-underline = "#50fa7b"; + }; + + gtk = { + enable = true; + theme = { + package = pkgs.dracula-theme; + name = "Dracula"; + }; + }; + + neovim = { + colourSchemePackage = pkgs.vimPlugins.dracula-vim; + colourScheme = "dracula"; + }; +} diff --git a/home/themes/gruvbox/default.nix b/home/themes/gruvbox/default.nix @@ -0,0 +1,102 @@ +{ pkgs, ... }: + +let + red1 = "#cc241d"; + red2 = "#fb4934"; + + green1 = "#98971a"; + green2 = "#b8bb26"; + + yellow1 = "#d79921"; + yellow2 = "#fabd24"; + + blue1 = "#458588"; + blue2 = "#83a598"; + + magenta1 = "#b16286"; + magenta2 = "#d3869b"; + + cyan1 = "#689d6a"; + cyan2 = "#8ec07c"; + + grey1 = "#a89984"; + grey2 = "#928374"; + + orange1 = "#d65d0e"; + orange2 = "#fe8019"; + + bg = "#282828"; + bg0_h = "#1d2021"; + bg0_s = "#32302f"; + bg0 = "#282828"; + bg1 = "#3c3836"; + bg2 = "#504945"; + bg3 = "#665c54"; + bg4 = "#7c6f64"; + + fg = "#edbdd2"; + fg0 = "#fbf1c7"; + fg1 = "#ebdbb2"; + fb2 = "#d5c4a1"; + fg3 = "#bdae93"; + fg4 = "#a89984"; +in +{ + home.stateVersion = "20.09"; + + imports = [ ../../modules ]; + + alacritty.colours = { + bg = bg0_h; + fg = fg0; + + black = bg0_h; + black-bright = grey2; + + red = red1; + red-bright = red2; + + green = green1; + green-bright = green2; + + yellow = yellow1; + yellow-bright = yellow2; + + blue = blue1; + blue-bright = blue2; + + magenta = magenta1; + magenta-bright = magenta2; + + cyan = cyan1; + cyan-bright = cyan2; + + white = grey1; + white-bright = fg1; + }; + + polybar.colours = { + background = bg0_h; + background-alt = bg2; + foreground = fg0; + foreground-alt = fg4; # bg4? + alert = red2; + wm-underline = yellow1; + date-underline = yellow1; + battery-underline = yellow1; + }; + + zathura.colours = { + bg = bg0_h; + bg2 = bg2; + fg = fg1; + }; + + gtk = { + enable = true; + theme = { + package = pkgs.gruvbox-dark-gtk; + name = "gruvbox-dark"; + }; + }; +}