diff --git a/backgrounds/blue-black-lines.jpg b/backgrounds/blue-black-lines.jpg new file mode 100644 index 0000000..06cf802 Binary files /dev/null and b/backgrounds/blue-black-lines.jpg differ diff --git a/backgrounds/dark-forest.jpg b/backgrounds/dark-forest.jpg new file mode 100644 index 0000000..af7af82 Binary files /dev/null and b/backgrounds/dark-forest.jpg differ diff --git a/backgrounds/dark-mesh.jpg b/backgrounds/dark-mesh.jpg new file mode 100644 index 0000000..142d3ee Binary files /dev/null and b/backgrounds/dark-mesh.jpg differ diff --git a/current-desktop.png b/current-desktop.png new file mode 100644 index 0000000..184069a Binary files /dev/null and b/current-desktop.png differ diff --git a/dotfiles/Xresources b/dotfiles/Xresources index ebc2165..64e8381 100644 --- a/dotfiles/Xresources +++ b/dotfiles/Xresources @@ -49,7 +49,7 @@ URxvt*loginShell: true *foreground: S_base0 *fadeColor: S_base03 *cursorColor: S_base1 -*pointerColorBackground:S_base01 +pointerColorBackground:S_base01 *pointerColorForeground:S_base1 #define S_yellow #b58900 @@ -127,8 +127,6 @@ URxvt.tabbed.title: no ! URxvt.keysym.Control-Left: \033[1;5D ! URxvt.keysym.Control-Right: \033[1;5C -! URxvt doesn't nicely send C-S- to the underlying app so they have to be -! added here as they become necessary. ! URxvt.keysym.C-S-0: Xft.dpi: 96 @@ -137,12 +135,11 @@ Xft.hinting: 1 Xft.hintstyle: hintslight Xft.rgba: rgb xterm*faceName: Inconsolata -xterm*faceSize: 7 7 7 7 7 7 7 +xterm*faceSize: 9 9 9 9 9 9 9 !URxvt*font: xft:Liberation Mono-8 !URxvt*boldFont: xft:Liberation Mono:bold -URxvt*font: xft:Inconsolata:size=8:antialias=true:hinting=true -URxvt*boldFont: xft:Inconsolata:bold -URxvt.letterSpace: -1 +URxvt*font: xft:Inconsolata:size=9:antialias=true:hinting=true +URxvt*boldFont: xft:Inconsolata:size=9:weight=bold:antialias=true:hinting=true URxvt*termName: rxvt-256color URxvt.iso14755: False diff --git a/dotfiles/config/nvim/init.vim b/dotfiles/config/nvim/init.vim index 648f885..c4f5f22 100644 --- a/dotfiles/config/nvim/init.vim +++ b/dotfiles/config/nvim/init.vim @@ -50,6 +50,7 @@ Plug 'mxw/vim-jsx' Plug 'digitaltoad/vim-jade' Plug 'wavded/vim-stylus' Plug 'raichoo/haskell-vim' +Plug 'OCamlPro/ocp-indent' " Org Mode Plug 'jceb/vim-orgmode' @@ -169,6 +170,10 @@ let g:syntastic_javascript_jsxhint_exec = 'eslint' " Color customizations " let g:indentLine_color_term=### +" Merlin for OCaml +let g:opamshare = substitute(system('opam config var share'),'\n$','','''') +execute "set rtp+=" . g:opamshare . "/merlin/vim" + " Fugitive bindings nnoremap gs :Gstatus nnoremap gd :Gdiff diff --git a/dotfiles/nixpkgs/.nixpkgs b/dotfiles/nixpkgs/.nixpkgs new file mode 120000 index 0000000..3d878fe --- /dev/null +++ b/dotfiles/nixpkgs/.nixpkgs @@ -0,0 +1 @@ +/home/taylor/.nixpkgs \ No newline at end of file diff --git a/dotfiles/ocamlinit b/dotfiles/ocamlinit new file mode 100644 index 0000000..12325a1 --- /dev/null +++ b/dotfiles/ocamlinit @@ -0,0 +1,12 @@ +(* Added by OPAM. *) +let () = + try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") + with Not_found -> () +;; + +#use "topfind";; +#thread;; +#camlp4o;; +#require "async";; +#require "core.top";; +#require "core.syntax";; diff --git a/dotfiles/xinitrc b/dotfiles/xinitrc index f7f8bb2..694c971 100644 --- a/dotfiles/xinitrc +++ b/dotfiles/xinitrc @@ -1,10 +1,8 @@ #!/bin/sh xrdb ~/.Xresources -# zsh ~/.fehbg & -# exec ~/essentials/scripts/sysinit/xmonad_start.sh -# exec awesome -feh --bg-scale ~/essentials/backgrounds/glass-blue-bg.jpg +compton --config ~/.compton.conf +feh --bg-scale ~/essentials/backgrounds/dark-forest.jpg xmodmap -e 'clear Lock' xmodmap -e 'keycode 0x42=Escape' -exec i3 +exec ~/essentials/scripts/sysinit/xmonad_start.sh diff --git a/dotfiles/xmonad/lib/Bar.hi b/dotfiles/xmonad/lib/Bar.hi index 4c456d5..ae69a1e 100644 Binary files a/dotfiles/xmonad/lib/Bar.hi and b/dotfiles/xmonad/lib/Bar.hi differ diff --git a/dotfiles/xmonad/lib/Bar.o b/dotfiles/xmonad/lib/Bar.o index ef05ebd..05aac77 100644 Binary files a/dotfiles/xmonad/lib/Bar.o and b/dotfiles/xmonad/lib/Bar.o differ diff --git a/dotfiles/xmonad/lib/PerWorkspaceDirs.hi b/dotfiles/xmonad/lib/PerWorkspaceDirs.hi index ca20174..2174910 100644 Binary files a/dotfiles/xmonad/lib/PerWorkspaceDirs.hi and b/dotfiles/xmonad/lib/PerWorkspaceDirs.hi differ diff --git a/dotfiles/xmonad/lib/PerWorkspaceDirs.o b/dotfiles/xmonad/lib/PerWorkspaceDirs.o index 70c56ce..8079a31 100644 Binary files a/dotfiles/xmonad/lib/PerWorkspaceDirs.o and b/dotfiles/xmonad/lib/PerWorkspaceDirs.o differ diff --git a/dotfiles/xmonad/lib/Spacing.hi b/dotfiles/xmonad/lib/Spacing.hi index 4bf39b0..6dd5beb 100644 Binary files a/dotfiles/xmonad/lib/Spacing.hi and b/dotfiles/xmonad/lib/Spacing.hi differ diff --git a/dotfiles/xmonad/lib/Spacing.o b/dotfiles/xmonad/lib/Spacing.o index d5bd5f8..291490c 100644 Binary files a/dotfiles/xmonad/lib/Spacing.o and b/dotfiles/xmonad/lib/Spacing.o differ diff --git a/dotfiles/xmonad/lib/XMonad/Layout/BinarySpacePartition.hi b/dotfiles/xmonad/lib/XMonad/Layout/BinarySpacePartition.hi index 3d77595..e8bffa1 100644 Binary files a/dotfiles/xmonad/lib/XMonad/Layout/BinarySpacePartition.hi and b/dotfiles/xmonad/lib/XMonad/Layout/BinarySpacePartition.hi differ diff --git a/dotfiles/xmonad/lib/XMonad/Layout/BinarySpacePartition.o b/dotfiles/xmonad/lib/XMonad/Layout/BinarySpacePartition.o index 2d5fe04..324aa3a 100644 Binary files a/dotfiles/xmonad/lib/XMonad/Layout/BinarySpacePartition.o and b/dotfiles/xmonad/lib/XMonad/Layout/BinarySpacePartition.o differ diff --git a/dotfiles/xmonad/xmonad-x86_64-linux b/dotfiles/xmonad/xmonad-x86_64-linux index 7d47de3..2c5f67f 100755 Binary files a/dotfiles/xmonad/xmonad-x86_64-linux and b/dotfiles/xmonad/xmonad-x86_64-linux differ diff --git a/dotfiles/xmonad/xmonad.errors b/dotfiles/xmonad/xmonad.errors index e69de29..9374efe 100644 --- a/dotfiles/xmonad/xmonad.errors +++ b/dotfiles/xmonad/xmonad.errors @@ -0,0 +1,26 @@ + +xmonad.hs:132:28: Warning: + In the use of ‘defaultConfig’ + (imported from XMonad, but defined in XMonad.Config): + Deprecated: "Use def (from Data.Default, and re-exported by XMonad and XMonad.Config) instead." + +xmonad.hs:135:34: Warning: + In the use of ‘defaultPP’ (imported from XMonad.Hooks.DynamicLog): + Deprecated: "Use def (from Data.Default, and re-exported by XMonad.Hooks.DynamicLog) instead." + +xmonad.hs:178:49: Warning: + In the use of ‘defaultConfig’ + (imported from XMonad, but defined in XMonad.Config): + Deprecated: "Use def (from Data.Default, and re-exported by XMonad and XMonad.Config) instead." + +xmonad.hs:203:63: Warning: + In the use of ‘defaultXPConfig’ (imported from XMonad.Prompt): + Deprecated: "Use def (from Data.Default, and re-exported from XMonad.Prompt) instead." + +xmonad.hs:241:62: Warning: + In the use of ‘defaultXPConfig’ (imported from XMonad.Prompt): + Deprecated: "Use def (from Data.Default, and re-exported from XMonad.Prompt) instead." + +xmonad.hs:242:59: Warning: + In the use of ‘defaultXPConfig’ (imported from XMonad.Prompt): + Deprecated: "Use def (from Data.Default, and re-exported from XMonad.Prompt) instead." diff --git a/dotfiles/xmonad/xmonad.hi b/dotfiles/xmonad/xmonad.hi index c27e92d..48fb64f 100644 Binary files a/dotfiles/xmonad/xmonad.hi and b/dotfiles/xmonad/xmonad.hi differ diff --git a/dotfiles/xmonad/xmonad.hs b/dotfiles/xmonad/xmonad.hs index 4d1dfd2..6686061 100644 --- a/dotfiles/xmonad/xmonad.hs +++ b/dotfiles/xmonad/xmonad.hs @@ -161,7 +161,7 @@ scratchpads = [ NS "htop" "urxvt -name htop -e htop" (resource =? "htop") defaul -- Spawn pipes and menus on boot, set default settings -------------------------------------------------------------------------------------------------------------------- myXmonadBar :: String -myXmonadBar = "lemonbar -f \"-benis-uushi-medium-r-normal--11-90-75-75-p-58-iso10646-1\" -B \"black\" | bash" +myXmonadBar = "lemonbar -f \"inconsolata 12\" -B \"#1f1f1f\" | bash" restartXmonad = "killall lemonbar; cd ~/.xmonad; ghc -threaded xmonad.hs; mv xmonad xmonad-x86_64-linux; xmonad --restart;" @@ -194,7 +194,7 @@ main = do `additionalKeys` [((myModMask , xK_q ), spawn restartXmonad) ,((myModMask .|. shiftMask , xK_c ), kill) - ,((myModMask .|. shiftMask , xK_b ), spawn "google-chrome-stable") + ,((myModMask .|. shiftMask , xK_b ), spawn "chromium-browser") ,((myModMask .|. shiftMask , xK_p ), spawn "mpc prev") ,((myModMask .|. shiftMask , xK_n ), spawn "mpc next") ,((myModMask .|. shiftMask , xK_i ), spawn "xcalib -invert -alter") @@ -219,6 +219,7 @@ main = do ,((myModMask .|. altMask .|. controlMask , xK_j ), sendMessage $ BSP.MoveSplit D) ,((myModMask .|. altMask .|. controlMask , xK_k ), sendMessage $ BSP.MoveSplit U) ,((myModMask .|. altMask .|. controlMask , xK_l ), sendMessage $ BSP.MoveSplit R) + ,((myModMask .|. shiftMask , xK_l ), spawn "physlock -d -u $(logname)") ,((myModMask , xK_p ), moveTo Prev NonEmptyWS) ,((myModMask , xK_n ), moveTo Next NonEmptyWS) ,((myModMask , xK_c ), moveTo Next EmptyWS) @@ -252,9 +253,9 @@ main = do ,((0 , xF86XK_Sleep ), spawn "pm-suspend") ,((0 , xF86XK_MonBrightnessUp ), spawn "xbacklight -inc 10") ,((0 , xF86XK_MonBrightnessDown ), spawn "xbacklight -dec 10") - ,((0 , xF86XK_AudioMute), spawn "~/scripts/dvol2 -t") - ,((0 , xF86XK_AudioLowerVolume), spawn "~/scripts/dvol2 -d 2 & mplayer /usr/share/sounds/freedesktop/stereo/audio-volume-change.oga") - ,((0 , xF86XK_AudioRaiseVolume ), spawn "~/scripts/dvol2 -i 2 & mplayer /usr/share/sounds/freedesktop/stereo/audio-volume-change.oga") + ,((0 , xF86XK_AudioMute), spawn "amixer -D pulse -q set Master toggle") + ,((0 , xF86XK_AudioLowerVolume), spawn "amixer -D pulse -q set Master 5%-") + ,((0 , xF86XK_AudioRaiseVolume ), spawn "amixer -D pulse -q set Master 6%+") ] `additionalMouseBindings` [((myModMask, 6), \_ -> moveTo Next NonEmptyWS) @@ -269,7 +270,7 @@ launcherConfig = LauncherConfig { pathToHoogle = "/home/zubin/.cabal/bin/hoogle" altMask = mod1Mask myTerminal :: String -myTerminal = "urxvtc" +myTerminal = "urxvt" myBitmapsDir :: String myBitmapsDir = "~/.xmonad/dzen2/" diff --git a/dotfiles/xmonad/xmonad.o b/dotfiles/xmonad/xmonad.o index dd67d67..c402300 100644 Binary files a/dotfiles/xmonad/xmonad.o and b/dotfiles/xmonad/xmonad.o differ diff --git a/dotfiles/zshrc b/dotfiles/zshrc index a923a5c..6363a7b 100644 --- a/dotfiles/zshrc +++ b/dotfiles/zshrc @@ -1,5 +1,4 @@ #Portable across both mac and linux now -export ZSH=~/.oh-my-zsh export LC_ALL=en_US.UTF-8 export LANG=en_US.UTF-8 if [[ "$OSTYPE" == "linux-gnu" ]]; then @@ -13,19 +12,7 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then fi export EDITOR="$VISUAL" export ITERM_24BIT=1 -export TERM=rxvt-256color - -# Colors get weird with Emacs in urxvt. I use urxvt on Linux -# so I need to export rxvt-256color and copy the rxvt-256color terminfo -# to the right location (see package installer for details). -# This will need to be changed if you use a different terminal emulator. -# -# Currently disabled to test automatic terminal detection -#if [[ "$OSTYPE" == "linux-gnu" ]]; then -# export TERM=rxvt-256color -#else -# export TERM=xterm-256color -#fi +export TERM=xterm-256color alias emacs='emacs -nw' alias irssi='TERM=screen-256color irssi' @@ -36,14 +23,6 @@ alias stoppg='pg_ctl -D /usr/local/var/postgres stop' # This is for the mac GUI version of emacs. alias emacs-gui='open -a /Applications/Emacs.app $1' -export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" - -# This is for nix if it exists -if [ -f ~/.nix-profile/etc/profile.d/nix.sh ]; -then - source ~/.nix-profile/etc/profile.d/nix.sh -fi - parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } @@ -64,16 +43,36 @@ plugins=(git brew npm coffee) # User configuration -export PATH="$PATH:$HOME/.rvm/bin:/usr/lib/rstudio/bin" # Add RVM to PATH for scripting -. ~/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true -# Haskell stuff -export PATH=~/.cabal/bin:$PATH -export PATH=.cabal-sandbox/bin:$PATH +if [[ "$OSTYPE" == "darwin"* ]]; then + export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" + export PATH="$PATH:$HOME/.rvm/bin:/usr/lib/rstudio/bin" # Add RVM to PATH for scripting + . ~/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true + + # Haskell stuff + export PATH=~/.cabal/bin:$PATH + export PATH=.cabal-sandbox/bin:$PATH + + # Git Town + export PATH=~/git-town/src:$PATH + MANPATH=$MANPATH:~/git-town/man + + # NOTE: 'Whence' is the ZSH idiom for bash's 'type' + export PRENPMPATH=$PATH + if [ -n "$(whence -f npm)" ]; + then + NPMPATH="$(npm bin)" + + if [ -d "$NPMPATH" ]; then + PATH=$NPMPATH:$PRENPMPATH + else + PATH=$PRENPMPATH + fi + + export PATH=$PATH + fi +fi -# Git Town -export PATH=~/git-town/src:$PATH -MANPATH=$MANPATH:~/git-town/man precmd(){ vcs_info @@ -87,17 +86,6 @@ RPROMPT="%{$fg[white]%}\${vcs_info_msg_0_}%{$reset_color%}" PROMPT="%{$fg[white]%}┌%{$reset_color%}[%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[cyan]%}%m%{$reset_color%}]─[%{$fg[green]%}%d%{$reset_color%}] %{$fg[white]%}└─╼%{$reset_color%} " -# NOTE: 'Whence' is the ZSH idiom for bash's 'type' -export PRENPMPATH=$PATH -if [ -n "$(whence -f npm)" ]; -then - NPMPATH="$(npm bin)" - - if [ -d "$NPMPATH" ]; then - PATH=$NPMPATH:$PRENPMPATH - else - PATH=$PRENPMPATH - fi - - export PATH=$PATH -fi +# Run opam init +~/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true +eval `opam config env` diff --git a/nix/audio/default.nix b/nix/audio/default.nix new file mode 100644 index 0000000..4294543 --- /dev/null +++ b/nix/audio/default.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + pulseaudioFull # Audio + spotify # Spotify + ]; + + hardware = { + pulseaudio.enable = true; + }; +} diff --git a/nix/comms/default.nix b/nix/comms/default.nix new file mode 100644 index 0000000..caece06 --- /dev/null +++ b/nix/comms/default.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + irssi + skype + ]; +} diff --git a/nix/configuration.nix b/nix/configuration.nix new file mode 100644 index 0000000..0d47e84 --- /dev/null +++ b/nix/configuration.nix @@ -0,0 +1,53 @@ +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./display + ./audio + ./input + ./users + ./security + ./development + ./games + ./comms + ./software + ]; + + # Use the gummiboot efi boot loader. + boot.loader.gummiboot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + nixpkgs.config = { + allowUnfree = true; + }; + + boot.initrd.luks.devices = [ + { name = "root"; device = "/dev/sda3"; } + ]; + + boot.initrd.luks.cryptoModules = [ "aes" "sha256" "sha1" "cbc" ]; + + networking.hostName = "ares"; # Define your hostname. + networking.networkmanager.enable = true; + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + i18n = { + consoleFont = "lat9w-16"; + consoleKeyMap = "us"; + defaultLocale = "en_US.UTF-8"; + }; + + time.timeZone = "US/Pacific"; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # The NixOS release to be compatible with for stateful data such as databases. + system.stateVersion = "16.03"; + +} diff --git a/nix/development/README.md b/nix/development/README.md new file mode 100644 index 0000000..2010cbb --- /dev/null +++ b/nix/development/README.md @@ -0,0 +1,14 @@ +# Development + +This directory contains everything needed to get started developing in my nix build. A key feature is the `env` directory +that contains a number of environments used to set up nix shells for isolated development. + +## The Nix Shells + +Inside `env` are the nix shells I use to develop. These contain specific packages for that language. Common packages across languages are moved into the default.nix file in the `development` directory to save typing. + +These shells are designed to get you up and running *quickly* and are not designed to be a perfect fit for any project. For project-based nix shells, you should build them yourself. You're welcome to use the files in `env` as a base. + +## Using the Nix Shells + +Simply `cd` in `env` and then `cd` into the language folder of your choice. Type `nix-shell --pure` and it will drop you into a configured nix shell you can then use for development. Each language has its own nuances - for example in `python` suggests you setup a `virtualenv` for each project. diff --git a/nix/development/default.nix b/nix/development/default.nix new file mode 100644 index 0000000..405136c --- /dev/null +++ b/nix/development/default.nix @@ -0,0 +1,46 @@ +{ config, pkgs, ... }: +{ + environment = { + + # OCaml has trouble finding pthread. So we set PTHREAD_LIBS to give iet a heads up + # ** currently doesnt set PTHREAD_LIBS at all ** + variables = { + EDITOR = "nvim"; + PTHREAD_CFLAGS = "-I${pkgs.glibc}/include/"; + PTHREAD_LIBS = "-L${pkgs.glibc}/lib/"; + }; + + systemPackages = with pkgs; [ + bar-xft # Lightweight xcb based bar + cabal-install # Haskell package installer + coreutils # GNU coreutils + cmake # CMake tool + curl # Tool for general HTTP, FTP, etc work + freetype # Library to render fonts required by some packages + gcc # GNU Compiler Collection + ghc # Haskell compiler + glibc # Glibc + gnumake # GNU Make + git # Source control + libev # Event loop library + libpng # PNG library + m4 # GNU Macro Processor + neovim # Better vim + ocaml # OCaml language + ocamlPackages.ocaml_batteries # OCaml batteries included + ocamlPackages.merlin # OCaml editor enhancement + ocamlPackages.findlib # OCaml findlib + ocamlPackages.lambdaTerm # Lambda Term Library + ocamlPackages.ocaml_lwt # OCaml LWT Library - Saves time otherwise spent fighting with opam + ocamlPackages.ocaml_oasis # OASIS Project Architecture Tool for OCaml + ocamlPackages.utop # Much better top-level for OCaml + opam # OCaml package manager + pkgconfig + python3 # Python 3 + python34Packages.setuptools # Python setuptools + silver-searcher # Better than grep + vim # Regular ole' vim + wget # Standard GNU package for HTTP, FTP, etc file retrieval + ]; + }; +} diff --git a/nix/development/env/python/default.nix b/nix/development/env/python/default.nix new file mode 100644 index 0000000..d36a700 --- /dev/null +++ b/nix/development/env/python/default.nix @@ -0,0 +1,50 @@ +#A quick-and-dirty environment for nix-shell that gets you started with python34, pip, and virtualenv. +# Simply run nix-shell with the directory that has this file in it to drop into a shell with everything +# you need. + +with import {}; +with pkgs.python3Packages; + +buildPythonPackage { + name = "pythonEnv"; + buildInputs = [ + freetype + gcc # GNU Compiler Collection + gfortran + git # Source control + atlas # ATLAS + blas # BLAS + openblas # OpenBLAS + libxml2 # XML2 library + libxslt # XLST library + libzip # Zip library + liblapack # Linear Algebra pack library + libpng # PNG library + xlibs.libX11 # X11 library + pkgconfig + python3 + python3Packages.virtualenv + python3Packages.setuptools + stdenv + which + zlib + zsh # ZSH because I develop in ZSH + ]; + src = null; + + # Environment variables for scipy builds + ATLAS = atlas; + # BLAS = openblas; + # LAPACK = liblapack; + + # When used as `nix-shell --pure` + shellHook = '' + unset http_proxy + export GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt + ''; + # used when building environments + extraCmds = '' + unset http_proxy # otherwise downloads will fail ("nodtd.invalid") + export GIT_SSL_CAINFO=/etc/ssl/certs/ca-bundle.crt + ''; +} diff --git a/nix/display/default.nix b/nix/display/default.nix new file mode 100644 index 0000000..29c45b2 --- /dev/null +++ b/nix/display/default.nix @@ -0,0 +1,65 @@ +{config, pkgs, ... }: +{ + imports = [ + ./terminal.nix + ]; + + environment.systemPackages = with pkgs; [ + arandr # GUI frontend for xrandr + compton # Windowing system + dmenu # Application launcher + feh # Wallpaper manager + python3Packages.udiskie # Automatically mount USB drives + scrot # Screenshot software + unclutter # Mouse hider + xlibs.xmodmap # keyboard reconfiguration + xmonad-with-packages # Tiling window manager + xorg.xbacklight # Backlight manager + ]; + + # services.xserver.videoDriver = + + fonts = { + enableFontDir = true; + enableGhostscriptFonts = true; + fonts = with pkgs; [ + corefonts # Microsoft free fonts + freetype # Freetype fonts + inconsolata # Great monospaced font + ubuntu_font_family # Another great font family + unifont # International language support + ]; + }; + + services = { + udisks2.enable = true; + + xserver = { + enableTCP = false; + exportConfiguration = false; + enable = true; + layout = "us"; + + displayManager = { + sessionCommands = '' + xset r rate 300 30 + unclutter -grab & + udiskie & + feh --bg-fill ~/bgs/dark_night.jpg & + compton --config /dev/null & + ''; + }; + + desktopManager = { + xterm.enable = false; + xfce.enable = false; + }; + + windowManager = { + xmonad.enable = true; + xmonad.enableContribAndExtras = true; + default = "xmonad"; + }; + }; + }; +} diff --git a/nix/display/terminal.nix b/nix/display/terminal.nix new file mode 100644 index 0000000..d39bee1 --- /dev/null +++ b/nix/display/terminal.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + rxvt_unicode-with-plugins # Terminal emulator + tmux # Terminal multiplexer + tree # Better file tree + zsh # ZShell + xclip # Command line clipboard tool + ]; + + programs.zsh.enable = true; +} + diff --git a/nix/games/default.nix b/nix/games/default.nix new file mode 100644 index 0000000..458b3cf --- /dev/null +++ b/nix/games/default.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + nethack + steam + # tibia + ]; +} diff --git a/nix/hardware-configuration.nix b/nix/hardware-configuration.nix new file mode 100644 index 0000000..f86f718 --- /dev/null +++ b/nix/hardware-configuration.nix @@ -0,0 +1,32 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, ... }: + +{ + imports = + [ + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.kernelModules = [ "fbcon" "kvm_intel" ]; # kvm_intel is disabled on the t440s + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/mapper/vg-root"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + mountPoint = "/boot"; + device = "/dev/sda2"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/mapper/vg-swap"; } + ]; + + nix.maxJobs = 8; +} diff --git a/nix/input/default.nix b/nix/input/default.nix new file mode 100644 index 0000000..f3acf09 --- /dev/null +++ b/nix/input/default.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: +{ + imports = [ + ./touchpad.nix + ]; +} diff --git a/nix/input/touchpad.nix b/nix/input/touchpad.nix new file mode 100644 index 0000000..618bcb4 --- /dev/null +++ b/nix/input/touchpad.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + xorg.xf86inputsynaptics + ]; + + services.xserver = { + synaptics = { + enable = true; + twoFingerScroll = true; + }; + }; +} diff --git a/nix/security/default.nix b/nix/security/default.nix new file mode 100644 index 0000000..9d28cc6 --- /dev/null +++ b/nix/security/default.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + physlock + ]; + + # Set sudo to use user home + security.sudo.extraConfig = '' + Defaults !always_set_home + Defaults env_keep+="HOME" + ''; + + services = { + # Configure physlock + physlock = { + enable = true; + user = "taylor"; + lockOn = { + suspend = true; + hibernate = true; + }; + }; + }; +} diff --git a/nix/software/default.nix b/nix/software/default.nix new file mode 100644 index 0000000..b00080c --- /dev/null +++ b/nix/software/default.nix @@ -0,0 +1,22 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + byzanz # Screen recording software + calibre # Ebook reader + chromium # Browser + gtk # For GTK+ themes + htop # System monitor + libreoffice # Libreoffice + mplayer # Video player + nox # Better nix package search + unzip # Unzipper + xdotool # Diagnostic tool for mouse and keyboard + ]; + + nixpkgs.config = { + chromium = { + enablePepperFlash = true; + enablePepperPdf = true; + }; + }; +} diff --git a/nix/users/default.nix b/nix/users/default.nix new file mode 100644 index 0000000..8febf8e --- /dev/null +++ b/nix/users/default.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: +{ + users.extraUsers.taylor = { + isNormalUser = true; + home = "/home/taylor"; + description = "taylor"; + extraGroups = [ "wheel" "networkmanager" ]; + shell = "/run/current-system/sw/bin/zsh"; + uid = 1000; + }; +} diff --git a/scripts/lemonbar/bar_start.sh b/scripts/lemonbar/bar_start.sh index 2ea7569..2f5bd24 100755 --- a/scripts/lemonbar/bar_start.sh +++ b/scripts/lemonbar/bar_start.sh @@ -1,2 +1,4 @@ +#!/bin/bash + sleep 1 ~/essentials/scripts/lemonbar/final_bar.sh | ~/essentials/scripts/lemonbar/my_bar.sh | bash diff --git a/scripts/lemonbar/final_bar.sh b/scripts/lemonbar/final_bar.sh index 9a0cf2b..43554d0 100755 --- a/scripts/lemonbar/final_bar.sh +++ b/scripts/lemonbar/final_bar.sh @@ -1,50 +1,56 @@ -#!/bin/sh -# +#!/usr/bin/env bash # z3bra - (c) wtfpl 2014 # Fetch infos on your computer, and print them to stdout every second. +# Also takes content from window manager to build bar + +# ICONS +wifi_icon='' +cpu_icon='' +ram_icon='' +speaker_icon='' +plug_icon='' +thunderbolt_icon='' +clock_icon='' clock() { - date '+%Y-%m-%d %H:%M' + date=$(date '+%Y-%m-%d %H:%M') + echo "%{F#FFFFFFFF}$clock_icon $date%{F#FF6A9FB5}" } battery() { BATC=/sys/class/power_supply/BAT0/capacity BATS=/sys/class/power_supply/BAT0/status - test "`cat $BATS`" = "Charging" && echo -n '+' || echo -n '-' + cap="$(sed -n p $BATC)" + green_decimal=$((128 + (128 * $cap) / 101)) + red_decimal=$((128 + (128 * (100 - $cap)) / 101)) + red_hex=$(echo "obase=16; $red_decimal" | bc) + green_hex=$(echo "obase=16; $green_decimal" | bc) + + test "`cat $BATS`" = "Charging" && echo -n "%{F#FFFFFFFF}$plug_icon " || echo -n "%{F#FFFFFF00}$thunderbolt_icon " - sed -n p $BATC + echo "%{F#FF${red_hex}${green_hex}80}$cap%%{F#FF6A9FB5}" } volume() { - amixer get Master | grep -P -o '\[[0-9]+%\]' + volume=$(amixer -D pulse get Master | grep -P -o '\[[0-9]+%\]') + echo "%{F#FFC2A366}$speaker_icon $volume%{F#FF6A9FB5}" } cpuload() { LINE=`ps -eo pcpu |grep -vE '^\s*(0.0|%CPU)' |sed -n '1h;$!H;$g;s/\n/ +/gp'` - bc <<< $LINE + cpu=$(bc <<< $LINE) + echo "%{F#FF94FF70}$cpu_icon $cpu%%{F#FF6A9FB5}" } memused() { - free -m | head -n 2 | tail -n 1 | awk '{printf("%2.1fG/%0.2gG\n" ,($3/1024),($2/1024))}' + mem=$(free -m | head -n 2 | tail -n 1 | awk '{printf("%2.1fG/%0.2gG\n" ,($3/1024),($2/1024))}') + echo "%{F#FF80E6FF}$ram_icon $mem%{F#FF6A9FB5}" } -network() { - read -d '' lo int1 int2 <<< $(ip link | sed -n 's/^[0-9]: \(.*\):.*$/\1/p') - if iwconfig $int1 >/dev/null 2>&1; then - wifi=$int1 - eth0=$int2 - else - wifi=$int2 - eth0=$int1 - fi - ip link show $eth0 | grep 'state UP' >/dev/null && int=$eth0 || int=$wifi - - ping -c 1 8.8.8.8 >/dev/null 2>&1 && - echo "$int connected" || echo "$int disconnected" - - #int=eth0 - +wifi() { + current_wifi=$(nmcli -t --fields NAME con show --active) + echo "%{F#FFB8D4DC}$wifi_icon $current_wifi%{F#FF6A9FB5} |" } groups() { @@ -61,16 +67,29 @@ groups() { alsamixer='xdotool key super+F10' htop='xdotool key super+F9' # This loop will fill a buffer with our infos, and output it to stdout. -while :; do +function build_status { buf="%{r}%{F#FF6A9FB5}" - buf="${buf} %{A:$htop:}⮡ $(cpuload)%% " - buf="${buf} | ⮡ $(memused)%{A}" - buf="${buf} | $(network) " - buf="${buf} |%{A:$alsamixer:} ⮞ $(volume)%%%{A}" - buf="${buf} | ⮡$(battery)%{A}" - buf="${buf} |%{A:gsimplecal&:} ⮖ $(clock)%{A}" + buf="${buf} $(wifi)" + buf="${buf} $(cpuload) |" + buf="${buf} $(memused) |" + buf="${buf} $(volume) |" + buf="${buf} $(battery) |" + buf="${buf} $(clock)" echo $buf - # use `nowplaying scroll` to get a scrolling output! - sleep 0.5 # The HUD will be updated every second +} + +while true; do + + read -t 0.25 new_wm_content + if [ -n "$new_wm_content" ]; then + wm_content="$new_wm_content" + fi + + status_content="$(build_status)" + combined_content="$wm_content$status_content" + + echo "$combined_content" + + sleep 0.1 done diff --git a/scripts/lemonbar/my_bar.sh b/scripts/lemonbar/my_bar.sh index 2c085b4..fcb743c 100755 --- a/scripts/lemonbar/my_bar.sh +++ b/scripts/lemonbar/my_bar.sh @@ -1,2 +1 @@ -back="#00000000" -lemonbar -f "-benis-uushi-medium-r-normal--11-90-75-75-p-58-iso10646-1" -B "black" -g "800x14+1118+1" +lemonbar -B "#1f1f1f" -g "800x14+1118+1" diff --git a/scripts/sysinit/xmonad_start.sh b/scripts/sysinit/xmonad_start.sh index 8b73f05..d3e39bb 100755 --- a/scripts/sysinit/xmonad_start.sh +++ b/scripts/sysinit/xmonad_start.sh @@ -17,5 +17,5 @@ xset r rate 300 30 unclutter -grab & tmux start-server pulseaudio -D -wmname LG3D +wmname compton xmonad diff --git a/ubuntu/99_physlock_on_hibernate_and_suspend b/ubuntu/99_physlock_on_hibernate_and_suspend new file mode 100755 index 0000000..97cb95b --- /dev/null +++ b/ubuntu/99_physlock_on_hibernate_and_suspend @@ -0,0 +1,9 @@ +#!/bin/bash + +case "$1" in +# suspend|hibernate) +# ;; +resume|thaw) + physlock -d & + ;; +esac diff --git a/ubuntu/README.md b/ubuntu/README.md new file mode 100644 index 0000000..717c286 --- /dev/null +++ b/ubuntu/README.md @@ -0,0 +1,71 @@ +# Ubuntu Install + +![desktop screenshot](../current-desktop.png?raw=true "Current Desktop") + +By running the installer it wipes a complete install and turns it into something more minimal and less resource +intensive. An alternative would've been to start with the Ubuntu minimal disk and work up, but the full Ubuntu ISO comes with some conveniences that I wanted to keep. Kit includes: + + - Compton + - Xmonad + - Dmenu + - Lemonbar + - Urxvt + - Physlock + - feh + - zsh + +It also substitutes Ubuntu's stock media players with less resource intensive alternatives such as `mplayer` and +`ffmpeg`. + +*NOTE:* After rebooting you will boot into a black screen. See the section on GRUB for details. To get to a login +screen press `ctrl + alt + f1` and login normally. + +## X Server + +To start Xmonad simply type `startx` at the tty. + +Make sure Xresources and Xinitrc are symlinked properly in your home directory. If you have any problems getting +Xmonad to start, check the logs, and then those two files. + +To Kill the server at any time press `alt + shift + q`. + +### Xmonad Hotkeys + +Here are some hotkeys to get you started: + +* `mod4 + shift + q`: Kill X server +* `mod4 + q`: Recompile Xmonad +* `mod4 + w`: Move window up +* `mod4 + s`: Move window down +* `mod4 + a`: Move window left +* `mod4 + d`: Move window right +* `mod4 + enter`: Spawn a new window +* `mod4 + space`: Launch dmenu +* `mod4 + h`: Shift focus left +* `mod4 + j`: Shift focus down +* `mod4 + k`: Shift focus up +* `mod4 + l`: Shift focus right +* `mod4 + <1...9>`: Change to nth workspace +* `mod4 + t`: Retile windows +* `mod4 + shift + c`: Close currently focused window + +## GRUB + +A small change has to be applied to stop Ubuntu from booting into a non-existent display manager's login screen: + +1. Type `sudo nano /etc/default/grub` +2. Find `GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"` +3. Replace (2) with `GRUB_CMDLINE_LINUX_DEFAULT="text"` +4. Run `sudo upgrade-grub` + +This will force Ubuntu to boot into a tty. To start Ubuntu type `startx` in any tty. + +## Changing Desktop Backgrounds + +Inside of `~/.xinitrc` is a line that starts with `feh`. Change the image being passed into this +to change the desktop background. Kill the xserver with `alt + shift + q` and `startx` again. + +## TODO + + 1. Have installer script `git clone` essentials and symlink everything correctly. + 2. Have installer automatically modify the grub config to set up text login mode. diff --git a/ubuntu/installer.sh b/ubuntu/installer.sh new file mode 100644 index 0000000..447862b --- /dev/null +++ b/ubuntu/installer.sh @@ -0,0 +1,159 @@ +# Simple script to get an ubuntu system up and running +# Tested on Ubuntu 16.04 LTS + +echo "======== UBUNTU AUTO-INSTALL SCRIPT ========" + +echo "Checking for internet connection..." +nc -z 8.8.8.8 53 >/dev/null 2>&1 +online=$? +if [ $online -ne 0 ]; then + echo "No internet connection detected! Please enable an internet connection before continuing." + exit +fi + +# Pre-setup +echo "Running pre-setup..." +sudo add-apt-repository ppa:neovim-ppa/unstable +sudo apt-add-repository -y "deb http://repository.spotify.com stable non-free" +sudo apt-add-repository -y ppa:richardgv/compton +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D2C19886 +sudo dpkg --add-architecture i386 +sudo add-apt-repository ppa:wine/wine-builds +sudo apt-get -qq -y update +sudo apt-get -qq -y upgrade + +# Window Manager +echo "Installing window manager..." +sudo apt-get -qq -y install xmonad +sudo apt-get -qq -y install compton +sudo apt-get -qq -y install libghc-xmonad-contrib-dev +sudo apt-get -qq -y install xorg +sudo apt-get -qq -y install xinit +sudo apt-get -qq -y install wmname +sudo apt-get -qq -y install libxcb-xinerama0-dev +sudo apt-get -qq -y install libxcb-randr0-dev +sudo apt-get -qq -y install xbacklight + +# Build and install lemonbar from source +echo "Installing lemonbar from source..." +pushd +cd ~ +git clone https://github.com/LemonBoy/bar.git +cd bar/ +make +sudo make install +popd + +# Dmenu +echo "Installing Dmenu..." +sudo apt-get -qq -y install suckless-tools + +# Languages +echo "Installing languages and tools..." +sudo apt-get -qq -y install python-dev +sudo apt-get -qq -y install python-pip +sudo apt-get -qq -y install python3-dev +sudo apt-get -qq -y install python3-pip +sudo apt-get -qq -y install python3-setuptools +sudo apt-get -qq -y install m4 +sudo apt-get -qq -y install ocaml +sudo apt-get -qq -y install aspcud +sudo apt-get -qq -y install liblapack-dev +sudo apt-get install --install-recommends winehq-devel +wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin + +# Editors +echo "Installing editors..." +sudo apt-get -qq -y install vim +sudo apt-get -qq -y install neovim + +echo "Installing python tools for neovim..." +sudo pip install neovim + +# Terminals +echo "Installing terminal..." +sudo apt-get -qq -y rxvt-unicode + +# Shell +echo "Installing shells..." +sudo apt-get -qq -y install zsh + +echo "Changing shell to zsh..." +chsh -s $(which zsh) + +# Source Control +echo "Installing source control..." +sudo apt-get -qq -y install git + +# Remove Unity (This has to be done here so we can reinstall what unity removes) +echo "Removing Unity..." +sudo apt-get -qq -y purge unity + +# Multimedia +echo "Installing multimedia..." +sudo apt-get -qq -y install ffmpeg +sudo apt-get -qq -y install mplayer +sudo apt-get -qq -y install spotify-client +sudo apt-get -qq -y install pepperflashplugin-nonfree + +# Tools +echo "Installing tools..." +sudo apt-get -qq -y install transmission +sudo apt-get -qq -y install htop +sudo apt-get -qq -y install scrot +sudo apt-get -qq -y install tmux +sudo apt-get -qq -y install feh +sudo apt-get -qq -y install unclutter +sudo apt-get -qq -y install xdotool +sudo apt-get -qq -y install cmake +sudo apt-get -qq -y install gsimplecal +sudo apt-get -qq -y install xclip + +# Comms +echo "Installing comms..." +sudo apt-get -qq -y install irssi +sudo apt-get -qq -y install skype + +# Browsers +echo "Installing browsers..." +sudo apt-get -qq -y install chromium-browser + +# Fonts +echo "Installing fonts..." +sudo apt-get -qq -y install fonts-inconsolata +fc-cache --really-force -v + +# Security +echo "Installing security..." +sudo apt-get -qq -y install physlock + +# Cleanup +echo "Cleaning up unneccessary programs..." +sudo apt-get -qq -y purge firefox +sudo apt-get -qq -y purge rhythmbox +sudo apt-get -qq -y purge cheese +sudo apt-get -qq -y purge shotwell +sudo apt-get -qq -y purge shotwell-common +sudo apt-get -qq -y purge thunderbird +sudo apt-get -qq -y purge aisleriot +sudo apt-get -qq -y purge webbrowser-app +sudo apt-get -qq -y purge gnome-sudoku +sudo apt-get -qq -y purge mahjongg +sudo apt-get -qq -y purge gnomine +sudo apt-get -qq -y purge ace-of-penguins +sudo apt-get -qq -y purge onboard +sudo apt-get -qq -y purge lightdm +sudo apt-get -qq -y purge gnome-terminal +sudo apt-get -qq -y purge gnome-terminal-data +sudo apt -qq -y autoremove + +# Right here is where the sed one-line would go to replace +# "quiet splash" with "text" in the grub config and then call +# sudo update grub. This eliminates Ubuntu getting stuck trying +# to boot a login screen that doesn't exist by dropping you +# straight into a tty. + +echo "!!! DONE INSTALLING !!!" +echo "======== REBOOTING IN 30 SECONDS ========" +sleep 30 +sudo reboot