Created
February 16, 2016 19:58
-
-
Save matejc/8c1ba1791f2cf94ff646 to your computer and use it in GitHub Desktop.
here be only examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.dockerctl = { | |
enable = true; | |
containers.searxOne = { | |
extraRunOptions = ["-p 7777:5000"]; | |
image = (import /home/matejc/workarea/nixos-docker/searx.nix {}).pull; | |
}; | |
containers.searxTwo = { | |
extraRunOptions = ["-p 7778:8888"]; | |
image = (import /home/matejc/workarea/nixos-docker/searx.nix {}).build; | |
}; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ source ? { outPath = /home/matejc/workarea/searx; name = "searx"; } | |
, pkgs ? import <nixpkgs> {} | |
}: | |
let | |
name = "searx"; | |
version = "0.8.0"; | |
port = "8888"; | |
baseUrl = "http://localhost:${port}"; | |
certifi2015 = pkgs.pythonPackages.buildPythonPackage rec { | |
name = "certifi-${version}"; | |
version = "2015.11.20.1"; | |
src = pkgs.fetchurl { | |
url = "https://pypi.python.org/packages/source/c/certifi/${name}.tar.gz"; | |
sha256 = "05lgwf9rz1kn465azy2bpb3zmpnsn9gkypbhnjlclchv98ssgc1h"; | |
}; | |
}; | |
searx = pkgs.pythonPackages.buildPythonPackage { | |
name = "${name}-${version}"; | |
inherit version; | |
src = source; | |
preConfigure = '' | |
substituteInPlace requirements.txt --replace "pygments==2.0.2" "pygments==2.1" | |
substituteInPlace requirements.txt --replace "lxml==3.5.0" "lxml==3.4.4" | |
substituteInPlace requirements.txt --replace "pyasn1==0.1.9" "pyasn1==0.1.8" | |
substituteInPlace requirements.txt --replace "requests==2.9.1" "requests==2.8.1" | |
substituteInPlace requirements.txt --replace "pyasn1-modules==0.0.8" "pyasn1-modules==0.0.5" | |
''; | |
propagatedBuildInputs = with pkgs.pythonPackages; [ pyyaml lxml | |
flaskbabel flask dateutil pygments certifi2015 pyasn1 pyasn1-modules | |
ndg-httpsclient speaklater Babel requests2 ]; | |
}; | |
buildImage = pkgs.dockerTools.buildImage { | |
imageName = name; | |
imageTag = version; | |
fromImage = null; | |
contents = with pkgs; [ | |
searx | |
coreutils | |
]; | |
runAsRoot = '' | |
#!${pkgs.stdenv.shell} -e | |
cp ${searx}/lib/python2.7/site-packages/searx/settings.yml /searx.yml | |
sed -i 's/127\.0\.0\.1/0\.0\.0\.0/g' /searx.yml | |
''; | |
config = { | |
Env = [ "PATH=/bin" "SEARX_SETTINGS_PATH=/searx.yml" ]; | |
Entrypoint = ["${searx}/bin/searx-run"]; | |
}; | |
}; | |
pullImage = pkgs.dockerTools.pullImage { | |
imageName = "cyrilix/searx"; | |
inherit name; | |
imageTag = version; | |
imageId = null; | |
sha256 = "10vyg93l7my855n2l0nzazrwp6i953phvq0fwmjrznavx1qnsc5y"; | |
# indexUrl = "https://index.docker.io"; | |
registryVersion = "v1"; | |
}; | |
pull = builtins.trace (builtins.toJSON pullImage.buildArgs) (pullImage); | |
build = builtins.trace (builtins.toJSON buildImage.buildArgs) (buildImage); | |
in { | |
inherit build pull; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment