Skip to content

smartbunny12/dotfiles

 
 

Repository files navigation

Hi there! That’s my dotfiles. Most of config files are now generated by org-babel from this file (yes, from README.org). That’s literate programming applied to dotfiles. To generate all files you can open this file in emacs and press M-x org-babel-tangle. Or from command line with:

emacs README.org --batch -f org-babel-tangle

I keep this document in sync with generated config files just in case I won’t have access to my Emacs. However, I recommend against looking at them—they’re just a generated mess; you’ll have much better time reading this doc instead—trust me.

Pieces not (yet) covered in this document are:

  • emacs configuration at .emacs.d/;
  • vim configuration at .vimrc and .vim/;
  • awesome wm configuration at .config/awesome/;
  • scripts at bin/;
  • irssi config at .irssi;

NixOS

I’m a NixOS user. What’s cool about it is that I can describe all my system configuration in one file (/etc/nixos/configuration.nix), so I can just copy it to other machine, call nixos-rebuild and have system with the same software, system settings, etc.

An outline looks like this.

{ config, pkgs, lib, ... }:
let
  meta = import ./meta.nix;
  machine-config = lib.getAttr meta.name {
    omicron = [
      <<machine-omicron>>
    ];
  };

in
{
  imports = [
    {
      nixpkgs.config.allowUnfree = true;

      # The NixOS release to be compatible with for stateful data such as databases.
      system.stateVersion = "19.09";
    }

    <<nixos-section>>
  ] ++ machine-config;
}

This <<nixos-section>> is replaced by other parts of this doc.

Default locations

Move nixos configuration from the default location to the dotfiles/nixos/configuration.nix.

Also disable channel mechanism and makes nixos use Nixpkgs in the dotfiles/channels directory. I usually follow nixpkgs-unstable, but that gives me more control.

{
  nix.nixPath =
    let dotfiles = "/home/rasen/dotfiles";
    in [
      "nixos-config=${dotfiles}/nixos/configuration.nix"
      "dotfiles=${dotfiles}"
      "${dotfiles}/channels"
    ];
}

If you want to override default configuration location for the very first nixos-rebuild, use -I flag:

sudo nixos-rebuild switch -I nixos-config=/etc/nixos/configuration.nix

Save config

Save nixos-config in the Nix store, so I can retrieve it later. The config for the currently running system is located at /var/run/current-system/configuration.nix.

{
  system.copySystemConfiguration = true;
}

This setting copies only the configuration.nix file, which works pretty nice as I have only one configuration file and don’t split it.

Users

I’m the only user of the system:

{
  users.extraUsers.rasen = {
    isNormalUser = true;
    uid = 1000;
    extraGroups = [ "users" "wheel" "input" ];
    initialPassword = "HelloWorld";
  };
}

initialPassword is used only first time when user is created. It must be changed as soon as possible with passwd.

Machines

I currently have only one machine.

omicron

This is my small Dell XPS 13.

{
  imports = [
    <nixos-hardware/dell/xps/13-9360>
    <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
  ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  nix.maxJobs = lib.mkDefault 4;

  powerManagement.cpuFreqGovernor = "powersave";

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
}

LVM on LUKS setup for disk encryption.

{
  boot.initrd.luks.devices = {
    root = {
      device = "/dev/disk/by-uuid/8b591c68-48cb-49f0-b4b5-2cdf14d583dc";
      preLVM = true;
    };
  };
  fileSystems."/boot" = {
    device = "/dev/disk/by-uuid/BA72-5382";
    fsType = "vfat";
  };
  fileSystems."/" = {
    device = "/dev/disk/by-uuid/434a4977-ea2c-44c0-b363-e7cf6e947f00";
    fsType = "ext4";
    options = [ "noatime" "nodiratime" "discard" ];
  };
  fileSystems."/home" = {
    device = "/dev/disk/by-uuid/8bfa73e5-c2f1-424e-9f5c-efb97090caf9";
    fsType = "ext4";
    options = [ "noatime" "nodiratime" "discard" ];
  };
  swapDevices = [
    { device = "/dev/disk/by-uuid/26a19f99-4f3a-4bd5-b2ed-359bed344b1e"; }
  ];
}

Clickpad:

{
  services.xserver.libinput = {
    enable = true;
    accelSpeed = "0.7";
  };
}

Local overlays

As a responsible NixOS user, I refuse to install software blindly with sudo make install. That’s why I must write my own nix-expressions. I keep them in my local overlay until they’re merged upstream.

Store overlays in a directory:

{
  nixpkgs.overlays = import ../nixpkgs-overlays/overlays.nix;
}

Store list of overlays in nixpkgs-overlays/overlays.nix.

[
  <<nixpkgs-overlays>>
]

To make package results testing better, I build them in isolated environment (for more info, see nixos manual):

{
  nix.useSandbox = "relaxed";
}

Note that this is "relaxed" instead of true, because I have some packages that require a network to build and thus are __noChroot.

Compatibility with nix tools

See https://nixos.wiki/wiki/Overlays#Using_nixpkgs.overlays_from_configuration.nix_as_.3Cnixpkgs-overlays.3E_in_your_NIX_PATH

Add compat/overlays.nix:

self: super:
with super.lib;
let
  # Using the nixos plumbing that's used to evaluate the config...
  eval = import <nixpkgs/nixos/lib/eval-config.nix>;
  # Evaluate the config,
  paths = (eval {modules = [(import <nixos-config>)];})
    # then get the `nixpkgs.overlays` option.
    .config.nixpkgs.overlays
  ;
in
foldl' (flip extends) (_: super) paths self

Add it to NIX_PATH:

{
  nix.nixPath = [ "nixpkgs-overlays=/home/rasen/dotfiles/nixpkgs-overlays/compat" ];
}

Custom Input font

I like the following settings more than defaults. I also need a custom four-style family because Emacs confuses regular/medium weight otherwise. Use link specified in requireFile to download the font.

./images/20200409192721-screenshot.png

self: super:
{
  # note it's a new attribute and does not override old one
  input-mono = (self.input-fonts.overrideAttrs (old: {
    src = self.requireFile {
      name = "Input-Font.zip";
      url = "https://input.fontbureau.com/download/index.html?customize&fontSelection=fourStyleFamily&regular=InputMonoNarrow-Regular&italic=InputMonoNarrow-Italic&bold=InputMonoNarrow-Bold&boldItalic=InputMonoNarrow-BoldItalic&a=0&g=0&i=topserif&l=serifs_round&zero=0&asterisk=height&braces=straight&preset=default&line-height=1.2&email=";
      sha256 = "0nn41w2b6jvsbr3r4lfy4p8w2ssjmgdjzd1pbj7p0vmawjpvx2w8";
    };
    outputHash = "1w2i660dg04nyc6fc6r6sd3pw53h8dh8yx4iy6ccpii9gwjl9val";
  }));
}

Add overlay to list of overlays:

(import ./input-mono)

Online banking

My bank uses a two-part websigner. The first part is a browser extension (does not require additional setup) and the second part is a native host application companion (it is installed here).

Pack native messaging host:

{ stdenv
, fetchurl
, autoPatchelfHook
, gtk2
, glib
, pcsclite
}:
stdenv.mkDerivation {
  pname = "procreditbank-websigner";
  version = "2020-01-20";

  src = fetchurl {
    url = "https://ibank.procreditbank.com.ua/websigner-linux.bin";
    sha256 = "1bm88jg7nhgrmc0q5hv35hgv4nc0d15ihl0acrhf6x5f7wv4pszv";
  };

  nativeBuildInputs = [ autoPatchelfHook ];

  buildInputs = [ gtk2 glib pcsclite ];

  unpackCmd = ''
    sh $src --extract
  '';

  dontConfigure = true;

  dontBuild = true;

  installPhase = ''
    mkdir -p $out/bin
    mkdir -p $out/lib/websigner/hosts/firefox
    mkdir -p $out/lib/websigner/hosts/chromium

    install -m 555 x86_64-linux/npwebsigner.so $out/lib/websigner
    install -m 777 x86_64-linux/nmwebsigner $out/lib/websigner

    sed "s|PLUGIN_PATH|$out/lib/websigner/nmwebsigner|" com.bifit.websigner-mozilla.json > $out/lib/websigner/hosts/firefox/com.bifit.websigner.json
    sed "s|PLUGIN_PATH|$out/lib/websigner/nmwebsigner|" com.bifit.websigner-chrome.json > $out/lib/websigner/hosts/chromium/com.bifit.websigner.json

    mkdir -p $out/lib/mozilla/native-messaging-hosts
    ln -s $out/lib/websigner/hosts/firefox/*.json $out/lib/mozilla/native-messaging-hosts
  '';
}

Initialize overlay and apply native messaging host to firefox:

self: super:
{
  procreditbank-websigner = self.callPackage ./websigner.nix { };

  firefox = super.firefox.override {
    extraNativeMessagingHosts = [ self.procreditbank-websigner ];
  };
}

Add overlay to list of overlays:

(import ./procreditbank)

Bluetooth

I have a bluetooth headset, so this enables bluetooth audio in NixOS.

{
  hardware.bluetooth.enable = true;
  hardware.pulseaudio = {
    enable = true;

    # NixOS allows either a lightweight build (default) or full build
    # of PulseAudio to be installed.  Only the full build has
    # Bluetooth support, so it must be selected here.
    package = pkgs.pulseaudioFull;
  };
}

NTFS

Install ntfs-3g to mount ntfs volumes in read-write mode.

{
  environment.systemPackages = [
    pkgs.ntfs3g
  ];
}

Services

VPN

{
  services.openvpn.servers.nano-vpn = {
    config = ''
      config /root/openvpn/nano-vpn.ovpn
    '';
  };
}

NetworkManager

{
  networking = {
    hostName = meta.name;

    networkmanager.enable = true;

    # disable wpa_supplicant
    wireless.enable = false;
  };

  users.extraUsers.rasen.extraGroups = [ "networkmanager" ];

  environment.systemPackages = [
    pkgs.networkmanagerapplet
  ];
}

Avahi

{
  services.avahi = {
    enable = true;
    interfaces = [];
    openFirewall = false;
  };
}

PulseAudio

Use pulseaudio (multiple sound sinks, skype calls). pavucontrol is PulseAudio Volume Control—a nice utility for controlling pulseaudio settings.

Also, Pulseaudio is a requirement for Firefox Quantum.

{
  hardware.pulseaudio = {
    enable = true;
    support32Bit = true;
  };

  environment.systemPackages = [ pkgs.pavucontrol ];
}

Locate

Update locate database daily.

{
  services.locate = {
    enable = true;
    localuser = "rasen";
  };
}

SSH

{
  services.openssh = {
    enable = true;
    passwordAuthentication = false;
  };
}

Mosh

Mosh (mobile shell) is a cool addition to ssh.

{
  programs.mosh.enable = true;
}

Gitolite

{
  services.gitolite = {
    enable = true;
    user = "git";
    adminPubkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHH15uiQw3jBbrdlcRb8wOr8KVltuwbHP/JOFAzXFO1l/4QxnKs6Nno939ugULM7Lu0Vx5g6FreuCOa2NMWk5rcjIwOzjrZnHZ7aoAVnE7H9scuz8NGnrWdc1Oq0hmcDxdZrdKdB6CPG/diGWNZy77nLvz5JcX1kPLZENPeApCERwR5SvLecA4Es5JORHz9ssEcf8I7VFpAebfQYDu+VZZvEu03P2+5SXv8+5zjiuxM7qxzqRmv0U8eftii9xgVNC7FaoRBhhM7yKkpbnqX7IeSU3WeVcw4+d1d8b9wD/sFOyGc1xAcvafLaGdgeCQGU729DupRRJokpw6bBRQGH29 rasen@omicron";
  };
}

dnsmasq

Use dnsmasq as a DNS cache.

{
  services.dnsmasq = {
    enable = true;

    # These are used in addition to resolv.conf
    servers = [
      "8.8.8.8"
      "8.8.4.4"
    ];

    extraConfig = ''
      listen-address=127.0.0.1
      cache-size=1000

      no-negcache
    '';
  };
}

Syncthing

I use Syncthing to sync my org-mode files to my phone.

{
  services.syncthing = {
    enable = true;
    user = "rasen";
    dataDir = "/home/rasen/.config/syncthing";
    configDir = "/home/rasen/.config/syncthing";
    openDefaultPorts = true;
  };
}

Firewall

Enable firewall. This blocks all ports (for ingress traffic) and pings.

{
  networking.firewall = {
    enable = true;
    allowPing = false;

    connectionTrackingModules = [];
    autoLoadConntrackHelpers = false;
  };
}

Development

{
  virtualisation.docker.enable = true;
}

Backup

I use borg for backups.

{
  environment.systemPackages = [ pkgs.borgbackup ];
}

ADB

I need to access my Android device.

{
  services.udev.packages = [ pkgs.android-udev-rules ];
  programs.adb.enable = true;
  users.users.rasen.extraGroups = ["adbusers"];
}

Mail setup

Mbsync

I use mbsync to sync my accounts and make them available offline.

{
  environment.systemPackages = [
    pkgs.isync
  ];
}

Config file is .mbsyncrc.

MaildirStore local
Path ~/Mail/
Inbox ~/Mail/INBOX
SubFolders Verbatim

<<mbsync-gmail(name="gmail", email="[email protected]", path="Personal")>>
<<mbsync-gmail(name="ps", email="[email protected]", path="protocolstandard")>>
<<mbsync-gmail(name="egoless", email="[email protected]", path="egoless")>>

I have multiple Gmail accounts, so here is a general template.

(rasen/interpolate-string "
IMAPAccount <<name>>
Host imap.gmail.com
User <<email>>
PassCmd \"pass imap.gmail.com/<<email>>\"
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt

IMAPStore <<name>>-remote
Account <<name>>

Channel sync-<<name>>-all
Master :<<name>>-remote:\"[Gmail]/All Mail\"
Slave :local:<<path>>/all
Create Both
SyncState *

Channel sync-<<name>>-spam
Master :<<name>>-remote:\"[Gmail]/Spam\"
Slave :local:<<path>>/spam
Create Both
SyncState *

Channel sync-<<name>>-sent
Master :<<name>>-remote:\"[Gmail]/Sent Mail\"
Slave :local:<<path>>/sent
Create Both
SyncState *

Group sync-<<name>>
Channel sync-<<name>>-all
Channel sync-<<name>>-spam
Channel sync-<<name>>-sent
")

Dovecot

Dovecot serves fetched mail to gnus.

{
  services.dovecot2 = {
    enable = true;
    enablePop3 = false;
    enableImap = true;
    mailLocation = "maildir:~/Mail:LAYOUT=fs";
  };

  # dovecot has some helpers in libexec (namely, imap).
  environment.pathsToLink = [ "/libexec/dovecot" ];
}

msmtp

Msmtp is used to send mail.

{
  environment.systemPackages = [
    pkgs.msmtp
  ];
}

Config file is .msmtprc.

defaults
auth on
tls on
tls_starttls off
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile ~/.msmtp.log

<<msmtp-gmail(name="gmail", email="[email protected]")>>
<<msmtp-gmail(name="ps", email="[email protected]")>>
<<msmtp-gmail(name="egoless", email="[email protected]")>>

Again, general template for gmail accounts.

(rasen/interpolate-string "
# <<name>>
account <<name>>
host smtp.gmail.com
port 465
from <<email>>
user <<email>>
passwordeval \"pass imap.gmail.com/<<email>>\"
")

notmuch

Notmuch is used for tagging.

{
  environment.systemPackages = [
    pkgs.notmuch
  ];
}

Config file is .notmuch-config.

[user]
name=Alexey Shmalko
[email protected]
[email protected],[email protected],[email protected],[email protected]

[database]
path=/home/rasen/Mail

[new]
tags=inbox;
ignore=.mbsyncstate;.mbsyncstate.lock;.mbsyncstate.new;.mbsyncstate.journal;.uidvalidity;dovecot-uidlist;dovecot-keywords;dovecot.index;dovecot.index.log;dovecot.index.log.2;dovecot.index.cache;/^archive/

[search]
exclude_tags=deleted;spam;muted;

[crypto]
gpg_path=gpg2

Environment

General

I definitely use X server:

{
  services.xserver.enable = true;
}

Use English as my only supported locale:

{
  i18n.supportedLocales = [ "en_US.UTF-8/UTF-8" ];
}

Setup timezone:

{
  time.timeZone = "Europe/Kiev";
}

Login manager / display manager

{
  services.xserver.displayManager.lightdm.enable = true;
}

Window manager

I use awesome wm:

{
  services.xserver.windowManager = {
    awesome = {
      enable = true;
      luaModules = [ pkgs.luaPackages.luafilesystem pkgs.luaPackages.cjson ];
    };
  };
  services.xserver.displayManager.defaultSession = "none+awesome";
}

Disabling xterm makes awesome wm a default choice in slim:

{
  services.xserver.desktopManager.xterm.enable = false;
}

These packages are used by my awesome wm setup:

{
  environment.systemPackages = [
    pkgs.wmname
    pkgs.xclip
    pkgs.escrotum
  ];
}

Keyboard

Layouts

I use English and Ukrainian layouts. I also use Russian symbols, but they are on the third level.

{
  services.xserver.layout = "us,ua";
  services.xserver.xkbVariant = "workman,";

  # Use same config for linux console
  console.useXkbConfig = true;
}

Map left Caps Lock to Ctrl, and left Ctrl to switch between layout. (Shift-Ctrl triggers Caps Lock function.)

I toggle between them with either Caps Lock, or Menu key—I have two different keyboards, and one doesn’t have Menu when Caps Lock is too far on the second. I never use Caps Lock–the feature, so it’s nice to have Caps LED indicate alternate layouts.

{
  services.xserver.xkbOptions = "grp:lctrl_toggle,grp_led:caps,ctrl:nocaps";
}

Layout indicator

I use built-in awesome layout indicator. See .config/awesome/rc.lua for more details.

Redshift

Redshift adjusts the color temperature of the screen according to the position of the sun.

Blue light blocks melatonin (sleep harmone) secretion, so you feel less sleepy when you stare at computer screen. Redshift blocks some blue light (making screen more red), which should improve melatonin secretion and restore sleepiness (which is a good thing).

{
  services.redshift = {
    enable = true;
  };
  location.provider = "geoclue2";
}

Screen brightness

xbacklight stopped working recently. acpilight is a drop-in replacement.

{
  hardware.acpilight.enable = true;
  environment.systemPackages = [
    pkgs.acpilight
  ];
  users.extraUsers.rasen.extraGroups = [ "video" ];
}

Look and Feel

Fonts

I’m not a font guru, so I just stuffed a bunch of random fonts in here.

{
  fonts = {
    enableFontDir = true;
    enableGhostscriptFonts = false;

    fonts = with pkgs; [
      inconsolata
      dejavu_fonts
      source-code-pro
      ubuntu_font_family
      unifont

      # Used by Emacs
      input-mono
      libertine
    ];
  };
}

Hi-DPI

These are for omicron-only.

Xft.dpi: 276
Xcursor.size: 64
{
  console.packages = [
    pkgs.terminus_font
  ];
  console.font = "ter-132n";
}
{
  services.xserver.dpi = 276;
}

Applications

Here go applications (almost) every normal user needs.

GPG

{
  programs.gnupg.agent = {
    enable = true;
    enableSSHSupport = true;
    pinentryFlavor = "qt";
  };

  ## is it no longer needed?
  #
  # systemd.user.sockets.gpg-agent-ssh = {
  #   wantedBy = [ "sockets.target" ];
  #   listenStreams = [ "%t/gnupg/S.gpg-agent.ssh" ];
  #   socketConfig = {
  #     FileDescriptorName = "ssh";
  #     Service = "gpg-agent.service";
  #     SocketMode = "0600";
  #     DirectoryMode = "0700";
  #   };
  # };

  services.pcscd.enable = true;
}

Yubikey

{
  environment.systemPackages = [
    pkgs.yubikey-manager
    pkgs.yubikey-personalization
    pkgs.yubikey-personalization-gui
  ];

  services.udev.packages = [ pkgs.yubikey-personalization ];
}

password-store

Install password-store along with one-time password extension.

{
  environment.systemPackages = [
    (pkgs.pass.withExtensions (exts: [ exts.pass-otp ]))
  ];
}

Install browserpass firefox extension backend.

{
  programs.browserpass.enable = true;
}

KDE apps

I don’t use full KDE but some apps are definitely nice.

{
  environment.systemPackages = [
    pkgs.gwenview
    pkgs.dolphin
    pkgs.kdeFrameworks.kfilemetadata
    pkgs.filelight
    pkgs.shared_mime_info
  ];
}

KDE apps might have issues with mime types without this:

{
  environment.pathsToLink = [ "/share" ];
}

Browsers

Google Chrome

Google Chrome used to be my default browser and I still use it from time to time.

{
  environment.systemPackages = [
    pkgs.google-chrome
  ];
}

Firefox

I use Firefox Quantum as my default browser now.

{
  environment.systemPackages = [
    pkgs.firefox
  ];
}

Zathura

Zathura is a cool document viewer with Vim-like bindings.

{
  environment.systemPackages = [
    pkgs.zathura
  ];
}

Enable incremental search (Zathura’s config goes to ~/.config/zathura/zathurarc).

set incremental-search true

These are my rebinding for Workman layout (swap j/k):

map j scroll up
map k scroll down

Screen locking

Slock

Slock is a simple X display locker and should probably not crash as xscreensaver does.

Slock tries to disable OOM killer (so the locker is not killed when memory is low) and this requires a suid flag for executable. Otherwise, you get the following message:

slock: unable to disable OOM killer. Make sure to suid or sgid slock.
{
  programs.slock.enable = true;
}

xss-lock

xss-lock is a small utility to plug a screen locker into screen saver extension for X. This automatically activates selected screensaver after a period of user inactivity, or when system goes to sleep.

{
  environment.systemPackages = [
    pkgs.xss-lock
  ];
}

Other applications

Don’t require additional setup.

{
  environment.systemPackages = [
    pkgs.google-play-music-desktop-player
    pkgs.tdesktop # Telegram

    pkgs.mplayer
    pkgs.smplayer

    # Used by naga setup
    pkgs.xdotool
  ];
}

Development

Editors

I’m a seasoned Vim user, but I’ve switched to emacs.

{
  environment.systemPackages = [
    (pkgs.vim_configurable.override { python3 = true; })
    pkgs.neovim
  ];
}

Start emacs as a daemon:

{
  services.emacs =
    let emacsConfig = import <dotfiles/.config/nixpkgs/emacs.nix> { inherit pkgs; };
    in {
      enable = true;
      defaultEditor = true;
      package = emacsConfig.finalEmacs;
    };
  environment.systemPackages = [
    pkgs.ripgrep
    (pkgs.aspellWithDicts (dicts: with dicts; [en en-computers en-science ru uk]))

    # pkgs.rustup
    # pkgs.rustracer

    # pkgs.clojure
    # pkgs.leiningen
  ];
  # environment.variables.RUST_SRC_PATH = "${pkgs.rustPlatform.rustcSrc}";
}

rxvt-unicode

I use urxvt as my terminal emulator:

{
  environment.systemPackages = [
    pkgs.rxvt_unicode
  ];
}

Urxvt gets its setting from .Xresources file. If you ever want to reload it on-the-fly, type the following (or press C-c C-c if you’re reading this document in emacs now):

xrdb ~/.Xresources

General setup

See rxvt-unicode documentation for the full reference.

urxvt.loginShell:         true
urxvt.saveLines:         65535
urxvt.urgentOnBell:       true

urxvt.scrollBar:         false
urxvt.scrollTtyOutput:   false
urxvt.scrollTtyKeypress:  true
urxvt.secondaryScroll:    true

The next piece disables annoying message when pressing Ctrl+Shift:

urxvt.iso14755: False

Copy-paste with Ctrl+Shift+C, Ctrl+Shift+V:

From urxvt-perls:

Since version 9.20 rxvt-unicode natively supports copying to and pasting from the CLIPBOARD buffer with the Ctrl-Meta-c and Ctrl-Meta-v key bindings. The clipboard.autocopy setting is provided by the selection_to_clipboard extension shipped with rxvt-unicode.

That means, I don’t need perl extensions at all.

Font

I use Terminus font.

{
  fonts = {
    fonts = [
      pkgs.powerline-fonts
      pkgs.terminus_font
    ];
  };
}
URxvt.font: -*-terminus-medium-r-normal-*-32-*-*-*-*-*-iso10646-1

Color theme

I like Molokai color theme.

URxvt*background: #101010
URxvt*foreground: #d0d0d0
URxvt*color0:     #101010
URxvt*color1:     #960050
URxvt*color2:     #66aa11
URxvt*color3:     #c47f2c
URxvt*color4:     #30309b
URxvt*color5:     #7e40a5
URxvt*color6:     #3579a8
URxvt*color7:     #9999aa
URxvt*color8:     #303030
URxvt*color9:     #ff0090
URxvt*color10:    #80ff00
URxvt*color11:    #ffba68
URxvt*color12:    #5f5fee
URxvt*color13:    #bb88dd
URxvt*color14:    #4eb4fa
URxvt*color15:    #d0d0d0

fish

fish is a cool shell, I use it as my default for day-to-day work.

{
  programs.fish.enable = true;
  users.defaultUserShell = pkgs.fish;
}

Vi key bindings

Tangle to .config/fish/functions/fish_user_key_bindings.fish.

function fish_user_key_bindings
    fish_vi_key_bindings

    bind -s j up-or-search
    bind -s k down-or-search
    bind -s -M visual j up-line
    bind -s -M visual k down-line

    bind -s '.' repeat-jump
end

git

{
  environment.systemPackages = [
    pkgs.gitFull
    pkgs.gitg
  ];
}

Basic info: my name, email, ui, editor, rerere.

[user]
    name = Alexey Shmalko
    email = [email protected]

[sendemail]
    smtpencryption = ssl
    smtpserver = smtp.gmail.com
    smtpuser = [email protected]
    smtpserverport = 465

[color]
    ui = true

[core]
    editor = vim

[push]
    default = simple

[pull]
    rebase = true

[rebase]
    autostash = true

[rerere]
    enabled = true

Configure signing with gpg.

[user]
    signingkey = EB3066C3

[gpg]
    program = gpg2

[push]
    gpgSign = if-asked

I have LOTS of aliases:

[alias]
    cl  = clone
    gh-cl = gh-clone
    cr  = cr-fix
    p   = push
    pl  = pull
    f   = fetch
    fa  = fetch --all
    a   = add
    ap  = add -p
    d   = diff
    dl  = diff HEAD~ HEAD
    ds  = diff --staged
    l   = log --show-signature
    l1  = log -1
    lp  = log -p
    c   = commit
    ca  = commit --amend
    co  = checkout
    cb  = checkout -b
    cm  = checkout origin/master
    de  = checkout --detach
    fco = fetch-checkout
    br  = branch
    s   = status
    re  = reset --hard
    r   = rebase
    rc  = rebase --continue
    ri  = rebase -i
    m   = merge
    t   = tag
    su  = submodule update --init --recursive
    bi  = bisect

Always push to github with ssh keys instead of login/password.

[url "[email protected]:"]
    pushInsteadOf = https://github.com/

tmux

{
  environment.systemPackages = [
    pkgs.tmux
  ];
}

Use C-a as a prefix.

set -g prefix C-a
unbind-key C-b
bind-key C-a send-prefix

Move windows (tabs) around. Stealed from here.

bind-key S-left swap-window -t -1
bind-key S-right swap-window -t +1

TODO describe other settings

# To make vim work properly
set -g default-terminal "screen-256color"

set -g status-keys vi
setw -g mode-keys vi

set -g history-limit 10000

# Start numbering from 1
set -g base-index 1

# Allows for faster key repetition
set -s escape-time 0

bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

bind-key s split-window
bind-key v split-window -h

bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."

set-window-option -g automatic-rename

Other terminal goodies

{
  environment.systemPackages = [
    pkgs.wget
    pkgs.htop
    pkgs.psmisc
    pkgs.zip
    pkgs.unzip
    pkgs.unrar
    pkgs.p7zip
    pkgs.bind
    pkgs.file
    pkgs.which
    pkgs.utillinuxCurses

    pkgs.patchelf

    pkgs.python2
    pkgs.python3

    pkgs.awscli
    pkgs.nodejs-13_x
    pkgs.shellcheck
  ];
  environment.variables.NPM_CONFIG_PREFIX = "$HOME/.npm-global";
  environment.variables.PATH = "$HOME/.npm-global/bin:$PATH";
}

Man pages

This install a number of default man pages for the linux/posix system.

{
  documentation = {
    man.enable = true;
    dev.enable = true;
  };

  environment.systemPackages = [
    pkgs.man-pages
    pkgs.stdman
    pkgs.posix_man_pages
    pkgs.stdmanpages
  ];
}

Meta

Setup

There is a setup.sh script in this directory. It just links all files to $HOME:

FILES=".vimrc .vim .nvimrc .nvim .gitconfig .zshrc .zsh .tmux.conf .Xresources .config/awesome .config/nvim .nethackrc .emacs.d .ssh bin .config/zathura .irssi .config/xkb .config/fish .msmtprc .notmuch-config .mbsyncrc .config/nixpkgs"

DEST=$1

if [ -z "$DEST" ]; then
    DEST="$HOME"
fi

BASE=$(cd "$(dirname "$0")" && pwd)

ask_install() {
    FILENAME=$1

    LINK="$DEST/$FILENAME"
    TARGET="$BASE/$FILENAME"

    if [ -e $LINK ]; then
        echo "$LINK exists. Skipping..."
    else
        read -r -p "Link $LINK to $TARGET? [y/N] " response
        case $response in
            [yY][eE][sS]|[yY])
                ln -v -s "$TARGET" "$LINK"
                ;;
        esac
    fi
}

for FILE in $FILES; do
    ask_install $FILE
done

Install fisherman

Fisherman is a plugin manager for fish.

if [ ! -e "$DEST/.config/fish/functions/fisher.fish" ]; then
    read -r -p "Install fisherman and all plugins? [y/N] " response
    case $response in
        [yY][eE][sS]|[yY])
            curl -Lo "$DEST/.config/fish/functions/fisher.fish" --create-dirs \
                https://raw.githubusercontent.com/fisherman/fisherman/master/fisher.fish
            fish -c fisher
            ;;
    esac
fi

Private :crypt-:

About

My dotfiles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 33.8%
  • Lua 18.3%
  • Nix 14.0%
  • Perl 13.3%
  • Python 8.8%
  • Vim Script 5.9%
  • Other 5.9%