Skip to content

Instantly share code, notes, and snippets.

@antaz
Created December 5, 2024 18:38
Show Gist options
  • Select an option

  • Save antaz/90b979f141c246a9b2a5e9cee47adf76 to your computer and use it in GitHub Desktop.

Select an option

Save antaz/90b979f141c246a9b2a5e9cee47adf76 to your computer and use it in GitHub Desktop.
{ pkgs, lib, ... }:
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "antr";
home.homeDirectory = "/home/antr";
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "24.05"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = [
pkgs.vim
pkgs.chromium
pkgs.nautilus
pkgs.foot
pkgs.dmenu
pkgs.b612
pkgs.tmux
pkgs.xdg-utils
pkgs.nil
pkgs.nixd
pkgs.pavucontrol
pkgs.audacity
pkgs.nixfmt-rfc-style
pkgs.wl-clipboard
pkgs.zathura
pkgs.mold
pkgs.pinentry-gnome3
pkgs.gnome-secrets
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
wayland.windowManager.river = {
enable = true;
extraConfig = ''
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river
riverctl map normal Super+Shift Return spawn foot
riverctl map normal Super Q close
riverctl map normal Super+Shift E exit
riverctl map normal Super J focus-view next
riverctl map normal Super K focus-view previous
riverctl map normal Super+Shift J swap next
riverctl map normal Super+Shift K swap previous
riverctl map normal Super Period focus-output next
riverctl map normal Super Comma focus-output previous
riverctl map normal Super+Shift Period send-to-output next
riverctl map normal Super+Shift Comma send-to-output previous
riverctl map normal Super H send-layout-cmd rivertile "main-ratio -0.05"
riverctl map normal Super L send-layout-cmd rivertile "main-ratio +0.05"
riverctl map normal Super+Shift H send-layout-cmd rivertile "main-count +1"
riverctl map normal Super+Shift L send-layout-cmd rivertile "main-count -1"
riverctl map normal Super+Alt H move left 100
riverctl map normal Super+Alt J move down 100
riverctl map normal Super+Alt K move up 100
riverctl map normal Super+Alt L move right 100
riverctl map normal Super+Alt+Control H snap left
riverctl map normal Super+Alt+Control J snap down
riverctl map normal Super+Alt+Control K snap up
riverctl map normal Super+Alt+Control L snap right
riverctl map normal Super+Alt H resize horizontal -50
riverctl map normal Super+Alt J resize vertical 50
riverctl map normal Super+Alt K resize vertical -50
riverctl map normal Super+Alt L resize horizontal 50
riverctl map-pointer normal Super BTN_LEFT move-view
riverctl map-pointer normal Super BTN_RIGHT resize-view
riverctl map-pointer normal Super BTN_MIDDLE toggle-float
for i in $(seq 1 9)
do
tags=$((1 << ($i - 1)))
# Super+[1-9] to focus tag [0-8]
riverctl map normal Super $i set-focused-tags $tags
# Super+Shift+[1-9] to tag focused view with tag [0-8]
riverctl map normal Super+Shift $i set-view-tags $tags
# Super+Control+[1-9] to toggle focus of tag [0-8]
riverctl map normal Super+Control $i toggle-focused-tags $tags
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
riverctl map normal Super+Shift+Control $i toggle-view-tags $tags
done
all_tags=$(((1 << 32) - 1))
riverctl map normal Super 0 set-focused-tags $all_tags
riverctl map normal Super+Shift 0 set-view-tags $all_tags
riverctl map normal Super Space toggle-float
riverctl map normal Super F toggle-fullscreen
riverctl map normal Super Up send-layout-cmd rivertile "main-location top"
riverctl map normal Super Right send-layout-cmd rivertile "main-location right"
riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom"
riverctl map normal Super Left send-layout-cmd rivertile "main-location left"
riverctl declare-mode passthrough
riverctl map normal Super F11 enter-mode passthrough
riverctl map passthrough Super F11 enter-mode normal
for mode in normal locked
do
riverctl map $mode None XF86Eject spawn 'eject -T'
# Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
riverctl map $mode None XF86AudioRaiseVolume spawn 'wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+'
riverctl map $mode None XF86AudioLowerVolume spawn 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-'
riverctl map $mode None XF86AudioMute spawn 'wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle'
riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause'
riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause'
riverctl map $mode None XF86AudioPrev spawn 'playerctl previous'
riverctl map $mode None XF86AudioNext spawn 'playerctl next'
riverctl map $mode None XF86MonBrightnessUp spawn 'light -U 5'
riverctl map $mode None XF86MonBrightnessDown spawn 'light -A 5'
done
riverctl border-width 0
riverctl background-color 0x002b36
riverctl border-color-focused 0x93a1a1
riverctl border-color-unfocused 0x586e75
riverctl set-repeat 50 300
riverctl rule-add -app-id 'float*' -title 'foo' float
riverctl rule-add -app-id "bar" csd
riverctl default-layout rivertile
rivertile -view-padding 6 -outer-padding 6 &
riverctl focus-follows-cursor normal
riverctl input pointer-* tap enabled
riverctl input pointer-* natural-scroll enabled
riverctl keyboard-layout -options "caps:ctrl_modifier,grp:toggle" us,ara
riverctl map normal Super D spawn dmenu_run
riverctl map normal Super S spawn 'grim -g "$(slurp)" - | swappy -f -'
riverctl map normal Super B spawn 'swaylock --image /home/k2/tmp/john-cobb-IE_sifhay7o-unsplash.jpg'
'';
};
# Gnome keyring
services.gnome-keyring.enable = true;
# Fonts
fonts = {
fontconfig.enable = true;
fontconfig.defaultFonts = {
serif = [
"Bitstream Vera Serif"
"SF Arabic"
];
sansSerif = [
"B612"
"SF Arabic"
];
monospace = [
"Monolisa"
"Noto Color Emoji"
];
emoji = [ "Noto Color Emoji" ];
};
};
programs.git = {
enable = true;
userName = "Antar Azri";
userEmail = "[email protected]";
signing = {
key = "[email protected]";
signByDefault = true;
};
extraConfig = {
core = {
editor = "${lib.getExe pkgs.zed-editor} --wait";
};
};
aliases = {
st = "status";
co = "checkout";
cm = "commit";
lg = "log --oneline --graph --all";
};
};
programs.zed-editor = {
enable = true;
extensions = [
"nix"
"toml"
"json"
"make"
"xy-zed"
];
userSettings = {
assistant = {
enabled = true;
version = "2";
default_open_ai_model = null;
default_model = {
provider = "zed.dev";
model = "claude-3-5-sonnet-latest";
};
};
node = {
path = lib.getExe pkgs.nodejs;
npm_path = lib.getExe' pkgs.nodejs "npm";
};
lsp = {
rust-analyzer = {
binary = {
path_lookup = true;
};
};
nix = {
binary = {
path_lookup = true;
};
};
};
languages = {
"Nix" = {
language_servers = [
"nil"
"nixd"
];
format_on_save = {
external = {
command = "nixfmt";
arguments = [
"--filename"
"{buffer_path}"
];
};
};
};
};
vim_mode = true;
load_direnv = "shell_hook";
theme = {
mode = "system";
light = "XY-Zed";
dark = "XY-Zed";
};
ui_font_family = "monospace";
buffer_font_family = "monospace";
};
};
programs.gpg = {
enable = true;
settings = {
default-key = "[email protected]";
};
};
services.gpg-agent = {
enable = true;
pinentryPackage = pkgs.pinentry-gnome3;
};
programs.ssh = {
enable = true;
};
programs.bash = {
enable = true;
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-wlr
xdg-desktop-portal-gtk
];
config = {
common = {
default = [
"gtk"
];
"org.freedesktop.impl.portal.Secret" = [
"gnome-keyring"
];
};
};
xdgOpenUsePortal = true;
};
dconf.settings = {
"org/gnome/desktop/interface" = {
color-scheme = "prefer-dark";
};
};
gtk = {
enable = true;
theme = {
name = "Adwaita-dark";
package = pkgs.gnome-themes-extra;
};
gtk3.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
gtk4.extraConfig = {
Settings = ''
gtk-application-prefer-dark-theme=1
'';
};
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a
# shell provided by Home Manager. If you don't want to manage your shell
# through Home Manager then you have to manually source 'hm-session-vars.sh'
# located at either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/antr/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
EDITOR = "zeditor";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment