From 33d41f425644e9d1bc1204e37d6ad8434c5e9d2d Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 2 Jun 2024 14:30:14 +0100 Subject: [PATCH] rice --- flake.lock | 51 +++++++++++++++++++ flake.nix | 5 +- home/common/core/default.nix | 4 +- home/common/core/nixvim.nix | 29 ++++++++++- home/common/core/zsh.nix | 39 ++++++++++---- .../optional/desktop/common/alacritty.nix | 32 +++++++++++- .../optional/desktop/common/default.nix | 1 + .../optional/desktop/hyprland/default.nix | 14 +++-- home/common/optional/desktop/mako.nix | 12 +++++ home/semita.nix | 3 ++ 10 files changed, 169 insertions(+), 21 deletions(-) create mode 100644 home/common/optional/desktop/mako.nix diff --git a/flake.lock b/flake.lock index d75fa14..4032baa 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "base16-schemes": { + "flake": false, + "locked": { + "lastModified": 1696158499, + "narHash": "sha256-5yIHgDTPjoX/3oDEfLSQ0eJZdFL1SaCfb9d6M0RmOTM=", + "owner": "tinted-theming", + "repo": "base16-schemes", + "rev": "a9112eaae86d9dd8ee6bb9445b664fba2f94037a", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-schemes", + "type": "github" + } + }, "devshell": { "inputs": { "flake-utils": "flake-utils", @@ -231,6 +247,25 @@ "type": "github" } }, + "nix-colors": { + "inputs": { + "base16-schemes": "base16-schemes", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1707825078, + "narHash": "sha256-hTfge2J2W+42SZ7VHXkf4kjU+qzFqPeC9k66jAUBMHk=", + "owner": "misterio77", + "repo": "nix-colors", + "rev": "b01f024090d2c4fc3152cd0cf12027a7b8453ba1", + "type": "github" + }, + "original": { + "owner": "misterio77", + "repo": "nix-colors", + "type": "github" + } + }, "nix-darwin": { "inputs": { "nixpkgs": [ @@ -282,6 +317,21 @@ "type": "indirect" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1697935651, + "narHash": "sha256-qOfWjQ2JQSQL15KLh6D7xQhx0qgZlYZTYlcEiRuAMMw=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e1e11fdbb01113d85c7f41cada9d2847660e3902", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1716655032, @@ -347,6 +397,7 @@ "disko": "disko", "home-manager": "home-manager", "impermanence": "impermanence", + "nix-colors": "nix-colors", "nix-secrets": "nix-secrets", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", diff --git a/flake.nix b/flake.nix index dc26e45..69da67a 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,9 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + # Nix colors + nix-colors.url = "github:misterio77/nix-colors"; + # Declarative partitioning and formatting disko = { url = "github:nix-community/disko"; @@ -49,7 +52,7 @@ disko, #impermanence, ... - } @ inputs: + } @ inputs: let inherit (self) outputs; systems = [ diff --git a/home/common/core/default.nix b/home/common/core/default.nix index 71712c1..b3dc7d5 100644 --- a/home/common/core/default.nix +++ b/home/common/core/default.nix @@ -1,12 +1,12 @@ -{ config, lib, pkgs, outputs, ... }: +{ config, lib, pkgs, outputs, inputs, ... }: { imports = [ + inputs.nix-colors.homeManagerModules.default ./zsh.nix ./nixvim.nix ./fonts.nix ] ; - # Global home packages without config go here (for all hosts and users) home.packages = builtins.attrValues { inherit (pkgs) diff --git a/home/common/core/nixvim.nix b/home/common/core/nixvim.nix index fde5a9c..9e66742 100644 --- a/home/common/core/nixvim.nix +++ b/home/common/core/nixvim.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: { +{ inputs, pkgs, config, ... }: { imports = [ inputs.nixvim.homeManagerModules.nixvim ]; @@ -23,6 +23,29 @@ }; }; + # Base16 colorscheme +# colorschemes.base16 = { +# enable = true; +# colorscheme = { +# base00 = "#${config.colorScheme.colors.base00}"; +# base01 = "#${config.colorScheme.colors.base01}"; +# base02 = "#${config.colorScheme.colors.base02}"; +# base03 = "#${config.colorScheme.colors.base03}"; +# base04 = "#${config.colorScheme.colors.base04}"; +# base05 = "#${config.colorScheme.colors.base05}"; +# base06 = "#${config.colorScheme.colors.base06}"; +# base07 = "#${config.colorScheme.colors.base07}"; +# base08 = "#${config.colorScheme.colors.base08}"; +# base09 = "#${config.colorScheme.colors.base09}"; +# base0A = "#${config.colorScheme.colors.base0A}"; +# base0B = "#${config.colorScheme.colors.base0B}"; +# base0C = "#${config.colorScheme.colors.base0C}"; +# base0D = "#${config.colorScheme.colors.base0D}"; +# base0E = "#${config.colorScheme.colors.base0E}"; +# base0F = "#${config.colorScheme.colors.base0F}"; +# }; +# }; + opts = { # # ========= General Appearance ========= @@ -101,6 +124,10 @@ fileTypes = [ "*" ]; }; + plugins.treesitter = { + enable = true; + }; + plugins.lualine = { enable = true; theme = "auto"; diff --git a/home/common/core/zsh.nix b/home/common/core/zsh.nix index 9facad2..c0cba1b 100644 --- a/home/common/core/zsh.nix +++ b/home/common/core/zsh.nix @@ -5,15 +5,15 @@ enableCompletion = true; autosuggestion.enable = true; syntaxHighlighting.enable = true; - + shellAliases = { ll = "ls -l"; }; history.size = 10000; history.path = "${config.xdg.dataHome}/zsh/history"; - initExtra = '' - bindkey -v + initExtra = '' + bindkey -v bindkey "^H" backward-delete-char bindkey "^?" backward-delete-char set -o vi @@ -22,11 +22,11 @@ if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then SESSION_TYPE="(ssh) " fi - + #### # Format prompt #### - + # Define colors COLOR_RED="red" COLOR_MAGENTA="92" @@ -34,20 +34,20 @@ COLOR_GREEN="36" COLOR_BLUE="4" COLOR_WHITE="7" - + # Format git colors autoload -Uz compinit && compinit autoload -Uz add-zsh-hook autoload -Uz vcs_info add-zsh-hook precmd vcs_info - + zstyle ':vcs_info:*' enable git zstyle ':vcs_info:*' formats " %F{cyan}%c%u(%b)%f" zstyle ':vcs_info:*' actionformats " %F{cyan}%c%u(%b)%f %a" zstyle ':vcs_info:*' stagedstr "%F{$COLOR_RED}" zstyle ':vcs_info:*' unstagedstr "%F{$COLOR_RED}" zstyle ':vcs_info:*' check-for-changes true - + zstyle ':vcs_info:git*+set-message:*' hooks git-untracked +vi-git-untracked() { if git --no-optional-locks status --porcelain 2> /dev/null | grep -q "^??"; then @@ -58,7 +58,7 @@ hook_com[staged]+="%F{$COLOR_GREEN}" fi } - + # Format prompt setopt PROMPT_SUBST PROMPT='%F{'$COLOR_GREEN'}'$(echo "$SESSION_TYPE")''' @@ -77,11 +77,28 @@ setopt autocd # Automatically cd into typed directory. stty stop undef # Disable ctrl-s to freeze terminal. setopt interactive_comments - + # General opts HISTSIZE=10000000 SAVEHIST=10000000 setopt appendhistory + + # Change cursor shape for different vi modes. + function zle-keymap-select () { + case $KEYMAP in + vicmd) echo -ne '\e[1 q';; # block + viins|main) echo -ne '\e[5 q';; # beam + esac + } + zle -N zle-keymap-select + zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" + } + zle -N zle-line-init + echo -ne '\e[5 q' # Use beam shape cursor on startup. + preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. + ''; }; -} +} diff --git a/home/common/optional/desktop/common/alacritty.nix b/home/common/optional/desktop/common/alacritty.nix index 71dd7c0..20ecd39 100644 --- a/home/common/optional/desktop/common/alacritty.nix +++ b/home/common/optional/desktop/common/alacritty.nix @@ -7,6 +7,37 @@ in enable = true; settings = { + colors = with config.colorScheme.palette; { + bright = { + black = "0x${base03}"; + blue = "0x${base04}"; + cyan = "0x${base0F}"; + green = "0x${base01}"; + magenta = "0x${base06}"; + red = "0x${base09}"; + white = "0x${base07}"; + yellow = "0x${base02}"; + }; + cursor = { + cursor = "0x${base05}"; + text = "0x${base00}"; + }; + normal = { + black = "0x${base00}"; + blue = "0x${base0D}"; + cyan = "0x${base0C}"; + green = "0x${base0B}"; + magenta = "0x${base0E}"; + red = "0x${base08}"; + white = "0x${base05}"; + yellow = "0x${base0A}"; + }; + primary = { + background = "0x${base00}"; + foreground = "0x${base05}"; + }; + }; + window.padding = { x = 5; y = 5; @@ -14,7 +45,6 @@ in shell.program = "${pkgs.zsh}/bin/zsh"; - cursor.style = "Beam"; }; }; } diff --git a/home/common/optional/desktop/common/default.nix b/home/common/optional/desktop/common/default.nix index 3bbbc74..3c8fb38 100644 --- a/home/common/optional/desktop/common/default.nix +++ b/home/common/optional/desktop/common/default.nix @@ -6,6 +6,7 @@ # Global packages for desktop environments home.packages = [ pkgs.alacritty + pkgs.libnotify pkgs.zathura pkgs.xfce.thunar pkgs.wofi diff --git a/home/common/optional/desktop/hyprland/default.nix b/home/common/optional/desktop/hyprland/default.nix index d73886f..689b2eb 100644 --- a/home/common/optional/desktop/hyprland/default.nix +++ b/home/common/optional/desktop/hyprland/default.nix @@ -9,6 +9,7 @@ ../wallpaper-changer/swww-wallpaper-changer ../common ../waybar.nix + ../mako.nix ]; wayland.windowManager.hyprland = { enable = true; @@ -21,9 +22,12 @@ "systemctl --user start hyprland-session.target" ]; }; - extraConfig = let - monitor = "${toString (builtins.map (m: "monitor=${ m.name },${ toString( m.width ) }x${ toString( m.height ) }@${ toString( m.refreshRate ) },${ toString( m.x ) }x${ toString( m.y ) },${ toString( m.scale ) }\n") config.monitors)}"; - in '' + extraConfig = + let + monitor = "${toString (builtins.map (m: "monitor=${ m.name },${ toString( m.width ) }x${ toString( m.height ) }@${ toString( m.refreshRate ) },${ toString( m.x ) }x${ toString( m.y ) },${ toString( m.scale ) }\n") config.monitors)}"; + active = "rgba(${config.colorScheme.colors.base08}ee)"; + inactive = "rgba(${config.colorScheme.colors.base0C}ee)"; + in '' ${monitor} $terminal = alacritty @@ -51,8 +55,8 @@ gaps_in = 10 gaps_out = 10 border_size = 2 - col.active_border = rgba(22ff00ee) - col.inactive_border = rgba(aecbb4ee) + col.active_border = ${active} + col.inactive_border = ${inactive} layout = dwindle allow_tearing = false } diff --git a/home/common/optional/desktop/mako.nix b/home/common/optional/desktop/mako.nix new file mode 100644 index 0000000..77db759 --- /dev/null +++ b/home/common/optional/desktop/mako.nix @@ -0,0 +1,12 @@ +{ pkgs, config, ... }: +{ + services.mako = { + enable = true; + backgroundColor = "#${config.colorScheme.colors.base00}"; + borderColor = "#${config.colorScheme.colors.base0D}"; + borderRadius = 5; + borderSize = 2; + textColor = "#${config.colorScheme.colors.base05}"; + layer = "overlay"; + }; +} diff --git a/home/semita.nix b/home/semita.nix index 9d87d88..9d60cf1 100644 --- a/home/semita.nix +++ b/home/semita.nix @@ -2,6 +2,7 @@ pkgs, config, lib, + inputs, ... }: { imports = [ @@ -18,6 +19,8 @@ ]; + colorScheme = inputs.nix-colors.colorSchemes.kanagawa; + monitors = [ { name = "DP-1";