release: Finish preparation for 4.16.0
release: Finish preparation for 4.16.0

File last commit:

r3449:7c3af07c default
r3500:79774464 v4.16.0 stable
Show More
default.nix
296 lines | 8.9 KiB | text/x-nix | NixLexer
/ default.nix
project: added all source files and assets
r1 # Nix environment for the community edition
#
nix: updated to 18.03 nix packages...
r2824 # This shall be as lean as possible, just producing the enterprise-ce
project: added all source files and assets
r1 # 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 nix packages...
r2824 #
# Configuration, set values in "~/.nixpkgs/config.nix".
# example
# {
# # Thoughts on how to configure the dev environment
# rc = {
nix: don't allow overriding the import packages. This causes overlays to fail
r3189 # codeInternalUrl = "https://usr:token@code.rhodecode.com/internal";
nix: updated to 18.03 nix packages...
r2824 # sources = {
# rhodecode-vcsserver = "/home/user/work/rhodecode-vcsserver";
# rhodecode-enterprise-ce = "/home/user/work/rhodecode-enterprise-ce";
# rhodecode-enterprise-ee = "/home/user/work/rhodecode-enterprise-ee";
# };
# };
# }
project: added all source files and assets
r1
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926 args@
build: fix 32bit builds
r3449 { system ? builtins.currentSystem
, pythonPackages ? "python27Packages"
project: added all source files and assets
r1 , pythonExternalOverrides ? self: super: {}
nix: updated to 18.03 nix packages...
r2824 , doCheck ? false
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926 , ...
project: added all source files and assets
r1 }:
let
build: fix 32bit builds
r3449 pkgs_ = args.pkgs or (import <nixpkgs> { inherit system; });
nix: don't allow overriding the import packages. This causes overlays to fail
r3189 in
let
pkgs = import <nixpkgs> {
packages: use common overlay structure that vcsserver uses.
r3140 overlays = [
(import ./pkgs/overlays.nix)
];
nix: don't pass pkgs into injected vcsserver.
r3144 inherit
(pkgs_)
packages: use common overlay structure that vcsserver uses.
r3140 system;
nix: don't allow overriding the import packages. This causes overlays to fail
r3189 };
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926
nix: updated to 18.03 nix packages...
r2824 # Works with the new python-packages, still can fallback to the old
# variant.
basePythonPackagesUnfix = basePythonPackages.__unfix__ or (
self: basePythonPackages.override (a: { inherit self; }));
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926
# Evaluates to the last segment of a file system path.
basename = path: with pkgs.lib; last (splitString "/" path);
# source code filter used as arugment to builtins.filterSource.
src-filter = path: type: with pkgs.lib;
let
ext = last (splitString "." path);
in
!builtins.elem (basename path) [
nix: updated to 18.03 nix packages...
r2824 ".git" ".hg" "__pycache__" ".eggs" ".idea" ".dev"
packaging: dropped bower, it's now replaced by npm and webcomponents from polymer.
r3176 "node_modules" "node_binaries"
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926 "build" "data" "result" "tmp"] &&
!builtins.elem ext ["egg-info" "pyc"] &&
# TODO: johbo: This check is wrong, since "path" contains an absolute path,
# it would still be good to restore it since we want to ignore "result-*".
!hasPrefix "result" path;
project: added all source files and assets
r1
nix: updated to 18.03 nix packages...
r2824 sources =
let
nix: use common formatting on inherit keyword.
r3143 inherit
(pkgs.lib)
all
isString
attrValues;
nix: updated to 18.03 nix packages...
r2824 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;
project: added all source files and assets
r1
nix: updated to 18.03 nix packages...
r2824 version = builtins.readFile "${rhodecode-enterprise-ce-src}/rhodecode/VERSION";
project: added all source files and assets
r1 rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
nix: Link node modules based on node2nix
r708 nodeEnv = import ./pkgs/node-default.nix {
nix: use common formatting on inherit keyword.
r3143 inherit
build: fix 32bit builds
r3449 pkgs
system;
project: added all source files and assets
r1 };
nix: Link node modules based on node2nix
r708 nodeDependencies = nodeEnv.shell.nodeDependencies;
project: added all source files and assets
r1
nix: updated to 18.03 nix packages...
r2824 rhodecode-testdata-src = sources.rhodecode-testdata or (
pkgs.fetchhg {
url = "https://code.rhodecode.com/upstream/rc_testdata";
rev = "v0.10.0";
sha256 = "0zn9swwvx4vgw4qn8q3ri26vvzgrxn15x6xnjrysi1bwmz01qjl0";
});
project: added all source files and assets
r1
nix: updated to 18.03 nix packages...
r2824 rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" {
inherit
doCheck
pkgs
pythonPackages;
project: added all source files and assets
r1 };
pythonLocalOverrides = self: super: {
rhodecode-enterprise-ce =
let
packaging: dropped bower, it's now replaced by npm and webcomponents from polymer.
r3176 linkNodePackages = ''
nix: export CE sources path
r743 export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src}
nix: updated to 18.03 nix packages...
r2824
js: use builtin packages for binaries...
r3162 echo "[BEGIN]: Link node packages and binaries"
nix: Link node modules based on node2nix
r708 # johbo: Linking individual packages allows us to run "npm install"
# inside of a shell to try things out. Re-entering the shell will
# restore a clean environment.
js: use builtin packages for binaries...
r3162 rm -fr node_modules
mkdir node_modules
nix: Link node modules based on node2nix
r708 ln -s ${nodeDependencies}/lib/node_modules/* node_modules/
js: use builtin packages for binaries...
r3162 export NODE_PATH=./node_modules
rm -fr node_binaries
mkdir node_binaries
ln -s ${nodeDependencies}/bin/* node_binaries/
echo "[DONE ]: Link node packages and binaries"
nix: updated to 18.03 nix packages...
r2824 '';
packaging: Link bower packages
r720
nix: updated to 18.03 nix packages...
r2824 releaseName = "RhodeCodeEnterpriseCE-${version}";
project: added all source files and assets
r1 in super.rhodecode-enterprise-ce.override (attrs: {
release: Provide attribute releaseName...
r241 inherit
doCheck
version;
nix: updated to 18.03 nix packages...
r2824
project: added all source files and assets
r1 name = "rhodecode-enterprise-ce-${version}";
nix: updated to 18.03 nix packages...
r2824 releaseName = releaseName;
project: added all source files and assets
r1 src = rhodecode-enterprise-ce-src;
packaging: don't run strip on sources for python packages
r1493 dontStrip = true; # prevent strip, we don't need it.
project: added all source files and assets
r1
nix: updated to 18.03 nix packages...
r2824 # expose following attributed outside
project: added all source files and assets
r1 passthru = {
packaging: Expose the local overrides via passthru.
r74 inherit
nix: updated to 18.03 nix packages...
r2824 rhodecode-testdata
packaging: dropped bower, it's now replaced by npm and webcomponents from polymer.
r3176 linkNodePackages
nix: Add linkNodeModules to passthru...
r465 myPythonPackagesUnfix
nix: updated to 18.03 nix packages...
r2824 pythonLocalOverrides
pythonCommunityOverrides;
project: added all source files and assets
r1 pythonPackages = self;
};
nix: updated to 18.03 nix packages...
r2824 buildInputs =
attrs.buildInputs or [] ++ [
rhodecode-testdata
];
#NOTE: option to inject additional propagatedBuildInputs
propagatedBuildInputs =
attrs.propagatedBuildInputs or [] ++ [
];
project: added all source files and assets
r1 LC_ALL = "en_US.UTF-8";
LOCALE_ARCHIVE =
nix: updated to 18.03 nix packages...
r2824 if pkgs.stdenv.isLinux
project: added all source files and assets
r1 then "${pkgs.glibcLocales}/lib/locale/locale-archive"
else "";
nix: updated to 18.03 nix packages...
r2824 # Add bin directory to path so that tests can find 'rhodecode'.
project: added all source files and assets
r1 preCheck = ''
export PATH="$out/bin:$PATH"
'';
nix: updated to 18.03 nix packages...
r2824 # custom check phase for testing
checkPhase = ''
runHook preCheck
PYTHONHASHSEED=random py.test -vv -p no:sugar -r xw --cov-config=.coveragerc --cov=rhodecode --cov-report=term-missing rhodecode
runHook postCheck
'';
project: added all source files and assets
r1 postCheck = ''
nix: updated to 18.03 nix packages...
r2824 echo "Cleanup of rhodecode/tests"
project: added all source files and assets
r1 rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests
'';
nix: updated to 18.03 nix packages...
r2824 preBuild = ''
js: use builtin packages for binaries...
r3162 echo "[BEGIN]: Building frontend assets"
packaging: dropped bower, it's now replaced by npm and webcomponents from polymer.
r3176 ${linkNodePackages}
js: use builtin packages for binaries...
r3162 make web-build
project: added all source files and assets
r1 rm -fr node_modules
js: use builtin packages for binaries...
r3162 rm -fr node_binaries
echo "[DONE ]: Building frontend assets"
project: added all source files and assets
r1 '';
postInstall = ''
packaging: don't wrap rhodecode tools since they are fully standalone.
r3121 # check required files
build: add stricter checks for static files inside build data
r3182 STATIC_CHECK="/robots.txt /502.html
/js/scripts.js /js/rhodecode-components.js
/css/style.css /css/style-polymer.css"
for file in $STATIC_CHECK;
do
if [ ! -f rhodecode/public/$file ]; then
echo "Missing $file"
exit 1
fi
done
packaging: don't wrap rhodecode tools since they are fully standalone.
r3121
nix: updated to 18.03 nix packages...
r2824 echo "Writing enterprise-ce meta information for rccontrol to nix-support/rccontrol"
nix: update default.nix to be consistent with ordering with vcsserver.
r1773 mkdir -p $out/nix-support/rccontrol
cp -v rhodecode/VERSION $out/nix-support/rccontrol/version
js: use builtin packages for binaries...
r3162 echo "[DONE ]: enterprise-ce meta information for rccontrol written"
nix: updated to 18.03 nix packages...
r2824
mkdir -p $out/etc
cp configs/production.ini $out/etc
js: use builtin packages for binaries...
r3162 echo "[DONE ]: saved enterprise-ce production.ini into $out/etc"
nix: update default.nix to be consistent with ordering with vcsserver.
r1773
packaging: properly expose rcextensions.tmpl using -Rf flags
r3190 cp -Rf rhodecode/config/rcextensions $out/etc/rcextensions.tmpl
js: use builtin packages for binaries...
r3162 echo "[DONE ]: saved enterprise-ce rcextensions into $out/etc/rcextensions.tmpl"
rcextensions: new builtin rcextensions....
r3133
project: added all source files and assets
r1 # python based programs need to be wrapped
nix: updated to 18.03 nix packages...
r2824 mkdir -p $out/bin
# required binaries from dependencies
packaging: only wrap external dependency scripts....
r3122 ln -s ${self.supervisor}/bin/supervisorctl $out/bin/
ln -s ${self.supervisor}/bin/supervisord $out/bin/
dependencies: made all dependencies lowercase, helps with diffing other projects, and keeps proper order.
r2718 ln -s ${self.pastescript}/bin/paster $out/bin/
notifications: support real-time notifications with websockets via channelstream
r526 ln -s ${self.channelstream}/bin/channelstream $out/bin/
nix: expose celery binaries
r2377 ln -s ${self.celery}/bin/celery $out/bin/
packaging: only wrap external dependency scripts....
r3122 ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
ln -s ${self.pyramid}/bin/prequest $out/bin/
ln -s ${self.pyramid}/bin/pserve $out/bin/
project: added all source files and assets
r1
js: use builtin packages for binaries...
r3162 echo "[DONE ]: created symlinks into $out/bin"
packaging: only wrap external dependency scripts....
r3122 DEPS="$out/bin/supervisorctl \
$out/bin/supervisord \
$out/bin/paster \
$out/bin/channelstream \
$out/bin/celery \
$out/bin/gunicorn \
$out/bin/prequest \
$out/bin/pserve"
# wrap only dependency scripts, they require to have full PYTHONPATH set
# to be able to import all packages
for file in $DEPS;
nix: update default.nix to be consistent with ordering with vcsserver.
r1773 do
project: added all source files and assets
r1 wrapProgram $file \
nix: updated to 18.03 nix packages...
r2824 --prefix PATH : $PATH \
--prefix PYTHONPATH : $PYTHONPATH \
--set PYTHONHASHSEED random
project: added all source files and assets
r1 done
js: use builtin packages for binaries...
r3162 echo "[DONE ]: enterprise-ce binary wrapping"
project: added all source files and assets
r1
packaging: don't wrap rhodecode tools since they are fully standalone.
r3121 # rhodecode-tools don't need wrapping
ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/
build: let CE expose static/source in the same way as EE for consistent etc/ directory structure
r3181 # expose sources of CE
ln -s $out $out/etc/rhodecode_enterprise_ce_source
# expose static files folder
cp -Rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/public/ $out/etc/static
chmod 755 -R $out/etc/static
project: added all source files and assets
r1 '';
});
};
nix: updated to 18.03 nix packages...
r2824 basePythonPackages = with builtins;
if isAttrs pythonPackages then
pythonPackages
else
getAttr pythonPackages pkgs;
pythonGeneratedPackages = import ./pkgs/python-packages.nix {
nix: use common formatting on inherit keyword.
r3143 inherit
pkgs;
inherit
(pkgs)
fetchurl
fetchgit
fetchhg;
nix: updated to 18.03 nix packages...
r2824 };
pythonCommunityOverrides = import ./pkgs/python-packages-overrides.nix {
inherit pkgs basePythonPackages;
};
Martin Bornhold
nix: Use path to rc_testdata from pkgs.config.rc.sources if present.
r211
project: added all source files and assets
r1 # Apply all overrides and fix the final package set
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926 myPythonPackagesUnfix = with pkgs.lib;
project: added all source files and assets
r1 (extends pythonExternalOverrides
(extends pythonLocalOverrides
nix: updated to 18.03 nix packages...
r2824 (extends pythonCommunityOverrides
(extends pythonGeneratedPackages
basePythonPackagesUnfix))));
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926 myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix);
project: added all source files and assets
r1
in myPythonPackages.rhodecode-enterprise-ce