From 34e2f2666627a516a73df8f7c19b3abac75050d6 Mon Sep 17 00:00:00 2001 From: sefidel Date: Sat, 1 Jan 2022 01:44:39 +0900 Subject: home/neotheme: init --- flake.lock | 16 -- home/modules/default.nix | 1 + home/modules/misc/neotheme/default.nix | 59 ++++++ home/modules/profiles/base/config/foot.nix | 42 ++-- home/modules/profiles/base/config/sway.nix | 38 ++-- home/modules/profiles/base/config/waybar-style.nix | 24 ++- home/modules/profiles/base/default.nix | 232 ++++++++++++--------- 7 files changed, 249 insertions(+), 163 deletions(-) create mode 100644 home/modules/misc/neotheme/default.nix diff --git a/flake.lock b/flake.lock index 9c8f491..66ca3a2 100644 --- a/flake.lock +++ b/flake.lock @@ -106,21 +106,6 @@ "type": "github" } }, - "nix-colors": { - "locked": { - "lastModified": 1640790541, - "narHash": "sha256-9s8SYx3hpz/d1oHzbVBoUl4cgGIzOifSxx3+x9Gir24=", - "owner": "Misterio77", - "repo": "nix-colors", - "rev": "98e4275faa0f3a4b51bf14476be39947397a5ba0", - "type": "github" - }, - "original": { - "owner": "Misterio77", - "repo": "nix-colors", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1640861606, @@ -181,7 +166,6 @@ "home-manager": "home-manager", "master": "master", "neovim": "neovim", - "nix-colors": "nix-colors", "nixpkgs": "nixpkgs", "nixpkgs-extra": "nixpkgs-extra", "phocus": "phocus", diff --git a/home/modules/default.nix b/home/modules/default.nix index d290e17..a42c555 100644 --- a/home/modules/default.nix +++ b/home/modules/default.nix @@ -10,4 +10,5 @@ "programs/zshell" = import ./programs/zshell; "misc/home" = import ./misc/home; + "misc/neotheme" = import ./misc/neotheme; } diff --git a/home/modules/misc/neotheme/default.nix b/home/modules/misc/neotheme/default.nix new file mode 100644 index 0000000..74f2c74 --- /dev/null +++ b/home/modules/misc/neotheme/default.nix @@ -0,0 +1,59 @@ +{ lib, pkgs, config, ... }: + +with lib; +let cfg = config.neotheme; +in { + options.neotheme = { + wallpaper = mkOption { + type = types.str; + default = ""; + description = "path for wallpaper image file"; + example = "/weird/dir/wallpaper.png"; + }; + + palette = { + identifier = mkOption { + type = types.str; + default = ""; + description = "palette identifier"; + example = "mytheme"; + }; + + name = mkOption { + type = types.str; + default = ""; + description = "palette name"; + example = "My Amazing Theme"; + }; + + colors = let + mkColorOption = name: { + inherit name; + value = mkOption { + type = types.strMatching "[a-fA-F0-9]{6}"; + description = "color ${name}."; + }; + }; + in listToAttrs (map mkColorOption [ + "background" + "foreground" + "color0" + "color1" + "color2" + "color3" + "color4" + "color5" + "color6" + "color7" + "bright0" + "bright1" + "bright2" + "bright3" + "bright4" + "bright5" + "bright6" + "bright7" + ]); + }; + }; +} diff --git a/home/modules/profiles/base/config/foot.nix b/home/modules/profiles/base/config/foot.nix index d53dba7..c47f689 100644 --- a/home/modules/profiles/base/config/foot.nix +++ b/home/modules/profiles/base/config/foot.nix @@ -1,3 +1,7 @@ +{ neotheme }: + +with neotheme.palette.colors; + { main = { term = "foot"; @@ -11,23 +15,23 @@ cursor.style = "beam"; colors = { - background = "18191f"; - foreground = "cbc0ab"; - regular0 = "222329"; - regular1 = "b17f81"; - regular2 = "8aa387"; - regular3 = "d4ae80"; - regular4 = "8896ae"; - regular5 = "c495a2"; - regular6 = "7aacaa"; - regular7 = "d0d0c7"; - bright0 = "36373d"; - bright1 = "c59395"; - bright2 = "9eb79b"; - bright3 = "e8c294"; - bright4 = "9caac2"; - bright5 = "d8a9b6"; - bright6 = "8ec0be"; - bright7 = "e4e4db"; + background = background; + foreground = foreground; + regular0 = color0; + regular1 = color1; + regular2 = color2; + regular3 = color3; + regular4 = color4; + regular5 = color5; + regular6 = color6; + regular7 = color7; + bright0 = bright0; + bright1 = bright1; + bright2 = bright2; + bright3 = bright3; + bright4 = bright4; + bright5 = bright5; + bright6 = bright6; + bright7 = bright7; }; -} \ No newline at end of file +} diff --git a/home/modules/profiles/base/config/sway.nix b/home/modules/profiles/base/config/sway.nix index ead4bfe..f294af5 100644 --- a/home/modules/profiles/base/config/sway.nix +++ b/home/modules/profiles/base/config/sway.nix @@ -1,4 +1,6 @@ -{ pkgs, wallpapers }: +{ pkgs, neotheme }: + +with neotheme.palette.colors; '' exec autotiling @@ -157,22 +159,22 @@ gaps inner 8 smart_borders on - set $color0 #18191f - set $color1 #e27878 - set $color2 #b4be82 - set $color3 #e2a478 - set $color4 #84a0c6 - set $color5 #a093c7 - set $color6 #89b8c2 - set $color7 #c6c8d1 - set $color8 #3c3d43 - set $color9 #e98989 - set $color10 #c0ca8e - set $color11 #e9b189 - set $color12 #91acd1 - set $color13 #ada0d3 - set $color14 #95c4ce - set $color15 #d2d4de + set $color0 #${color0} + set $color1 #${color1} + set $color2 #${color2} + set $color3 #${color3} + set $color4 #${color4} + set $color5 #${color5} + set $color6 #${color6} + set $color7 #${color7} + set $color8 #${bright0} + set $color9 #${bright1} + set $color10 #${bright2} + set $color11 #${bright3} + set $color12 #${bright4} + set $color13 #${bright5} + set $color14 #${bright6} + set $color15 #${bright7} set $primary $color4 set $muted #4d698f @@ -182,7 +184,7 @@ client.focused_inactive $muted $muted $color0 $color5 client.unfocused $muted $muted $color7 $color5 client.urgent $color10 $color10 $color0 $color5 - output "*" bg ${wallpapers}/nixos/nix-glow-fg-d4ae80.png fill + output "*" bg ${neotheme.wallpaper} fill output "*" scale 1 output "*" scale_filter nearest diff --git a/home/modules/profiles/base/config/waybar-style.nix b/home/modules/profiles/base/config/waybar-style.nix index ccb88b2..c47ea23 100644 --- a/home/modules/profiles/base/config/waybar-style.nix +++ b/home/modules/profiles/base/config/waybar-style.nix @@ -1,3 +1,7 @@ +{ neotheme }: + +with neotheme.palette.colors; + '' * { border: none; @@ -8,20 +12,20 @@ } window#waybar { - background: #18191f; - color: #84a0c6; + background: #${background}; + color: #${foreground}; } #workspaces button { padding: 0 8px; - background: #84a0c6; - color: #18191f; + background: #${color4}; + color: #${background}; border-bottom: 3px solid rgba (255, 255, 255, .2); } #workspaces button.focused { - background-color: #84a0c6; - border-bottom: 3px solid #18191f; + background-color: #${color4}; + border-bottom: 3px solid #${background}; } #workspaces button:hover { @@ -43,15 +47,15 @@ #custom-weather { padding: 0 10px; margin: 0 4px; - color: #18191f; - background-color: #84a0c6; + color: #${background}; + background-color: #${color4}; border-bottom: 3px solid rgba (255, 255, 255, .2); } @keyframes blink { to { - background-color: #84a0c6; - color: #18191f; + background-color: #${color4}; + color: #${background}; } } '' diff --git a/home/modules/profiles/base/default.nix b/home/modules/profiles/base/default.nix index 96522ef..5b23f9e 100644 --- a/home/modules/profiles/base/default.nix +++ b/home/modules/profiles/base/default.nix @@ -2,122 +2,154 @@ let cfg = config.profiles.base; + neotheme = config.neotheme; + inherit (self.packages.x86_64-linux) neovim iosevka-pure-bin sf-mono-liga-bin phocus wallpapers; in - { - options.profiles.base.enable = lib.mkEnableOption - "The base profile, should be always enabled"; - - config = lib.mkIf cfg.enable { - home.sessionVariables = rec { - EDITOR = "nvim"; - VISUAL = "nvim"; - GIT_EDITOR = EDITOR; - }; - - gtk.enable = true; - gtk.iconTheme.package = pkgs.papirus-icon-theme; - gtk.iconTheme.name = "Papirus-Dark"; - gtk.theme.package = phocus; - gtk.theme.name = "phocus"; - - home.keyboard.layout = "us"; - home.packages = [ - pkgs.hydra-check - neovim - - # Fonts - iosevka-pure-bin - sf-mono-liga-bin - pkgs.dina-font - pkgs.sarasa-gothic - pkgs.scientifica - pkgs.jetbrains-mono - pkgs.twemoji-color-font - pkgs.symbola - pkgs.emacs-all-the-icons-fonts - (pkgs.nerdfonts.override { fonts = [ "Iosevka" "JetBrainsMono" ]; }) - ]; - - - wayland.windowManager.sway = { - enable = true; +{ + options.profiles.base.enable = lib.mkEnableOption + "The base profile, should be always enabled"; + + config = lib.mkIf cfg.enable { + home.sessionVariables = rec { + EDITOR = "nvim"; + VISUAL = "nvim"; + GIT_EDITOR = EDITOR; + }; - config = { - bars = [{ command = "${pkgs.waybar}/bin/waybar"; }]; - keybindings = { }; + gtk.enable = true; + gtk.iconTheme.package = pkgs.papirus-icon-theme; + gtk.iconTheme.name = "Papirus-Dark"; + gtk.theme.package = phocus; + gtk.theme.name = "phocus"; + + neotheme = { + wallpaper = "${wallpapers}/nixos/nix-glow-fg-d4ae80.png"; + + palette = { + identifier = "nightlamp"; + name = "Nightlamp Theme"; + + colors = { + background = "18191f"; + foreground = "cbc0ab"; + color0 = "222329"; + color1 = "b17f81"; + color2 = "8aa387"; + color3 = "d4ae80"; + color4 = "8896ae"; + color5 = "c495a2"; + color6 = "7aacaa"; + color7 = "d0d0c7"; + bright0 = "36373d"; + bright1 = "c59395"; + bright2 = "9eb79b"; + bright3 = "e8c294"; + bright4 = "9caac2"; + bright5 = "d8a9b6"; + bright6 = "8ec0be"; + bright7 = "e4e4db"; }; + }; + }; - extraConfig = import ./config/sway.nix { inherit pkgs wallpapers; }; + home.keyboard.layout = "us"; + home.packages = [ + pkgs.hydra-check + neovim + + # Fonts + iosevka-pure-bin + sf-mono-liga-bin + pkgs.dina-font + pkgs.sarasa-gothic + pkgs.scientifica + pkgs.jetbrains-mono + pkgs.twemoji-color-font + pkgs.symbola + pkgs.emacs-all-the-icons-fonts + (pkgs.nerdfonts.override { fonts = [ "Iosevka" "JetBrainsMono" ]; }) + ]; + + + wayland.windowManager.sway = { + enable = true; + + config = { + bars = [{ command = "${pkgs.waybar}/bin/waybar"; }]; + keybindings = { }; }; - programs = { - bat.enable = true; - direnv.enable = true; - direnv.nix-direnv.enable = true; - exa.enable = true; - exa.enableAliases = true; - home-manager.enable = true; - htop.enable = true; + extraConfig = import ./config/sway.nix { inherit pkgs neotheme; }; + }; - foot = { - enable = true; + programs = { + bat.enable = true; + direnv.enable = true; + direnv.nix-direnv.enable = true; + exa.enable = true; + exa.enableAliases = true; + home-manager.enable = true; + htop.enable = true; - settings = import ./config/foot.nix; - }; + foot = { + enable = true; - waybar = { - enable = config.wayland.windowManager.sway.enable; + settings = import ./config/foot.nix { inherit neotheme; }; + }; - settings = [ (import ./config/waybar-settings.nix) ]; + waybar = { + enable = config.wayland.windowManager.sway.enable; - style = import ./config/waybar-style.nix; - }; + settings = [ (import ./config/waybar-settings.nix) ]; - zsh = { - enable = true; - - enableCompletion = true; - enableAutosuggestions = true; - - autocd = true; - - dotDir = ".config/zsh"; - - plugins = [ - { - name = "powerlevel10k"; - src = pkgs.zsh-powerlevel10k; - file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; - } - - { - name = "powerlevel10k-config"; - src = lib.cleanSource ./p10k-config; - file = "p10k.zsh"; - } - - { - name = "zsh-syntax-highlighting"; - src = pkgs.fetchFromGitHub { - owner = "zsh-users"; - repo = "zsh-syntax-highlighting"; - rev = "0.7.1"; - sha256 = "03r6hpb5fy4yaakqm3lbf4xcvd408r44jgpv4lnzl9asp4sb9qc0"; - }; - } - ]; - - shellAliases = config.programs.zshell.aliases; - }; + style = import ./config/waybar-style.nix { inherit neotheme; }; }; - services.wlsunset = { + zsh = { enable = true; - latitude = "36.5"; - longitude = "127.2"; + + enableCompletion = true; + enableAutosuggestions = true; + + autocd = true; + + dotDir = ".config/zsh"; + + plugins = [ + { + name = "powerlevel10k"; + src = pkgs.zsh-powerlevel10k; + file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + } + + { + name = "powerlevel10k-config"; + src = lib.cleanSource ./p10k-config; + file = "p10k.zsh"; + } + + { + name = "zsh-syntax-highlighting"; + src = pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-syntax-highlighting"; + rev = "0.7.1"; + sha256 = "03r6hpb5fy4yaakqm3lbf4xcvd408r44jgpv4lnzl9asp4sb9qc0"; + }; + } + ]; + + shellAliases = config.programs.zshell.aliases; }; + }; - nixpkgs.allowedUnfree = [ "symbola" ]; + services.wlsunset = { + enable = true; + latitude = "36.5"; + longitude = "127.2"; }; - } + + nixpkgs.allowedUnfree = [ "symbola" ]; + }; +} -- cgit 1.4.1