Skip to content

Instantly share code, notes, and snippets.

@pkinsky pkinsky/XResources
Created Apr 3, 2018

Embed
What would you like to do?
nixos vm config stuff
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
environment.systemPackages = with pkgs; [
# basic widgets
wget
sudo
manpages
nix
rxvt_unicode
# x11 apps
firefoxWrapper
chromium
xclip
xscreensaver
# font junk, copied from github gist
xfontsel
xlsfonts
# for use by xmonad
dzen2
# for setting up desktop background
feh
];
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "nodev";
boot.loader.grub.efiSupport = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.checkJournalingFS = false;
boot.initrd.luks.devices = [
{
name = "root";
device = "/dev/disk/by-uuid/ba73f992-25da-4968-8de4-16b3e41021d5";
preLVM = true;
allowDiscards = true;
}
];
# User account
# * Set a password using
# $ useradd -m pkinsky ; passwd pkinsky
users.extraUsers.pkinsky = {
createHome = true;
home = "/home/pkinsky";
description = "Paul Kinsky";
# copied from gist, todo revisit (https://gist.github.com/i-e-b/6320077)
extraGroups = [ "wheel" "disk" "vboxusers" "cdrom" ];
isSystemUser = false;
# useDefaultShell = true;
shell = pkgs.zsh;
};
security.sudo.enable = true;
services = {
# x11
xserver = {
enable = true;
layout = "us";
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
extraPackages = haskellPackages: [
haskellPackages.xmonad-contrib
haskellPackages.xmonad-extras
haskellPackages.xmonad
];
};
windowManager.default = "xmonad";
};
};
# not sure if still required
programs.zsh.promptInit = ""; # Clear this to avoid a conflict with oh-my-zsh
# networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Select internationalisation properties.
# i18n = {
# consoleFont = "Lat2-Terminus16";
# consoleKeyMap = "us";
# defaultLocale = "en_US.UTF-8";
# };
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.bash.enableCompletion = true;
# 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 touchpad support.
# services.xserver.libinput.enable = true;
# 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 = "17.09"; # Did you read the comment?
}
{-# LANGUAGE FlexibleContexts #-}
--------------------------------------------------------------------------------
import Data.Monoid
--------------------------------------------------------------------------------
import XMonad
--------------------------------------------------------------------------------
import XMonad.Config.Desktop
--------------------------------------------------------------------------------
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.UrgencyHook
--------------------------------------------------------------------------------
import XMonad.Layout.DecorationMadness
import XMonad.Layout.Fullscreen
import XMonad.Layout.LayoutModifier
import XMonad.Layout.NoBorders
import XMonad.Layout.ThreeColumns
--------------------------------------------------------------------------------
import qualified XMonad.Prompt as P
import XMonad.Prompt.Shell
--------------------------------------------------------------------------------
import XMonad.Util.EZConfig
import XMonad.Util.Run (spawnPipe)
--------------------------------------------------------------------------------
main = do
spawn "xrdb -merge ~/.xmonad/XResources"
spawn "feh --bg-scale ~/.xmonad/desktop.jpg"
let baseConf = desktopConfig
{ modMask = modm
, terminal = "urxvt"
, logHook = dynamicLogWithPP dzenPP
, layoutHook = myLayout
} `additionalKeysP` ezKeyBindings
xmonad =<< myDzen baseConf
modm :: KeyMask
modm = mod1Mask -- mod4 is left CMD on macbook, mod1 is right alt/option
-- key bindings for use with ez config tool
ezKeyBindings :: [(String, X ())]
ezKeyBindings =
[ ("M-p", shellPrompt myXPConfig)
]
-- the type on this is atrocious, sorta servant-esque type level layour repr
-- todo figure out how to represent well
-- myLayout :: Choose ThreeCol (Choose Tall (Choose Mirror Tall) Full) a
myLayout
= ThreeColMid 1 (3/100) (1/2)
||| Tall 1 (3/100) (1/2)
||| Mirror (Tall 1 (3/100) (1/2))
||| Full
-- fun experimental layouts, maybe bind to specific key?
layoutMadness
= circleSimpleDefault -- less useful but fun for HACKERMAN style demos I guess
||| circleSimpleTabbed -- slightly more useful, lists windows via tabs. keep, maybe
||| tallSimpleDefault -- basically just tall w/ tabs on windows
||| mirrorTallSimpleDefault -- basically just mirror tall w/ tabs on windows
--------------------------------------------------------------------------------
-- | Customize the way 'XMonad.Prompt' looks and behaves.
myXPConfig :: P.XPConfig
myXPConfig = def
{ P.position = P.Top
, P.alwaysHighlight = True
, P.promptBorderWidth = 0
, P.font = "xft:monospace:size=9"
, P.bgColor = bg
, P.fgColor = fg
}
fg, bg :: String
fg = "#a8a3f7"
bg = "#3f3c6d"
--------------------------------------------------------------------------------
-- | my tweaked version of https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/src/XMonad-Hooks-DynamicLog.html#dzen
myDzen :: LayoutClass l Window
=> XConfig l -> IO (XConfig (ModifiedLayout AvoidStruts l))
myDzen conf = statusBar ("dzen2 " ++ flags) dzenPP toggleStrutsKey conf
where
toggleStrutsKey XConfig{modMask = modm} = (modm, xK_b )
-- note: -dock here makes struts avoidance work, not sure why
flags = mconcat [ "-e 'onstart=lower' -dock -ta l -fg '"
, fg
, "' -bg '"
, bg
, "'" -- fg and bg need to be wrapped in single quotes
]
URxvt.scrollBar: false
urxvt*termName: rxvt
urxvt*font: xft:uushi:pixelsize=16
urxvt*boldFont:
urxvt*background: #000000
urxvt*foreground: #666699
urxvt*cursorColor: #6699CC
urxvt*colorBD: #CCCCFF
!Visiblue
urxvt*color0: #333366
urxvt*color8: #333399
urxvt*color1: #6666CC
urxvt*color9: #9999FF
urxvt*color2: #0099CC
urxvt*color10: #00CCFF
urxvt*color3: #3366CC
urxvt*color11: #6699FF
urxvt*color4: #006699
urxvt*color12: #0099CC
urxvt*color5: #0066FF
urxvt*color13: #0099FF
urxvt*color6: #669999
urxvt*color14: #66CCCC
urxvt*color7: #99CCCC
urxvt*color15: #CCFFFF
URxvt.transparent: True
URxvt.shading: 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.