os/home.nix

132 lines
4.2 KiB
Nix
Raw Normal View History

2024-07-01 22:52:04 +02:00
{config, lib, pkgs, inputs, ...}: {
2024-07-02 00:06:26 +02:00
2024-07-02 00:20:09 +02:00
imports = [
./programs/firefox.nix
];
2024-07-01 22:52:04 +02:00
home.stateVersion = "22.05";
home.packages = [ pkgs.fortune ];
programs.home-manager.enable = true;
programs.bash.enable = true;
programs.bash.bashrcExtra = ''
# Prompt
if [ -n "$PS1" ]; then
# A temporary variable to contain our prompt command
NEW_PROMPT_COMMAND='
MY_PWD="$PWD"
[[ "$MY_PWD" =~ ^"$HOME"(/|$) ]] && MY_PWD="~''${MY_PWD#$HOME}"
TRIMMED_PWD=''${MY_PWD: -40};
TRIMMED_PWD=''${TRIMMED_PWD:-$MY_PWD}
[[ "''${#MY_PWD}" -ge 41 ]] && TRIMMED_PWD="…$TRIMMED_PWD"
SHELL_PREFIX=""
[[ -n "$IN_NIX_SHELL" ]] && SHELL_PREFIX="$SHELL_PREFIX "
[[ -n "$AWS_VAULT" ]] && SHELL_PREFIX="$SHELL_PREFIX 🔓"
[[ -n "$FLUTTER_ENV" ]] && SHELL_PREFIX="$SHELL_PREFIX "
[[ -n "$REACTNATIVE_ENV" ]] && SHELL_PREFIX="$SHELL_PREFIX "
'
# If there's an existing prompt command, let's not
# clobber it
if [ -n "''${PROMPT_COMMAND// /}" ]; then
PROMPT_COMMAND="$PROMPT_COMMAND
$NEW_PROMPT_COMMAND"
else
PROMPT_COMMAND="$NEW_PROMPT_COMMAND"
fi
# We're done with our temporary variable
unset NEW_PROMPT_COMMAND
# Set PS1 with our new variable
# \h - hostname, \u - username
# PS1='\u@\h:$TRIMMED_PWD\$ '
export PS1="[\t \[\e[32m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]]"'$SHELL_PREFIX'" \[\e[36m\]"'$TRIMMED_PWD'"\[\e[m\] \$ "
fi
eval "$(direnv hook bash)"
2024-07-01 23:59:35 +02:00
export NIXPKGS_ALLOW_UNFREE=1
2024-07-01 22:52:04 +02:00
'';
programs.bash.shellAliases = {
chmod = "chmod --preserve-root";
chown = "chown --preserve-root";
ls = "ls -Isnap --color";
df = "df -h -x squashfs -x tmpfs -x devtmpfs -x overlay -x revokefs-fuse";
free = "free -h";
toupper = "tr [:lower:] [:upper:]";
tolower = "tr [:upper:] [:lower:]";
rebuild = ''
nixos-rebuild switch --flake "$HOME/.local/os#" --use-remote-sudo
'';
":r" = "!!";
};
programs.bash.sessionVariables = {
NIX_SHELL_PRESERVE_PROMPT = 1;
};
programs.tmux.enable = true;
programs.tmux.terminal = "xterm-256color";
programs.tmux.baseIndex = 1;
programs.tmux.clock24 = true;
programs.tmux.prefix = "C-a";
programs.tmux.escapeTime = 0;
programs.tmux.extraConfig = ''
set-option -g status-position top
setw -g automatic-rename on
set -g renumber-windows on
set -g set-titles on
set -g set-titles-string "#T"
'';
dconf.settings = {
"org/gnome/desktop/wm/keybindings" = {
move-to-workspace-left = ["<Alt><Super>Left"];
move-to-workspace-right = ["<Alt><Super>Right"];
switch-to-workspace-left = ["<Super>Left"];
switch-to-workspace-right = ["<Super>Right"];
switch-applications = ["<Super>Tab"];
switch-applications-backward = ["<Shift><Super>Tab"];
switch-windows = ["<Alt>Tab"];
switch-windows-backward = ["<Shift><Alt>Tab"];
};
"org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = ["/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/"];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = {
binding = "<Super>t";
command = "kgx";
name = "gnome-console";
};
"org/gnome/desktop/interface" = {
clock-show-weekday = true;
};
"org/gnome/desktop/peripherals/touchpad" = {
tap-to-click = true;
two-finger-scrolling-enabled = true;
};
"org/gnome/shell" = rec {
enabled-extensions = [
"trayIconsReloaded@selfmade.pl"
"AlphabeticalAppGrid@stuarthayhurst"
"clipboard-history@alexsaveau.dev"
"noannoyance@daase.net"
];
# disabled-extensions = builtins.filter (x: ! builtins.elem x enabled-extensions) disabled-extensions;
favorite-apps = [
2024-07-01 23:54:27 +02:00
"firefox.desktop"
2024-07-01 22:52:04 +02:00
"chromium-browser.desktop"
"org.gnome.Console.desktop"
"org.gnome.Nautilus.desktop"
];
};
};
}