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 pkgs.nix-info
35 config.programs.ssh.package
36 pkgs.perl
37 pkgs.procps
38 pkgs.rsync
39 pkgs.strace
40 pkgs.su
41 pkgs.time
42 pkgs.utillinux
43 pkgs.which # 88K size
44 ];
45
46in
47
48{
49 options = {
50
51 environment = {
52
53 systemPackages = mkOption {
54 type = types.listOf types.package;
55 default = [];
56 example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
57 description = ''
58 The set of packages that appear in
59 /run/current-system/sw. These packages are
60 automatically available to all users, and are
61 automatically updated every time you rebuild the system
62 configuration. (The latter is the main difference with
63 installing them in the default profile,
64 <filename>/nix/var/nix/profiles/default</filename>.
65 '';
66 };
67
68 pathsToLink = mkOption {
69 type = types.listOf types.str;
70 # Note: We need `/lib' to be among `pathsToLink' for NSS modules
71 # to work.
72 default = [];
73 example = ["/"];
74 description = "List of directories to be symlinked in <filename>/run/current-system/sw</filename>.";
75 };
76
77 extraOutputsToInstall = mkOption {
78 type = types.listOf types.str;
79 default = [ ];
80 example = [ "doc" "info" "devdoc" ];
81 description = "List of additional package outputs to be symlinked into <filename>/run/current-system/sw</filename>.";
82 };
83
84 extraSetup = mkOption {
85 type = types.lines;
86 default = "";
87 description = "Shell fragments to be run after the system environment has been created. This should only be used for things that need to modify the internals of the environment, e.g. generating MIME caches. The environment being built can be accessed at $out.";
88 };
89
90 };
91
92 system = {
93
94 path = mkOption {
95 internal = true;
96 description = ''
97 The packages you want in the boot environment.
98 '';
99 };
100
101 };
102
103 };
104
105 config = {
106
107 environment.systemPackages = requiredPackages;
108
109 environment.pathsToLink =
110 [ "/bin"
111 "/etc/xdg"
112 "/etc/gtk-2.0"
113 "/etc/gtk-3.0"
114 "/lib" # FIXME: remove and update debug-info.nix
115 "/sbin"
116 "/share/emacs"
117 "/share/nano"
118 "/share/org"
119 "/share/themes"
120 "/share/vim-plugins"
121 "/share/vulkan"
122 "/share/kservices5"
123 "/share/kservicetypes5"
124 "/share/kxmlgui5"
125 ];
126
127 system.path = pkgs.buildEnv {
128 name = "system-path";
129 paths = config.environment.systemPackages;
130 inherit (config.environment) pathsToLink extraOutputsToInstall;
131 ignoreCollisions = true;
132 # !!! Hacky, should modularise.
133 # outputs TODO: note that the tools will often not be linked by default
134 postBuild =
135 ''
136 if [ -x $out/bin/gtk-update-icon-cache -a -f $out/share/icons/hicolor/index.theme ]; then
137 $out/bin/gtk-update-icon-cache $out/share/icons/hicolor
138 fi
139
140 if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
141 $out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
142 fi
143
144 ${config.environment.extraSetup}
145 '';
146 };
147
148 };
149}