##// END OF EJS Templates
nix: Pass the backwards compatible fetchgit to python and node packages.
Martin Bornhold -
r926:14a58a7b default
parent child Browse files
Show More
@@ -4,14 +4,55 b''
4 # derivation. For advanced tweaks to pimp up the development environment we use
4 # derivation. For advanced tweaks to pimp up the development environment we use
5 # "shell.nix" so that it does not have to clutter this file.
5 # "shell.nix" so that it does not have to clutter this file.
6
6
7 { pkgs ? (import <nixpkgs> {})
7 args@
8 , pythonPackages ? "python27Packages"
8 { pythonPackages ? "python27Packages"
9 , pythonExternalOverrides ? self: super: {}
9 , pythonExternalOverrides ? self: super: {}
10 , doCheck ? true
10 , doCheck ? true
11 , ...
11 }:
12 }:
12
13
13 let
14 let
14 inherit (pkgs.lib) fix extends;
15
16 # Use nixpkgs from args or import them. We use this indirect approach
17 # through args to be able to use the name `pkgs` for our customized packages.
18 # Otherwise we will end up with an infinite recursion.
19 nixpkgs = args.pkgs or (import <nixpkgs> { });
20
21 # johbo: Interim bridge which allows us to build with the upcoming
22 # nixos.16.09 branch (unstable at the moment of writing this note) and the
23 # current stable nixos-16.03.
24 backwardsCompatibleFetchgit = { ... }@args:
25 let
26 origSources = nixpkgs.fetchgit args;
27 in
28 nixpkgs.lib.overrideDerivation origSources (oldAttrs: {
29 NIX_PREFETCH_GIT_CHECKOUT_HOOK = ''
30 find $out -name '.git*' -print0 | xargs -0 rm -rf
31 '';
32 });
33
34 # Create a customized version of nixpkgs which should be used throughout the
35 # rest of this file.
36 pkgs = nixpkgs.overridePackages (self: super: {
37 fetchgit = backwardsCompatibleFetchgit;
38 });
39
40 # Evaluates to the last segment of a file system path.
41 basename = path: with pkgs.lib; last (splitString "/" path);
42
43 # source code filter used as arugment to builtins.filterSource.
44 src-filter = path: type: with pkgs.lib;
45 let
46 ext = last (splitString "." path);
47 in
48 !builtins.elem (basename path) [
49 ".git" ".hg" "__pycache__" ".eggs"
50 "bower_components" "node_modules"
51 "build" "data" "result" "tmp"] &&
52 !builtins.elem ext ["egg-info" "pyc"] &&
53 # TODO: johbo: This check is wrong, since "path" contains an absolute path,
54 # it would still be good to restore it since we want to ignore "result-*".
55 !hasPrefix "result" path;
15
56
16 basePythonPackages = with builtins; if isAttrs pythonPackages
57 basePythonPackages = with builtins; if isAttrs pythonPackages
17 then pythonPackages
58 then pythonPackages
@@ -21,25 +62,6 b' let'
21 pkgs.buildBowerComponents or
62 pkgs.buildBowerComponents or
22 (import ./pkgs/backport-16.03-build-bower-components.nix { inherit pkgs; });
63 (import ./pkgs/backport-16.03-build-bower-components.nix { inherit pkgs; });
23
64
24 elem = builtins.elem;
25 basename = path: with pkgs.lib; last (splitString "/" path);
26 startsWith = prefix: full: let
27 actualPrefix = builtins.substring 0 (builtins.stringLength prefix) full;
28 in actualPrefix == prefix;
29
30 src-filter = path: type: with pkgs.lib;
31 let
32 ext = last (splitString "." path);
33 in
34 !elem (basename path) [
35 ".git" ".hg" "__pycache__" ".eggs"
36 "bower_components" "node_modules"
37 "build" "data" "result" "tmp"] &&
38 !elem ext ["egg-info" "pyc"] &&
39 # TODO: johbo: This check is wrong, since "path" contains an absolute path,
40 # it would still be good to restore it since we want to ignore "result-*".
41 !startsWith "result" path;
42
43 sources = pkgs.config.rc.sources or {};
65 sources = pkgs.config.rc.sources or {};
44 version = builtins.readFile ./rhodecode/VERSION;
66 version = builtins.readFile ./rhodecode/VERSION;
45 rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
67 rhodecode-enterprise-ce-src = builtins.filterSource src-filter ./.;
@@ -218,11 +240,11 b' let'
218 });
240 });
219
241
220 # Apply all overrides and fix the final package set
242 # Apply all overrides and fix the final package set
221 myPythonPackagesUnfix =
243 myPythonPackagesUnfix = with pkgs.lib;
222 (extends pythonExternalOverrides
244 (extends pythonExternalOverrides
223 (extends pythonLocalOverrides
245 (extends pythonLocalOverrides
224 (extends pythonOverrides
246 (extends pythonOverrides
225 pythonGeneratedPackages)));
247 pythonGeneratedPackages)));
226 myPythonPackages = (fix myPythonPackagesUnfix);
248 myPythonPackages = (pkgs.lib.fix myPythonPackagesUnfix);
227
249
228 in myPythonPackages.rhodecode-enterprise-ce
250 in myPythonPackages.rhodecode-enterprise-ce
@@ -15,19 +15,6 b' let'
15 };
15 };
16 };
16 };
17
17
18 # johbo: Interim bridge which allows us to build with the upcoming
19 # nixos.16.09 branch (unstable at the moment of writing this note) and the
20 # current stable nixos-16.03.
21 backwardsCompatibleFetchgit = { ... }@args:
22 let
23 origSources = pkgs.fetchgit args;
24 in
25 pkgs.lib.overrideDerivation origSources (oldAttrs: {
26 NIX_PREFETCH_GIT_CHECKOUT_HOOK = ''
27 find $out -name '.git*' -print0 | xargs -0 rm -rf
28 '';
29 });
30
31 in
18 in
32
19
33 self: super: {
20 self: super: {
@@ -110,7 +97,7 b' self: super: {'
110 });
97 });
111
98
112 py-gfm = super.py-gfm.override {
99 py-gfm = super.py-gfm.override {
113 src = backwardsCompatibleFetchgit {
100 src = pkgs.fetchgit {
114 url = "https://code.rhodecode.com/upstream/py-gfm";
101 url = "https://code.rhodecode.com/upstream/py-gfm";
115 rev = "0d66a19bc16e3d49de273c0f797d4e4781e8c0f2";
102 rev = "0d66a19bc16e3d49de273c0f797d4e4781e8c0f2";
116 sha256 = "0ryp74jyihd3ckszq31bml5jr3bciimhfp7va7kw6ld92930ksv3";
103 sha256 = "0ryp74jyihd3ckszq31bml5jr3bciimhfp7va7kw6ld92930ksv3";
@@ -134,7 +121,7 b' self: super: {'
134
121
135 Pylons = super.Pylons.override (attrs: {
122 Pylons = super.Pylons.override (attrs: {
136 name = "Pylons-1.0.1-patch1";
123 name = "Pylons-1.0.1-patch1";
137 src = backwardsCompatibleFetchgit {
124 src = pkgs.fetchgit {
138 url = "https://code.rhodecode.com/upstream/pylons";
125 url = "https://code.rhodecode.com/upstream/pylons";
139 rev = "707354ee4261b9c10450404fc9852ccea4fd667d";
126 rev = "707354ee4261b9c10450404fc9852ccea4fd667d";
140 sha256 = "b2763274c2780523a335f83a1df65be22ebe4ff413a7bc9e9288d23c1f62032e";
127 sha256 = "b2763274c2780523a335f83a1df65be22ebe4ff413a7bc9e9288d23c1f62032e";
General Comments 0
You need to be logged in to leave comments. Login now