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/doc"
110 "/share/emacs"
111 "/share/info"
112 "/share/man"
113 "/share/nano"
114 "/share/org"
115 "/share/terminfo"
116 "/share/vim-plugins"
117 ];
118
119 system.path = pkgs.buildEnv {
120 name = "system-path";
121 paths = config.environment.systemPackages;
122 inherit (config.environment) pathsToLink;
123 ignoreCollisions = true;
124 # !!! Hacky, should modularise.
125 postBuild =
126 ''
127 if [ -x $out/bin/update-mime-database -a -w $out/share/mime/packages ]; then
128 XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null
129 fi
130
131 if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
132 $out/bin/gtk-update-icon-cache $out/share/icons/hicolor
133 fi
134
135 if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
136 $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
137 fi
138
139 if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then
140 $out/bin/update-desktop-database $out/share/applications
141 fi
142
143 if [ -x $out/bin/install-info -a -w $out/share/info ]; then
144 shopt -s nullglob
145 for i in $out/share/info/*.info $out/share/info/*.info.gz; do
146 $out/bin/install-info $i $out/share/info/dir
147 done
148 fi
149 '';
150 };
151
152 };
153}