Skip to content

Instantly share code, notes, and snippets.

@ccarlile
Created December 11, 2023 22:06
Show Gist options
  • Save ccarlile/379708c89d1e54de92d4533a48f8da15 to your computer and use it in GitHub Desktop.
Save ccarlile/379708c89d1e54de92d4533a48f8da15 to your computer and use it in GitHub Desktop.
{ pkgs, unstable, ...}:
with pkgs;
let
my-python-packages = ps: with ps; [
pandas
];
in
{
home.packages = [
#development
silver-searcher
ripgrep
ammonite
elmPackages.elm-language-server
nodePackages.typescript-language-server
kakoune
sbt
sqlite
nodejs
libvterm-neovim
apacheKafka
zookeeper
kafkacat
arion
guile
jq
purescript
spago
coreutils
findutils
gnugrep
gnused
(python310.withPackages my-python-packages)
metals
rust-analyzer
# cli utils
tree
wget
bat
awscli2
saml2aws
ffmpeg
podman
cmark-gfm
plantuml
poppler
ditaa
unzip
ispell
rubyPackages.redcarpet
# nodePackages.mermaid-cli
pandoc
yq-go
pre-commit
shellcheck
csvkit
# cli bs
cowsay
fortune
figlet
nethack
youtube-dl
pipes
# k8s packages
# kubernetes-helm
# docker
stern
kubectx
kubectl
sops
dive
kind
istioctl
helmfile
vagrant
sops
virt-manager
];
}
flake-config/home-manager git:master*
❯ tree -L 2
.
├── configs
│   ├── ammonite.sc
│   └── nethackrc
├── emacs
│   ├── elisp
│   ├── emacs-init.nix
│   ├── emacs.nix
│   ├── snippets
│   └── startup.txt
├── home.nix
├── modules
│   ├── dev-packages.nix
│   ├── rofi
│   ├── sway.nix
│   ├── swaylock.nix
│   └── xdg.nix
└── themes
├── default.nix
├── gruvbox.nix
└── wallpapers
8 directories, 12 files
{ pkgs, ...}: {
emacs-theme-name = "doom-gruvbox-light";
kitty-theme-name = "Gruvbox Light Soft";
# gtkThemePackage = pkgs.gruvbox-dark-gtk;
# gtkThemeName = "gruvbox-dark";
gtkThemePackage = pkgs.gruvterial-theme;
gtkThemeName = "gruvterial";
base00 = "f2e5bc"; # ----
base01 = "ebdbb2"; # ---
base02 = "d5c4a1"; # --
base03 = "bdae93"; # -
base04 = "665c54"; # +
base05 = "504945"; # ++
base06 = "3c3836"; # +++
base07 = "282828"; # ++++
base08 = "9d0006"; # red
base09 = "af3a03"; # orange
base0A = "b57614"; # yellow
base0B = "79740e"; # green
base0C = "427b58"; # aqua/cyan
base0D = "076678"; # blue
base0E = "8f3f71"; # purple
base0F = "d65d0e"; # brown
backgroundImage = ./wallpapers/hokusai2.png;
}
user: { inputs, outputs, lib, config, pkgs, unstable, ... }:
let
usingTheme = import ./themes/gruvbox.nix pkgs;
commonFonts = import ../common/fonts.nix pkgs;
linuxFonts = if pkgs.stdenv.isLinux then (import ../nixos/linux-fonts.nix pkgs) else [];
allFonts = commonFonts + linuxFonts;
in
{
imports = [
./modules/rofi
./modules/xdg.nix
./modules/sway.nix
./emacs/emacs.nix
./modules/dev-packages.nix
];
nixpkgs = {
overlays = [
];
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = (_: true);
};
};
mine.rofi = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
theme = usingTheme;
};
mine.xdg = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
};
mine.sway = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
theme = usingTheme;
};
mine.emacs = {
enable = true;
theme = usingTheme.emacs-theme-name;
orgDir = user.orgDir;
agendaDir = if user.agendaDir == null then null else user.agendaDir;
package = if pkgs.stdenv.isDarwin then unstable.emacs29-macport else pkgs.emacs29;
};
programs.obs-studio = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
plugins = [
pkgs.obs-studio-plugins.droidcam-obs
];
};
# TODO: Set your username
home = {
username = user.username;
homeDirectory = user.homeDir;
packages = (import ../common/fonts.nix pkgs) ;
};
programs.home-manager.enable = true;
programs.git = {
enable = true;
userName = user.name;
userEmail = user.email;
ignores = [
"*~"
"\\#*\\#"
"/.emacs.desktop"
"/.emacs.desktop.lock"
".\#*"
".projectile"
".dir-locals.el"
".direnv/"
".envrc"
".swp"
];
};
programs.vim = {
enable = true;
plugins = with pkgs.vimPlugins; [
airline
surround
repeat
nord-vim
];
settings = {
ignorecase = true;
smartcase = true;
backupdir = [ "~/.vim/backup//" ];
directory = [ "~/.vim/backup//" ];
number = true;
relativenumber = true;
expandtab = true;
};
extraConfig = ''
set autoread
set encoding=utf8
set backspace=2
set clipboard=unnamed
set laststatus=2
set noshowmode
imap jk <esc>
let mapleader = "\<Space>"
nnoremap ; :
nnoremap : ;
nnoremap <Leader>n :bnext<CR>
nnoremap <Leader>p :bprevious<CR>
nnoremap <Leader>x :bdelete<CR>
set t_Co=256
colorscheme nord
'';
};
programs.kitty = {
enable = true;
font = {
name = "Hasklig";
size = 11;
};
theme = usingTheme.kitty-theme-name;
extraConfig = ''
# dont ask before closing
confirm_os_window_close 0
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
'';
};
programs.zsh = {
enable = true;
enableCompletion = true;
enableAutosuggestions = true;
oh-my-zsh = {
enable = true;
theme = "refined";
plugins = [ "fzf" "kubectl" "docker" ];
};
sessionVariables = {
EDITOR = "$(which vim)";
};
shellAliases = {
lsnix = "print -z -- ls /nix/store/$(ls /nix/store | fzf)";
ls = "ls --color=auto";
k = "kubectl";
cdr = "cd $(git rev-parse --show-toplevel)";
};
initExtra = ''
export PATH="$HOME/bin:$PATH"
fortune | cowsay
if [[ "$TERM" == "dumb" ]]; then
unsetopt zle
PS1='> '
HISTFILE=~/.tramp-histfile
fi
vterm_printf(){
if [ -n "$TMUX" ] && ([ "''${TERM%%-*}" = "tmux" ] || [ "''${TERM%%-*}" = "screen" ] ); then
# Tell tmux to pass the escape sequences through
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
elif [ "''${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf "\eP\e]%s\007\e\\" "$1"
else
printf "\e]%s\e\\" "$1"
fi
}
vterm_prompt_end() {
vterm_printf "51;A$(whoami)@$(hostname):$(pwd)";
}
setopt PROMPT_SUBST
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'
bindkey '^ ' forward-word
kbash () {
kubectl exec --tty --stdin $1 -n $2 -- /bin/bash
}
'';
};
programs.fzf = {
enable = true;
};
programs.direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};
gtk = lib.mkIf pkgs.stdenv.isLinux {
enable = true;
iconTheme = {
# package = pkgs.tela-circle-icon-theme;
name = "Numix";
};
theme = {
package = usingTheme.gtkThemePackage;
name = usingTheme.gtkThemeName;
};
gtk3.extraConfig = { gtk-key-theme-name = "Emacs"; };
};
home.file.".ammonite/predef.sc".source = ./configs/ammonite.sc;
home.file.".nethackrc".source = ./configs/nethackrc;
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
home.stateVersion = "22.11";
}
{ lib, pkgs, config, ... } :
with lib;
let
cfg = config.mine.rofi;
baseTheme = ../../themes/gruvbox.nix;
in
{
options.mine.rofi = {
enable = mkEnableOption "personal rofi config";
theme = mkOption {
type = types.attrs;
default = baseTheme;
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.tela-circle-icon-theme ];
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
theme = "gruvbox-light-soft";
font = "Source Sans Pro 14";
plugins = [
pkgs.rofi-emoji
pkgs.rofi-power-menu
pkgs.rofi-bluetooth
];
extraConfig = {
show-icons = false;
modi = "drun,run";
# location = 5;
kb-mode-next = "Control+Alt+n";
kb-mode-previous = "Control+Alt+p";
icon-theme = "Tela-circle-dark";
application-fallback-icon = "application-default-icon";
display-run = "";
display-drun = "";
display-emoji = "";
display-input = "";
display-power = "";
display-combi = "";
display-filebrowser = "";
};
};
#write rofi scripts
xdg.configFile."rofi/scripts/input_enable.sh".source =
./rofi-scripts/input_enable.sh;
xdg.configFile."rofi/scripts/power_menu.sh".source =
./rofi-scripts/power_menu.sh;
xdg.configFile."rofi/scripts/kill_process.sh".source =
./rofi-scripts/kill_process.sh;
xdg.configFile."rofi/scripts/switch_window.sh".source =
./rofi-scripts/switch_window.sh;
};
}
{ pkgs, config, lib, ...}:
with lib;
let
cfg = config.mine.sway;
baseTheme = ../themes/gruvbox.nix;
dbus-sway-environment = pkgs.writeTextFile {
name = "dbus-sway-environment";
destination = "/bin/dbus-sway-environment";
executable = true;
text = ''
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
};
configure-gtk = pkgs.writeTextFile {
name = "configure-gtk";
destination = "/bin/configure-gtk";
executable = true;
text = let
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in ''
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
gnome_schema=org.gnome.desktop.interface
gsettings set $gnome_schema gtk-theme 'gruvbox-dark'
'';
};
in
{
imports = [
./swaylock.nix
];
options.mine.sway = {
enable = mkEnableOption "personal sway config";
theme = mkOption {
type = types.attrs;
default = baseTheme;
};
lockCmd = mkOption {
type = types.str;
default = "echo None specified";
};
};
config = mkIf cfg.enable {
mine.swaylock = {
enable = true;
bgcolor = cfg.theme.base02;
backgroundImage = cfg.theme.backgroundImage;
};
wayland.windowManager.sway = {
package = null;
enable = true;
swaynag.enable = true;
wrapperFeatures.gtk.enable = true;
extraSessionCommands = "export GRIM_DEFAULT_DIR=~/Screenshots";
config = {
modifier = "Mod4";
bars = [];
colors.focused = {
background = cfg.theme.base00;
border = cfg.theme.base00;
childBorder = cfg.theme.base0A;
text = cfg.theme.base09;
indicator = cfg.theme.base00;
};
floating.criteria = [
# { title = "Steam - Update News"; }
# { class = "Pavucontrol"; }
];
floating.modifier = "Mod4";
gaps = {
inner = 5;
top = 34;
};
input = {
"1267:32:Elan_TrackPoint" = {
pointer_accel = ".60";
scroll_factor = "5";
};
"1739:31251:DLL07BF:01_06CB:7A13_Touchpad" = {
dwt = "enabled";
tap = "enabled";
middle_emulation = "enabled";
};
"1:1:AT_Translated_Set_2_keyboard" = {
xkb_layout = "us";
xkb_options = "ctrl:nocaps";
};
};
keybindings = let
modifier = "Mod4";
in lib.mkOptionDefault {
"${modifier}+Shift+e" = "exec rofi -show power -modi \"power:$HOME/.config/rofi/scripts/power_menu.sh,kill:$HOME/.config/rofi/scripts/kill_process.sh,input:$HOME/.config/rofi/scripts/input_enable.sh\" -sidebar-mode";
"${modifier}+space" = "exec rofi -show drun -show-icons | xargs swaymsg exec --";
"${modifier}+Shift+i" = "exec rofi -show emoji";
"${modifier}+Tab" = "exec $HOME/.config/rofi/scripts/switch_window.sh";
"${modifier}+End" = "exec ${cfg.lockCmd}";
"${modifier}+Shift+b" = "exec ${pkgs.rofi-bluetooth}/bin/rofi-bluetooth";
"XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle";
"XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%";
"Print" = "grim";
"XF86MonBrightnessUp" = "exec light -A 5";
"XF86MonBrightnessDown" = "exec light -U 5";
};
menu = "rofi -modi \"run,drun\" -show run | xargs swaymsg exec --";
output = {
"*".bg = "${cfg.theme.backgroundImage} center #${cfg.theme.base02}";
};
startup = [
{ command = "swayidle -w before-sleep '${cfg.lockCmd}'"; }
{ command = "waybar"; }
{ command = "dbus-sway-environment"; }
{ command = "configure-gtk"; }
];
terminal = "kitty";
};
extraConfig = ''
set $laptop eDP-1
bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable
'';
};
programs.waybar = {
enable = true;
settings = {
mainBar = {
layer = "bottom";
mode = "hide";
height = 30;
spacing = 4;
modules-left = ["sway/workspaces" "sway/window" "sway/mode" "sway/scratchpad" "custom/media"];
modules-right = [
"pulseaudio"
"network"
"cpu"
"memory"
"temperature"
"backlight"
"disk"
"battery"
"clock"
"tray"
"bluetooth"
];
"sway/workspaces".format = "{name}";
"sway/mode".format = "<span style=\"italic\">{}</span>";
"sway/scratchpad" = {
format = "<span style=\"italic\">{}</span>";
show-empty = false;
format-icons = [ "" ""];
tooltip = true;
tooltip-format = "{app}: {title}";
};
tray.spacing = 10;
disk.format = "/: {free} 󰆼";
cpu.format = "CPU: {usage}% 󰘚";
memory.format = "Mem: {percentage}% 󰍛";
temperature = {
critical-threshold = 80;
format = "{temperatureC}°C 󱃃";
};
backlight.format = "{percent}% ";
battery = {
states = {
warning = 30;
critical = 15;
};
format = "{capacity}% {icon}";
format-charging = "{capacity}% ";
format-plugged = "{capacity}% ";
format-alt = "{time} {icon}";
format-icons = ["" "" "" "" ""];
};
network = {
format-wifi = "{essid} ({signalStrength}%) ";
format-ethernet = "{ipaddr}/{cidr} ";
tooltip-format = "{ifname} via {gwaddr} ";
format-linked = "{ifname} (No IP) ";
format-disconnected = "Disconnected ⚠";
format-alt = "{ifname}: {ipaddr}/{cidr}";
};
pulseaudio = {
format = "{volume}% {icon} {format_source}";
format-bluetooth = "{volume}% {icon} {format_source}";
format-bluetooth-muted = " {icon} {format_source}";
format-muted = " {format_source}";
format-source = "{volume}% ";
format-source-muted = "";
format-icons = {
headphone = "";
hands-free = "";
headset = "";
phone = "";
portable = "";
car = "";
default = ["" "" ""];
};
on-click = "pavucontrol";
};
};
};
style = ''
* {
border: none;
font-size: 15px;
min-height: 0;
}
window#waybar {
background: transparent;
color: #${cfg.theme.base0A};
}
window > box {
margin: 3px 5px 5px 5px;
padding: 3px 10px 3px 10px;
background: #${cfg.theme.base00};
border: 2px solid #${cfg.theme.base0A};
}
#workspaces button {
min-width: 0;
padding: 0 5px;
background: transparent;
color: #${cfg.theme.base0A};
border-bottom: 3px solid transparent;
border-top: 3px solid transparent;
}
#workspaces button.focused {
background: #${cfg.theme.base0B};
color: #ffffff;
border-bottom: 3px solid #${cfg.theme.base04};
border-top: 3px solid #${cfg.theme.base04};
}
#workspaces button.urgent {
background-color: #${cfg.theme.base0C};
}
#clock, #battery, #cpu, #memory, #temperature, #backlight, #network, #pulseaudio, #custom-media, #tray, #mode, #idle_inhibitor {
padding: 0 8px;
}
#window {
padding: 0 0 0 15;
}
'';
};
home.packages = with pkgs; [
swayidle
wl-clipboard
glib
grim
neofetch
gnome3.adwaita-icon-theme
configure-gtk
slurp
dbus-sway-environment
mako # notification daemon
libappindicator-gtk3
libappindicator
];
home.sessionVariables = {
GRIM_DEFAULT_DIR = "~/Screenshots";
};
};
}
let
gruvbox = import ./gruvbox.nix;
in {
theme = gruvbox;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment