improve comments and general tweaks

This commit is contained in:
Noah Masur 2022-05-29 13:44:45 -04:00
parent 3ea0e40121
commit 3ba26ccfd5
14 changed files with 76 additions and 34 deletions

View File

@ -11,14 +11,33 @@
../modules/mail/himalaya.nix ../modules/mail/himalaya.nix
]; ];
options = with lib; {
dotfilesPath = mkOption {
type = types.path;
description = "Path of dotfiles repository.";
default = builtins.toPath "/home/${config.user}/dev/personal/dotfiles";
};
};
config = { config = {
# Enable features in Nix commands
nix.extraOptions = "experimental-features = nix-command flakes"; nix.extraOptions = "experimental-features = nix-command flakes";
# Basic common system packages for all devices
environment.systemPackages = with pkgs; [ git vim wget curl ];
# Use the system-level nixpkgs instead of Home Manager's
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
# Install packages to /etc/profiles instead of ~/.nix-profile, useful when
# using multiple profiles
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
environment.systemPackages = with pkgs; [ git vim wget curl ]; # Set a variable for dotfiles repo, not necessary but convenient
home-manager.users.${config.user} = {
home.sessionVariables = { DOTS = config.dotfilesPath; };
};
}; };

View File

@ -47,8 +47,11 @@
MANPAGER = "nvim +Man!"; MANPAGER = "nvim +Man!";
}; };
programs.fish = { programs.fish = {
shellAliases = { vim = "nvim"; }; shellAbbrs = {
shellAbbrs = { vll = "vim -c 'Telescope oldfiles'"; }; v = lib.mkForce "nvim";
vl = lib.mkForce "nvim -c 'normal! `0'";
vll = "nvim -c 'Telescope oldfiles'";
};
}; };
}; };

View File

@ -95,13 +95,13 @@ in {
# Adjust screen brightness # Adjust screen brightness
"Shift+F12" = "Shift+F12" =
"exec ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ddcutil --display 2 setvcp 10 + 30"; "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 + 30";
"Shift+F11" = "Shift+F11" =
"exec ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ddcutil --display 2 setvcp 10 - 30"; "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 - 30";
"XF86MonBrightnessUp" = "XF86MonBrightnessUp" =
"exec ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ddcutil --display 2 setvcp 10 + 30"; "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 + 30";
"XF86MonBrightnessDown" = "XF86MonBrightnessDown" =
"exec ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ddcutil --display 2 setvcp 10 - 30"; "exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 - 30";
# Media player controls # Media player controls
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; "XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";

View File

@ -32,8 +32,11 @@ in {
config = lib.mkIf config.gui.enable { config = lib.mkIf config.gui.enable {
sound.enable = true; sound.enable = true;
# Enable PulseAudio
hardware.pulseaudio.enable = true; hardware.pulseaudio.enable = true;
# These aren't necessary, but helpful for the user
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
pamixer # Audio control pamixer # Audio control
volnoti # Volume notifications volnoti # Volume notifications
@ -44,15 +47,28 @@ in {
# Graphical volume notifications # Graphical volume notifications
services.volnoti.enable = true; services.volnoti.enable = true;
# i3 keybinds for changing the volume xsession.windowManager.i3.config = {
xsession.windowManager.i3.config.keybindings = {
"XF86AudioRaiseVolume" = # Make sure that Volnoti actually starts (home-manager doesn't start
"exec --no-startup-id ${increaseVolume}/bin/increaseVolume"; # user daemon's automatically)
"XF86AudioLowerVolume" = startup = [{
"exec --no-startup-id ${decreaseVolume}/bin/decreaseVolume"; command = "systemctl --user restart volnoti";
"XF86AudioMute" = "exec --no-startup-id ${toggleMute}/bin/toggleMute"; always = true;
"XF86AudioMicMute" = notification = false;
"exec --no-startup-id pamixer --default-source --toggle-mute"; }];
# i3 keybinds for changing the volume
keybindings = {
"XF86AudioRaiseVolume" =
"exec --no-startup-id ${increaseVolume}/bin/increaseVolume";
"XF86AudioLowerVolume" =
"exec --no-startup-id ${decreaseVolume}/bin/decreaseVolume";
"XF86AudioMute" = "exec --no-startup-id ${toggleMute}/bin/toggleMute";
# We can mute the mic by adding "--default-source"
"XF86AudioMicMute" =
"exec --no-startup-id ${pkgs.pamixer}/bin/pamixer --default-source --toggle-mute";
};
}; };
}; };

View File

@ -1,6 +1,7 @@
{ ... }: { { ... }: {
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
# These came with the system and I don't know if they're required.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;

View File

@ -1,13 +1,16 @@
{ ... }: { { ... }: {
services.xserver = { services.xserver = {
layout = "us";
# Keyboard responsiveness # Keyboard responsiveness
autoRepeatDelay = 250; autoRepeatDelay = 250;
autoRepeatInterval = 40; autoRepeatInterval = 40;
# Configure keymap in X11 # Swap escape key with caps lock key
layout = "us";
xkbOptions = "eurosign:e,caps:swapescape"; xkbOptions = "eurosign:e,caps:swapescape";
}; };
} }

View File

@ -19,10 +19,10 @@
}; };
}; };
# Detect monitors (brightness) # Detect monitors (brightness) for ddcutil
hardware.i2c.enable = true; hardware.i2c.enable = true;
# Grant user access to external monitors # Grant main user access to external monitors
users.users.${config.user}.extraGroups = [ "i2c" ]; users.users.${config.user}.extraGroups = [ "i2c" ];
services.xserver.displayManager = { services.xserver.displayManager = {

View File

@ -2,7 +2,7 @@
config = lib.mkIf config.gui.enable { config = lib.mkIf config.gui.enable {
# Mouse config # Mouse customization
services.ratbagd.enable = true; services.ratbagd.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View File

@ -2,8 +2,7 @@
# Prevent wake from keyboard # Prevent wake from keyboard
powerManagement.powerDownCommands = '' powerManagement.powerDownCommands = ''
echo disabled > /sys/bus/usb/devices/1-6/power/wakeup for wakeup in /sys/bus/usb/devices/1-*/power/wakeup; do echo disabled > $wakeup; done
echo disabled > /sys/bus/usb/devices/1-8/power/wakeup
''; '';
} }

View File

@ -1,7 +1,9 @@
{ ... }: { { ... }: {
networking.wireless.enable = # Enables wireless support via wpa_supplicant.
true; # Enables wireless support via wpa_supplicant. networking.wireless.enable = true;
# Allows the user to control the WiFi settings.
networking.wireless.userControlled.enable = true; networking.wireless.userControlled.enable = true;
} }

View File

@ -3,11 +3,7 @@
home-manager.users.${config.user}.programs.direnv = { home-manager.users.${config.user}.programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;
config = { config = { whitelist = { prefix = [ config.dotfilesPath ]; }; };
whitelist = {
prefix = [ "/home/${config.user}/dev/personal/dotfiles/" ];
};
};
}; };
} }

View File

@ -1,10 +1,12 @@
{ config, pkgs, lib, ... }: { { config, pkgs, lib, ... }: {
users.users.${config.user}.shell = pkgs.fish; users.users.${config.user}.shell = pkgs.fish;
programs.fish.enable = true; # Needed for LightDM to remember username programs.fish.enable =
true; # Needed for LightDM to remember username (TODO: fix)
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
# Packages used in abbreviations and aliases
home.packages = with pkgs; [ curl ]; home.packages = with pkgs; [ curl ];
programs.fish = { programs.fish = {
@ -89,7 +91,7 @@
tan = "tmux attach-session -t noah"; tan = "tmux attach-session -t noah";
tnn = "tmux new-session -s noah"; tnn = "tmux new-session -s noah";
# Vim # Vim (overwritten by Neovim)
v = "vim"; v = "vim";
vl = "vim -c 'normal! `0'"; vl = "vim -c 'normal! `0'";

View File

@ -18,6 +18,7 @@
shellAbbrs = { lf = "ls -lh | fzf"; }; shellAbbrs = { lf = "ls -lh | fzf"; };
}; };
# Global fzf configuration
home.sessionVariables = let fzfCommand = "fd --type file"; home.sessionVariables = let fzfCommand = "fd --type file";
in { in {
FZF_DEFAULT_COMMAND = fzfCommand; FZF_DEFAULT_COMMAND = fzfCommand;

View File

@ -19,7 +19,7 @@ in {
home-manager.users.root.programs.git = { home-manager.users.root.programs.git = {
enable = true; enable = true;
extraConfig.safe.directory = "/home/${config.user}/dev/personal/dotfiles"; extraConfig.safe.directory = config.dotfilesPath;
}; };
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
@ -29,7 +29,7 @@ in {
userEmail = config.gitEmail; userEmail = config.gitEmail;
extraConfig = { extraConfig = {
pager = { branch = "false"; }; pager = { branch = "false"; };
safe = { directory = "/home/${config.user}/dev/personal/dotfiles"; }; safe = { directory = config.dotfilesPath; };
pull = { ff = "only"; }; pull = { ff = "only"; };
init = { defaultBranch = "master"; }; init = { defaultBranch = "master"; };
}; };