diff --git a/dotfiles/config/rofi/sidestyle.rasi b/dotfiles/config/rofi/sidestyle.rasi index 8d688079..e4091fee 100644 --- a/dotfiles/config/rofi/sidestyle.rasi +++ b/dotfiles/config/rofi/sidestyle.rasi @@ -91,7 +91,7 @@ } #element { - font: "Open Sans 13"; + font: "Source Code Pro 13"; padding: 12px 1.5em 12px 14px; } diff --git a/dotfiles/config/taffybar/stack.yaml b/dotfiles/config/taffybar/stack.yaml index ee3aa68c..d0355036 100644 --- a/dotfiles/config/taffybar/stack.yaml +++ b/dotfiles/config/taffybar/stack.yaml @@ -46,3 +46,23 @@ extra-deps: - time-units-1.0.0 - xml-helpers-1.0.0 resolver: lts-11.7 +nix: + packages: + - cairo + - gcc + - gnome2.pango + - gobjectIntrospection + - gtk3 + - hicolor-icon-theme + - libdbusmenu-glib + - libdbusmenu-gtk3 + - libxml2 + - numix-icon-theme-circle + - pkgconfig + - x11 + - xorg.libX11 + - xorg.libXext + - xorg.libXinerama + - xorg.libXrandr + - xorg.libXrender + - zlib diff --git a/dotfiles/config/termite/config b/dotfiles/config/termite/config index 6f5c2929..dfe4dda1 100644 --- a/dotfiles/config/termite/config +++ b/dotfiles/config/termite/config @@ -1,5 +1,6 @@ [options] dynamic_title = true +scrollback_lines = -1 [colors] # Base16 Default Dark @@ -49,3 +50,4 @@ color18 = #282828 color19 = #383838 color20 = #b8b8b8 color21 = #e8e8e8 + diff --git a/dotfiles/config/xmonad/build b/dotfiles/config/xmonad/build index a1ecc97b..5b93498c 100755 --- a/dotfiles/config/xmonad/build +++ b/dotfiles/config/xmonad/build @@ -1,9 +1,36 @@ #!/usr/bin/env bash +function min { + [ $1 -le $2 ] && echo "$1" || echo "$2" +} + +function get_exe_dir { + # XXX: This exists because calling in to stack is kind of slow with nix + # integration enabled, even when just using it to get a path. + if [ -e ./.cached-stack-install-path ]; then + cat .cached-stack-install-path + else + stack path --local-install-root + fi +} + +function do_rebuild { + +} + SRC_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" EXE_NAME=imalison-xmonad +EXE_LOCATION=$(get_exe_dir)/bin/$EXE_NAME output_file=$1; shift -stack install -cp -uf $(stack path --local-install-root)/bin/$EXE_NAME $output_file +if [ -e ./.cached-stack-install-path ]; then + last_built=$(stat -c '%Y' $EXE_LOCATION) + xmonad_modified=$(stat -c '%Y' ./xmonad.hs) + + [ $last_built -lt $xmonad_modified ] && stack install +else + stack install +fi + +cp -uf $EXE_LOCATION $output_file diff --git a/dotfiles/config/xmonad/stack.yaml b/dotfiles/config/xmonad/stack.yaml index 045170ce..8e09048c 100644 --- a/dotfiles/config/xmonad/stack.yaml +++ b/dotfiles/config/xmonad/stack.yaml @@ -9,3 +9,12 @@ packages: extra-deps: - X11-xft-0.3.1 resolver: lts-11.7 +nix: + packages: + - pkgconfig + - x11 + - xorg.libX11 + - xorg.libXext + - xorg.libXinerama + - xorg.libXrandr + - xorg.libXrender diff --git a/dotfiles/config/xmonad/xmonad.hs b/dotfiles/config/xmonad/xmonad.hs index f41efd79..95468e81 100644 --- a/dotfiles/config/xmonad/xmonad.hs +++ b/dotfiles/config/xmonad/xmonad.hs @@ -461,7 +461,6 @@ myReplaceWindow = -- Workspace Names for EWMH - setWorkspaceNames :: X () setWorkspaceNames = withWindowSet $ \s -> withDisplay $ \dpy -> do sort' <- getSortByIndex @@ -865,6 +864,10 @@ goToNextScreenX = windows goToNextScreen -- Key bindings +volumeUp = spawn "set_volume.sh --unmute --change-volume +5" +volumeDown = spawn "set_volume.sh --unmute --change-volume -5" +mute = spawn "set_volume.sh --toggle-mute" + shiftToEmptyOnScreen direction = followingWindow (windowToScreen direction True) >> shiftToEmptyAndView @@ -907,7 +910,7 @@ addKeys conf@XConfig { modMask = modm } = , ((modalt, xK_Return), deactivateFullAnd restoreAllMinimized) , ((modm .|. controlMask, xK_t), setReplaceTarget >> spawn "chromix-too open chrome://newtab") - , ((mod .|. controlMask, xK_c), chromeReplaceKill) + , ((modm .|. controlMask, xK_c), chromeReplaceKill) , ((hyper, xK_g), gatherThisClass) -- Directional navigation @@ -1005,12 +1008,12 @@ addKeys conf@XConfig { modMask = modm } = , ((0, xF86XK_AudioPrev), spawn "playerctl previous") -- Volume control - , ((0, xF86XK_AudioRaiseVolume), spawn "set_volume.sh up") - , ((0, xF86XK_AudioLowerVolume), spawn "set_volume.sh down") - , ((0, xF86XK_AudioMute), spawn "set_volume.sh mute") - , ((modm, xK_i), spawn "set_volume.sh up") - , ((modm, xK_k), spawn "set_volume.sh down") - , ((modm, xK_u), spawn "set_volume.sh mute") + , ((0, xF86XK_AudioRaiseVolume), volumeUp) + , ((0, xF86XK_AudioLowerVolume), volumeDown) + , ((0, xF86XK_AudioMute), mute) + , ((modm, xK_i), volumeUp) + , ((modm, xK_k), volumeDown) + , ((modm, xK_u), mute) , ((hyper .|. shiftMask, xK_q), spawn "toggle_mute_current_window.sh") , ((hctrl, xK_q), spawn "toggle_mute_current_window.sh only") diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index 700ac00c..c83a941a 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -218,6 +218,7 @@ These definitions silence the byte-compiler. Sets environment variables by starting a shell. #+BEGIN_SRC emacs-lisp (use-package exec-path-from-shell + :disabled (not (equal system-type 'darwin)) :config (progn ;; For debugging @@ -1417,6 +1418,7 @@ Paradox is a package.el extension. I have no use for it now that I use straight. ** server #+BEGIN_SRC emacs-lisp (use-package server + :demand t :config (progn (defvar imalison:default-server-file @@ -2772,7 +2774,8 @@ The following is taken from [[https://github.com/syl20bnr/spacemacs/blob/a650877 #+BEGIN_SRC emacs-lisp (use-package lsp-haskell :config - (add-hook 'haskell-mode-hook 'lsp-haskell-enable)) + (when (executable-find "hie") + (add-hook 'haskell-mode-hook 'lsp-haskell-enable))) #+END_SRC **** intero Intero seems to be causing hangs, so it has been disabled @@ -3605,7 +3608,9 @@ alphanumeric characters only." *** TeX #+BEGIN_SRC emacs-lisp (use-package tex - :straight auctex + :straight (auctex :host github :repo "raxod502/auctex" + :branch "fork/1" + :files (:defaults (:exclude "doc/*.texi"))) :commands TeX-mode :preface (progn diff --git a/dotfiles/lib/bin/set_volume.sh b/dotfiles/lib/bin/set_volume.sh index b2771cc6..f89dedd3 100755 --- a/dotfiles/lib/bin/set_volume.sh +++ b/dotfiles/lib/bin/set_volume.sh @@ -10,7 +10,8 @@ function switch_sink_applications() } current_default=$(pahelper.sh list | grep '*' | all_after_char ":" | xargs) -environment_variable_exists USE_ONLY_ONE_PASINK && pahelper.sh "$current_default" +environment_variable_exists USE_ONLY_O_PASINK && pahelper.sh "$current_default" -pulseaudio-ctl "$@" +# XXX: this does not prevent volumes higher than 100 +pulsemixer "$@" pashowvolume diff --git a/dotfiles/lib/setup_functions.sh b/dotfiles/lib/setup_functions.sh index e98a4d67..4c9a753f 100644 --- a/dotfiles/lib/setup_functions.sh +++ b/dotfiles/lib/setup_functions.sh @@ -60,7 +60,6 @@ function get_linux_distro { return 1 } - function is_osx() { if command_exists uname; then case `uname` in @@ -82,3 +81,7 @@ function source_directory_files { source "$filename" done } + +function min { + [ $1 -le $2 ] && echo "$1" || echo "$2" +} diff --git a/dotfiles/lib/shellenv/linux.sh b/dotfiles/lib/shellenv/linux.sh index 95c74d59..3fc459e6 100644 --- a/dotfiles/lib/shellenv/linux.sh +++ b/dotfiles/lib/shellenv/linux.sh @@ -13,7 +13,7 @@ pasink() { pavolume () { pacmd list-sinks | awk '/^\s+name: /{indefault = $2 == "<'"$(pasink)"'>"} - /^\s+volume: / && indefault {print $5; exit}' + /^\s+volume: / && indefault {print $5; exit}' | grep -Eo "[0-9]*" } paismuted () { @@ -24,7 +24,7 @@ pashowvolume () { if paismuted; then volnoti-show -m else - volnoti-show "$(pavolume)" + volnoti-show "$(min $(pavolume) 100)" fi } diff --git a/dotfiles/xprofile b/dotfiles/xprofile index 34526974..ea51963e 100644 --- a/dotfiles/xprofile +++ b/dotfiles/xprofile @@ -1,9 +1,11 @@ # -*- mode: sh; -*- - # If there are issues with path, check /etc/profile for hard overrides of PATH. . "$HOME/.lib/login.sh" # XXX: prevents https://github.com/xmonad/xmonad/issues/86 from affecting startup rm -f ~/.xmonad/xmonad.state load_xkb_map.sh + +run_if_exists systemctl --user import-environment XDG_DATA_DIRS +run_if_exists systemctl --user start wm.target diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 00000000..c3a96cdb --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,201 @@ +{ config, pkgs, ... }: +let + my-python-packages = python-packages: with python-packages; [ + appdirs + requests + virtualenv + ipython + ipdb + virtualenvwrapper + pip + ]; + python-with-my-packages = pkgs.python3.withPackages my-python-packages; +in +{ + boot.loader.systemd-boot.enable = true; + nixpkgs.config.allowUnfree = true; + security.sudo.wheelNeedsPassword = false; + networking.networkmanager.enable = true; + + i18n = { + consoleKeyMap = "us"; + defaultLocale = "en_US.UTF-8"; + }; + + # Set your time zone. + # TODO: this should be set dynamically + time.timeZone = "America/Los_Angeles"; + + fonts = { + fonts = with pkgs; [ + fira-mono + dejavu_fonts + noto-fonts-emoji + emojione + twemoji-color-font + source-code-pro + roboto + source-sans-pro + source-serif-pro + ]; + fontconfig = { + defaultFonts = { + monospace = [ "Source Code Pro" ]; + sansSerif = [ "Roboto" ]; + serif = [ "Source Serif Pro" ]; + }; + ultimate = { + enable = false; + }; + }; + }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + + # Applications + google-chrome + firefox + hexchat + kodi + vlc + xfce.thunar + spotify + termite + rxvt_unicode + emacs + + # Appearance + numix-icon-theme-circle + gnome3.adwaita-icon-theme + hicolor-icon-theme + + # Desktop + autorandr + clipit + compton + feh + sddm-kcm + networkmanagerapplet + pinentry + pommed_light + rofi + rofi-pass + volnoti + xclip + xdotool + xorg.xkbcomp + xsettingsd + + # Audio + pulsemixer + pavucontrol + playerctl + + # Haskell + cabal-install + cabal2nix + ghc + stack2nix + stack + + # Tools + binutils + gcc + gitFull + gnumake + gnupg + htop + ncdu + pass + python-with-my-packages + rcm + silver-searcher + stow + tmux + wget + zsh + + # Miscellaneous + librsvg + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + + environment.loginShellInit = ". ~/.lib/nix_login.sh"; + + services.xserver = { + exportConfiguration = true; + enable = true; + layout = "us"; + videoDrivers = [ "nvidia" ]; + desktopManager = { + gnome3.enable = true; + default = "none"; + }; + windowManager = { + default = "xmonad"; + i3.enable = true; + session = [{ + name = "xmonad"; + start = '' + /usr/bin/env imalison-xmonad & + waitPID=$! + ''; + }]; + }; + displayManager = { + # lightdm = { + # enable = true; + # extraSeatDefaults='' + # greeter-hide-users=false + # ''; + # }; + sddm = { + enable = true; + }; + }; + + }; + + hardware.opengl.driSupport32Bit = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.extraUsers.imalison = { + name = "imalison"; + group = "users"; + isNormalUser = true; + extraGroups = [ + "wheel" "disk" "audio" "video" + "networkmanager" "systemd-journal" + ]; + createHome = true; + uid = 1000; + home = "/home/imalison"; + shell = pkgs.zsh; + }; + + system.stateVersion = "18.03"; # Did you read the comment? +} diff --git a/nixos/machines/imalison-home.nix b/nixos/machines/imalison-home.nix new file mode 100644 index 00000000..53fd22b5 --- /dev/null +++ b/nixos/machines/imalison-home.nix @@ -0,0 +1,60 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + + ../configuration.nix + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/110e3bf8-19b7-4a39-8e2a-b4c3c0d59d0e"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/B2DA-CD21"; + fsType = "vfat"; + }; + + fileSystems."/arch-linux-root" = { + device = "/dev/disk/by-uuid/9095e51e-33f9-440d-a272-46e129800f81"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/a6933b22-c7f4-4c57-b330-1450f313922e"; } + { device = "/dev/disk/by-uuid/dbd49a76-4b3e-4b5c-9a88-68a9e61f6210"; } + ]; + + nix.maxJobs = lib.mkDefault 4; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + + boot.initrd.luks.devices = [ + { + name = "root"; + device = "/dev/sda3"; + preLVM = true; + } + ]; + + boot.loader.grub.device = "/dev/sda"; + + networking.hostName = "imalison-home"; + boot.loader.efi.canTouchEfiVariables = true; + + services.xserver.screenSection = '' + DefaultDepth 24 + Option "RegistryDwords" "PerfLevelSrc=0x3322; PowerMizerDefaultAC=0x1" + Option "TripleBuffer" "True" + Option "Stereo" "0" + Option "nvidiaXineramaInfoOrder" "DFP-0" + Option "metamodes" "DVI-D-0: nvidia-auto-select +0+2160 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, HDMI-0: nvidia-auto-select +640+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, HDMI-1: nvidia-auto-select +2560+2160 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}" + Option "SLI" "Off" + Option "MultiGPU" "Off" + Option "BaseMosaic" "off" + ''; +}