##// END OF EJS Templates
config: Add argument to convert settings to lowercase or not....
config: Add argument to convert settings to lowercase or not. Most settings should be converted to lowercase during app init. But at least file system paths should not lower cased. Threfore we need a switch to control it.

File last commit:

r940:1fece5a0 default
r1003:7a52996d default
Show More
default.nix
250 lines | 7.9 KiB | text/x-nix | NixLexer
project: added all source files and assets
r1 # Nix environment for the community edition
#
# This shall be as lean as possible, just producing the Enterprise
# derivation. For advanced tweaks to pimp up the development environment we use
# "shell.nix" so that it does not have to clutter this file.
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926 args@
{ pythonPackages ? "python27Packages"
project: added all source files and assets
r1 , pythonExternalOverrides ? self: super: {}
, doCheck ? true
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926 , ...
project: added all source files and assets
r1 }:
let
Martin Bornhold
nix: Pass the backwards compatible fetchgit to python and node packages.
r926
# Use nixpkgs from args or import them. We use this indirect approach
# through args to be able to use the name `pkgs` for our customized packages.
# Otherwise we will end up with an infinite recursion.
nixpkgs = args.pkgs or (import <nixpkgs> { });
# johbo: Interim bridge which allows us to build with the upcoming
# nixos.16.09 branch (unstable at the moment of writing this note) and the
# current stable nixos-16.03.
backwardsCompatibleFetchgit = { ... }@args:
let
origSources = nixpkgs.fetchgit args;
in
nixpkgs.lib.overrideDerivation origSources (oldAttrs: {
NIX_PREFETCH_GIT_CHECKOUT_HOOK = ''
find $out -name '.git*' -print0 | xargs -0 rm -rf
'';
});
# Create a customized version of nixpkgs which should be used throughout the
# rest of this file.
pkgs = nixpkgs.overridePackages (self: super: {
fetchgit = backwardsCompatibleFetchgit;
});
# 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) [
".git" ".hg" "__pycache__" ".eggs"
"bower_components" "node_modules"
"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
basePythonPackages = with builtins; if isAttrs pythonPackages
then pythonPackages
else getAttr pythonPackages pkgs;
packaging: Backport bower support utilities...
r725 buildBowerComponents =
pkgs.buildBowerComponents or
(import ./pkgs/backport-16.03-build-bower-components.nix { inherit pkgs; });
Martin Bornhold
nix: Use path to rc_testdata from pkgs.config.rc.sources if present.
r211 sources = pkgs.config.rc.sources or {};
packaging: Improve name of bower components derivation...
r724 version = builtins.readFile ./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 {
inherit pkgs;
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
packaging: Backport bower support utilities...
r725 bowerComponents = buildBowerComponents {
packaging: Improve name of bower components derivation...
r724 name = "enterprise-ce-${version}";
dependencies: Update bower packages...
r719 generated = ./pkgs/bower-packages.nix;
src = rhodecode-enterprise-ce-src;
};
project: added all source files and assets
r1 pythonGeneratedPackages = self: basePythonPackages.override (a: {
inherit self;
})
// (scopedImport {
self = self;
super = basePythonPackages;
inherit pkgs;
inherit (pkgs) fetchurl fetchgit;
} ./pkgs/python-packages.nix);
pythonOverrides = import ./pkgs/python-packages-overrides.nix {
inherit
basePythonPackages
pkgs;
};
pythonLocalOverrides = self: super: {
rhodecode-enterprise-ce =
let
packaging: Link bower packages
r720 linkNodeAndBowerPackages = ''
nix: export CE sources path
r743 echo "Export RhodeCode CE path"
export RHODECODE_CE_PATH=${rhodecode-enterprise-ce-src}
project: added all source files and assets
r1 echo "Link node packages"
rm -fr node_modules
nix: Link node modules based on node2nix
r708 mkdir node_modules
# 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.
ln -s ${nodeDependencies}/lib/node_modules/* node_modules/
project: added all source files and assets
r1 echo "DONE: Link node packages"
packaging: Link bower packages
r720
echo "Link bower packages"
rm -fr bower_components
mkdir bower_components
ln -s ${bowerComponents}/bower_components/* bower_components/
echo "DONE: Link bower packages"
project: added all source files and assets
r1 '';
in super.rhodecode-enterprise-ce.override (attrs: {
release: Provide attribute releaseName...
r241 inherit
doCheck
version;
project: added all source files and assets
r1 name = "rhodecode-enterprise-ce-${version}";
release: Provide attribute releaseName...
r241 releaseName = "RhodeCodeEnterpriseCE-${version}";
project: added all source files and assets
r1 src = rhodecode-enterprise-ce-src;
buildInputs =
attrs.buildInputs ++
(with self; [
dependencies: Adding Bower out of nixpkgs...
r709 pkgs.nodePackages.bower
project: added all source files and assets
r1 pkgs.nodePackages.grunt-cli
pkgs.subversion
pytest-catchlog
Martin Bornhold
nix: Import rhodecode testdata as derivation.
r218 rhodecode-testdata
project: added all source files and assets
r1 ]);
propagatedBuildInputs = attrs.propagatedBuildInputs ++ (with self; [
rhodecode-tools
]);
# TODO: johbo: Make a nicer way to expose the parts. Maybe
# pkgs/default.nix?
passthru = {
packaging: Expose the local overrides via passthru.
r74 inherit
dependencies: Update bower packages...
r719 bowerComponents
packaging: Link bower packages
r720 linkNodeAndBowerPackages
nix: Add linkNodeModules to passthru...
r465 myPythonPackagesUnfix
pythonLocalOverrides;
project: added all source files and assets
r1 pythonPackages = self;
};
LC_ALL = "en_US.UTF-8";
LOCALE_ARCHIVE =
if pkgs.stdenv ? glibc
then "${pkgs.glibcLocales}/lib/locale/locale-archive"
else "";
# Somewhat snappier setup of the development environment
# TODO: move into shell.nix
# TODO: think of supporting a stable path again, so that multiple shells
# can share it.
shellHook = ''
tmp_path=$(mktemp -d)
export PATH="$tmp_path/bin:$PATH"
export PYTHONPATH="$tmp_path/${self.python.sitePackages}:$PYTHONPATH"
mkdir -p $tmp_path/${self.python.sitePackages}
python setup.py develop --prefix $tmp_path --allow-hosts ""
packaging: Link bower packages
r720 '' + linkNodeAndBowerPackages;
project: added all source files and assets
r1
preCheck = ''
export PATH="$out/bin:$PATH"
'';
postCheck = ''
rm -rf $out/lib/${self.python.libPrefix}/site-packages/pytest_pylons
rm -rf $out/lib/${self.python.libPrefix}/site-packages/rhodecode/tests
'';
packaging: Link bower packages
r720 preBuild = linkNodeAndBowerPackages + ''
project: added all source files and assets
r1 grunt
rm -fr node_modules
'';
postInstall = ''
# python based programs need to be wrapped
ln -s ${self.supervisor}/bin/supervisor* $out/bin/
ln -s ${self.gunicorn}/bin/gunicorn $out/bin/
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/
packaging: Link pyramid tools, set PATH in wrappers
r167 ln -s ${self.pyramid}/bin/* $out/bin/ #*/
project: added all source files and assets
r1
# rhodecode-tools
# TODO: johbo: re-think this. Do the tools import anything from enterprise?
ln -s ${self.rhodecode-tools}/bin/rhodecode-* $out/bin/
# note that condition should be restricted when adding further tools
for file in $out/bin/*; do #*/
wrapProgram $file \
--prefix PYTHONPATH : $PYTHONPATH \
packaging: Link pyramid tools, set PATH in wrappers
r167 --prefix PATH : $PATH \
project: added all source files and assets
r1 --set PYTHONHASHSEED random
done
mkdir $out/etc
cp configs/production.ini $out/etc
echo "Writing meta information for rccontrol to nix-support/rccontrol"
mkdir -p $out/nix-support/rccontrol
cp -v rhodecode/VERSION $out/nix-support/rccontrol/version
echo "DONE: Meta information for rccontrol written"
# TODO: johbo: Make part of ac-tests
if [ ! -f rhodecode/public/js/scripts.js ]; then
echo "Missing scripts.js"
exit 1
fi
if [ ! -f rhodecode/public/css/style.css ]; then
echo "Missing style.css"
exit 1
fi
'';
});
Martin Bornhold
nix: Import rhodecode testdata as derivation.
r218 rhodecode-testdata = import "${rhodecode-testdata-src}/default.nix" {
inherit
doCheck
pkgs
pythonPackages;
project: added all source files and assets
r1 };
};
Martin Bornhold
nix: Use path to rc_testdata from pkgs.config.rc.sources if present.
r211 rhodecode-testdata-src = sources.rhodecode-testdata or (
pkgs.fetchhg {
url = "https://code.rhodecode.com/upstream/rc_testdata";
packaging: Update rc-testdata...
r940 rev = "v0.9.0";
sha256 = "0k0ccb7cncd6mmzwckfbr6l7fsymcympwcm948qc3i0f0m6bbg1y";
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
(extends pythonOverrides
pythonGeneratedPackages)));
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