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.rsync
38 pkgs.strace
39 pkgs.su
40 pkgs.time
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" "devdoc" ];
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 "/lib" # FIXME: remove and update debug-info.nix
108 "/sbin"
109 "/share/applications"
110 "/share/desktop-directories"
111 "/share/doc"
112 "/share/emacs"
113 "/share/icons"
114 "/share/menus"
115 "/share/mime"
116 "/share/nano"
117 "/share/org"
118 "/share/themes"
119 "/share/vim-plugins"
120 "/share/vulkan"
121 "/share/kservices5"
122 "/share/kservicetypes5"
123 "/share/kxmlgui5"
124 ];
125
126 system.path = pkgs.buildEnv {
127 name = "system-path";
128 paths = config.environment.systemPackages;
129 inherit (config.environment) pathsToLink extraOutputsToInstall;
130 ignoreCollisions = true;
131 # !!! Hacky, should modularise.
132 # outputs TODO: note that the tools will often not be linked by default
133 postBuild =
134 ''
135 if [ -x $out/bin/update-mime-database -a -w $out/share/mime ]; then
136 XDG_DATA_DIRS=$out/share $out/bin/update-mime-database -V $out/share/mime > /dev/null
137 fi
138
139 if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
140 $out/bin/gtk-update-icon-cache $out/share/icons/hicolor
141 fi
142
143 if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
144 $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
145 fi
146
147 if [ -x $out/bin/update-desktop-database -a -w $out/share/applications ]; then
148 $out/bin/update-desktop-database $out/share/applications
149 fi
150
151 if [ -x $out/bin/install-info -a -w $out/share/info ]; then
152 shopt -s nullglob
153 for i in $out/share/info/*.info $out/share/info/*.info.gz; do
154 $out/bin/install-info $i $out/share/info/dir
155 done
156 fi
157 '';
158 };
159
160 };
161}