##// END OF EJS Templates
py3: packaging changes to build python37 packages, and make pip2nix work.
py3: packaging changes to build python37 packages, and make pip2nix work.

File last commit:

r981:55389aab python3
r981:55389aab python3
Show More
default.nix
211 lines | 6.6 KiB | text/x-nix | NixLexer
initial commit
r0 # Nix environment for the community edition
#
# This shall be as lean as possible, just producing the rhodecode-vcsserver
# derivation. For advanced tweaks to pimp up the development environment we use
# "shell.nix" so that it does not have to clutter this file.
nix: updated to 18.03 packages....
r472 args@
build: fix 32bit builds
r639 { system ? builtins.currentSystem
py3: packaging changes to build python37 packages, and make pip2nix work.
r981 , pythonPackages ? "python37Packages"
initial commit
r0 , pythonExternalOverrides ? self: super: {}
nix: updated to 18.03 packages....
r472 , doCheck ? false
, ...
initial commit
r0 }:
nix: don't allow overriding the import packages. This causes overlays to fail
r571 let
build: fix 32bit builds
r639 pkgs_ = args.pkgs or (import <nixpkgs> { inherit system; });
nix: don't allow overriding the import packages. This causes overlays to fail
r571 in
initial commit
r0
let
nix: don't allow overriding the import packages. This causes overlays to fail
r571 pkgs = import <nixpkgs> {
nix: updated to 18.03 packages....
r472 overlays = [
(import ./pkgs/overlays.nix)
];
nix: use some more consistent formatting
r570 inherit
(pkgs_)
nix: updated to 18.03 packages....
r472 system;
nix: don't allow overriding the import packages. This causes overlays to fail
r571 };
dependencies: bumped git version to 2.9.3
r116
nix: updated to 18.03 packages....
r472 # Evaluates to the last segment of a file system path.
basename = path: with pkgs.lib; last (splitString "/" path);
packaging: switched to nix 20.03 packages and latest pip2nix code...
r970 startsWith = prefix: full: let
actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full;
in actualPrefix == prefix;
initial commit
r0
nix: updated to 18.03 packages....
r472 # source code filter used as arugment to builtins.filterSource.
initial commit
r0 src-filter = path: type: with pkgs.lib;
let
ext = last (splitString "." path);
packaging: switched to nix 20.03 packages and latest pip2nix code...
r970 parts = last (splitString "/" path);
initial commit
r0 in
nix: updated to 18.03 packages....
r472 !builtins.elem (basename path) [
".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev"
nix: don't allow overriding the import packages. This causes overlays to fail
r571 "node_modules" "node_binaries"
nix: updated to 18.03 packages....
r472 "build" "data" "result" "tmp"] &&
!builtins.elem ext ["egg-info" "pyc"] &&
packaging: switched to nix 20.03 packages and latest pip2nix code...
r970 !startsWith "result" (basename path);
initial commit
r0
nix: updated to 18.03 packages....
r472 sources =
let
nix: use some more consistent formatting
r570 inherit
(pkgs.lib)
all
isString
attrValues;
packaging: switched to nix 20.03 packages and latest pip2nix code...
r970
nix: updated to 18.03 packages....
r472 sourcesConfig = pkgs.config.rc.sources or {};
in
# Ensure that sources are configured as strings. Using a path
# would result in a copy into the nix store.
assert all isString (attrValues sourcesConfig);
sourcesConfig;
nix: further nix changes
r976 rhodecode-vcsserver-src = builtins.filterSource src-filter ./.;
nix: updated to 18.03 packages....
r472 version = builtins.readFile "${rhodecode-vcsserver-src}/vcsserver/VERSION";
initial commit
r0
pythonLocalOverrides = self: super: {
nix: updated to 18.03 packages....
r472 rhodecode-vcsserver =
let
releaseName = "RhodeCodeVCSServer-${version}";
py3: packaging changes to build python37 packages, and make pip2nix work.
r981 in super.rhodecode-vcsserver.overridePythonAttrs (attrs: {
nix: updated to 18.03 packages....
r472 inherit
doCheck
version;
nix: added custom checkPhase to remove sugar output during package building.
r135
packaging: Include version in name
r18 name = "rhodecode-vcsserver-${version}";
nix: updated to 18.03 packages....
r472 releaseName = releaseName;
initial commit
r0 src = rhodecode-vcsserver-src;
packaging: don't run strip on sources for python packages
r174 dontStrip = true; # prevent strip, we don't need it.
initial commit
r0
packaging: switched to nix 20.03 packages and latest pip2nix code...
r970 buildInputs =
attrs.buildInputs or [] ++ [
];
#NOTE: option to inject additional propagatedBuildInputs
nix: updated to 18.03 packages....
r472 propagatedBuildInputs =
attrs.propagatedBuildInputs or [] ++ [
pkgs.git
pkgs.subversion
];
packaging: switched to nix 20.03 packages and latest pip2nix code...
r970 preBuild = ''
export NIX_PATH=nixpkgs=${pkgs.path}
export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt
'';
nix-shell: set the LOCALE_ARCHIVE paths so it uses nix-es local-archive instead of the system one.
r496
nix: updated to 18.03 packages....
r472 # Add bin directory to path so that tests can find 'vcsserver'.
initial commit
r0 preCheck = ''
nix: further nix changes
r976 echo "Expanding PATH with $out/bin directory"
initial commit
r0 export PATH="$out/bin:$PATH"
'';
nix: updated to 18.03 packages....
r472 # custom check phase for testing
nix: added custom checkPhase to remove sugar output during package building.
r135 checkPhase = ''
runHook preCheck
py3: packaging changes to build python37 packages, and make pip2nix work.
r981 PYTHONHASHSEED=$RANDOM py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=vcsserver --cov-report=term-missing vcsserver
nix: added custom checkPhase to remove sugar output during package building.
r135 runHook postCheck
'';
nix: updated to 18.03 packages....
r472 postCheck = ''
echo "Cleanup of vcsserver/tests"
rm -rf $out/lib/${self.python.libPrefix}/site-packages/vcsserver/tests
'';
initial commit
r0 postInstall = ''
nix: updated to 18.03 packages....
r472 echo "Writing vcsserver meta information for rccontrol to nix-support/rccontrol"
initial commit
r0 mkdir -p $out/nix-support/rccontrol
cp -v vcsserver/VERSION $out/nix-support/rccontrol/version
nix: updated to 18.03 packages....
r472 echo "DONE: vcsserver meta information for rccontrol written"
mkdir -p $out/etc
cp configs/production.ini $out/etc
echo "DONE: saved vcsserver production.ini into $out/etc"
initial commit
r0
nix: save env vars
r974 echo "saving env in $out/etc/env_vars.txt"
touch $out/etc/env_vars.txt
echo "# RhodeCode build env vars" >> $out/etc/env_vars.txt
echo "LOCALE_ARCHIVE=\"${pkgs.glibcLocales}/lib/locale/locale-archive\"" >> $out/etc/env_vars.txt
echo "LC_ALL=\"en_US.UTF-8\"" >> $out/etc/env_vars.txt
nix: further nix changes
r976 # expose sources of vcsserver
ln -s $out $out/etc/rhodecode_vcsserver_source
initial commit
r0 '';
});
};
nix: updated to 18.03 packages....
r472 basePythonPackages = with builtins;
if isAttrs pythonPackages then
pythonPackages
else
getAttr pythonPackages pkgs;
pythonGeneratedPackages = import ./pkgs/python-packages.nix {
packaging: switched to nix 20.03 packages and latest pip2nix code...
r970 inherit pkgs;
inherit (pkgs) fetchurl fetchgit fetchhg;
nix: updated to 18.03 packages....
r472 };
pythonVCSServerOverrides = import ./pkgs/python-packages-overrides.nix {
packaging: switched to nix 20.03 packages and latest pip2nix code...
r970 inherit pkgs basePythonPackages;
nix: updated to 18.03 packages....
r472 };
py3: packaging changes to build python37 packages, and make pip2nix work.
r981 # Apply all overrides and fix the vcsserver package set
targetPython = basePythonPackages.python.override {
packageOverrides = self: super: with pkgs.lib;
(extends pythonExternalOverrides
(extends pythonLocalOverrides
(extends pythonVCSServerOverrides
(extends pythonGeneratedPackages
(self: super))))) self;
};
# Python env with rhodecode-vcsserver
pythonEnv = (targetPython.withPackages(ps: with ps; [rhodecode-vcsserver]));
nix: updated to 18.03 packages....
r472
py3: packaging changes to build python37 packages, and make pip2nix work.
r981 # Generic env with wrapped binaries
vcsserver = pkgs.buildEnv {
name = if ! isNull targetPython.pkgs.rhodecode-vcsserver
then "vcsserver-${targetPython.pkgs.rhodecode-vcsserver.version}"
else "vcsserver";
paths = [
pythonEnv
# Symlink version control utilities
# We ensure that always the correct version is available as a symlink.
# So that users calling them via the profile path will always use the
# correct version. Wrapping is required so those can "import"
# vcsserver python hooks.
pkgs.git
pkgs.subversion
];
# expose following attributed outside
passthru = {
pythonPackages = targetPython.pkgs;
vcs_pkgs = pkgs;
};
buildInputs = [
pkgs.makeWrapper
];
postBuild = (if ! isNull targetPython.pkgs.rhodecode-vcsserver then ''
echo "Writing vcsserver meta information for rccontrol to nix-support/rccontrol"
ln -s ${targetPython.pkgs.rhodecode-vcsserver}/nix-support $out/nix-support
echo "DONE: vcsserver meta information for rccontrol written"
'' else "") + ''
DEPS="$out/bin/*"
# wrap only dependency scripts, they require to have full PYTHONPATH set
# to be able to import all packages
for file in $DEPS;
do
wrapProgram $file \
--prefix PATH : ${pkgs.git}/bin \
--prefix PATH : ${pkgs.subversion}/bin \
--prefix PATH : ${pythonEnv}/bin \
--prefix PYTHONPATH : ${pythonEnv}/${pythonEnv.sitePackages} \
--prefix PYTHONPATH : ${pkgs.subversion}/${pythonEnv.sitePackages} \
--set PYTHONHASHSEED $RANDOM
done
echo "DONE: vcsserver binary wrapping"
'';
};
initial commit
r0
py3: packaging changes to build python37 packages, and make pip2nix work.
r981 in vcsserver