1# This module defines the packages that appear in
2# /run/current-system/sw.
3
4{ config, lib, pkgs, ... }:
5
6with lib;
7
8let
9
10 extraManpages = pkgs.runCommand "extra-manpages" { buildInputs = [ pkgs.help2man ]; }
11 ''
12 mkdir -p $out/share/man/man1
13 help2man ${pkgs.gnutar}/bin/tar > $out/share/man/man1/tar.1
14 '';
15
16 requiredPackages =
17 [ config.nix.package
18 pkgs.acl
19 pkgs.attr
20 pkgs.bashInteractive # bash with ncurses support
21 pkgs.bzip2
22 pkgs.coreutils
23 pkgs.cpio
24 pkgs.curl
25 pkgs.diffutils
26 pkgs.findutils
27 pkgs.gawk
28 pkgs.glibc # for ldd, getent
29 pkgs.gnugrep
30 pkgs.gnupatch
31 pkgs.gnused
32 pkgs.gnutar
33 pkgs.gzip
34 pkgs.xz
35 pkgs.less
36 pkgs.libcap
37 pkgs.man
38 pkgs.nano
39 pkgs.ncurses
40 pkgs.netcat
41 config.programs.ssh.package
42 pkgs.perl
43 pkgs.procps
44 pkgs.rsync
45 pkgs.strace
46 pkgs.su
47 pkgs.time
48 pkgs.texinfoInteractive
49 pkgs.utillinux
50 extraManpages
51 ];
52
53in
54
55{
56 options = {
57
58 environment = {
59
60 systemPackages = mkOption {
61 type = types.listOf types.package;
62 default = [];
63 example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
64 description = ''
65 The set of packages that appear in
66 /run/current-system/sw. These packages are
67 automatically available to all users, and are
68 automatically updated every time you rebuild the system
69 configuration. (The latter is the main difference with
70 installing them in the default profile,
71 <filename>/nix/var/nix/profiles/default</filename>.
72 '';
73 };
74
75 pathsToLink = mkOption {
76 type = types.listOf types.str;
77 # Note: We need `/lib' to be among `pathsToLink' for NSS modules
78 # to work.
79 default = [];
80 example = ["/"];
81 description = "List of directories to be symlinked in `/run/current-system/sw'.";
82 };
83 };
84
85 system = {
86
87 path = mkOption {
88 internal = true;
89 description = ''
90 The packages you want in the boot environment.
91 '';
92 };
93
94 };
95
96 };
97
98 config = {
99
100 environment.systemPackages = requiredPackages;
101
102 environment.pathsToLink =
103 [ "/bin"
104 "/etc/xdg"
105 "/info"
106 "/lib" # FIXME: remove
107 #"/lib/debug/.build-id" # enables GDB to find separated debug info
108 "/man"
109 "/sbin"
110 "/share/applications"
111 "/share/desktop-directories"
112 "/share/doc"
113 "/share/emacs"
114 "/share/icons"
115 "/share/info"
116 "/share/man"
117 "/share/menus"
118 "/share/mime"
119 "/share/nano"
120 "/share/org"
121 "/share/terminfo"
122 "/share/themes"
123 "/share/vim-plugins"
124 ];
125
126 system.path = pkgs.buildEnv {
127 name = "system-path";
128 paths = config.environment.systemPackages;
129 inherit (config.environment) pathsToLink;
130 ignoreCollisions = true;
131 # !!! Hacky, should modularise.
132 postBuild =
133 ''
134 if [ -x $out/bin/update-mime-database -a -w $out/share/mime/packages ]; then
135 XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null
136 fi
137
138 if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
139 $out/bin/gtk-update-icon-cache $out/share/icons/hicolor
140 fi
141
142 if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
143 $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
144 fi
145
146 if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then
147 $out/bin/update-desktop-database $out/share/applications
148 fi
149
150 if [ -x $out/bin/install-info -a -w $out/share/info ]; then
151 shopt -s nullglob
152 for i in $out/share/info/*.info $out/share/info/*.info.gz; do
153 $out/bin/install-info $i $out/share/info/dir
154 done
155 fi
156 '';
157 };
158
159 };
160}