updated
This commit is contained in:
parent
34e82ad7a9
commit
10ebee18b8
29
box.nix
Normal file
29
box.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./common.nix
|
||||||
|
./musician.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
users.extraUsers."anish".extraGroups = [ "jackaudio" ];
|
||||||
|
|
||||||
|
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
|
||||||
|
# ];
|
||||||
|
}
|
||||||
|
|
115
common.nix
Normal file
115
common.nix
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./nvim.nix
|
||||||
|
# ./unstable.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
htop
|
||||||
|
iftop
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
exa
|
||||||
|
bat
|
||||||
|
fd
|
||||||
|
ag
|
||||||
|
tcpdump
|
||||||
|
whois
|
||||||
|
mtr
|
||||||
|
file
|
||||||
|
lsof
|
||||||
|
atool
|
||||||
|
inotify-tools
|
||||||
|
strace
|
||||||
|
zip
|
||||||
|
unzip
|
||||||
|
rsync
|
||||||
|
tmux
|
||||||
|
pwgen
|
||||||
|
glow
|
||||||
|
jq
|
||||||
|
gitAndTools.gitFull
|
||||||
|
#neovim defined in ./nvim.nix
|
||||||
|
wofi
|
||||||
|
firefox
|
||||||
|
fractal
|
||||||
|
pinentry_gnome
|
||||||
|
pass
|
||||||
|
gcc
|
||||||
|
less
|
||||||
|
mpv
|
||||||
|
zathura
|
||||||
|
#qmk_firmware
|
||||||
|
python3
|
||||||
|
gdb
|
||||||
|
vcv-rack
|
||||||
|
#xdotool
|
||||||
|
#neofetch
|
||||||
|
#calibre
|
||||||
|
#openvpn
|
||||||
|
gimp
|
||||||
|
xxd
|
||||||
|
tilix
|
||||||
|
kitty
|
||||||
|
taskwarrior
|
||||||
|
gnupg
|
||||||
|
openjdk
|
||||||
|
glslviewer
|
||||||
|
filezilla
|
||||||
|
signal-desktop
|
||||||
|
wire-desktop
|
||||||
|
tdesktop
|
||||||
|
feedreader
|
||||||
|
newsflash
|
||||||
|
syncthing
|
||||||
|
dijo
|
||||||
|
#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
|
||||||
|
#processing
|
||||||
|
#nextcloud-client
|
||||||
|
zsh-powerlevel10k
|
||||||
|
powerline-fonts
|
||||||
|
supercollider
|
||||||
|
haskellPackages.tidal
|
||||||
|
# vim-zettel
|
||||||
|
pandoc
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.bash.enableCompletion = true;
|
||||||
|
|
||||||
|
# needed for vcv-rack
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
system.copySystemConfiguration = true;
|
||||||
|
services.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
openDefaultPorts = true;
|
||||||
|
systemService = true;
|
||||||
|
user = "anish";
|
||||||
|
dataDir = "/home/anish/usr/syncthing";
|
||||||
|
};
|
||||||
|
|
||||||
|
#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"];
|
||||||
|
|
||||||
|
}
|
147
configuration.nix
Normal file
147
configuration.nix
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
# 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;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd.secrets = {
|
||||||
|
"/keyfile0.bin" = /etc/secrets/initrd/keyfile0.bin;
|
||||||
|
"/keyfile1.bin" = /etc/secrets/initrd/keyfile1.bin;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd.luks.devices = {
|
||||||
|
"root" = {
|
||||||
|
#name = "root";
|
||||||
|
device = "/dev/disk/by-uuid/f37f3222-47d7-42d8-b400-363320a31853"; # UUID for /dev/nvme01np2
|
||||||
|
preLVM = true;
|
||||||
|
allowDiscards = true;
|
||||||
|
keyFile = "/keyfile0.bin";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# 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?
|
||||||
|
|
||||||
|
}
|
||||||
|
|
32
hardware-configuration.nix
Normal file
32
hardware-configuration.nix
Normal 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";
|
||||||
|
}
|
24
musician.nix
Normal file
24
musician.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{pkgs, config, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
/home/anish/usr/musnix
|
||||||
|
];
|
||||||
|
|
||||||
|
musnix.enable = true;
|
||||||
|
users.users.anish.extraGroups = [ "audio" ];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [ ardour patchage helm ];
|
||||||
|
#services.jack = {
|
||||||
|
# jackd.enable = true;
|
||||||
|
# # support ALSA only programs via ALSA JACK PCM plugin
|
||||||
|
# alsa.enable = false;
|
||||||
|
# # support ALSA only programs via loopback device (supports programs like Steam)
|
||||||
|
# loopback = {
|
||||||
|
# enable = true;
|
||||||
|
# # buffering parameters for dmix device to work with ALSA only semi-professional sound programs
|
||||||
|
# #dmixConfig = ''
|
||||||
|
# # period_size 2048
|
||||||
|
# #'';
|
||||||
|
# };
|
||||||
|
#};
|
||||||
|
}
|
6
musnix.nix
Normal file
6
musnix.nix
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [ <musnix> ];
|
||||||
|
musnix.enable = true;
|
||||||
|
|
||||||
|
users.users."anish".extraGroups = [ "audio" ];
|
||||||
|
}
|
104
nixos-legacy-bios-encrypted.sh
Normal file
104
nixos-legacy-bios-encrypted.sh
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eux
|
||||||
|
|
||||||
|
hostname="bowl"
|
||||||
|
password="xxx"
|
||||||
|
|
||||||
|
diskdev=/dev/sda
|
||||||
|
rootpart=/dev/sda2
|
||||||
|
|
||||||
|
# -o clear
|
||||||
|
# -g convert to gpt disk
|
||||||
|
# -n new partition num:start:end +size
|
||||||
|
# ef00 EFI / 8300 linux fs
|
||||||
|
sgdisk -o -g -n 1::+5M -t 1:ef02 -n 2:: -t 2:8300 $diskdev
|
||||||
|
|
||||||
|
# LVM part
|
||||||
|
echo "$password" | cryptsetup luksFormat --type luks1 -h sha512 $rootpart
|
||||||
|
echo "$password" | cryptsetup luksOpen $rootpart enc-pv
|
||||||
|
|
||||||
|
pvcreate /dev/mapper/enc-pv
|
||||||
|
vgcreate vg0 /dev/mapper/enc-pv
|
||||||
|
lvcreate -L 8G -n swap vg0
|
||||||
|
lvcreate -L 40G -n nixos vg0
|
||||||
|
lvcreate -l '100%FREE' -n home vg0
|
||||||
|
|
||||||
|
# format disk
|
||||||
|
mkfs.ext4 -L root /dev/vg0/nixos
|
||||||
|
mkfs.ext4 -L home /dev/vg0/home
|
||||||
|
mkswap -L swap /dev/vg0/swap
|
||||||
|
|
||||||
|
swapon /dev/vg0/swap
|
||||||
|
mount /dev/vg0/nixos /mnt
|
||||||
|
|
||||||
|
nix-channel --add https://nixos.org/channels/nixos-unstable nixos
|
||||||
|
nix-channel --update
|
||||||
|
|
||||||
|
nixos-generate-config --root /mnt
|
||||||
|
|
||||||
|
for uuid in /dev/disk/by-uuid/*
|
||||||
|
do
|
||||||
|
if test $(readlink -f $uuid) = $rootpart
|
||||||
|
then
|
||||||
|
luksuuid=$uuid
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cat << EOF > /mnt/etc/nixos/configuration.nix
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ # Include the results of the hardware scan.
|
||||||
|
./hardware-configuration.nix
|
||||||
|
];
|
||||||
|
boot.loader.grub.devices = [ "/dev/sda" ];
|
||||||
|
boot.loader.grub.enable = true;
|
||||||
|
boot.loader.grub.version = 2;
|
||||||
|
boot.loader.grub.enableCryptodisk = true;
|
||||||
|
boot.loader.supportsInitrdSecrets = true;
|
||||||
|
|
||||||
|
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||||
|
boot.initrd.availableKernelModules = ["virtio-pci"];
|
||||||
|
boot.initrd.network = {
|
||||||
|
enable = true;
|
||||||
|
ssh = {
|
||||||
|
enable = true;
|
||||||
|
port = 2222;
|
||||||
|
authorizedKeys = ["ssh-rsa xxx"];
|
||||||
|
hostKeys = [ "/host_ecdsa_key" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd.luks.devices = [
|
||||||
|
{
|
||||||
|
name = "enc-pv";
|
||||||
|
preLVM = true;
|
||||||
|
device = "$luksuuid";
|
||||||
|
allowDiscards = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.secrets = {
|
||||||
|
"/host_ecdsa_key" = "/host_ecdsa_key";
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.cleanTmpDir = true;
|
||||||
|
boot.kernelModules = [ "dm-snapshot" ];
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
users.users.root.initialHashedPassword = "";
|
||||||
|
services.openssh.permitRootLogin = "prohibit-password";
|
||||||
|
networking.hostName = "$hostname";
|
||||||
|
time.timeZone = "Europe/Paris";
|
||||||
|
services.openssh.enable = true;
|
||||||
|
users.users.root.openssh.authorizedKeys.keys = ["ssh-rsa xxx"];
|
||||||
|
system.stateVersion = "20.03";
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
ssh-keygen -t ecdsa -N "" -f host_ecdsa_key
|
||||||
|
|
||||||
|
cp host_ecdsa_key /mnt/
|
||||||
|
|
||||||
|
nixos-install --no-root-passwd
|
||||||
|
|
262
nvim.nix
Normal file
262
nvim.nix
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
|
||||||
|
#nvim
|
||||||
|
{
|
||||||
|
environment.variables.EDITOR = "nvim";
|
||||||
|
environment.shellAliases = {
|
||||||
|
k = "vim -c :VimwikiIndex";
|
||||||
|
kz = "vim -c :VimwikiIndex -c :ZettelNew";
|
||||||
|
};
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
nodejs
|
||||||
|
( neovim.override {
|
||||||
|
vimAlias = true;
|
||||||
|
configure = {
|
||||||
|
packages.myPlugins = with pkgs.vimPlugins; {
|
||||||
|
start = [
|
||||||
|
vim-nix
|
||||||
|
fzf-vim
|
||||||
|
vim-elixir
|
||||||
|
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
|
||||||
|
vim-fugitive
|
||||||
|
#iron-nvim
|
||||||
|
#nvim-colorizer
|
||||||
|
vim-devicons
|
||||||
|
|
||||||
|
# testing
|
||||||
|
#vim-processing
|
||||||
|
#vim-tidal
|
||||||
|
taskwiki
|
||||||
|
vim-zettel
|
||||||
|
vimwiki-sync
|
||||||
|
];
|
||||||
|
};
|
||||||
|
customRC = ''
|
||||||
|
set tabstop=2
|
||||||
|
set showmatch
|
||||||
|
set shiftwidth=2
|
||||||
|
set noexpandtab
|
||||||
|
set autoindent
|
||||||
|
|
||||||
|
set foldmethod=indent " fold based on indent
|
||||||
|
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
|
||||||
|
|
||||||
|
" window
|
||||||
|
nmap <leader>wh :topleft vnew<CR>
|
||||||
|
nmap <leader>wl :botright vnew<CR>
|
||||||
|
nmap <leader>wk :topleft new<CR>
|
||||||
|
nmap <leader>wj :botright new<CR>
|
||||||
|
|
||||||
|
let mapleader = "\<Space>"
|
||||||
|
|
||||||
|
" lightline colorscheme
|
||||||
|
let g:lightline = {
|
||||||
|
\ 'colorscheme': 'seoul256',
|
||||||
|
\ }
|
||||||
|
|
||||||
|
" 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> <leader>h
|
||||||
|
:nnoremap <A-j> <leader>j
|
||||||
|
:nnoremap <A-k> <leader>k
|
||||||
|
:nnoremap <A-l> <leader>l
|
||||||
|
:nnoremap <F5> "=strftime("%Y-%m-%d %H:%M:")
|
||||||
|
:inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M:")
|
||||||
|
|
||||||
|
" exit normal mode in terminal
|
||||||
|
:tnoremap <C-n> <C-\><C-n>
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
" keyboard commands
|
||||||
|
map <leader>t :NERDTreeToggle<CR>
|
||||||
|
map <leader>s :w<CR>
|
||||||
|
map <leader>q :wq<CR>
|
||||||
|
map <leader>r :RainbowParenthesesToggleAll<CR>
|
||||||
|
map <leader>zs :ZettelSearch<CR>
|
||||||
|
map <leader>zo :ZettelOpen<CR>
|
||||||
|
map <leader>zn :ZettelNew<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" NERDTree
|
||||||
|
" open on directory
|
||||||
|
autocmd StdinReadPre * let s:std_in=1
|
||||||
|
|
||||||
|
" 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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)];
|
||||||
|
}
|
13
unstable.nix
Normal file
13
unstable.nix
Normal 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 ];
|
||||||
|
}
|
Loading…
Reference in a new issue