From d49dbebf9d624c4321a0b9eb58f063bbe45044d6 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 22 Jan 2022 15:58:20 -0500 Subject: [PATCH] vi mode and direnv updates --- nixos/home.nix | 38 +++++++++++++++++++++++++++----------- nixos/justfile | 8 ++++++++ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/nixos/home.nix b/nixos/home.nix index 2b66331..dd9171c 100644 --- a/nixos/home.nix +++ b/nixos/home.nix @@ -3,6 +3,7 @@ let name = "Noah Masur"; + editor = "nvim"; font = "Victor Mono"; in { @@ -54,11 +55,24 @@ in { size = 14.0; normal = { family = "${font}"; }; }; - key_bindings = [{ - key = "L"; - mods = "Control|Shift"; - chars = "\\x1F"; - }]; + key_bindings = [ + { + key = "L"; + mods = "Control|Shift"; + chars = "\\x1F"; + } + { + key = "K"; + mods = "Control"; + mode = "~Vi"; + action = "ToggleViMode"; + } + { + key = "Return"; + mode = "Vi"; + action = "ToggleViMode"; + } + ]; colors = { primary = { background = "0x1d2021"; @@ -98,7 +112,10 @@ in { functions = { }; interactiveShellInit = ""; loginShellInit = ""; - shellAliases = { vim = "nvim"; }; + shellAliases = { + vim = "nvim"; + sudo = "doas"; + }; shellAbbrs = { # Directory aliases @@ -155,7 +172,7 @@ in { v = "vim"; vl = "vim -c 'normal! `0'"; vll = "vim -c 'Telescope oldfiles'"; - vimrc = "vim ~/dev/personal/dotfiles/nvim.configlink/init.lua"; + vimrc = "vim ${builtins.getEnv "PWD"}/../nvim.configlink/init.lua"; # Notes qn = "quicknote"; @@ -210,7 +227,7 @@ in { home.sessionVariables = { fish_greeting = ""; - EDITOR = "nvim"; + EDITOR = "${editor}"; NIXOS_CONFIG = builtins.getEnv "PWD"; DOTS = "${builtins.getEnv "PWD"}/.."; }; @@ -236,15 +253,14 @@ in { "nvim/init.lua".source = ../nvim.configlink/init.lua; "fish/functions".source = ../fish.configlink/functions; "awesome/rc.lua".source = ./awesomerc.lua; + "direnvrc".text = "source $HOME/.nix-profile/share/nix-direnv/direnvrc"; }; - home.file.".direnvrc".text = - "source $HOME/.nix-profile/share/nix-direnv/direnvrc"; - programs.direnv = { enable = true; enableFishIntegration = true; nix-direnv.enable = true; + config = { whitelist = { prefix = [ "${builtins.getEnv "PWD"}/" ]; }; }; }; programs.git = { diff --git a/nixos/justfile b/nixos/justfile index af83d3f..ff31cfd 100644 --- a/nixos/justfile +++ b/nixos/justfile @@ -2,6 +2,14 @@ default: @just --list --list-heading $'Update NixOS config:\n' +# Bootstrap from nothing +bootstrap: + sudo nix-channel --add https://nixos.org/channels/nixos-unstable + sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable + sudo nix-channel --update + sudo nixos-rebuild switch -I nixos-config=./configuration.nix + +# Use intended software channels channels: doas nix-channel --add https://nixos.org/channels/nixos-unstable doas nix-channel --add https://nixos.org/channels/nixpkgs-unstable