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"
107 "/man"
108 "/sbin"
109 "/share/applications"
110 "/share/desktop-directories"
111 "/share/doc"
112 "/share/emacs"
113 "/share/icons"
114 "/share/info"
115 "/share/man"
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;
129 ignoreCollisions = true;
130 # !!! Hacky, should modularise.
131 postBuild =
132 ''
133 if [ -x $out/bin/update-mime-database -a -w $out/share/mime/packages ]; then
134 XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null
135 fi
136
137 if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
138 $out/bin/gtk-update-icon-cache $out/share/icons/hicolor
139 fi
140
141 if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
142 $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
143 fi
144
145 if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then
146 $out/bin/update-desktop-database $out/share/applications
147 fi
148
149 if [ -x $out/bin/install-info -a -w $out/share/info ]; then
150 shopt -s nullglob
151 for i in $out/share/info/*.info $out/share/info/*.info.gz; do
152 $out/bin/install-info $i $out/share/info/dir
153 done
154 fi
155 '';
156 };
157
158 };
159}