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 requiredPackages =
11 [ config.nix.package
12 pkgs.acl
13 pkgs.attr
14 pkgs.bashInteractive # bash with ncurses support
15 pkgs.bzip2
16 pkgs.coreutils
17 pkgs.cpio
18 pkgs.curl
19 pkgs.diffutils
20 pkgs.findutils
21 pkgs.gawk
22 pkgs.glibc # for ldd, getent
23 pkgs.gnugrep
24 pkgs.gnupatch
25 pkgs.gnused
26 pkgs.gnutar
27 pkgs.gzip
28 pkgs.xz
29 pkgs.less
30 pkgs.libcap
31 pkgs.nano
32 pkgs.ncurses
33 pkgs.netcat
34 config.programs.ssh.package
35 pkgs.perl
36 pkgs.procps
37 pkgs.strace
38 pkgs.su
39 pkgs.time
40 pkgs.texinfoInteractive
41 pkgs.utillinux
42 pkgs.which # 88K size
43 ];
44
45in
46
47{
48 options = {
49
50 environment = {
51
52 systemPackages = mkOption {
53 type = types.listOf types.package;
54 default = [];
55 example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
56 description = ''
57 The set of packages that appear in
58 /run/current-system/sw. These packages are
59 automatically available to all users, and are
60 automatically updated every time you rebuild the system
61 configuration. (The latter is the main difference with
62 installing them in the default profile,
63 <filename>/nix/var/nix/profiles/default</filename>.
64 '';
65 };
66
67 pathsToLink = mkOption {
68 type = types.listOf types.str;
69 # Note: We need `/lib' to be among `pathsToLink' for NSS modules
70 # to work.
71 default = [];
72 example = ["/"];
73 description = "List of directories to be symlinked in <filename>/run/current-system/sw</filename>.";
74 };
75
76 extraOutputsToInstall = mkOption {
77 type = types.listOf types.str;
78 default = [ ];
79 example = [ "doc" "info" "docdev" ];
80 description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
81 };
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 "/etc/gtk-2.0"
106 "/etc/gtk-3.0"
107 "/info"
108 "/lib" # FIXME: remove and update debug-info.nix
109 "/sbin"
110 "/share/applications"
111 "/share/desktop-directories"
112 "/share/doc"
113 "/share/emacs"
114 "/share/icons"
115 "/share/info"
116 "/share/menus"
117 "/share/mime"
118 "/share/nano"
119 "/share/org"
120 "/share/terminfo"
121 "/share/themes"
122 "/share/vim-plugins"
123 ];
124
125 system.path = pkgs.buildEnv {
126 name = "system-path";
127 paths = config.environment.systemPackages;
128 inherit (config.environment) pathsToLink extraOutputsToInstall;
129 ignoreCollisions = true;
130 # !!! Hacky, should modularise.
131 # outputs TODO: note that the tools will often not be linked by default
132 postBuild =
133 ''
134 if [ -x $out/bin/update-mime-database -a -w $out/share/mime ]; 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}