Skip to content

Instantly share code, notes, and snippets.

@oscarduignan
Last active October 11, 2017 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscarduignan/6ce341dd02061b7cfd295a8ba7b8b826 to your computer and use it in GitHub Desktop.
Save oscarduignan/6ce341dd02061b7cfd295a8ba7b8b826 to your computer and use it in GitHub Desktop.
Get the latest version of docker-compose with nixpkgs which requires overriding texttable dependency version (using overlays)
self: super:
let
docker_compose = super.docker_compose.override (oldAttrs: {
texttable = super.python.pkgs.buildPythonPackage rec {
name = "texttable-0.9.1";
src = super.fetchurl {
url = "mirror://pypi/t/texttable/${name}.tar.gz";
sha256 = "119041773ff03596b56392532f9315cb3a3116e404fd6f36e76a7dc088d95c79";
};
};
});
in {
docker_compose = docker_compose.overrideDerivation (oldAttrs: rec {
name = "docker-compose-1.16.1";
src = super.fetchurl {
url = "mirror://pypi/d/docker-compose/${name}.tar.gz";
sha256 = "fb46a6a2c4d193a3ff1e4d7208eea920b629c81dc92257c87f3f93095cfb0bdf";
};
});
python27Packages = super.python27Packages // {
inherit (self) docker_compose;
};
}
@oscarduignan
Copy link
Author

Got some feedback on https://gist.github.com/oscarduignan/20991f9289403eb3ec81e5f281b2df66 which uses packageOverrides and it was suggested to use overlays instead - so have scrounged some info and had a go at doing that.

Stick this file in ~/.config/nixpkgs/latest_docker_compose.nix and you can then do nix-env -i docker-compose and get the latest docker-compose installed. Alongside this I have also moved my "buildEnv" composed environments into an ~/.config/nixpkgs/environments.nix so I can do nix-env -i allTools which just installs all the packages I want (docker-compose, git, etc) in one command. Or if I don't want to install it I can just do nix-shell -p devTools, here's an example of that file:

self: super: 

with super; {
  baseTools = buildEnv {
    name = "baseTools";
    paths = [
      google-chrome
      firefox
      zip
      openvpn
    ];
  };

  devTools = buildEnv {
    name = "devTools";
    paths = [
      vscode
      idea.idea-ultimate
      git
      ansible
      neovim
      self.docker_compose
      yarn
    ];
  };

  allTools = buildEnv {
    name = "allTools";
    paths = with self; [
      baseTools
      devTools
    ];
  };
}

The ~/.config/nixpkgs/config.nix now for me just contains

{
  allowUnfree = true;
}

I need to look more into nix-shell I think next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment