Sfoglia il codice sorgente

Merge branch 'worknix'

Thomas Dy 5 anni fa
parent
commit
26b789dfbf

+ 3 - 0
.config/git/config

@@ -17,3 +17,6 @@
 	lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"
 	po = push origin
 	pof = push origin --force-with-lease
+	rom = rebase origin/master
+	riom = rebase -i origin/master
+	ca = commit --amend

+ 1 - 0
.config/nixpkgs/config.nix

@@ -0,0 +1 @@
+{ allowUnfree = true; }

+ 13 - 0
.config/nixpkgs/overlays/packages/cfn-lint.nix

@@ -0,0 +1,13 @@
+{ lib, buildPythonPackage, fetchPypi
+, pyyaml, requests, aws-sam-translator, jsonpatch, jsonschema, pathlib2
+}:
+buildPythonPackage rec {
+  pname = "cfn-lint";
+  version = "0.14.0";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "03kq92bx94fvqf7rrvaak742s1b0c84fqvdhp41qabc5f8mlg5w7";
+  };
+  doCheck = false; # TODO: why?
+  propagatedBuildInputs = [ pyyaml requests aws-sam-translator jsonpatch jsonschema pathlib2 ];
+}

+ 13 - 0
.config/nixpkgs/overlays/packages/cfn_flip.nix

@@ -0,0 +1,13 @@
+{ lib, buildPythonPackage, fetchPypi
+, pyyaml, tox, six, pytestrunner, click
+}:
+buildPythonPackage rec {
+  pname = "cfn_flip";
+  version = "1.2.0";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1v31zcdlmlfldlfvp0fagphz1hlgnkylgq284s3b142gkjdg7jbx";
+  };
+  doCheck = false; # TODO: why?
+  propagatedBuildInputs = [ pyyaml tox six pytestrunner click ];
+}

+ 3 - 0
.config/nixpkgs/overlays/packages/chef/Gemfile

@@ -0,0 +1,3 @@
+source "http://rubygems.org"
+
+gem "chef", "11.18.0"

+ 81 - 0
.config/nixpkgs/overlays/packages/chef/Gemfile.lock

@@ -0,0 +1,81 @@
+GEM
+  remote: http://rubygems.org/
+  specs:
+    chef (11.18.0)
+      chef-zero (~> 2.2, >= 2.2.1)
+      diff-lcs (~> 1.2, >= 1.2.4)
+      erubis (~> 2.7)
+      ffi-yajl (~> 1.2)
+      highline (~> 1.6, >= 1.6.9)
+      mime-types (~> 1.16)
+      mixlib-authentication (~> 1.3)
+      mixlib-cli (~> 1.4)
+      mixlib-config (~> 2.0)
+      mixlib-log (~> 1.3)
+      mixlib-shellout (~> 1.4)
+      net-ssh (~> 2.6)
+      net-ssh-multi (~> 1.1)
+      ohai (~> 7.4)
+      plist (~> 3.1.0)
+      pry (~> 0.9)
+      rest-client (>= 1.0.4, <= 1.6.7)
+    chef-zero (2.2.1)
+      ffi-yajl (~> 1.1)
+      hashie (~> 2.0)
+      mixlib-log (~> 1.3)
+      rack
+    coderay (1.1.2)
+    diff-lcs (1.3)
+    erubis (2.7.0)
+    ffi (1.10.0)
+    ffi-yajl (1.4.0)
+      ffi (~> 1.5)
+      libyajl2 (~> 1.2)
+    hashie (2.1.2)
+    highline (1.7.10)
+    ipaddress (0.8.3)
+    libyajl2 (1.2.0)
+    method_source (0.9.2)
+    mime-types (1.25.1)
+    mixlib-authentication (1.4.2)
+    mixlib-cli (1.7.0)
+    mixlib-config (2.2.18)
+      tomlrb
+    mixlib-log (1.7.1)
+    mixlib-shellout (1.6.1)
+    net-ssh (2.9.4)
+    net-ssh-gateway (1.3.0)
+      net-ssh (>= 2.6.5)
+    net-ssh-multi (1.2.1)
+      net-ssh (>= 2.6.5)
+      net-ssh-gateway (>= 1.2.0)
+    ohai (7.4.1)
+      ffi (~> 1.9)
+      ffi-yajl (~> 1.1)
+      ipaddress
+      mime-types (~> 1.16)
+      mixlib-cli
+      mixlib-config (~> 2.0)
+      mixlib-log
+      mixlib-shellout (~> 1.2)
+      systemu (~> 2.6.4)
+      wmi-lite (~> 1.0)
+    plist (3.1.0)
+    pry (0.12.2)
+      coderay (~> 1.1.0)
+      method_source (~> 0.9.0)
+    rack (2.0.6)
+    rest-client (1.6.7)
+      mime-types (>= 1.16)
+    systemu (2.6.5)
+    tomlrb (1.2.8)
+    wmi-lite (1.0.2)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  chef (= 11.18.0)
+
+BUNDLED WITH
+   1.16.3

+ 13 - 0
.config/nixpkgs/overlays/packages/chef/default.nix

@@ -0,0 +1,13 @@
+{ buildEnv, bundlerEnv, ruby_2_3 }:
+let
+  gems = bundlerEnv rec {
+    name = "chef";
+    ruby = ruby_2_3;
+    gemdir = ./.;
+  };
+in
+
+buildEnv {
+  name = "chef-packages";
+  paths = [ gems ];
+}

+ 243 - 0
.config/nixpkgs/overlays/packages/chef/gemset.nix

@@ -0,0 +1,243 @@
+{
+  chef = {
+    dependencies = ["chef-zero" "diff-lcs" "erubis" "ffi-yajl" "highline" "mime-types" "mixlib-authentication" "mixlib-cli" "mixlib-config" "mixlib-log" "mixlib-shellout" "net-ssh" "net-ssh-multi" "ohai" "plist" "pry" "rest-client"];
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "00ikandfhdx6014b1ygh2yw8csgkrhxq4bfi6q8ssxpj958dv3dy";
+      type = "gem";
+    };
+    version = "11.18.0";
+  };
+  chef-zero = {
+    dependencies = ["ffi-yajl" "hashie" "mixlib-log" "rack"];
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0gyhair9pp9w0nvhbq0ncqq5pja78bkj5jfxmflyvh243cacx586";
+      type = "gem";
+    };
+    version = "2.2.1";
+  };
+  coderay = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "15vav4bhcc2x3jmi3izb11l4d9f3xv8hp2fszb7iqmpsccv1pz4y";
+      type = "gem";
+    };
+    version = "1.1.2";
+  };
+  diff-lcs = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "18w22bjz424gzafv6nzv98h0aqkwz3d9xhm7cbr1wfbyas8zayza";
+      type = "gem";
+    };
+    version = "1.3";
+  };
+  erubis = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1fj827xqjs91yqsydf0zmfyw9p4l2jz5yikg3mppz6d7fi8kyrb3";
+      type = "gem";
+    };
+    version = "2.7.0";
+  };
+  ffi = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0j8pzj8raxbir5w5k6s7a042sb5k02pg0f8s4na1r5lan901j00p";
+      type = "gem";
+    };
+    version = "1.10.0";
+  };
+  ffi-yajl = {
+    dependencies = ["ffi" "libyajl2"];
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1l289wyzc06v0rn73msqxx4gm48iqgxkd9rins22f13qicpczi5g";
+      type = "gem";
+    };
+    version = "1.4.0";
+  };
+  hashie = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "08w9ask37zh5w989b6igair3zf8gwllyzix97rlabxglif9f9qd9";
+      type = "gem";
+    };
+    version = "2.1.2";
+  };
+  highline = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "01ib7jp85xjc4gh4jg0wyzllm46hwv8p0w1m4c75pbgi41fps50y";
+      type = "gem";
+    };
+    version = "1.7.10";
+  };
+  ipaddress = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1x86s0s11w202j6ka40jbmywkrx8fhq8xiy8mwvnkhllj57hqr45";
+      type = "gem";
+    };
+    version = "0.8.3";
+  };
+  libyajl2 = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0n5j0p8dxf9xzb9n4bkdr8w0a8gg3jzrn9indri3n0fv90gcs5qi";
+      type = "gem";
+    };
+    version = "1.2.0";
+  };
+  method_source = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1pviwzvdqd90gn6y7illcdd9adapw8fczml933p5vl739dkvl3lq";
+      type = "gem";
+    };
+    version = "0.9.2";
+  };
+  mime-types = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0mhzsanmnzdshaba7gmsjwnv168r1yj8y0flzw88frw1cickrvw8";
+      type = "gem";
+    };
+    version = "1.25.1";
+  };
+  mixlib-authentication = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1lh8vrkq2nnf0rx69mlyiqkx664baxbp32imb7l517lbcw5xspgb";
+      type = "gem";
+    };
+    version = "1.4.2";
+  };
+  mixlib-cli = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0647msh7kp7lzyf6m72g6snpirvhimjm22qb8xgv9pdhbcrmcccp";
+      type = "gem";
+    };
+    version = "1.7.0";
+  };
+  mixlib-config = {
+    dependencies = ["tomlrb"];
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1gm6yj9cbbgsl9x4xqxga0vz5w0ksq2jnq1wj8hvgm5c4wfcrswb";
+      type = "gem";
+    };
+    version = "2.2.18";
+  };
+  mixlib-log = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "14sknyi9r7rg28m21c8ixzyndhbmi0d6vk02y4hf42dd60hmdbgp";
+      type = "gem";
+    };
+    version = "1.7.1";
+  };
+  mixlib-shellout = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0awwll2gbsvsz7g6j473f0xrjzyxq755vl260lmki6p937d33f7a";
+      type = "gem";
+    };
+    version = "1.6.1";
+  };
+  net-ssh = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1xsjq4s3pn6m3fxx1xybyhy5axli1zcxpvmd3d88x552v2c8gb0j";
+      type = "gem";
+    };
+    version = "2.9.4";
+  };
+  net-ssh-gateway = {
+    dependencies = ["net-ssh"];
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "04ws9bvf3ppvcj9vrnwyabcwv4lz1m66ni443z2cf4wvvqssifsa";
+      type = "gem";
+    };
+    version = "1.3.0";
+  };
+  net-ssh-multi = {
+    dependencies = ["net-ssh" "net-ssh-gateway"];
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "13kxz9b6kgr9mcds44zpavbndxyi6pvyzyda6bhk1kfmb5c10m71";
+      type = "gem";
+    };
+    version = "1.2.1";
+  };
+  ohai = {
+    dependencies = ["ffi" "ffi-yajl" "ipaddress" "mime-types" "mixlib-cli" "mixlib-config" "mixlib-log" "mixlib-shellout" "systemu" "wmi-lite"];
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1rsmmzv06a60j7lgzlqmyvn6sxc51qlm68gjznkbaspnvbrry03p";
+      type = "gem";
+    };
+    version = "7.4.1";
+  };
+  plist = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0rh8nddwdya888j1f4wix3dfan1rlana3mc7mwrvafxir88a1qcs";
+      type = "gem";
+    };
+    version = "3.1.0";
+  };
+  pry = {
+    dependencies = ["coderay" "method_source"];
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "00rm71x0r1jdycwbs83lf9l6p494m99asakbvqxh8rz7zwnlzg69";
+      type = "gem";
+    };
+    version = "0.12.2";
+  };
+  rack = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1pcgv8dv4vkaczzlix8q3j68capwhk420cddzijwqgi2qb4lm1zm";
+      type = "gem";
+    };
+    version = "2.0.6";
+  };
+  rest-client = {
+    dependencies = ["mime-types"];
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0nn7zalgidz2yj0iqh3xvzh626krm2al79dfiij19jdhp0rk8853";
+      type = "gem";
+    };
+    version = "1.6.7";
+  };
+  systemu = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0gmkbakhfci5wnmbfx5i54f25j9zsvbw858yg3jjhfs5n4ad1xq1";
+      type = "gem";
+    };
+    version = "2.6.5";
+  };
+  tomlrb = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "0g28ssfal6vry3cmhy509ba3vi5d5aggz1gnffnvvmc8ml8vkpiv";
+      type = "gem";
+    };
+    version = "1.2.8";
+  };
+  wmi-lite = {
+    source = {
+      remotes = ["http://rubygems.org"];
+      sha256 = "1170npj167cvs6khlzn744jv422f9md1k822x2jnf75xbnz8z74h";
+      type = "gem";
+    };
+    version = "1.0.2";
+  };
+}

+ 25 - 0
.config/nixpkgs/overlays/packages/eikaiwa-packages.nix

@@ -0,0 +1,25 @@
+{ lib, buildEnv, yarn, overmind, ruby_2_5, nodejs-10_x ? null }:
+
+let
+ pkgsNewEnough = (lib.versionAtLeast yarn.version "1.10.0") && (nodejs-10_x != null);
+
+ webpkgs = if pkgsNewEnough
+   then { inherit yarn nodejs-10_x; }
+   else builtins.trace "Using <nixpkgs-unstable> channel for web packages"
+        (import <nixpkgs-unstable> {});
+in
+
+let
+ nodejs = webpkgs.nodejs-10_x;
+ yarn   = webpkgs.yarn.override { inherit nodejs; };
+in
+
+buildEnv {
+ name = "eikaiwa-packages";
+ paths = [
+   nodejs
+   yarn
+   overmind
+   ruby_2_5
+ ];
+}

+ 13 - 0
.config/nixpkgs/overlays/packages/k8s-packages.nix

@@ -0,0 +1,13 @@
+{ buildEnv }:
+
+let
+  pkgs = import <nixpkgs-unstable> {};
+in
+buildEnv {
+  name = "k8s-packages";
+  paths = [
+    pkgs.kubectl
+    pkgs.kubectx
+    pkgs.kops
+  ];
+}

+ 25 - 0
.config/nixpkgs/overlays/packages/wl-clipboard.nix

@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, meson, ninja, pkgconfig
+, wayland, wayland-protocols }:
+
+stdenv.mkDerivation rec {
+  pname = "wl-clipboard";
+  version = "1.0.0-git";
+
+  src = fetchFromGitHub {
+    owner = "bugaevc";
+    repo = "wl-clipboard";
+    rev = "c010972e6b0d2eb3002c49a6a1b5620ff5f7c910";
+    sha256 = "020l3jy9gsj6gablwdfzp1wfa8yblay3axdjc56i9q8pbhz7g12j";
+  };
+
+  nativeBuildInputs = [ meson ninja pkgconfig wayland-protocols ];
+  buildInputs = [ wayland ];
+
+  meta = with stdenv.lib; {
+    description = "Command-line copy/paste utilities for Wayland";
+    homepage = https://github.com/bugaevc/wl-clipboard;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ dywedir ];
+    platforms = platforms.linux;
+  };
+}

+ 85 - 0
.config/nixpkgs/overlays/userPackages.nix

@@ -0,0 +1,85 @@
+self: super:
+
+let
+  nixpkgs-unstable = import <unstable> {};
+in
+{
+  userPackages = super.userPackages or {
+
+    inherit (self)
+      # cli
+      vimHugeX
+      neovim
+      neovim-remote
+      git
+      git-lfs
+      feh
+      ripgrep
+      jq
+      yq
+      tree
+      fzf
+      dnsutils
+      httpie
+      htop
+      bc
+      pv
+      caddy
+      openssl
+      pwgen
+      gnupg
+      whois
+      traceroute
+      gnumake
+      tig
+      gettext
+      unzip
+      zip
+      shellcheck
+      any-nix-shell
+
+      # apps
+      pcmanfm
+      lxappearance
+      pavucontrol
+      pamixer
+      gnumeric
+      mpv
+
+      # work
+      insomnia
+      awscli
+      docker
+      docker_compose
+      amazon-ecr-credential-helper
+      virtmanager
+      tmux-cssh
+      ;
+
+
+    xrdb = self.xorg.xrdb;
+    qterminal = self.lxqt.qterminal;
+    mps-youtube = self.python36Packages.mps-youtube;
+    keepassxc = nixpkgs-unstable.keepassxc.override { qtbase = self.qt5.qtbase; };
+    op = nixpkgs-unstable._1password;
+    deadbeef = nixpkgs-unstable.deadbeef;
+    cfn-lint = nixpkgs-unstable.python27.pkgs.callPackage ./packages/cfn-lint.nix {};
+    cfn_flip = nixpkgs-unstable.python27.pkgs.callPackage ./packages/cfn_flip.nix {};
+    wl-clipboard = nixpkgs-unstable.callPackage ./packages/wl-clipboard.nix {};
+
+    nix-rebuild = super.writeScriptBin "nix-rebuild" ''
+      #!${super.stdenv.shell}
+      if ! command -v nix-env &>/dev/null; then
+          echo "warning: nix-env was not found in PATH, add nix to userPackages" >&2
+          PATH=${self.nix}/bin:$PATH
+      fi
+      exec nix-env -f '<nixpkgs>' -r -iA userPackages "$@"
+    '';
+
+    cssh = super.writeScriptBin "cssh" ''
+      #!${super.stdenv.shell}
+      exec ${self.tmux-cssh}/bin/tmux-cssh $@
+    '';
+
+  };
+}

+ 5 - 0
.config/nixpkgs/overlays/workPackages.nix

@@ -0,0 +1,5 @@
+self: super: {
+  eikaiwa-packages = super.callPackage ./packages/eikaiwa-packages.nix {};
+  chef-packages = super.callPackage ./packages/chef/default.nix {};
+  k8s-packages = super.callPackage ./packages/k8s-packages.nix {};
+}

+ 2 - 0
.gitignore

@@ -6,6 +6,8 @@
 !.config
 !.config/git
 !.config/git/**
+!.config/nixpkgs
+!.config/nixpkgs/**
 !.config/nvim
 !.vim
 !.vim/init.vim

+ 4 - 4
.vim/init.vim

@@ -103,9 +103,9 @@ vnoremap k gk
 nnoremap <C-P> :GitFiles -o -c --exclude-standard<CR>
 nnoremap <C-O> :Buffers<CR>
 if executable('rg')
-  nnoremap <Leader>f :Rg<CR>
+  nnoremap <Leader>f :Rg<SPACE>
 elseif executable('ag')
-  nnoremap <Leader>f :Ag<CR>
+  nnoremap <Leader>f :Ag<SPACE>
 endif
 
 " git
@@ -122,10 +122,10 @@ nnoremap <Leader>vs :source $MYVIMRC<CR>
 " ------ nvim specific ------
 if has('nvim')
   set inccommand=split
-  tnoremap <M-j><M-j> <C-\><C-N>
+  tnoremap <C-[><C-[> <C-\><C-N>
   autocmd TermOpen * setlocal scrollback=10000 nonumber norelativenumber
   autocmd TermOpen * startinsert
-  autocmd TermOpen *FZF* tnoremap <buffer> jj <ESC>
+  autocmd FileType fzf tnoremap <buffer> jj <ESC>
   autocmd BufWinEnter,WinEnter term://* startinsert
   autocmd BufLeave term://* stopinsert
 

+ 7 - 1
.zsh/config.zsh

@@ -3,7 +3,11 @@ if [ -f ~/.dircolors ]; then
 fi
 alias ls="ls --color=auto --group-directories-first -F --quoting-style literal"
 
-alias config='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
+if whence -p yadm > /dev/null; then
+  export YADM_OVERRIDE_REPO="$HOME/.dotfiles"
+else
+  alias yadm='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
+fi
 
 autoload -U compinit && compinit
 
@@ -48,6 +52,8 @@ zle -N up-line-or-beginning-search
 zle -N down-line-or-beginning-search
 bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
 bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
+bindkey "^P" up-line-or-beginning-search
+bindkey "^N" down-line-or-beginning-search
 
 autoload -z edit-command-line
 zle -N edit-command-line

+ 2 - 0
.zsh/custom/chef.zsh

@@ -0,0 +1,2 @@
+export NIX_SHELL_NAME=chef
+nix-shell -p chef-packages

+ 4 - 0
.zsh/custom/k8s.zsh

@@ -0,0 +1,4 @@
+KUBE_DIR=$HOME/.root/opt/kube
+export PATH=$PATH:$KUBE_DIR
+fpath+=$KUBE_DIR/completions
+compinit

+ 0 - 1
.zshrc

@@ -6,7 +6,6 @@ zplug rimraf/k
 zplug tarrasch/zsh-bd
 zplug zsh-users/zsh-syntax-highlighting, defer:2
 zplug zsh-users/zaw
-zplug chisui/zsh-nix-shell
 zplug "${HOME}/.zsh", from:local
 if [ -f "$HOME/.zshrc.local" ]; then
   source $HOME/.zshrc.local