diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2022-11-29 11:29:34 +0000 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2022-11-29 11:29:34 +0000 |
| commit | 57788ab135d9a0aa0a7320b9cf03de5505f812d8 (patch) | |
| tree | 10fefd7962ec0077e1ea9544b7f5f74922b8548b | |
| parent | 066408ccd8b5079b52d54bb0c99aeb12771cde06 (diff) | |
add shell scripts
| -rw-r--r-- | home.nix | 78 | ||||
| -rw-r--r-- | overlays/treesitter.nix | 4 | ||||
| -rw-r--r-- | shell-scripts.nix | 12 | ||||
| -rw-r--r-- | shell-scripts/nix-proxy | 14 |
4 files changed, 64 insertions, 44 deletions
@@ -5,35 +5,44 @@ home-manager, ... }: { - # Found this here: nix-community.github.io configuration example - home.username = "mike"; home.homeDirectory = "/home/mike"; home.stateVersion = "22.05"; programs.home-manager.enable = true; - home.packages = with pkgs; [ - docker - kubectl - k9s - - htop - fortune - vim - stow - (nerdfonts.override {fonts = ["FiraCode"];}) - ripgrep - inotify-tools - - firefox-wayland - - swaylock - swayidle - wl-clipboard - mako - wofi - waybar - ]; + home.packages = with pkgs; + [ + docker + kubectl + k9s + + htop + fortune + vim + stow + (nerdfonts.override {fonts = ["FiraCode"];}) + ripgrep + inotify-tools + + firefox-wayland + + swaylock + swayidle + wl-clipboard + mako + wofi + waybar + ] + ++ (import ./shell-scripts.nix {inherit pkgs;}); + + programs.direnv.enable = true; + programs.direnv.nix-direnv.enable = true; + programs.bash = { + enable = true; + shellAliases = { + new-flake = "nix flake new -t github:nix-community/nix-direnv "; + }; + }; programs.git = { enable = true; @@ -80,6 +89,11 @@ # fixes hotpot cannot be found error after updates home.activation = { + neovim-symlink = home-manager.lib.hm.dag.entryAfter ["writeBoundary"] '' + NEOVIM_CONFIG="${config.home.homeDirectory}/neovim" + XDG_CONFIG_HOME_NVIM="${config.xdg.configHome}/nvim" + $DRY_RUN_CMD ln -sf $NEOVIM_CONFIG $XDG_CONFIG_HOME_NVIM + ''; clearHotpotCache = home-manager.lib.hm.dag.entryAfter ["writeBoundary"] '' HOTPOT_CACHE="${config.xdg.cacheHome}/nvim/hotpot" if [[ -d "$HOTPOT_CACHE" ]]; then @@ -88,11 +102,6 @@ ''; }; - xdg.configFile.nvim = { - source = config.lib.file.mkOutOfStoreSymlink ./neovim; - recursive = true; - }; - programs.neovim = { enable = true; package = pkgs.neovim-unwrapped; @@ -109,17 +118,6 @@ statix fnlfmt ]; -# extraConfig = " -# lua <<LUA -# Flake = { -# lua_language_server = [[${pkgs.sumneko-lua-language-server}]], -# bash = [[${pkgs.bashInteractive}/bin/bash]] -# } -# vim.opt.runtimepath:append({ [[~/dotnix/neovim]], [[~/dotnix/neovim/lua]], [[~/dotnix/neovim/fnl]], [[~/dotnix/neovim/after]]}) -# package.path = [[/home/mike/dotnix/?/init.lua;]] .. [[/home/mike/dotnix/?/?;]] .. [[/home/mike/.cache/nvim/hotpot/hotpot.nvim/lua/?/init.lua;]] .. package.path -# require'neovim' -# LUA -# "; plugins = with pkgs.vimPlugins; [ # highlighting (nvim-treesitter.withPlugins (plugins: pkgs.tree-sitter.allGrammars)) diff --git a/overlays/treesitter.nix b/overlays/treesitter.nix index 6d6cabb..cef45e8 100644 --- a/overlays/treesitter.nix +++ b/overlays/treesitter.nix @@ -5,10 +5,6 @@ // { nvim-treesitter = mvinkioPkgs.vimPlugins.nvim-treesitter.overrideAttrs (old: { version = "2022-10-28"; - src = builtins.fetchGit { - url = "file:///home/mike/projects/nvim-treesitter"; - rev = "2c0ae6e8e81366ba088f1e5be62f467212cda52e"; - }; passthru.withPlugins = grammarFn: final.vimPlugins.nvim-treesitter.overrideAttrs (_: { postPatch = let diff --git a/shell-scripts.nix b/shell-scripts.nix new file mode 100644 index 0000000..5cec1eb --- /dev/null +++ b/shell-scripts.nix @@ -0,0 +1,12 @@ +{pkgs, ...}: +with builtins; let + script-names = attrNames (readDir ./shell-scripts); + package = ( + filename: let + contents = readFile ./shell-scripts/${filename}; + in + pkgs.writeShellScriptBin filename contents + ); + packages = map package script-names; +in + packages diff --git a/shell-scripts/nix-proxy b/shell-scripts/nix-proxy new file mode 100644 index 0000000..f0b4ada --- /dev/null +++ b/shell-scripts/nix-proxy @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +if [[ $(id -u) -ne 0 ]]; then + echo "Should be run with sudo privileges" + exit +fi +mkdir /run/systemd/system/nix-daemon.service.d/ +cat << EOF >/run/systemd/system/nix-daemon.service.d/override.conf +[Service] +Environment="http_proxy=$http_proxy" +Environment="https_proxy=$http_proxy" +Environment="all_proxy=$http_proxy" +EOF +systemctl daemon-reload +systemctl restart nix-daemon |
