Skip to content

Instantly share code, notes, and snippets.

@kendricktan
Last active February 7, 2024 01:58
Show Gist options
  • Save kendricktan/8c33019cf5786d666d0ad64c6a412526 to your computer and use it in GitHub Desktop.
Save kendricktan/8c33019cf5786d666d0ad64c6a412526 to your computer and use it in GitHub Desktop.
NixOS 18.03 (To get zsh working, `nixos-rebuild switch; cp /etc/zsh ~/.zshrc; remove first two lines of zshrc`)
# 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
];
# VirtualBox
virtualisation.virtualbox.guest.enable = true;
boot.initrd.checkJournalingFS = false;
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
networking.hostName = "kendrick-t460s"; # 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 = "Australia/Brisbane";
# List packages installed in system profile. To search, run:
# $ nix search wget
environment = {
systemPackages = with pkgs; [
curl
wget
dmenu
firefox
git
gparted
haskell.packages.ghc802.hdevtools
haskell.packages.ghc802.hoogle
htop
lambda-mod-zsh-theme
gnome3.gedit
gnome3.nautilus
neovim
oh-my-zsh
p7zip
python36
python36Packages.neovim
termite
telnet
tmux
unrar
unzip
wget
xlibs.xmodmap
xlibs.xbacklight
zsh
];
};
# 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; };
programs.zsh = {
enable = true;
shellAliases = {
vim = "nvim";
};
enableCompletion = true;
enableAutosuggestions = true;
interactiveShellInit = ''
# z - jump around
source ${pkgs.fetchurl {url = "https://github.com/rupa/z/raw/2ebe419ae18316c5597dd5fb84b5d8595ff1dde9/z.sh"; sha256 = "0ywpgk3ksjq7g30bqbhl9znz3jh6jfg8lxnbdbaiipzgsy41vi10";}}
export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh
export ZSH_THEME="lambda"
plugins=(git)
source $ZSH/oh-my-zsh.sh
'';
promptInit = "";
};
# 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;
# Enable the X11 windowing system.
services.xserver = {
enable = true;
layout = "us";
xkbOptions = "eurosign:e";
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
extraPackages = haskellPackages: [
haskellPackages.xmonad-contrib
haskellPackages.xmonad-extras
haskellPackages.xmonad
];
};
windowManager.default = "xmonad";
displayManager.sessionCommands = with pkgs; lib.mkAfter
''
# Swap caps lock and escape
xmodmap -e "keycode 9 = Caps_Lock NoSymbol Caps_Lock"
xmodmap -e "keycode 66 = Escape NoSymbol Escape"
xmodmap -e "clear Lock"
'';
};
fonts = {
enableCoreFonts = true;
enableFontDir = true;
fonts = with pkgs; [
corefonts # Microsoft free fonts
fira # Monospace
inconsolata # Monospace
powerline-fonts
ubuntu_font_family
unifont # International languages
];
};
# Enable touchpad support.
# services.xserver.libinput.enable = true;
# Enable the KDE Desktop Environment.
# services.xserver.displayManager.sddm.enable = true;
# services.xserver.desktopManager.plasma5.enable = true;
# Define a user account. Don't forget to set a password with ‘passwd’.
# users.extraUsers.guest = {
# isNormalUser = true;
# uid = 1000;
# };
users = {
defaultUserShell = pkgs.zsh;
extraUsers.kendrick = {
isNormalUser = true;
home = "/home/kendrick";
description = "Kendrick Tan";
extraGroups = [ "wheel" "networkmanager" ];
shell = pkgs.zsh;
};
};
# Allow unfree build
nixpkgs.config = {
allowUnfree = true;
packageOverrides = pkgs: rec {
neovim = (import ./vim.nix);
};
};
# 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?
}
with import <nixpkgs> {};
pkgs.neovim.override {
vimAlias = true;
configure = {
customRC = ''
" Use Vim settings, rather than Vi Settings
set nocompatible
"************************************************
"" Settings
"************************************************
" deoplete
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_smart_case = 1
let b:deoplete_disable_auto_complete = 1
" airline
let g:airline#extensions#tabline#enabled = 1
" syntastic
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
" haskell
let g:haskellmode_completion_ghc = 0
let g:haskell_classic_highlighting = 1
au FileType haskell nnoremap <buffer> <F1> :HdevtoolsType<CR>
au FileType haskell nnoremap <buffer> <silent> <F2> :HdevtoolsClear<CR>
autocmd FileType haskell setlocal shiftwidth=2 softtabstop=2
"************************************************
"" Key mappings
"************************************************
" Leader Key is `,`
let mapleader=','
" Buffer navigation
noremap <leader>q :bp<CR>
noremap <leader>w :bn<CR>
noremap <leader>c :bd<CR>
noremap <leader>C :bd!<CR>
" Clears highlighted search terms
nnoremap <silent> <C-l> :nohl<CR><C-l
" Opens terminal
noremap <leader>t :term<CR>
" Toggle terminal input
tnoremap <F12> <C-\><C-n>
" AutoFormat
noremap <F5> :Neoformat<CR>
" Toggle paste
set pastetoggle=<F10>
" Open Nerdtree
noremap <F3> :NERDTreeToggle<CR>
" Tab to autocomplete
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ deoplete#mappings#manual_complete()
function! s:check_back_space() abort "{{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction"}}}
"************************************************
"" Core
"************************************************
syntax on " Syntax highlighting
filetype plugin indent on " File type detection + language dependent indenting
let no_buffers_menu=1
set backspace=indent,eol,start " Backspace works as expected
set relativenumber " Relative line numbers
set hidden " Allows hidden buffers
set cursorline " Highlight current line
" Fix terminal color scheme
set t_Co=256
" set termguicolors
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
set background=dark " Setting dark mode
" Color scheme
colorscheme deus
let g:deus_termcolors=256
'';
vam.knownPlugins = pkgs.vimPlugins // {
deus = pkgs.vimUtils.buildVimPlugin {
name = "deus";
src = pkgs.fetchFromGitHub {
owner = "ajmwagar";
repo = "vim-deus";
rev = "bd29baa02917d926e68ca880217d17cbb317ac00";
sha256 = "1sn62nvdjs8i4lvmqj19gyj5k9w588whaylk50xn4y2z57cyf7a7";
};
};
};
vam.pluginDictionaries = [
{
names = [
"airline"
"deus"
"deoplete-nvim"
"haskell-vim"
"nerdtree"
"neoformat"
"syntastic"
"vim-polyglot"
"vim-hdevtools"
"vim-multiple-cursors"
];
}
];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment