nix: Pass the backwards compatible fetchgit to python and node packages.
This commit is contained in:
parent
dc2d17cfb3
commit
ff59708ca8
2 changed files with 48 additions and 39 deletions
70
default.nix
70
default.nix
|
|
@ -4,14 +4,55 @@
|
|||
# derivation. For advanced tweaks to pimp up the development environment we use
|
||||
# "shell.nix" so that it does not have to clutter this file.
|
||||
|
||||
{ pkgs ? (import <nixpkgs> {})
|
||||
, pythonPackages ? "python27Packages"
|
||||
args@
|
||||
{ pythonPackages ? "python27Packages"
|
||||
, pythonExternalOverrides ? self: super: {}
|
||||
, doCheck ? true
|
||||
, ...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs.lib) fix extends;
|
||||
|
||||
# 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;
|
||||
|
||||
basePythonPackages = with builtins; if isAttrs pythonPackages
|
||||
then pythonPackages
|
||||
|
|
@ -21,25 +62,6 @@ let
|
|||
pkgs.buildBowerComponents or
|
||||
(import ./pkgs/backport-16.03-build-bower-components.nix { inherit pkgs; });
|
||||
|
||||
elem = builtins.elem;
|
||||
basename = path: with pkgs.lib; last (splitString "/" path);
|
||||
startsWith = prefix: full: let
|
||||
actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full;
|
||||
in actualPrefix == prefix;
|
||||
|
||||
src-filter = path: type: with pkgs.lib;
|
||||
let
|
||||
ext = last (splitString "." path);
|
||||
in
|
||||
!elem (basename path) [
|
||||
".git" ".hg" "__pycache__" ".eggs"
|
||||
"bower_components" "node_modules"
|
||||
"build" "data" "result" "tmp"] &&
|
||||
!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-*".
|
||||
!startsWith "result" path;
|
||||
|
||||
sources = pkgs.config.rc.sources or {};
|
||||
version = builtins.readFile ./rhodecode/VERSION;
|
||||
rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
|
||||
|
|
@ -218,11 +240,11 @@ let
|
|||
});
|
||||
|
||||
# Apply all overrides and fix the final package set
|
||||
myPythonPackagesUnfix =
|
||||
myPythonPackagesUnfix = with pkgs.lib;
|
||||
(extends pythonExternalOverrides
|
||||
(extends pythonLocalOverrides
|
||||
(extends pythonOverrides
|
||||
pythonGeneratedPackages)));
|
||||
myPythonPackages = (fix myPythonPackagesUnfix);
|
||||
myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix);
|
||||
|
||||
in myPythonPackages.rhodecode-enterprise-ce
|
||||
|
|
|
|||
|
|
@ -15,19 +15,6 @@ let
|
|||
};
|
||||
};
|
||||
|
||||
# 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 = pkgs.fetchgit args;
|
||||
in
|
||||
pkgs.lib.overrideDerivation origSources (oldAttrs: {
|
||||
NIX_PREFETCH_GIT_CHECKOUT_HOOK = ''
|
||||
find $out -name '.git*' -print0 | xargs -0 rm -rf
|
||||
'';
|
||||
});
|
||||
|
||||
in
|
||||
|
||||
self: super: {
|
||||
|
|
@ -110,7 +97,7 @@ self: super: {
|
|||
});
|
||||
|
||||
py-gfm = super.py-gfm.override {
|
||||
src = backwardsCompatibleFetchgit {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://code.rhodecode.com/upstream/py-gfm";
|
||||
rev = "0d66a19bc16e3d49de273c0f797d4e4781e8c0f2";
|
||||
sha256 = "0ryp74jyihd3ckszq31bml5jr3bciimhfp7va7kw6ld92930ksv3";
|
||||
|
|
@ -134,7 +121,7 @@ self: super: {
|
|||
|
||||
Pylons = super.Pylons.override (attrs: {
|
||||
name = "Pylons-1.0.1-patch1";
|
||||
src = backwardsCompatibleFetchgit {
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://code.rhodecode.com/upstream/pylons";
|
||||
rev = "707354ee4261b9c10450404fc9852ccea4fd667d";
|
||||
sha256 = "b2763274c2780523a335f83a1df65be22ebe4ff413a7bc9e9288d23c1f62032e";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue