about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2022-09-10 15:51:06 +0100
committerDavid Morgan <djm_uk@protonmail.com>2022-09-10 15:51:06 +0100
commita43429841ae67b7bb73f87349888eb4645c5d92e (patch)
treed25e2bc24e0634b447c6d19bbd6e416fb776f9d9
parentafbfbc667042538fa82b9a8162d4f3781cb35209 (diff)
downloaddotfiles-a43429841ae67b7bb73f87349888eb4645c5d92e.tar.gz
Add some nix home configuration
-rw-r--r--nixconf/clojure.nix18
-rw-r--r--nixconf/common.nix64
-rw-r--r--nixconf/config.nix1
-rw-r--r--nixconf/darwin.nix36
-rw-r--r--nixconf/djmuk1.nix25
-rw-r--r--nixconf/egalmoth.nix25
-rw-r--r--nixconf/linux-dev.nix35
-rw-r--r--nixconf/linux-server.nix15
-rw-r--r--nixconf/otm.nix25
-rw-r--r--nixconf/zsh.nix168
10 files changed, 412 insertions, 0 deletions
diff --git a/nixconf/clojure.nix b/nixconf/clojure.nix
new file mode 100644
index 0000000..3681e8b
--- /dev/null
+++ b/nixconf/clojure.nix
@@ -0,0 +1,18 @@
+{ config, pkgs, lib, isDarwin, isLinux, ... }:
+let
+  inherit (lib) optionals;
+in
+{
+  home.packages = with pkgs; [
+    babashka
+    clj-kondo
+    clojure
+    clojure-lsp
+    jet
+    maven
+    neil
+  ]
+  ++ optionals stdenv.isDarwin [ (leiningen.override { jdk = jdk8; }) ]
+  ++ optionals stdenv.isLinux [ leiningen ];
+}
+
diff --git a/nixconf/common.nix b/nixconf/common.nix
new file mode 100644
index 0000000..a93fe1d
--- /dev/null
+++ b/nixconf/common.nix
@@ -0,0 +1,64 @@
+{ config, pkgs, ... }:
+{
+
+  imports = [
+    ./zsh.nix
+  ];
+
+  home.packages = with pkgs; [
+    bat
+    bottom
+    curl
+    difftastic
+    #docker
+    #docker-compose
+    duf
+    du-dust
+    elinks
+    exa
+    fd
+    fzf
+    git
+    gnupg
+    gopass
+    gopass-jsonapi
+    heroku
+    isync
+    jq
+    lscolors
+    lynx
+    mopidy
+    mopidy-ytmusic
+    mopidy-scrobbler
+    mpv
+    mu
+    neovim
+    nix-info
+    #pinentry
+    #procs
+    libqalculate
+    ripgrep
+    rlwrap
+    sd
+    tealdeer
+    ugrep
+    vim
+    w3m
+    #zenith
+  ];
+
+  programs.gpg.enable = true;
+  programs.tmux = {
+    enable = true;
+    terminal = "screen-256color";
+    #tmuxp.enable = true;
+    extraConfig = ''
+      set-option -g status-bg '#666666'
+      set-option -g status-fg '#aaaaaa'
+      set-option -g status-left-length 50
+      set-option -g status-right " #(date ''\'+%a, %b %d - %I:%M''\') "
+    '';
+  };
+
+}
+
diff --git a/nixconf/config.nix b/nixconf/config.nix
new file mode 100644
index 0000000..69baf10
--- /dev/null
+++ b/nixconf/config.nix
@@ -0,0 +1 @@
+{ allowUnfree = true; }
diff --git a/nixconf/darwin.nix b/nixconf/darwin.nix
new file mode 100644
index 0000000..735b80d
--- /dev/null
+++ b/nixconf/darwin.nix
@@ -0,0 +1,36 @@
+{ config, pkgs, ... }:
+{
+  imports = [
+    ./clojure.nix
+  ];
+
+  home.packages = with pkgs; [
+    awscli2
+    coreutils
+    curl
+    diffutils
+    ((emacsPackagesFor emacsMacport).emacsWithPackages(ps: [ ps.vterm ]))
+    findutils
+    gh
+    #gnused
+    #adoptopenjdk-hotspot-bin-8
+    #lima
+    mpv
+    mu
+    nix # on darwin we are not using nixos (duh)
+    openvpn
+    pinentry_mac
+    pgcli
+    pgformatter
+    postgresql
+    #python310Packages.sqlparse
+    sqls
+    wget
+  ];
+
+  programs.java = {
+    enable = true;
+    #package = (pkgs.jdk8.overrideAttrs (_: { postPatch = "ln -nsf ../zulu-8.jdk/Contents/Home/man man"; }));
+  };
+}
+
diff --git a/nixconf/djmuk1.nix b/nixconf/djmuk1.nix
new file mode 100644
index 0000000..2d3a474
--- /dev/null
+++ b/nixconf/djmuk1.nix
@@ -0,0 +1,25 @@
+{ config, pkgs, ... }:
+{
+  imports = [ 
+    ./common.nix
+    ./linux-server.nix
+  ];
+
+  # Let Home Manager install and manage itself.
+  programs.home-manager.enable = true;
+
+  # Home Manager needs a bit of information about you and the
+  # paths it should manage.
+  home.username = "djm";
+  home.homeDirectory = "/home/djm";
+  
+  # This value determines the Home Manager release that your
+  # configuration is compatible with. This helps avoid breakage
+  # when a new Home Manager release introduces backwards
+  # incompatible changes.
+  #
+  # You can update Home Manager without changing this value. See
+  # the Home Manager release notes for a list of state version
+  # changes in each release.
+  home.stateVersion = "21.05";
+}
diff --git a/nixconf/egalmoth.nix b/nixconf/egalmoth.nix
new file mode 100644
index 0000000..bbf090c
--- /dev/null
+++ b/nixconf/egalmoth.nix
@@ -0,0 +1,25 @@
+{ config, pkgs, ... }:
+{
+  imports = [ 
+    ./common.nix
+    ./linux-dev.nix
+  ];
+
+  # Let Home Manager install and manage itself.
+  programs.home-manager.enable = true;
+
+  # Home Manager needs a bit of information about you and the
+  # paths it should manage.
+  home.username = "djm";
+  home.homeDirectory = "/home/djm";
+  
+  # This value determines the Home Manager release that your
+  # configuration is compatible with. This helps avoid breakage
+  # when a new Home Manager release introduces backwards
+  # incompatible changes.
+  #
+  # You can update Home Manager without changing this value. See
+  # the Home Manager release notes for a list of state version
+  # changes in each release.
+  home.stateVersion = "21.11";
+}
diff --git a/nixconf/linux-dev.nix b/nixconf/linux-dev.nix
new file mode 100644
index 0000000..9fc4f05
--- /dev/null
+++ b/nixconf/linux-dev.nix
@@ -0,0 +1,35 @@
+{ config, pkgs, ... }:
+{
+  imports = [
+    ./clojure.nix
+  ];
+  #services.emacs.package = pkgs.emacsUnstable;
+
+  nixpkgs.overlays = [
+    (import (builtins.fetchTarball {
+      url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
+    }))
+  ];
+  programs.emacs = {
+    enable = true;
+    #package = pkgs.emacsGcc;
+    package = pkgs.emacs28NativeComp;
+    extraPackages = (epkgs: [ epkgs.vterm ] );
+  };
+
+  home.packages = with pkgs; [
+    docker
+    docker-compose
+    gcc
+    gnumake
+    mpv
+    mu
+    notmuch
+    nix
+    protonmail-bridge
+    protonvpn-cli
+    youtube-dl
+  ];
+
+}
+
diff --git a/nixconf/linux-server.nix b/nixconf/linux-server.nix
new file mode 100644
index 0000000..cf0b652
--- /dev/null
+++ b/nixconf/linux-server.nix
@@ -0,0 +1,15 @@
+{ config, pkgs, ... }:
+{
+
+  #services.emacs.package = pkgs.emacsUnstable;
+
+  home.packages = with pkgs; [
+    bitlbee
+    bitlbee-discord
+    emacs-nox
+    heroku
+    irssi
+  ];
+
+}
+
diff --git a/nixconf/otm.nix b/nixconf/otm.nix
new file mode 100644
index 0000000..c3abe20
--- /dev/null
+++ b/nixconf/otm.nix
@@ -0,0 +1,25 @@
+{ config, pkgs, ... }:
+{
+  imports = [ 
+    ./common.nix
+    ./darwin.nix
+  ];
+
+  # Let Home Manager install and manage itself.
+  programs.home-manager.enable = true;
+
+  # Home Manager needs a bit of information about you and the
+  # paths it should manage.
+  home.username = "djm";
+  home.homeDirectory = "/Users/djm";
+  
+  # This value determines the Home Manager release that your
+  # configuration is compatible with. This helps avoid breakage
+  # when a new Home Manager release introduces backwards
+  # incompatible changes.
+  #
+  # You can update Home Manager without changing this value. See
+  # the Home Manager release notes for a list of state version
+  # changes in each release.
+  home.stateVersion = "21.11";
+}
diff --git a/nixconf/zsh.nix b/nixconf/zsh.nix
new file mode 100644
index 0000000..f78ecef
--- /dev/null
+++ b/nixconf/zsh.nix
@@ -0,0 +1,168 @@
+{ config, pkgs, ... }:
+
+{
+  home.packages = with pkgs; [
+    zsh-completions
+  ];
+
+  programs.fzf = {
+    enable = true;
+    enableZshIntegration = true;
+  };
+  programs.zoxide = {
+    enable = true;
+    enableZshIntegration = true;
+  };
+  programs.direnv = {
+    enable = true;
+    nix-direnv.enable = true;
+  };
+  programs.keychain = {
+    enable = true;
+    agents = [ "ssh" "gpg"];
+    keys = [ "id_rsa" "id_ed25519" "C171251002C200F2" ];
+  #  extraFlags = [ "--quiet" "--ignore-missing" ];
+  };
+  programs.zsh = {
+    enable = true;
+    enableCompletion = true;
+    enableAutosuggestions = true;
+    defaultKeymap = "emacs";
+    history = {
+      size = 100000;
+      save = 100000;
+    };
+
+    profileExtra = ''
+      [[ -f ~/.nix-profile/etc/profile.d/nix.sh ]] && . ~/.nix-profile/etc/profile.d/nix.sh
+      path=(~/bin
+            ~/.local/bin
+            ~/go/bin/
+            $path)
+    '';
+    shellAliases = {
+      cp = "cp -iv";
+      mv = "mv -iv";
+      mkdir = "mkdir -v";
+      pp = "pushbullet push \"Pixel\" link \"\${1}\" \"\${1}\"";
+      upgrade_emacs = "emacs -Q --batch -L \"~/.emacs.d/lisp/\" -l \"init-packages.el\" --eval \"(my/upgrade-packages)\"";
+
+      # Git log aliases from the omz git plugin
+      gl = "git pull";
+      glg = "git log --stat";
+      glgp = "git log --stat -p";
+      glgg = "git log --graph";
+      glgga = "git log --graph --decorate --all";
+      glgm = "git log --graph --max-count=10";
+      glo = "git log --oneline --decorate";
+      glol = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\"";
+      glols = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --stat";
+      glod = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\"";
+      glods = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\" --date=short";
+      glola = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --all";
+      glog = "git log --oneline --decorate --graph";
+      gloga = "git log --oneline --decorate --graph --all";
+    };
+         
+    initExtra = ''
+      # Taken from prezto tmux plugin
+      if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && -z "$SSH_TTY" ]]; then
+        tmux start-server
+
+        if ! tmux has-session 2> /dev/null; then
+          tmux new-session -d -s "0" \; set-option -t "0" destroy-unattached off &> /dev/null
+        fi
+
+        exec tmux -u attach-session -d
+      fi
+
+      export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow -g "!{.git,node_modules}/*" 2> /dev/null'
+      export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
+      export FZF_ALT_C_COMMAND="rg --hidden --files --sort-files --null | xargs -0 dirname | sort -u"
+      if [ -d "~/fzf-git" ]; then
+        source ~/fzf-git/functions.sh
+        source ~/fzf-git/key-binding.zsh
+      fi
+      
+      autopair-init
+      enable-fzf-tab
+      bindkey '^[[A' history-substring-search-up
+      bindkey '^[[B' history-substring-search-down
+
+      # disable sort when completing `git checkout`
+      zstyle ''\':completion:*:git-checkout:*''\' sort false
+      # set descriptions format to enable group support
+      zstyle ''\':completion:*:descriptions''\' format ''\'[%d]''\'
+      # Allow tab to expand aliases
+      zstyle ':completion:*' completer _expand_alias _complete _ignored
+      # set list-colors to enable filename colorizing
+      #zstyle ''\':completion:*''\' list-colors ''${(s.:.)LS_COLORS}
+      # preview directory''\'s content with exa when completing cd
+      zstyle ''\':fzf-tab:complete:cd:*''\' fzf-preview ''\'exa -1 --color=always ''$realpath''\'
+      # switch group using `,` and `.`
+      zstyle ''\':fzf-tab:*''\' switch-group ''\',''\' ''\'.''\'
+      
+      set -o noclobber append_history share_history
+
+      test -e "~/.iterm2_shell_integration.zsh" && source "~/.iterm2_shell_integration.zsh" || true
+      
+      if [ "$(uname 2> /dev/null)" = "Darwin" ]; then
+        #colima status 2>/dev/null || ( nohup colima start & ) >/dev/null 2>&1
+	pgrep -q openvpn || ( pushd ~/otm-vpn ; nohup sudo -C 20 openvpn --config otm.ovpn --auth-user-pass <(gpg -qd ~/otm-vpn/vpn_creds.txt.gpg) & ; popd ) >/dev/null 2>&1
+      fi
+
+      function generate () { gopass generate -s -p $1 $((RANDOM % 14 + 45)) }
+
+      [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
+    '';
+
+   plugins = with pkgs; [
+      {
+        name = "zsh-autopair";
+        src = zsh-autopair;
+        file = "share/zsh/zsh-autopair/autopair.zsh";
+      }
+      {
+        name = "zsh-fzf-tab";
+        src = zsh-fzf-tab;
+        file = "share/fzf-tab/fzf-tab.zsh";
+      }
+      {
+        name = "zsh-fast-syntax-highlighting";
+	src = zsh-fast-syntax-highlighting;
+	file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
+      }
+      {
+        name = "zsh-powerlevel10k";
+        src = zsh-powerlevel10k;
+	file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
+      }
+      {
+        name = "zsh-history-substring-search";
+	src = zsh-history-substring-search;
+	file = "share/zsh-history-substring-search/zsh-history-substring-search.zsh";
+      }
+      {
+        name = "forgit";
+        src = fetchFromGitHub {
+          owner = "wfxr";
+          repo = "forgit";
+          rev = "810735294107ef1b1de66cf1cdfc358fc14049ac";
+          sha256 = "11mydkl8psic57qzkzyjlff9wl6inwx9hn3a0vqyfr78pv6vk23y";
+        };
+        file = "forgit.plugin.zsh";
+      }
+      {
+        name = "zsh-edit";
+        src = fetchFromGitHub {
+          owner = "marlonrichert";
+          repo = "zsh-edit";
+          rev = "17b17e5f32fc69349cb9474cf591d5c74e399cdc";
+          sha256 = "0nvb7jril7in5b0279z25vmlc0karhagmfsxpjw1rzni5qpyak1s";
+        };
+        file = "zsh-edit.plugin.zsh";
+      }
+    ];
+  };
+}
+