Browse Source

Add nix configuration

Thomas Dy 5 years ago
parent
commit
760b4713b5

+ 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 ];
+}

+ 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
+  ];
+}

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

@@ -0,0 +1,86 @@
+self: super:
+
+{
+  userPackages = super.userPackages or {
+
+    # cli
+    vimHugeX = self.vimHugeX;
+    neovim = self.neovim;
+    neovim-remote = self.neovim-remote;
+    git = self.git;
+    feh = self.feh;
+    ripgrep = self.ripgrep;
+    jq = self.jq;
+    tree = self.tree;
+    dnsutils = self.dnsutils;
+    httpie = self.httpie;
+    htop = self.htop;
+    bc = self.bc;
+    pv = self.pv;
+    caddy = self.caddy;
+    openssl = self.openssl;
+    pwgen = self.pwgen;
+    gnupg = self.gnupg;
+    whois = self.whois;
+    traceroute = self.traceroute;
+    tig = self.tig;
+    gettext = self.gettext;
+    unzip = self.unzip;
+
+    # desktop
+    adapta-gtk-theme = self.adapta-gtk-theme;
+    hicolor-icon-theme = self.hicolor-icon-theme;
+    arc-icon-theme = self.arc-icon-theme;
+    gmrun = self.gmrun;
+    dunst = self.dunst;
+    compton = self.compton;
+    fcitx-configtool = self.fcitx-configtool;
+    volumeicon = self.volumeicon;
+    pcmanfm = self.pcmanfm;
+    lxappearance = self.lxappearance;
+    xdotool = self.xdotool;
+    scrot = self.scrot;
+    xbacklight = self.xorg.xbacklight;
+    libnotify = self.libnotify;
+
+    # apps
+    firefox = self.firefox;
+    chromium = self.chromium;
+    pavucontrol = self.pavucontrol;
+    gnumeric = self.gnumeric;
+    qterminal = self.lxqt.qterminal;
+    networkmanagerapplet = self.gnome3.networkmanagerapplet;
+    networkmanager_openvpn = self.gnome3.networkmanager_openvpn;
+    keepass = self.keepass.override {
+      plugins = [ self.keepass-keeagent ];
+    };
+    insomnia = self.insomnia;
+
+    # work
+    awscli = self.awscli;
+    docker = self.docker;
+    docker-machine = self.docker-machine;
+    docker-machine-kvm = self.docker-machine-kvm;
+    docker-machine-kvm2 = self.docker-machine-kvm2;
+    virtmanager = self.virtmanager;
+    tmux-cssh = self.tmux-cssh;
+    cfn-lint = let
+      pkgs = import <nixpkgs-unstable> {};
+    in pkgs.python27.pkgs.callPackage ./packages/cfn-lint.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