This commit is contained in:
Anish Lakhwara 2020-08-18 21:34:25 +10:00
parent 6ce13cf35b
commit 68e745c15c
7 changed files with 566 additions and 3 deletions

View file

@ -1 +0,0 @@
/etc/nixos/box.nix

27
box.nix Normal file
View file

@ -0,0 +1,27 @@
{ config, pkgs, ... }:
{
imports = [
# install software
./common.nix
];
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome3.enable = true;
};
# task whisperer broken
nixpkgs.config.allowBroken = true;
# virtual box
virtualisation.virtualbox.host.enable = true;
# ErgoDox Firmware (doesn't compile)
# environment.systemPackages = with pkgs; [
# qmk_firmware
# ];
}

View file

@ -1 +0,0 @@
/etc/nixos/common.nix

102
common.nix Normal file
View file

@ -0,0 +1,102 @@
{ config, pkgs, ... }:
{
imports = [
./nvim.nix
# ./unstable.nix
];
environment.systemPackages = with pkgs; [
htop
iftop
wget
curl
tcpdump
whois
mtr
file
lsof
atool
inotify-tools
strace
zip
unzip
rsync
tmux
pwgen
glow
gitAndTools.gitFull
#neovim defined in ./nvim.nix
#rofi
firefox
fractal
pinentry_gnome
pass
gcc
less
mpv
zathura
python3
gdb
vcv-rack
#xdotool
#neofetch
#calibre
#openvpn
gimp
xxd
tilix
taskwarrior
gnupg
openjdk
glslviewer
filezilla
signal-desktop
wire-desktop
tdesktop
feedreader
syncthing
#kdeconnect
#ssb-patchwork
gnome3.gnome-tweaks
gnome3.pomodoro
gnomeExtensions.gsconnect
gnomeExtensions.taskwhisperer
#gnome3.networkmanager-openvpn
#python3Packages.youtube-dl
appimage-run
home-manager
libreoffice
fontconfig
hugo
nodejs
#processing
#nextcloud-client
zsh-powerlevel10k
powerline-fonts
supercollider
haskellPackages.tidal
#(let neuronSrc = builtins.fetchTarball https://github.com/srid/neuron/archive/master.tar.gz;
#in import neuronSrc)
];
programs.bash.enableCompletion = true;
# needed for vcv-rack
nixpkgs.config.allowUnfree = true;
system.copySystemConfiguration = true;
services.syncthing.enable = true;
services.syncthing.user = "anish";
#zsh powerlevel10k
programs.zsh.enable = true;
programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
users.users.anish.shell = pkgs.zsh;
#android
programs.adb.enable = true;
users.users.anish.extraGroups = ["adbusers"];
}

143
configuration.nix Normal file
View file

@ -0,0 +1,143 @@
# 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
./common.nix
./box.nix
];
# Use the GRUB 2 boot loader.
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.loader.grub = {
enable = true;
device = "nodev";
version = 2;
efiSupport = true;
enableCryptodisk = true;
extraInitrd = /boot/initrd.keys.gz;
};
boot.initrd.luks.devices = [
{
name = "root";
device = "/dev/disk/by-uuid/f37f3222-47d7-42d8-b400-363320a31853"; # UUID for /dev/nvme01np2
preLVM = true;
keyFile = "/keyfile0.bin";
allowDiscards = true;
}
];
# Data mount
fileSystems."/data" = {
device = "/dev/disk/by-uuid/3276a297-9ee4-4998-b262-1ed100366c06"; # UUID for /dev/mapper/crypted-data
encrypted = {
enable = true;
label = "crypted-data";
blkDev = "/dev/disk/by-uuid/8a317bf4-fe13-4334-a6df-5fe5a5048b5e"; # UUID for /dev/sda1
keyFile = "/keyfile1.bin";
};
};
# boot.loader.grub.efiInstallAsRemovable = true;
# boot.loader.efi.efiSysMountPoint = "/boot/efi";
# Define on which hard drive you want to install Grub.
# boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
networking.hostName = "box"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.enp0s31f6.useDHCP = true;
networking.interfaces.enp3s0.useDHCP = true;
networking.interfaces.wlp4s0.useDHCP = true;
# OpenVPN
services.openvpn.servers = {
officeVPN =
{ config = ''
config /home/anish/usr/work/ThreatDefence/vpn/anishcarbon19.ovpn '';
autoStart = false;
updateResolvConf = true;
};
};
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n = {
# consoleFont = "Lat2-Terminus16";
# consoleKeyMap = "us";
# defaultLocale = "en_US.UTF-8";
# };
# Set your time zone.
# time.timeZone = "Europe/Amsterdam";
# List packages installed in system profile. To search, run:
# $ nix search wget
# environment.systemPackages = with pkgs; [
# wget vim
# ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# 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;
services.openssh.permitRootLogin = "yes";
# 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;
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
# 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.users.anish = {
isNormalUser = true;
extraGroups = [ "wheel" ]; # Enable sudo for the user.
hashedPassword = "MO0Pbd2O4eIlA";
};
# 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 = "19.09"; # Did you read the comment?
}

View file

@ -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 =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/ade0752d-84d3-4e39-865b-9027ba2d5c67";
fsType = "ext4";
};
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/1715-278E";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/b790abb4-ba5f-4476-8f09-b0fc575414aa"; }
];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

View file

@ -1 +0,0 @@
/etc/nixos/nvim.nix

244
nvim.nix Normal file
View file

@ -0,0 +1,244 @@
{ pkgs, ... }:
#nvim
{ environment.variables.EDITOR = "nvim";
environment.systemPackages = with pkgs; [
( neovim.override {
vimAlias = true;
configure = {
packages.myPlugins = with pkgs.vimPlugins; {
start = [
vim-nix
fzf-vim
vim-elixir
# vim-processing
# scvim
emmet-vim
nerdtree
goyo-vim
vim-sneak
lightline-vim
csv-vim
vimwiki
coc-nvim
coc-json
coc-python
coc-pairs
coc-emmet
emmet-vim
LanguageClient-neovim
ayu-vim
rainbow_parentheses-vim
vim-surround
#neuron-vim
];
};
customRC = ''
set tabstop=2
set showmatch
set shiftwidth=2
set noexpandtab
set autoindent
set number
set nocompatible
set relativenumber
set showtabline=2
set autowriteall
syntax on
set list lcs=tab:\|\
filetype plugin on
set termguicolors
let ayucolor="dark"
colorscheme ayu
let mapleader = "\<Space>"
" moving splits with vim movements.
:tnoremap <A-h> <C-\><C-N><C-w>h
:tnoremap <A-j> <C-\><C-N><C-w>j
:tnoremap <A-k> <C-\><C-N><C-w>k
:tnoremap <A-l> <C-\><C-N><C-w>l
:inoremap <A-h> <C-\><C-N><C-w>h
:inoremap <A-j> <C-\><C-N><C-w>j
:inoremap <A-k> <C-\><C-N><C-w>k
:inoremap <A-l> <C-\><C-N><C-w>l
:nnoremap <A-h> <C-w>h
:nnoremap <A-j> <C-w>j
:nnoremap <A-k> <C-w>k
:nnoremap <A-l> <C-w>l
:nnoremap <F5> "=strftime("%Y-%m-%d %H:%M:")
:inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M:")
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 = 0
let g:rainbow_active = 0
autocmd BufReadPost,BufNewFile c,py,nix RainbowParenthesesToggleAll
" call plug#begin('~/.vim/plugged')
" call plug#end()
" fzf notational vim
" let g:nv_search_paths = ['~/vimwiki', '~/usr/devlog']
" let g:nv_default_extension = '.wiki'
" keyboard commands
map <leader>t :NERDTreeToggle<CR>
map <leader>s :w<CR>
map <leader>q :wq<CR>
map <leader>z :NV<CR>
map <leader>r :RainbowParenthesesToggleAll<CR>
" lightline colorscheme
let g:lightline = {
\ 'colorscheme': 'seoul256',
\ }
" NERDTree
" open on directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" coc
"
" if hidden is not set, TextEdit might fail.
set hidden
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup
" Better display for messages
set cmdheight=2
" You will have bad experience for diagnostic messages when it's default 4000.
set updatetime=300
" don't give |ins-completion-menu| messages.
set shortmess+=c
" always show signcolumns
set signcolumn=yes
" Use tab for trigger completion with characters ahead and navigate.
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
inoremap <silent><expr> <c-space> coc#refresh()
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
" Coc only does snippet and additional edit on confirm.
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
" Or use `complete_info` if your vim support it, like:
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
" Use `[g` and `]g` to navigate diagnostics
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
" Remap keys for gotos
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
" Highlight symbol under cursor on CursorHold
autocmd CursorHold * silent call CocActionAsync('highlight')
" Remap for rename current word
nmap <leader>rn <Plug>(coc-rename)
" Remap for format selected region
xmap <leader>f <Plug>(coc-format-selected)
nmap <leader>f <Plug>(coc-format-selected)
augroup mygroup
autocmd!
" Setup formatexpr specified filetype(s).
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
" Update signature help on jump placeholder
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>a <Plug>(coc-codeaction-selected)
" Remap for do codeAction of current line
nmap <leader>ac <Plug>(coc-codeaction)
" Fix autofix problem of current line
nmap <leader>qf <Plug>(coc-fix-current)
" Create mappings for function text object, requires document symbols feature of languageserver.
xmap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap if <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
" Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
nmap <silent> <C-d> <Plug>(coc-range-select)
xmap <silent> <C-d> <Plug>(coc-range-select)
" Use `:Format` to format current buffer
command! -nargs=0 Format :call CocAction('format')
" Use `:Fold` to fold current buffer
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" use `:OR` for organize import of current buffer
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
" Add status line support, for integration with other plugin, checkout `:h coc-status`
" set statusline^=%{coc#status()}%{get(b:,'coc_current_function',"")}
" Using CocList
" Show all diagnostics
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
" Do default action for next item.
nnoremap <silent> <space>j :<C-u>CocNext<CR>
" Do default action for previous item.
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl
'';
};
}
)];
}

5
pull-nix-files.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
cp /etc/nixos/* ./
git add .
git commit -m "updated"
git push

13
unstable.nix Normal file
View file

@ -0,0 +1,13 @@
{ config, pkgs, ... }:
let
unstable = import <nixos-unstable> {};
in {
nix.nixPath = [
"nixos-unstable=https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz"
];
#currently installed this software through nix-env -f https://nixos.org/channels/nixos-unstable -iA [ packages ]
environment.systemPackages = [ unstable.ripcord ];
}