···1-let requiredVersion = "1.10"; in
23if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.nixVersion == 1 then
4
···1+let requiredVersion = import ./lib/minver.nix; in
23if ! builtins ? nixVersion || builtins.compareVersions requiredVersion builtins.nixVersion == 1 then
4
+2
lib/minver.nix
···00
···1+# Expose the minimum required version for evaluating Nixpkgs
2+"1.10"
+14-7
lib/types.nix
···193194 nullOr = elemType: mkOptionType {
195 name = "null or ${elemType.name}";
196- check = x: builtins.isNull x || elemType.check x;
197 merge = loc: defs:
198- let nrNulls = count (def: isNull def.value) defs; in
199 if nrNulls == length defs then null
200 else if nrNulls != 0 then
201 throw "The option `${showOption loc}' is defined both null and not null, in ${showFiles (getFiles defs)}."
···230 substSubModules = m: submodule m;
231 };
232233- enum = values: mkOptionType {
234- name = "one of ${concatStringsSep ", " values}";
235- check = flip elem values;
236- merge = mergeOneOption;
237- };
0000000238239 either = t1: t2: mkOptionType {
240 name = "${t1.name} or ${t2.name}";
···193194 nullOr = elemType: mkOptionType {
195 name = "null or ${elemType.name}";
196+ check = x: x == null || elemType.check x;
197 merge = loc: defs:
198+ let nrNulls = count (def: def.value == null) defs; in
199 if nrNulls == length defs then null
200 else if nrNulls != 0 then
201 throw "The option `${showOption loc}' is defined both null and not null, in ${showFiles (getFiles defs)}."
···230 substSubModules = m: submodule m;
231 };
232233+ enum = values:
234+ let
235+ show = v:
236+ if builtins.isString v then ''"${v}"''
237+ else if builtins.isInt v then builtins.toString v
238+ else ''<${builtins.typeOf v}>'';
239+ in
240+ mkOptionType {
241+ name = "one of ${concatMapStringsSep ", " show values}";
242+ check = flip elem values;
243+ merge = mergeOneOption;
244+ };
245246 either = t1: t2: mkOptionType {
247 name = "${t1.name} or ${t2.name}";
···1diff --git a/config/environments/production.rb b/config/environments/production.rb
2-index 78bf543..9b37122 100644
3--- a/config/environments/production.rb
4+++ b/config/environments/production.rb
5-@@ -66,10 +66,10 @@ Gitlab::Application.configure do
67 config.action_mailer.delivery_method = :sendmail
8 # Defaults to:
···18 config.action_mailer.raise_delivery_errors = true
1920diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
21-index e7a8d08..834ecaf 100644
22--- a/config/gitlab.yml.example
23+++ b/config/gitlab.yml.example
24-@@ -17,8 +17,8 @@ production: &base
25 ## GitLab settings
26 gitlab:
27 ## Web server settings (note: host is the FQDN, do not include http://)
···32 https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
3334 # Uncommment this line below if your ssh host is different from HTTP/HTTPS one
35-@@ -31,11 +31,11 @@ production: &base
36 # relative_url_root: /gitlab
3738 # Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
39- # user: git
40+ user: gitlab
4142- ## Email settings
000043 # Email address used in the "From" field in mails sent by GitLab
44- email_from: example@example.com
45+ email_from: <%= ENV['GITLAB_EMAIL_FROM'] %>
004647- # Email server smtp settings are in [a separate file](initializers/smtp_settings.rb.sample).
48-49-@@ -230,12 +230,12 @@ production: &base
50 # GitLab Satellites
51 satellites:
52 # Relative paths are relative to Rails.root (default: tmp/repo_satellites/)
···58 backup:
59- path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
60+ path: <%= ENV['GITLAB_BACKUP_PATH'] %>
061 # keep_time: 604800 # default: 0 (forever) (in seconds)
62- # upload:
63- # # Fog storage connection settings, see http://fog.io/storage/ .
64-@@ -249,11 +249,11 @@ production: &base
6566 ## GitLab Shell settings
67 gitlab_shell:
···73- hooks_path: /home/git/gitlab-shell/hooks/
74+ repos_path: <%= ENV['GITLAB_REPOSITORIES_PATH'] %>
75+ hooks_path: <%= ENV['GITLAB_SHELL_HOOKS_PATH'] %>
000007677 # Git over HTTP
78 upload_pack: true
79-@@ -266,7 +266,7 @@ production: &base
80 # CAUTION!
81 # Use the default values unless you really know what you are doing
82 git:
···85 # The next value is the maximum memory size grit can use
86 # Given in number of bytes per git object (e.g. a commit)
87 # This value can be increased if you have very large commits
88-@@ -299,7 +299,7 @@ test:
89 gravatar:
90 enabled: true
91 gitlab:
···9596 # When you run tests we clone and setup gitlab-shell
97diff --git a/lib/gitlab/app_logger.rb b/lib/gitlab/app_logger.rb
98-index 8e4717b..abfe2e4 100644
99--- a/lib/gitlab/app_logger.rb
100+++ b/lib/gitlab/app_logger.rb
101@@ -1,7 +1,7 @@
102 module Gitlab
103 class AppLogger < Gitlab::Logger
104- def self.file_name
105-- 'application.log'
106+ ENV["GITLAB_APPLICATION_LOG_PATH"]
107 end
108
···1diff --git a/config/environments/production.rb b/config/environments/production.rb
2+index 3316ece..c34dec0 100644
3--- a/config/environments/production.rb
4+++ b/config/environments/production.rb
5+@@ -67,10 +67,10 @@ Gitlab::Application.configure do
67 config.action_mailer.delivery_method = :sendmail
8 # Defaults to:
···18 config.action_mailer.raise_delivery_errors = true
1920diff --git a/config/gitlab.yml.example b/config/gitlab.yml.example
21+index 15930fc..bdb423c 100644
22--- a/config/gitlab.yml.example
23+++ b/config/gitlab.yml.example
24+@@ -29,8 +29,8 @@ production: &base
25 ## GitLab settings
26 gitlab:
27 ## Web server settings (note: host is the FQDN, do not include http://)
···32 https: false # Set to true if using HTTPS, see installation.md#using-https for additional HTTPS configuration details
3334 # Uncommment this line below if your ssh host is different from HTTP/HTTPS one
35+@@ -43,7 +43,7 @@ production: &base
36 # relative_url_root: /gitlab
3738 # Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
39- # user: git
40+ user: gitlab
4142+ ## Date & Time settings
43+ # Uncomment and customize if you want to change the default time zone of GitLab application.
44+@@ -54,7 +54,7 @@ production: &base
45+ # Uncomment and set to false if you need to disable email sending from GitLab (default: true)
46+ # email_enabled: true
47 # Email address used in the "From" field in mails sent by GitLab
48- email_from: example@example.com
49+ email_from: <%= ENV['GITLAB_EMAIL_FROM'] %>
50+ email_display_name: GitLab
51+ email_reply_to: noreply@example.com
5253+@@ -298,12 +298,12 @@ production: &base
0054 # GitLab Satellites
55 satellites:
56 # Relative paths are relative to Rails.root (default: tmp/repo_satellites/)
···62 backup:
63- path: "tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
64+ path: <%= ENV['GITLAB_BACKUP_PATH'] %>
65+ # archive_permissions: 0640 # Permissions for the resulting backup.tar file (default: 0600)
66 # keep_time: 604800 # default: 0 (forever) (in seconds)
67+ # pg_schema: public # default: nil, it means that all schemas will be backed up
68+@@ -322,15 +322,15 @@ production: &base
06970 ## GitLab Shell settings
71 gitlab_shell:
···77- hooks_path: /home/git/gitlab-shell/hooks/
78+ repos_path: <%= ENV['GITLAB_REPOSITORIES_PATH'] %>
79+ hooks_path: <%= ENV['GITLAB_SHELL_HOOKS_PATH'] %>
80+81+ # File that contains the secret key for verifying access for gitlab-shell.
82+ # Default is '.gitlab_shell_secret' relative to Rails.root (i.e. root of the GitLab app).
83+- # secret_file: /home/git/gitlab/.gitlab_shell_secret
84++ secret_file: <%= ENV['GITLAB_SHELL_SECRET_PATH'] %>
8586 # Git over HTTP
87 upload_pack: true
88+@@ -343,7 +343,7 @@ production: &base
89 # CAUTION!
90 # Use the default values unless you really know what you are doing
91 git:
···94 # The next value is the maximum memory size grit can use
95 # Given in number of bytes per git object (e.g. a commit)
96 # This value can be increased if you have very large commits
97+@@ -388,7 +388,7 @@ test:
98 gravatar:
99 enabled: true
100 gitlab:
···104105 # When you run tests we clone and setup gitlab-shell
106diff --git a/lib/gitlab/app_logger.rb b/lib/gitlab/app_logger.rb
107+index dddcb25..d61f10a 100644
108--- a/lib/gitlab/app_logger.rb
109+++ b/lib/gitlab/app_logger.rb
110@@ -1,7 +1,7 @@
111 module Gitlab
112 class AppLogger < Gitlab::Logger
113+ def self.file_name_noext
114+- 'application'
115+ ENV["GITLAB_APPLICATION_LOG_PATH"]
116 end
117
···1-{ lib, stdenv, fetchurl, enableThreading ? true }:
2-3-let
4-5- libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr";
6-7-in
8-9-stdenv.mkDerivation rec {
10- name = "perl-5.16.3";
11-12- src = fetchurl {
13- url = "mirror://cpan/src/${name}.tar.gz";
14- sha256 = "1dpd9lhc4723wmsn4dsn4m320qlqgyw28bvcbhnfqp2nl3f0ikv9";
15- };
16-17- patches =
18- [ # Do not look in /usr etc. for dependencies.
19- ./no-sys-dirs.patch
20- ./no-impure-config-time.patch
21- ./fixed-man-page-date.patch
22- ./no-date-in-perl-binary.patch
23- ]
24- ++ lib.optional stdenv.isSunOS ./ld-shared.patch
25- ++ lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
26-27- # There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
28- # in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
29- # while at the same time erasing the PATH environment variable so it unconditionally
30- # fails. The code in question is guarded by a check for Mac OS, but the patch below
31- # doesn't have any runtime effect on other platforms.
32- postPatch = ''
33- pwd="$(type -P pwd)"
34- substituteInPlace dist/Cwd/Cwd.pm \
35- --replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
36- '';
37-38- # Build a thread-safe Perl with a dynamic libperls.o. We need the
39- # "installstyle" option to ensure that modules are put under
40- # $out/lib/perl5 - this is the general default, but because $out
41- # contains the string "perl", Configure would select $out/lib.
42- # Miniperl needs -lm. perl needs -lrt.
43- configureFlags =
44- [ "-de"
45- "-Uinstallusrbinperl"
46- "-Dinstallstyle=lib/perl5"
47- "-Duseshrplib"
48- "-Dlocincpth=${libc}/include"
49- "-Dloclibpth=${libc}/lib"
50- ]
51- ++ lib.optional enableThreading "-Dusethreads";
52-53- configureScript = "${stdenv.shell} ./Configure";
54-55- dontAddPrefix = true;
56-57- enableParallelBuilding = true;
58-59- preConfigure =
60- ''
61- configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
62-63- ${lib.optionalString stdenv.isArm ''
64- configureFlagsArray=(-Dldflags="-lm -lrt")
65- ''}
66-67- ${lib.optionalString stdenv.isCygwin ''
68- cp cygwin/cygwin.c{,.bak}
69- echo "#define PERLIO_NOT_STDIO 0" > tmp
70- cat tmp cygwin/cygwin.c.bak > cygwin/cygwin.c
71- ''}
72- '';
73-74- preBuild = lib.optionalString (!(stdenv ? cc && stdenv.cc.nativeTools))
75- ''
76- # Make Cwd work on NixOS (where we don't have a /bin/pwd).
77- substituteInPlace dist/Cwd/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
78- '';
79-80- setupHook = ./setup-hook.sh;
81-82- passthru.libPrefix = "lib/perl5/site_perl";
83-}
···1-diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
2---- perl-5.14.2-orig/Configure 2011-09-26 11:44:34.000000000 +0200
3-+++ perl-5.14.2/Configure 2012-02-16 17:24:50.779839039 +0100
4-@@ -1368,7 +1368,7 @@
5- : List of libraries we want.
6- : If anyone needs extra -lxxx, put those in a hint file.
7- libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
8--libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
9-+libswanted="$libswanted m crypt sec c cposix posix ucb bsd BSD"
10- : We probably want to search /usr/shlib before most other libraries.
11- : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
12- glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
···1-diff --git a/Configure b/Configure
2-index fdbbf20..ba1fd07 100755
3---- a/Configure
4-+++ b/Configure
5-@@ -106,15 +106,7 @@ if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
6- fi
7-8- : Proper PATH setting
9--paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
10--paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
11--paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
12--paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
13--paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
14--paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
15--paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
16--paths="$paths /sbin /usr/sbin /usr/libexec"
17--paths="$paths /system/gnu_library/bin"
18-+paths=''
19-20- for p in $paths
21- do
22-@@ -1323,8 +1315,7 @@ archobjs=''
23- archname=''
24- : Possible local include directories to search.
25- : Set locincpth to "" in a hint file to defeat local include searches.
26--locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
27--locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
28-+locincpth=""
29- :
30- : no include file wanted by default
31- inclwanted=''
32-@@ -1335,17 +1326,12 @@ DEBUGGING=''
33-34- libnames=''
35- : change the next line if compiling for Xenix/286 on Xenix/386
36--xlibpth='/usr/lib/386 /lib/386'
37-+xlibpth=''
38- : Possible local library directories to search.
39--loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
40--loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
41-+loclibpth=""
42-43- : general looking path for locating libraries
44--glibpth="/lib /usr/lib $xlibpth"
45--glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
46--test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
47--test -f /shlib/libc.so && glibpth="/shlib $glibpth"
48--test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
49-+glibpth=""
50-51- : Private path used by Configure to find libraries. Its value
52- : is prepended to libpth. This variable takes care of special
53-@@ -1380,8 +1366,6 @@ libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
54- libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
55- : We probably want to search /usr/shlib before most other libraries.
56- : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
57--glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
58--glibpth="/usr/shlib $glibpth"
59- : Do not use vfork unless overridden by a hint file.
60- usevfork=false
61-62-@@ -2389,7 +2373,6 @@ uname
63- zip
64- "
65- pth=`echo $PATH | sed -e "s/$p_/ /g"`
66--pth="$pth /lib /usr/lib"
67- for file in $loclist; do
68- eval xxx=\$$file
69- case "$xxx" in
70-@@ -4708,7 +4691,7 @@ $rm -f testcpp.c testcpp.out
71- : Set private lib path
72- case "$plibpth" in
73- '') if ./mips; then
74-- plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
75-+ plibpth="$incpath/usr/lib"
76- fi;;
77- esac
78- case "$libpth" in
79-@@ -8354,13 +8337,8 @@ esac
80- echo " "
81- case "$sysman" in
82- '')
83-- syspath='/usr/share/man/man1 /usr/man/man1'
84-- syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
85-- syspath="$syspath /usr/man/u_man/man1"
86-- syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
87-- syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
88-- syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
89-- sysman=`./loc . /usr/man/man1 $syspath`
90-+ syspath=''
91-+ sysman=''
92- ;;
93- esac
94- if $test -d "$sysman"; then
95-@@ -19742,9 +19720,10 @@ $rm_try tryp
96- case "$full_ar" in
97- '') full_ar=$ar ;;
98- esac
99-+full_ar=ar
100-101- : Store the full pathname to the sed program for use in the C program
102--full_sed=$sed
103-+full_sed=sed
104-105- : see what type gids are declared as in the kernel
106- echo " "
107-diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
108-index 439f254..2cdfdb0 100644
109---- a/ext/Errno/Errno_pm.PL
110-+++ b/ext/Errno/Errno_pm.PL
111-@@ -137,11 +137,7 @@ sub get_files {
112- if ($dep =~ /(\S+errno\.h)/) {
113- $file{$1} = 1;
114- }
115-- } elsif ($^O eq 'linux' &&
116-- $Config{gccversion} ne '' &&
117-- $Config{gccversion} !~ /intel/i
118-- # might be using, say, Intel's icc
119-- ) {
120-+ } elsif (0) {
121- # Some Linuxes have weird errno.hs which generate
122- # no #file or #line directives
123- my $linux_errno_h = -e '/usr/include/errno.h' ?
124-diff --git a/hints/freebsd.sh b/hints/freebsd.sh
125-index a67c0bb..0f07ca5 100644
126---- a/hints/freebsd.sh
127-+++ b/hints/freebsd.sh
128-@@ -119,21 +119,21 @@ case "$osvers" in
129- objformat=`/usr/bin/objformat`
130- if [ x$objformat = xaout ]; then
131- if [ -e /usr/lib/aout ]; then
132-- libpth="/usr/lib/aout /usr/local/lib /usr/lib"
133-- glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
134-+ libpth=""
135-+ glibpth=""
136- fi
137- lddlflags='-Bshareable'
138- else
139-- libpth="/usr/lib /usr/local/lib"
140-- glibpth="/usr/lib /usr/local/lib"
141-+ libpth=""
142-+ glibpth=""
143- ldflags="-Wl,-E "
144- lddlflags="-shared "
145- fi
146- cccdlflags='-DPIC -fPIC'
147- ;;
148- *)
149-- libpth="/usr/lib /usr/local/lib"
150-- glibpth="/usr/lib /usr/local/lib"
151-+ libpth=""
152-+ glibpth=""
153- ldflags="-Wl,-E "
154- lddlflags="-shared "
155- cccdlflags='-DPIC -fPIC'
156-diff --git a/hints/linux.sh b/hints/linux.sh
157-index 688c68d..c12f5f5 100644
158---- a/hints/linux.sh
159-+++ b/hints/linux.sh
160-@@ -60,17 +60,6 @@ libswanted="$*"
161- # Debian 4.0 puts ndbm in the -lgdbm_compat library.
162- libswanted="$libswanted gdbm_compat"
163-164--# If you have glibc, then report the version for ./myconfig bug reporting.
165--# (Configure doesn't need to know the specific version since it just uses
166--# gcc to load the library for all tests.)
167--# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
168--# are insufficiently precise to distinguish things like
169--# libc-2.0.6 and libc-2.0.7.
170--if test -L /lib/libc.so.6; then
171-- libc=`ls -l /lib/libc.so.6 | awk '{print $NF}'`
172-- libc=/lib/$libc
173--fi
174--
175- # Configure may fail to find lstat() since it's a static/inline
176- # function in <sys/stat.h>.
177- d_lstat=define
178-@@ -154,24 +143,6 @@ case "$optimize" in
179- ;;
180- esac
181-182--# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
183--# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
184--# where to look. We don't want gcc's own libraries, however, so we
185--# filter those out.
186--# This could be conditional on Unbuntu, but other distributions may
187--# follow suit, and this scheme seems to work even on rather old gcc's.
188--# This unconditionally uses gcc because even if the user is using another
189--# compiler, we still need to find the math library and friends, and I don't
190--# know how other compilers will cope with that situation.
191--# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
192--# we don't want its libraries. So we try to prefer the system gcc
193--# Still, as an escape hatch, allow Configure command line overrides to
194--# plibpth to bypass this check.
195--if [ -x /usr/bin/gcc ] ; then
196-- gcc=/usr/bin/gcc
197--else
198-- gcc=gcc
199--fi
200-201- case "$plibpth" in
202- '') plibpth=`LANG=C LC_ALL=C $gcc -print-search-dirs | grep libraries |
203-@@ -345,22 +316,6 @@ sparc*)
204- ;;
205- esac
206-207--# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than
208--# true libraries. The scripts cause binding against static
209--# version of -lgdbm which is a bad idea. So if we have 'nm'
210--# make sure it can read the file
211--# NI-S 2003/08/07
212--if [ -r /usr/lib/libndbm.so -a -x /usr/bin/nm ] ; then
213-- if /usr/bin/nm /usr/lib/libndbm.so >/dev/null 2>&1 ; then
214-- echo 'Your shared -lndbm seems to be a real library.'
215-- else
216-- echo 'Your shared -lndbm is not a real library.'
217-- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
218-- shift
219-- libswanted="$*"
220-- fi
221--fi
222--
223-224- # This script UU/usethreads.cbu will get 'called-back' by Configure
225- # after it has prompted the user for whether to use threads.
···16#
17# To use at startup, see hardware.bumblebee options.
1819-# This nix expression supports for now only the native nvidia driver.
20-# It should not be hard to generalize this approach to support the
21-# nouveau driver as well (parameterize hostEnv, i686Env over the
22-# module package, and parameterize the two wrappers as well)
23-24-{ stdenv, fetchurl, pkgconfig, help2man
25-, libX11, glibc, glib, libbsd
26-, makeWrapper, buildEnv, module_init_tools
27-, xorg, xkeyboard_config
28-, nvidia_x11, virtualgl
29# The below should only be non-null in a x86_64 system. On a i686
30# system the above nvidia_x11 and virtualgl will be the i686 packages.
31# TODO: Confusing. Perhaps use "SubArch" instead of i686?
32, nvidia_x11_i686 ? null
33-, virtualgl_i686 ? null
34, useDisplayDevice ? false
35-, extraDeviceOptions ? ""
0036}:
37-with stdenv.lib;
38let
39 version = "3.2.1";
40- name = "bumblebee-${version}";
4142- # Isolated X11 environment without the acceleration driver module.
43- # Includes the rest of the components needed for bumblebeed and
44- # optirun to spawn the second X server and to connect to it.
45- x11Env = buildEnv {
46- name = "bumblebee-env";
47- paths = [
48- module_init_tools
49- xorg.xorgserver
50- xorg.xrandr
51- xorg.xrdb
52- xorg.setxkbmap
53- xorg.libX11
54- xorg.libXext
55- xorg.xf86inputevdev
56- ];
57- };
5859- # The environment for the host architecture.
60- hostEnv = buildEnv {
61- name = "bumblebee-x64-env";
62- paths = [
63- nvidia_x11
64- virtualgl
65- ];
66- };
6768- # The environment for the sub architecture, i686, if there is one
69- i686Env = if virtualgl_i686 != null
70- then buildEnv {
71- name = "bumblebee-i686-env";
72- paths = [
73- nvidia_x11_i686
74- virtualgl_i686
75- ];
76- }
77- else null;
7879- allEnvs = [hostEnv] ++ optional (i686Env != null) i686Env;
80- ldPathString = makeLibraryPath allEnvs;
8182- # By default we don't want to use a display device
83- deviceOptions = if useDisplayDevice
84- then ""
85- else ''
8687- # Disable display device
88- Option "UseEDID" "false"
89- Option "UseDisplayDevice" "none"
90- ''
91- + extraDeviceOptions;
9293-in stdenv.mkDerivation {
94- inherit name deviceOptions;
9596 src = fetchurl {
97 url = "http://bumblebee-project.org/${name}.tar.gz";
98 sha256 = "03p3gvx99lwlavznrpg9l7jnl1yfg2adcj8jcjj0gxp20wxp060h";
99 };
100101- patches = [ ./xopts.patch ./nvidia-conf.patch];
0000000000000000102103 preConfigure = ''
104 # Substitute the path to the actual modinfo program in module.c.
···114115 # Apply configuration options
116 substituteInPlace conf/xorg.conf.nvidia \
117- --subst-var deviceOptions
000118 '';
119120 # Build-time dependencies of bumblebeed and optirun.
121 # Note that it has several runtime dependencies.
122- buildInputs = [ stdenv makeWrapper pkgconfig help2man libX11 glib libbsd ];
0123124 # The order of LDPATH is very specific: First X11 then the host
125 # environment then the optional sub architecture paths.
···130 # include the sub architecture components.
131 configureFlags = [
132 "--with-udev-rules=$out/lib/udev/rules.d"
133- "CONF_DRIVER=nvidia"
134- "CONF_DRIVER_MODULE_NVIDIA=nvidia"
135- "CONF_LDPATH_NVIDIA=${x11Env}/lib:${ldPathString}"
136- "CONF_MODPATH_NVIDIA=${hostEnv}/lib/xorg/modules,${x11Env}/lib/xorg/modules"
0137 ];
138139- # create a wrapper environment for bumblebeed and optirun
0000140 postInstall = ''
141 wrapProgram "$out/sbin/bumblebeed" \
142- --prefix PATH : "${x11Env}/sbin:${x11Env}/bin:${hostEnv}/bin:\$PATH" \
143- --prefix LD_LIBRARY_PATH : "${x11Env}/lib:${hostEnv}/lib:\$LD_LIBRARY_PATH" \
144- --set FONTCONFIG_FILE "/etc/fonts/fonts.conf" \
145- --set XKB_BINDIR "${xorg.xkbcomp}/bin" \
146- --set XKB_DIR "${xkeyboard_config}/etc/X11/xkb"
147148 wrapProgram "$out/bin/optirun" \
149- --prefix PATH : "${hostEnv}/bin"
150- '' + (if i686Env == null
151- then ""
152- else ''
153- makeWrapper "$out/bin/.optirun-wrapped" "$out/bin/optirun32" \
154- --prefix PATH : "${i686Env}/bin"
155- '');
156157- meta = {
158 homepage = http://github.com/Bumblebee-Project/Bumblebee;
159 description = "Daemon for managing Optimus videocards (power-on/off, spawns xservers)";
160- license = stdenv.lib.licenses.gpl3;
00161 };
162}
···16#
17# To use at startup, see hardware.bumblebee options.
1819+{ stdenv, lib, fetchurl, pkgconfig, help2man, makeWrapper
20+, glib, libbsd
21+, libX11, libXext, xorgserver, xkbcomp, module_init_tools, xkeyboard_config, xf86videonouveau
22+, nvidia_x11, virtualgl, primusLib
00000023# The below should only be non-null in a x86_64 system. On a i686
24# system the above nvidia_x11 and virtualgl will be the i686 packages.
25# TODO: Confusing. Perhaps use "SubArch" instead of i686?
26, nvidia_x11_i686 ? null
27+, primusLib_i686 ? null
28, useDisplayDevice ? false
29+, extraNvidiaDeviceOptions ? ""
30+, extraNouveauDeviceOptions ? ""
31+, useNvidia ? true
32}:
33+34let
35 version = "3.2.1";
03637+ primus = if useNvidia then primusLib else primusLib.override { nvidia_x11 = null; };
38+ primus_i686 = if useNvidia then primusLib_i686 else primusLib_i686.override { nvidia_x11 = null; };
000000000000003940+ primusLibs = lib.makeLibraryPath ([primus] ++ lib.optional (primusLib_i686 != null) primus_i686);
00000004142+ nvidia_x11s = [nvidia_x11] ++ lib.optional (nvidia_x11_i686 != null) nvidia_x11_i686;
0000000004344+ nvidiaLibs = lib.makeLibraryPath nvidia_x11s;
04546+ bbdPath = lib.makeSearchPath "bin" [ module_init_tools xorgserver ];
47+ bbdLibs = lib.makeLibraryPath [ libX11 libXext ];
004849+ xmodules = lib.concatStringsSep "," (map (x: "${x}/lib/xorg/modules") ([ xorgserver ] ++ lib.optional (!useNvidia) xf86videonouveau));
00005051+in stdenv.mkDerivation rec {
52+ name = "bumblebee-${version}";
5354 src = fetchurl {
55 url = "http://bumblebee-project.org/${name}.tar.gz";
56 sha256 = "03p3gvx99lwlavznrpg9l7jnl1yfg2adcj8jcjj0gxp20wxp060h";
57 };
5859+ patches = [ ./nixos.patch ];
60+61+ # By default we don't want to use a display device
62+ nvidiaDeviceOptions = lib.optionalString (!useDisplayDevice) ''
63+ # Disable display device
64+ Option "UseEDID" "false"
65+ Option "UseDisplayDevice" "none"
66+ '' + extraNvidiaDeviceOptions;
67+68+ nouveauDeviceOptions = extraNouveauDeviceOptions;
69+70+ # the have() function is deprecated and not available to bash completions the
71+ # way they are currently loaded in NixOS, so use _have. See #10936
72+ patchPhase = ''
73+ substituteInPlace scripts/bash_completion/bumblebee \
74+ --replace "have optirun" "_have optirun"
75+ '';
7677 preConfigure = ''
78 # Substitute the path to the actual modinfo program in module.c.
···8889 # Apply configuration options
90 substituteInPlace conf/xorg.conf.nvidia \
91+ --subst-var nvidiaDeviceOptions
92+93+ substituteInPlace conf/xorg.conf.nouveau \
94+ --subst-var nouveauDeviceOptions
95 '';
9697 # Build-time dependencies of bumblebeed and optirun.
98 # Note that it has several runtime dependencies.
99+ buildInputs = [ libX11 glib libbsd ];
100+ nativeBuildInputs = [ makeWrapper pkgconfig help2man ];
101102 # The order of LDPATH is very specific: First X11 then the host
103 # environment then the optional sub architecture paths.
···108 # include the sub architecture components.
109 configureFlags = [
110 "--with-udev-rules=$out/lib/udev/rules.d"
111+ # see #10282
112+ #"CONF_PRIMUS_LD_PATH=${primusLibs}"
113+ ] ++ lib.optionals useNvidia [
114+ "CONF_LDPATH_NVIDIA=${nvidiaLibs}"
115+ "CONF_MODPATH_NVIDIA=${nvidia_x11}/lib/xorg/modules"
116 ];
117118+ CFLAGS = [
119+ "-DX_MODULE_APPENDS=\\\"${xmodules}\\\""
120+ "-DX_XKB_DIR=\\\"${xkeyboard_config}/etc/X11/xkb\\\""
121+ ];
122+123 postInstall = ''
124 wrapProgram "$out/sbin/bumblebeed" \
125+ --set XKB_BINDIR "${xkbcomp}/bin" \
126+ --prefix PATH : "${bbdPath}" \
127+ --prefix LD_LIBRARY_PATH : "${bbdLibs}"
00128129 wrapProgram "$out/bin/optirun" \
130+ --prefix PATH : "${virtualgl}/bin"
131+ '';
00000132133+ meta = with stdenv.lib; {
134 homepage = http://github.com/Bumblebee-Project/Bumblebee;
135 description = "Daemon for managing Optimus videocards (power-on/off, spawns xservers)";
136+ platforms = platforms.linux;
137+ license = licenses.gpl3;
138+ maintainers = with maintainers; [ abbradar ];
139 };
140}