config: add macbook config

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay Pai 2018-07-28 14:44:59 +05:30
commit e7c4c20797
10 changed files with 648 additions and 0 deletions

28
bspwmrc Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
bspc monitor -d 1 2 3 4 5 6
bspc config border_width 4
bspc config window_gap 16
bspc config focused_border_color \#f0f0f0
bspc config normal_border_color \#151515
bspc config split_ratio 0.50
bspc config borderless_monocle true
bspc config gapless_monocle true
bspc config focus_follows_pointer true
#bspc config click_to_focus true
bspc config center_pseudo_tiled false
bspc config single_monocle true
bspc config pointer_modifier mod1
/etc/nixos/displayon
# display-on
# xrandr --output LVDS-1 --brightness 0.85
nitrogen --restore &
pgrep -x compton &> /dev/null && pkill compton
compton --config /etc/nixos/compton.conf -b &
pgrep -x polybar &> /dev/null && pkill polybar
polybar -c /etc/nixos/polybar base &

38
compton.conf Normal file
View File

@ -0,0 +1,38 @@
# compton config
shadow-opacity = 0.7;
frame-opacity = 0.5;
opacity-exclude = [
"class_g = 'mpv'"
];
opacity-rule = [ "30:class_g = 'Bspwm' && class_i = 'presel_feedback'" ];
fading = true;
fade-delta = 10;
fade-in-step = 0.02;
fade-out-step = 0.02;
## Keep the shadows tight
shadow = true;
shadow-radius = 7;
shadow-offset-x = -5;
shadow-offset-y = -5;
no-dock-shadow = false;
no-dnd-shadow = true;
clear-shadow = true;
backend = "glx"
glx-swap-method = "buffer-age"
glx-no-rebind-pixmap = true
glx-no-stencil = true
unredir-if-possible = false
detect-transient = true;
detect-client-leader = true;
shadow-ignore-shaped = true;
detect-rounded-corners = true;
refresh-rate = 0;
vsync = "opengl-swc";
dbe = false;
paint-on-overlay = true;

259
configuration.nix Normal file
View File

@ -0,0 +1,259 @@
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.cleanTmpDir = true;
boot.consoleLogLevel = 3;
boot.extraModprobeConfig = ''
options snd_hda_intel power_save=1
options i915 enable_rc6=1 enable_fbc=1 fastboot=1 lvds_downclock=1
'';
boot.kernelParams = [
"quiet"
"intremap=off"
"elevator=deadline"
];
boot.kernel.sysctl = {
"vm.swappiness" = 5;
"vm.vfs_cache_pressure" = 50;
"vm.dirty_background_ratio" = 25;
"vm.dirty_background_bytes" = 0;
"vm.dirty_ratio" = 75;
"vm.dirty_bytes" = 0;
"vm.dirty_expire_centisecs" = 6000;
"vm.dirty_writeback_centisecs" = 2000;
"ipv6.disable" = 1;
};
boot.blacklistedKernelModules = [ "uvcvideo" "wl" "bluetooth" "btusb" ];
# Networking configuration.
networking.hostName = "tuxbox"; # Define your hostname.
networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.enableB43Firmware = true;
networking.extraHosts = ''
127.0.0.1 tuxbox
'';
networking.enableIPv6 = false;
networking.dhcpcd.persistent = true;
networking.dhcpcd.extraConfig = ''
noarp
ipv4only
noipv6
'';
# Select internationalisation properties.
i18n = {
consoleFont = "Lat2-Terminus16";
consoleKeyMap = "us";
defaultLocale = "en_US.UTF-8";
};
# Set your time zone.
time.timeZone = "Asia/Kolkata";
# Fonts
fonts.enableFontDir = true;
fonts.enableCoreFonts = true;
fonts.enableGhostscriptFonts = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
wget
vim
git
acpi
screen
zip
unzip
which
file
ntfs3g
sshfsFuse
curl
];
# Allow non-free packages
nixpkgs.config.allowUnfree = true;
# Enable Thunderbolt module.
nixpkgs.config.packageOverrides = pkgs: {
linux = pkgs.linuxPackages.override {
extraConfig = ''
THUNDERBOLT m
'';
};
};
# disable udev-settle
systemd.services.systemd-udev-settle.enable = false;
# Enable power management.
powerManagement.enable = true;
services.tlp.enable = true;
services.tlp.extraConfig = ''
USB_BLACKLIST_PHONE=1
'';
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.bash.enableCompletion = true;
programs.bash.shellAliases = {
vim = "nvim";
};
# programs.mtr.enable = true;
programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
# Disable nscd
services.nscd.enable = false;
# Enable upower
services.upower.enable = true;
# Enable fstrim.
services.fstrim.enable = true;
# Enable openssh daemon.
services.openssh.enable = true;
services.openssh.ports = [ 22 ];
# Enable acpid.
services.acpid.enable = true;
services.logind.lidSwitchDocked = "suspend";
services.logind.extraConfig = ''
HandlePowerKey=suspend
'';
# Enable mbpfan.
services.mbpfan.enable = true;
# Enable thermald.
services.thermald.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 microcode updates.
hardware.cpu.intel.updateMicrocode = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.pulseaudio.support32Bit = true;
# Bluetooth configuration.
hardware.bluetooth.enable = false;
# OpenGL VAAPI
hardware.opengl.extraPackages = [ pkgs.vaapiIntel pkgs.vaapiVdpau ];
# Enable the X11 windowing system.
# services.xserver.autorun = false;
services.xserver.enable = true;
services.xserver.layout = "us";
services.xserver.videoDrivers = [ "intel" ];
services.xserver.xkbVariant = "mac";
services.xserver.xkbOptions = "terminate:ctrl_alt_bksp, ctrl:nocaps";
# Libinput configuration.
services.xserver.libinput.enable = true;
services.xserver.libinput.accelSpeed = "0.6";
services.xserver.libinput.disableWhileTyping = true;
services.xserver.libinput.naturalScrolling = true;
services.xserver.libinput.tappingDragLock = false;
services.xserver.libinput.additionalOptions = ''
Option "TappingDrag" "off"
'';
# Display manager and desktop manager.
services.xserver.displayManager.sddm.enable = true;
services.xserver.displayManager.sddm.setupScript = ''
${pkgs.xorg.xrandr}/bin/xrandr --output LVDS1 --pos 640x1080 --rotate normal
'';
services.xserver.displayManager.sddm.autoLogin = {
enable = true;
user = "smolboye";
};
services.xserver.windowManager.bspwm.enable = true;
services.xserver.windowManager.bspwm.configFile = "/etc/nixos/bspwmrc";
services.xserver.windowManager.bspwm.sxhkd.configFile = "/etc/nixos/sxhkdrc";
services.xserver.desktopManager.default = "none";
services.xserver.windowManager.default = "bspwm";
services.xserver.desktopManager.xterm.enable = false;
# Monitor configuration
services.xserver.xrandrHeads = [
{
output = "HDMI1";
monitorConfig = ''
Modeline "2560x1080_52.00" 196.50 2560 2712 2976 3392 1080 1083 1093 1115 -hsync +vsync
Option "PreferredMode" "2560x1080_52.00"
'';
}
];
# Enable udev rule.
services.udev.extraRules = ''
KERNEL=="card0", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/smolboye/.Xauthority", RUN+="/etc/nixos/bspwmrc"
'';
# Enable sudo.
security.sudo.enable = true;
security.sudo.wheelNeedsPassword = true;
# User account configuration.
users.extraUsers.smolboye = {
isNormalUser = true;
uid = 1000;
group = "users";
description = "Chinmay Pai";
extraGroups = [
"wheel"
"systemd-journal"
"audio"
"video"
];
createHome = true;
home = "/home/smolboye";
};
# Mount filesystems.
fileSystems."/home/smolboye/hdd" =
{
device = "/dev/disk/by-uuid/02b58034-d250-4a2d-b854-484c399c687e";
fsType = "ext4";
};
fileSystems."/home/smolboye/seagate" =
{
device = "${pkgs.sshfsFuse}/bin/sshfs#pi@192.168.0.107:/home/pi/seagate";
fsType = "fuse";
options = [ "noauto" "_netdev" "x-systemd.automount" "port=22693" "user" "allow_other"
"noatime" "follow_symlinks" "IdentityFile=/home/smolboye/.ssh/id_rsa"
"reconnect" "uid=1000" "gid=1000"
];
};
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "18.03"; # Did you read the comment?
}

14
displayon Executable file
View File

@ -0,0 +1,14 @@
#!/bin/sh
export DISPLAY=:0
export XAUTHORITY=/home/smolboye/.Xauthority
function connect(){
xrandr --output DP3 --off --output DP2 --off --output DP1 --off --output HDMI3 --off --output HDMI2 --off --output HDMI1 --mode 2560x1080_52.00 --pos 0x0 --rotate normal --output LVDS1 --primary --mode 1280x800 --pos 640x1080 --rotate normal --gamma 0.85:0.85:0.85 --brightness 0.9 --output VGA1 --off
}
function disconnect(){
xrandr --output HDMI1 --off
}
xrandr | grep "HDMI1 connected" &> /dev/null && connect || disconnect

View File

@ -0,0 +1,31 @@
# 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 =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "firewire_ohci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ];
boot.kernelModules = [ "kvm-intel" "wl" ];
boot.extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/04eee0e4-3fd2-46d9-8516-412dd7a1c797";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/74C7-123C";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/ab69ae50-0e6d-45ad-ba41-a3300bbde543"; }
];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

108
kbdbacklight Executable file
View File

@ -0,0 +1,108 @@
#!/bin/sh
# By Giorgos Keramidas
# backlight_get
# Print current keyboard brightness from UPower to stdout.
backlight_get()
{
dbus-send --type=method_call --print-reply=literal --system \
--dest='org.freedesktop.UPower' \
'/org/freedesktop/UPower/KbdBacklight' \
'org.freedesktop.UPower.KbdBacklight.GetBrightness' \
| awk '{print $2}'
}
# backlight_get_max
# Print the maximum keyboard brightness from UPower to stdout.
backlight_get_max()
{
dbus-send --type=method_call --print-reply=literal --system \
--dest='org.freedesktop.UPower' \
'/org/freedesktop/UPower/KbdBacklight' \
'org.freedesktop.UPower.KbdBacklight.GetMaxBrightness' \
| awk '{print $2}'
}
# backlight_set NUMBER
# Set the current backlight brighness to NUMBER, through UPower
backlight_set()
{
value="$1"
if test -z "${value}" ; then
echo "Invalid backlight value ${value}"
fi
dbus-send --type=method_call --print-reply=literal --system \
--dest='org.freedesktop.UPower' \
'/org/freedesktop/UPower/KbdBacklight' \
'org.freedesktop.UPower.KbdBacklight.SetBrightness' \
"int32:${value}}"
}
# backlight_change [ UP | DOWN | NUMBER ]
# Change the current backlight value upwards or downwards, or
# set it to a specific numeric value.
backlight_change()
{
change="$1"
if test -z "${change}" ; then
echo "Invalid backlight change ${change}." \
"Should be 'up' or 'down'." >&2
return 1
fi
case ${change} in
[1234567890]|[[1234567890][[1234567890])
current=$( backlight_get )
max=$( backlight_get_max )
value=$( expr ${change} + 0 )
if test ${value} -lt 0 || test ${value} -gt ${max} ; then
echo "Invalid backlight value ${value}." \
"Should be a number between 0 .. ${max}" >&2
return 1
else
backlight_set "${value}"
#notify-send -t 800 "Keyboard brightness set to ${value}"
fi
;;
[uU][pP])
current=$( backlight_get )
max=$( backlight_get_max )
if test "${current}" -lt "${max}" ; then
value=$(( ${current} + 1 ))
backlight_set "${value}"
#notify-send -t 800 "Keyboard brightness set to ${value}"
fi
;;
[dD][oO][wW][nN])
current=$( backlight_get )
if test "${current}" -gt 0 ; then
value=$(( ${current} - 1 ))
backlight_set "${value}"
#notify-send -t 800 "Keyboard brightness set to ${value}"
fi
;;
*)
echo "Invalid backlight change ${change}." >&2
echo "Should be 'up' or 'down' or a number between" \
"1 .. $( backlight_get_max )" >&2
return 1
;;
esac
}
if test $# -eq 0 ; then
current_brightness=$( backlight_get )
#notify-send -t 800 "Keyboard brightness is ${current_brightness}"
else
# Handle multiple backlight changes, e.g.:
# backlight.sh up up down down up
for change in "$@" ; do
backlight_change "${change}"
done
fi

77
polybar Normal file
View File

@ -0,0 +1,77 @@
[colors]
background = #0A0606
dim = #A0A5AC
foreground = #DCD6D6
active = #386CBB
[bar/base]
monitor = LVDS1
width = 100%
height = 28
bottom = true
background = ${colors.background}
foreground = ${colors.foreground}
font-0 = "Terminus:size=8;2"
font-1 = "Siji:size=18;2"
padding = 2
module-margin = 2
modules-left = date
modules-center = bspwm
modules-right = volume
[module/date]
type = internal/date
interval = 1.0
date-alt = " %m-%d"
date = " %H:%M"
[module/bspwm]
type = internal/bspwm
ws-icon-default = 
label-focused = 
label-occupied = %icon%
label-urgent = %icon%
label-empty = %icon%
label-separator = " "
label-focused-foreground = ${colors.active}
label-dimmed-foreground = ${colors.dim}
label-occupied-foreground = ${colors.dim}
label-urgent-foreground = ${colors.dim}
label-empty-foreground = ${colors.dim}
[module/mpd]
type = internal/mpd
format-online = <label-song> <icon-prev> <toggle> <icon-next>
format-playing = ${self.format-online}
format-paused = ${self.format-online}
format-stopped = ${self.format-online}
label-song = %artist% - %title%
icon-play = 
icon-pause = 
icon-prev = 
icon-next = 
[module/volume]
type = internal/volume
format-volume = <ramp-volume><label-volume>
format-muted = <label-muted>
label-volume = %percentage%
label-muted =  muted
label-muted-foreground = ${colors.dim}
format-volume-padding = 1
format-muted-padding = 1
ramp-volume-0 = 
ramp-volume-1 = 
ramp-volume-2 = 
ramp-headphones-0 = 

93
sxhkdrc Executable file
View File

@ -0,0 +1,93 @@
# terminal emulator
super + Return
termite
# program launcher
super + d
dmenu_run -nb "#000000" -nf "#ffffff" -sb "#adadad" -fn "Terminus-7" # -h 28
# make sxhkd reload its configuration files:
super + Escape
pkill -USR1 -x sxhkd
# quit bspwm normally
super + alt + Escape
pkill 'bspwm|sxhkd'
# close and kill
super + {_,shift + }w
bspc node -{c,k}
# alternate between the tiled and monocle layout
super + m
bspc desktop -l next
# if the current node is automatic, send it to the last manual, otherwise pull the last leaf
super + y
bspc query -N -n focused.automatic && bspc node -n last.!automatic || bspc node last.leaf -n focused
# swap the current node and the biggest node
super + g
bspc node -s biggest
# set the window state
super + {t,shift + t,s,f}
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
# set the node flags
super + ctrl + {x,y,z}
bspc node -g {locked,sticky,private}
# focus the node in the given direction
super + {_,shift + }{Left,Down,Up,Right}
bspc node -{f,s} {west,south,north,east}
# focus the node for the given path jump
super + {p,b,comma,period}
bspc node -f @{parent,brother,first,second}
# focus the next/previous node in the current desktop
super + {_,shift + }c
bspc node -f {next,prev}.local
# focus the next/previous desktop in the current monitor
super + bracket{left,right}
bspc desktop -f {prev,next}.local
# focus the last node/desktop
super + {grave,Tab}
bspc {node,desktop} -f last
# focus the older or newer node in the focus history
super + {o,i}
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
# focus or send to the given desktop
super + {_,shift + }{1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
# preselect the direction
super + ctrl + {Left,Down,Up,Right}
bspc node -p {west,south,north,east}
# preselect the ratio
super + ctrl + {1-9}
bspc node -o 0.{1-9}
# cancel the preselection for the focused node
super + ctrl + space
bspc node -p cancel
# cancel the preselection for the focused desktop
super + ctrl + shift + space
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
# expand a window by moving one of its side outward
super + alt + {Left,Down,Up,Right}
bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
# contract a window by moving one of its side inward
super + alt + shift + {Left,Down,Up,Right}
bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
# move a floating window
super + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}
# multimedia
XF86Audio{Raise,Lower}Volume
pactl set-sink-volume 0 {+,-}5%
XF86AudioMute
pactl set-sink-mute 0 toggle
XF86MonBrightnessUp
xbacklight -inc 10
XF86MonBrightnessDown
xbacklight -dec 10
XF86KbdBrightnessUp
/etc/nixos/kbdbacklight up
XF86KbdBrightnessDown
/etc/nixos/kbdbacklight down
XF86AudioPlay
playerctl play-pause
XF86AudioNext
playerctl next
XF86AudioPrev
playerctl previous

BIN
wallpapers/screen-hdmi.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

BIN
wallpapers/screen-lvds.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 MiB