refactor shell.nix

This commit is contained in:
Sergey Bubnov 2018-10-25 12:13:36 +04:00
parent 3ed0611b4d
commit 86580b04ee
5 changed files with 110 additions and 54 deletions

38
nix/ansible/default.nix Normal file
View File

@ -0,0 +1,38 @@
{ pkgs ? import <nixpkgs> {}
, windowsSupport ? false
}:
with pkgs;
pythonPackages.buildPythonPackage rec {
pname = "ansible";
version = "devel";
name = "${pname}-${version}";
src = fetchFromGitHub {
owner = "ansible";
repo = "ansible";
rev = "f0fd0f219de80a8f682b80e1ccdb83fd4988da64";
sha256 = "128847r4bc650lcpc2z1wxjgdnh07zhxfd9m2bi3wfl069dvhjk9";
};
prePatch = ''
sed -i "s,/usr/,$out," lib/ansible/constants.py
'';
doCheck = false;
dontStrip = true;
dontPatchELF = true;
dontPatchShebangs = false;
propagatedBuildInputs = with pythonPackages; [
pycrypto paramiko jinja2 pyyaml httplib2 boto six netaddr dnspython
] ++ stdenv.lib.optional windowsSupport pywinrm;
meta = with stdenv.lib; {
homepage = http://www.ansible.com;
description = "A simple automation tool";
license = with licenses; [ gpl3 ];
platforms = with platforms; linux ++ darwin;
};
}

22
nix/glob2/default.nix Normal file
View File

@ -0,0 +1,22 @@
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
python27.pkgs.buildPythonPackage rec {
pname = "glob2";
version = "0.6";
src = python36.pkgs.fetchPypi {
inherit pname version;
sha256 = "1miyz0pjyji4gqrzl04xsxcylk3h2v9fvi7hsg221y11zy3adc7m";
};
nativeBuildInputs = with pythonPackages; [ setuptools_scm ];
buildInputs = with pythonPackages; [ ];
doCheck = false;
meta = {
homepage = "https://github.com/miracle2k/python-glob2";
description = "extended version of Python's builtin glob module";
};
}

20
nix/proxmoxer/default.nix Normal file
View File

@ -0,0 +1,20 @@
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
python27.pkgs.buildPythonPackage rec {
pname = "proxmoxer";
version = "1.0.3";
src = python36.pkgs.fetchPypi {
inherit pname version;
sha256 = "145hvphvlzvwq6sn31ldnin0ii50blsapxz0gv2zx3grzp6x9hvh";
};
doCheck = false;
meta = {
homepage = "https://github.com/swayf/proxmoxer";
description = "Proxmoxer is a wrapper around the Proxmox REST API v2";
};
}

View File

@ -0,0 +1,25 @@
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
python27.pkgs.buildPythonPackage rec {
pname = "pytest-bdd";
version = "3.0.0";
src = python36.pkgs.fetchPypi {
inherit pname version;
sha256 = "1np2qvfnhz3amd02f2y4shp4pracnfdkcdxkhkigv997iwc4sih0";
};
glob2 = callPackage ../glob2 {};
nativeBuildInputs = with pythonPackages; [ setuptools_scm ];
propagatedBuildInputs = with pythonPackages; [ glob2 pytest pytest-forked mock pytest_xdist Mako parse-type ];
doCheck = false;
meta = {
homepage = "https://github.com/pytest-dev/pytest-bdd";
description = "BDD library for the py.test runner";
};
}

View File

@ -5,67 +5,18 @@
with pkgs;
let
myAnsible = pythonPackages.buildPythonPackage rec {
pname = "ansible";
version = "devel";
name = "${pname}-${version}";
pytest-bdd = callPackage nix/pytest-bdd {};
proxmoxer = callPackage nix/proxmoxer {};
ansible = callPackage nix/ansible {};
src = fetchFromGitHub {
owner = "ansible";
repo = "ansible";
rev = "f0fd0f219de80a8f682b80e1ccdb83fd4988da64";
sha256 = "128847r4bc650lcpc2z1wxjgdnh07zhxfd9m2bi3wfl069dvhjk9";
};
prePatch = ''
sed -i "s,/usr/,$out," lib/ansible/constants.py
'';
doCheck = false;
dontStrip = true;
dontPatchELF = true;
dontPatchShebangs = false;
propagatedBuildInputs = with pythonPackages; [
pycrypto paramiko jinja2 pyyaml httplib2 boto six netaddr dnspython
] ++ stdenv.lib.optional windowsSupport pywinrm;
meta = with stdenv.lib; {
homepage = http://www.ansible.com;
description = "A simple automation tool";
license = with licenses; [ gpl3 ];
maintainers = with maintainers; [
jgeerds
joamaki
];
platforms = with platforms; linux ++ darwin;
};
};
myProxmoxer = python27.pkgs.buildPythonPackage rec {
pname = "proxmoxer";
version = "1.0.2";
src = python36.pkgs.fetchPypi {
inherit pname version;
sha256 = "0vpb3b1b8w4r4c28kfhyviw4q70s3vwwirkq6rywryl4wqc3fyra";
};
doCheck = false;
meta = {
homepage = "https://github.com/swayf/proxmoxer";
description = "Proxmoxer is a wrapper around the Proxmox REST API v2";
};
};
myPython = python27.withPackages (ps: with ps; [ myProxmoxer jmespath virtualenv pip hypothesis pytest_xdist pytest ]);
myPython = python27.withPackages (ps: with ps; [ pytest-bdd proxmoxer jmespath virtualenv pip hypothesis pytest_xdist pytest ]);
in
stdenv.mkDerivation {
name = "alt-infra-ansible";
buildInputs = [
openssh
myAnsible
ansible
myPython
pass
];