mirror of
https://github.com/vale981/dotfiles
synced 2025-03-05 09:31:43 -05:00
direnv and nixos
This commit is contained in:
parent
f090e313ff
commit
54bdc3de83
14 changed files with 243 additions and 36 deletions
|
@ -43,19 +43,19 @@ draw_bold_text_with_bright_colors: true
|
|||
font:
|
||||
# The normal (roman) font face to use.
|
||||
normal:
|
||||
family: FiraCode Nerd Font
|
||||
family: Fira Code
|
||||
# Style can be specified to pick a specific
|
||||
style: medium
|
||||
|
||||
# The bold font face
|
||||
bold:
|
||||
family: FiraCode Nerd Font
|
||||
family: Fira Code
|
||||
# Style can be specified to pick a specific
|
||||
style: bold
|
||||
|
||||
# The italic font face
|
||||
italic:
|
||||
family: FiraCode Nerd Font
|
||||
family: Fira Code
|
||||
# Style can be specified to pick a specific
|
||||
style: italic
|
||||
|
||||
|
@ -102,7 +102,7 @@ font:
|
|||
#
|
||||
# To completely disable the visual bell, set its duration to 0.
|
||||
#
|
||||
visual_bell:
|
||||
bell:
|
||||
animation: EaseOutExpo
|
||||
duration: 0
|
||||
|
||||
|
|
2
dots/cursor/.link
Normal file
2
dots/cursor/.link
Normal file
|
@ -0,0 +1,2 @@
|
|||
TASKNAME="Configure Cursor Theme"
|
||||
LINKTO=".icons/default/"
|
4
dots/cursor/index.theme
Normal file
4
dots/cursor/index.theme
Normal file
|
@ -0,0 +1,4 @@
|
|||
[Icon Theme]
|
||||
Name=Default
|
||||
Comment=Default Cursor Theme
|
||||
Inherits=capitaine-cursors
|
|
@ -128,7 +128,7 @@ Prevent custom from preserving state.
|
|||
*** Font and Editor
|
||||
- Set font to ~JetBrains Mono~.
|
||||
#+BEGIN_SRC emacs-lisp :tangle yes
|
||||
(set-frame-font "JetBrains Mono 11" nil t)
|
||||
(set-frame-font "JetBrains Mono 11" t t)
|
||||
(set-face-attribute 'default t :font "JetBrains Mono 11")
|
||||
#+END_SRC
|
||||
|
||||
|
@ -183,8 +183,7 @@ We use the doom theme.
|
|||
doom-themes-enable-italic t) ; if nil, italics is universally disabled
|
||||
(load-theme 'doom-solarized-light t)
|
||||
(doom-themes-treemacs-config)
|
||||
(doom-themes-org-config)
|
||||
)
|
||||
(doom-themes-org-config))
|
||||
|
||||
(use-package doom-modeline
|
||||
:ensure t
|
||||
|
@ -332,11 +331,7 @@ Color code matching delimiters.
|
|||
;;:hook prog-mode)
|
||||
#+END_SRC
|
||||
|
||||
*** Smart Tab
|
||||
#+begin_src emacs-lisp :tangle yes
|
||||
(use-package smart-tab
|
||||
:config (global-smart-tab-mode))
|
||||
#+end_src
|
||||
|
||||
*** Ripgrep
|
||||
#+begin_src emacs-lisp :tangle yes
|
||||
(use-package rg
|
||||
|
@ -434,6 +429,12 @@ Use abbrev for greek input.
|
|||
#+begin_src emacs-lisp :tangle yes
|
||||
(use-package hydra)
|
||||
#+end_src
|
||||
*** Direnv Support
|
||||
#+begin_src emacs-lisp :tangle yes
|
||||
(use-package direnv
|
||||
:config
|
||||
(direnv-mode))
|
||||
#+end_src
|
||||
** Programming / Language Support
|
||||
*** LSP
|
||||
Support for the =Language Server Protocol=.
|
||||
|
|
|
@ -24,3 +24,5 @@ function cmus
|
|||
set cmus_sess "cmus"
|
||||
tmux new-session -A -s $cmus_sess "bash -c cmus"
|
||||
end
|
||||
|
||||
eval (direnv hook fish)
|
||||
|
|
5
dots/home/.direnvrc
Normal file
5
dots/home/.direnvrc
Normal file
|
@ -0,0 +1,5 @@
|
|||
source $HOME/.nix-direnv/direnvrc
|
||||
|
||||
if [ -f /run/current-system/sw/share/nix-direnv/direnvrc ]; then
|
||||
source /run/current-system/sw/share/nix-direnv/direnvrc
|
||||
fi
|
|
@ -1,15 +1,6 @@
|
|||
export PATH="${PATH}:~/.local/bin"
|
||||
eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
|
||||
export SSH_AUTH_SOCK
|
||||
picom &
|
||||
dunst &
|
||||
xmodmap ~/.xmodmaprc
|
||||
udiskie &
|
||||
xfce4-clipman &
|
||||
kdeconnect-indicator &
|
||||
xset dpms 600 &
|
||||
xrdb .Xresources &
|
||||
wallp &
|
||||
{{ #SCREENLAYOUT }}
|
||||
{{ SCREENLAYOUT }}
|
||||
{{ /SCREENLAYOUT }}
|
||||
xmodmap ~/.xmodmaprc &
|
||||
dunst &
|
||||
picom --config .picom.conf &
|
||||
xrdb .Xresources &
|
||||
|
|
2
dots/nix-direnv/.link
Normal file
2
dots/nix-direnv/.link
Normal file
|
@ -0,0 +1,2 @@
|
|||
TASKNAME="Configure nix-direnv"
|
||||
LINKTO=".nix-direnv/"
|
179
dots/nix-direnv/direnvrc
Normal file
179
dots/nix-direnv/direnvrc
Normal file
|
@ -0,0 +1,179 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
_nix_import_env() {
|
||||
local env=$1
|
||||
|
||||
local term_backup=$TERM path_backup=$PATH
|
||||
if [[ -n ${TMPDIR+x} ]]; then
|
||||
local tmp_backup=$TMPDIR
|
||||
fi
|
||||
local impure_ssl_cert_file=${SSL_CERT_FILE:-__UNSET__}
|
||||
local impure_nix_ssl_cert_file=${NIX_SSL_CERT_FILE:-__UNSET__}
|
||||
|
||||
eval "$env"
|
||||
|
||||
# `nix-shell --pure` sets invalid ssl certificate paths
|
||||
if [[ "${SSL_CERT_FILE:-}" = /no-cert-file.crt ]]; then
|
||||
if [[ $impure_ssl_cert_file == __UNSET__ ]]; then
|
||||
unset SSL_CERT_FILE
|
||||
else
|
||||
export SSL_CERT_FILE=$impure_ssl_cert_file
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${NIX_SSL_CERT_FILE:-}" = /no-cert-file.crt ]]; then
|
||||
if [[ $impure_nix_ssl_cert_file == __UNSET__ ]]; then
|
||||
unset NIX_SSL_CERT_FILE
|
||||
else
|
||||
export NIX_SSL_CERT_FILE=${impure_nix_ssl_cert_file}
|
||||
fi
|
||||
fi
|
||||
|
||||
export PATH=$PATH:$path_backup TERM=$term_backup
|
||||
if [[ -n ${tmp_backup+x} ]]; then
|
||||
export TMPDIR=${tmp_backup}
|
||||
else
|
||||
unset TMPDIR
|
||||
fi
|
||||
|
||||
# misleading since we are in an impure shell now
|
||||
export IN_NIX_SHELL=impure
|
||||
}
|
||||
|
||||
_nix_add_gcroot() {
|
||||
local storepath=$1
|
||||
local symlink=$2
|
||||
|
||||
local stripped_pwd=${PWD/\//}
|
||||
local escaped_pwd=${stripped_pwd//-/--}
|
||||
local escaped_pwd=${escaped_pwd//\//-}
|
||||
ln -fs "$storepath" "$symlink"
|
||||
ln -fs "$symlink" "/nix/var/nix/gcroots/per-user/$USER/$escaped_pwd"
|
||||
}
|
||||
|
||||
use_flake() {
|
||||
watch_file flake.nix
|
||||
watch_file flake.lock
|
||||
|
||||
local profile="$(direnv_layout_dir)/flake-profile"
|
||||
local profile_rc="${profile}.rc"
|
||||
|
||||
if [[ ! -e "$profile" ]] || \
|
||||
[[ ! -e "$profile_rc" ]] || \
|
||||
[[ "$HOME/.direnvrc" -nt "$profile_rc" ]] || \
|
||||
[[ .envrc -nt "$profile_rc" ]] || \
|
||||
[[ flake.nix -nt "$profile_rc" ]] || \
|
||||
[[ flake.lock -nt "$profile_rc" ]];
|
||||
then
|
||||
local tmp_profile="$(direnv_layout_dir)/flake-profile.$$"
|
||||
[[ -d "$(direnv_layout_dir)" ]] || mkdir "$(direnv_layout_dir)"
|
||||
local tmp_profile_rc=$(nix print-dev-env --profile "$tmp_profile")
|
||||
drv=$(realpath "$tmp_profile")
|
||||
echo "$tmp_profile_rc" > "$profile_rc"
|
||||
rm -f "$tmp_profile" "$tmp_profile"*
|
||||
_nix_add_gcroot "$drv" "$profile"
|
||||
log_status renewed cache
|
||||
else
|
||||
log_status using cached dev shell
|
||||
fi
|
||||
|
||||
local old_nix_build_top=${NIX_BUILD_TOP:-__UNSET__}
|
||||
local old_tmp=${TMP:-__UNSET__}
|
||||
local old_tmpdir=${TMPDIR:-__UNSET__}
|
||||
local old_temp=${TEMP:-__UNSET__}
|
||||
local old_tempdir=${TEMPDIR:-__UNSET__}
|
||||
eval "$(< "$profile_rc")"
|
||||
# nix print-env-dev will create a temporary directory and use it a TMPDIR,
|
||||
# we cannot rely on this directory beeing not deleted at some point,
|
||||
# hence we are just removing it right away.
|
||||
if [[ "$NIX_BUILD_TOP" == */nix-shell.* && -d "$NIX_BUILD_TOP" ]]; then
|
||||
rmdir "$NIX_BUILD_TOP"
|
||||
fi
|
||||
|
||||
if [[ "$old_nix_build_top" == __UNSET__ ]]; then
|
||||
unset NIX_BUILD_TOP
|
||||
else
|
||||
export NIX_BUILD_TOP=$old_nix_build_top
|
||||
fi
|
||||
if [[ "$old_tmp" == __UNSET__ ]]; then
|
||||
unset TMP
|
||||
else
|
||||
export TMP=$old_temp
|
||||
fi
|
||||
if [[ "$old_tmpdir" == __UNSET__ ]]; then
|
||||
unset TMPDIR
|
||||
else
|
||||
export TMPDIR=$old_tmpdir
|
||||
fi
|
||||
if [[ "$old_temp" == __UNSET__ ]]; then
|
||||
unset TEMP
|
||||
else
|
||||
export TEMP=$old_temp
|
||||
fi
|
||||
if [[ "$old_tempdir" == __UNSET__ ]]; then
|
||||
unset TEMPDIR
|
||||
else
|
||||
export TEMPDIR=$old_tempdir
|
||||
fi
|
||||
}
|
||||
|
||||
use_nix() {
|
||||
local path direnv_dir
|
||||
path=$(nix-instantiate --find-file nixpkgs)
|
||||
direnv_dir=$(direnv_layout_dir)
|
||||
|
||||
if [[ "${direnv:-}" == "" ]]; then
|
||||
log_status "\$direnv environment variable was not defined. Was this script run inside direnv?"
|
||||
fi
|
||||
|
||||
local version
|
||||
if [[ -f "${path}/.version-suffix" ]]; then
|
||||
version=$(< "${path}/.version-suffix")
|
||||
elif [[ -f "${path}/.git/HEAD" ]]; then
|
||||
local head
|
||||
read -r head < "${path}/.git/HEAD"
|
||||
local regex="ref: (.*)"
|
||||
if [[ "$head" =~ $regex ]]; then
|
||||
read -r version < ".git/${BASH_REMATCH[1]}"
|
||||
else
|
||||
version="$head"
|
||||
fi
|
||||
fi
|
||||
|
||||
local cache="$direnv_dir/cache-${version:-unknown}"
|
||||
|
||||
local update_drv=0
|
||||
if [[ ! -e "$cache" ]] || \
|
||||
[[ "$HOME/.direnvrc" -nt "$cache" ]] || \
|
||||
[[ .envrc -nt "$cache" ]] || \
|
||||
[[ default.nix -nt "$cache" ]] || \
|
||||
[[ shell.nix -nt "$cache" ]];
|
||||
then
|
||||
[[ -d "$direnv_dir" ]] || mkdir "$direnv_dir"
|
||||
local dump_cmd tmp
|
||||
dump_cmd="echo -n _____direnv_____; \"$direnv\" dump bash"
|
||||
tmp=$(nix-shell --show-trace --pure "$@" --run "$dump_cmd" \
|
||||
| grep -oP '(?<=_____direnv_____).*')
|
||||
echo "$tmp" > "$cache"
|
||||
update_drv=1
|
||||
else
|
||||
log_status using cached derivation
|
||||
fi
|
||||
|
||||
log_status eval "$cache"
|
||||
read -r cache_content < "$cache"
|
||||
_nix_import_env "$cache_content"
|
||||
|
||||
# This part is based on https://discourse.nixos.org/t/what-is-the-best-dev-workflow-around-nix-shell/418/4
|
||||
if [[ "${out:-}" != "" ]] && (( update_drv )); then
|
||||
local drv_link="${direnv_dir}/drv" drv
|
||||
drv=$(nix show-derivation "$out" | grep -E -o -m1 '/nix/store/.*.drv')
|
||||
_nix_add_gcroot "$drv" "$drv_link"
|
||||
log_status renewed cache and derivation link
|
||||
fi
|
||||
|
||||
if [[ "$#" == 0 ]]; then
|
||||
watch_file default.nix
|
||||
watch_file shell.nix
|
||||
fi
|
||||
}
|
2
dots/picom/.link
Normal file
2
dots/picom/.link
Normal file
|
@ -0,0 +1,2 @@
|
|||
TASKNAME="Configure Picom"
|
||||
LINKTO="./"
|
17
dots/picom/.picom.conf
Normal file
17
dots/picom/.picom.conf
Normal file
|
@ -0,0 +1,17 @@
|
|||
active-opacity=1.000000;
|
||||
backend="glx";
|
||||
fade-delta=10;
|
||||
fade-exclude=[ ];
|
||||
fade-in-step=0.028000;
|
||||
fade-out-step=0.030000;
|
||||
fading=false;
|
||||
inactive-opacity=1.000000;
|
||||
opacity-rule=[ ];
|
||||
refresh-rate=0;
|
||||
shadow=true;
|
||||
shadow-exclude=[ ];
|
||||
shadow-offset-x=-15;
|
||||
shadow-offset-y=-15;
|
||||
shadow-opacity=0.100000;
|
||||
vsync=true;
|
||||
wintypes:{ dropdown_menu={ opacity=1.000000; }; popup_menu={ opacity=1.000000; }; };
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
xrandr --output DisplayPort-1 --off --output DisplayPort-0 --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output DisplayPort-2 --mode 1920x1080 --pos 3840x0 --rotate normal --output DVI-I-0 --mode 1920x1080 --pos 0x0 --rotate normal --output DVI-D-1 --off
|
||||
xrandr --output DisplayPort-0 --mode 1920x1080 --pos 0x0 --rotate normal --output DisplayPort-1 --primary --mode 1920x1080 --pos 1920x0 --rotate normal --output HDMI-A-0 --off --output HDMI-A-1 --off --output DVI-D-0 --mode 1920x1080 --pos 3840x0 --rotate normal
|
||||
|
|
|
@ -91,19 +91,21 @@ name = ws[3]:Terms
|
|||
# Mod key, (Windows key is Mod4) (Apple key on OSX is Mod2)
|
||||
modkey = Mod4
|
||||
|
||||
# This allows you to include pre-defined key bindings for your keyboard layout.
|
||||
keyboard_mapping = ~/.spectrwm_wm.conf
|
||||
|
||||
# PROGRAMS
|
||||
program[ec] = bash /home/hiro/.scripts/ec -c
|
||||
bind[ec] = MOD+p
|
||||
program[quit-xfce] = xfce4-session-logout --fast
|
||||
bind[quit-xfce] = MOD+Shift+q
|
||||
|
||||
program[volup] = pactl set-sink-volume 0 +5%
|
||||
program[voldown] = pactl set-sink-volume 0 -5%
|
||||
program[mute] = pactl set-sink-mute 0 toggle
|
||||
bind[volup] = XF86AudioRaiseVolume
|
||||
bind[voldown] = XF86AudioLowerVolume
|
||||
bind[mute] = XF86AudioMute
|
||||
|
||||
# program[volup] = pactl set-sink-volume 0 +5%
|
||||
# program[voldown] = pactl set-sink-volume 0 -5%
|
||||
# program[mute] = pactl set-sink-mute 0 toggle
|
||||
# bind[volup] = XF86AudioRaiseVolume
|
||||
# bind[voldown] = XF86AudioLowerVolume
|
||||
# bind[mute] = XF86AudioMute
|
||||
|
||||
program[gopass] = sh -c "gopass ls --flat | rofi -matching fuzzy -dmenu | xargs --no-run-if-empty gopass show -c"
|
||||
bind[gopass] = MOD+Shift+p
|
||||
|
@ -119,7 +121,7 @@ bind[XF86MonBrightnessDown] = brightdown
|
|||
{{ /laptop }}
|
||||
|
||||
# Validated default programs:
|
||||
# program[lock] = xlock
|
||||
program[lock] = xflock4
|
||||
program[term] = alacritty
|
||||
program[menu] = rofi -matching fuzzy -show run
|
||||
program[search_win] = rofi -matching fuzzy -show-icons -show
|
||||
|
|
|
@ -25,7 +25,7 @@ bind[move_down] = MOD+Shift+p
|
|||
bind[move_left] = MOD+Shift+e
|
||||
bind[move_right] = MOD+Shift+o
|
||||
bind[move_up] = MOD+Shift+u
|
||||
bind[ws_release] = MOD+Shift+a
|
||||
# bind[ws_release] = MOD+Shift+a
|
||||
bind[mvrg_1] = MOD+Shift+KP_End
|
||||
bind[mvrg_2] = MOD+Shift+KP_Down
|
||||
bind[mvrg_3] = MOD+Shift+KP_Next
|
||||
|
@ -58,7 +58,7 @@ bind[mvws_20] = MOD+Shift+F10
|
|||
bind[mvws_21] = MOD+Shift+F11
|
||||
bind[mvws_22] = MOD+Shift+F12
|
||||
bind[name_workspace] = MOD+Shift+slash
|
||||
bind[quit] = MOD+Shift+q
|
||||
|
||||
bind[raise_toggle] = MOD+Shift+r
|
||||
bind[restart] = MOD+q
|
||||
bind[rg_1] = MOD+KP_End
|
||||
|
|
Loading…
Add table
Reference in a new issue