2009-05-25 19:41:03 +02:00
|
|
|
# This module defines the packages that appear in
|
2012-07-16 17:27:59 +02:00
|
|
|
# /run/current-system/sw.
|
2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-05-25 19:41:03 +02:00
|
|
|
let
|
|
|
|
|
2024-08-27 20:42:49 +02:00
|
|
|
requiredPackages = map (pkg: lib.setPrio ((pkg.meta.priority or lib.meta.defaultPriority) + 3) pkg)
|
2020-06-04 14:18:18 +02:00
|
|
|
[ pkgs.acl
|
2009-05-25 19:41:03 +02:00
|
|
|
pkgs.attr
|
|
|
|
pkgs.bashInteractive # bash with ncurses support
|
|
|
|
pkgs.bzip2
|
2018-08-28 22:05:53 +02:00
|
|
|
pkgs.coreutils-full
|
2009-05-25 19:41:03 +02:00
|
|
|
pkgs.cpio
|
|
|
|
pkgs.curl
|
2009-06-12 13:12:46 +02:00
|
|
|
pkgs.diffutils
|
2009-05-25 19:41:03 +02:00
|
|
|
pkgs.findutils
|
2009-06-12 13:12:46 +02:00
|
|
|
pkgs.gawk
|
2018-03-24 21:33:47 +01:00
|
|
|
pkgs.stdenv.cc.libc
|
|
|
|
pkgs.getent
|
|
|
|
pkgs.getconf
|
2009-05-25 19:41:03 +02:00
|
|
|
pkgs.gnugrep
|
2009-06-12 13:12:46 +02:00
|
|
|
pkgs.gnupatch
|
2009-05-25 19:41:03 +02:00
|
|
|
pkgs.gnused
|
2012-03-04 16:47:44 +01:00
|
|
|
pkgs.gnutar
|
2009-05-25 19:41:03 +02:00
|
|
|
pkgs.gzip
|
2013-01-30 15:01:31 +01:00
|
|
|
pkgs.xz
|
2009-05-25 19:41:03 +02:00
|
|
|
pkgs.less
|
|
|
|
pkgs.libcap
|
|
|
|
pkgs.ncurses
|
|
|
|
pkgs.netcat
|
2015-06-27 02:09:58 +02:00
|
|
|
config.programs.ssh.package
|
2020-10-26 03:22:17 +01:00
|
|
|
pkgs.mkpasswd
|
2009-05-25 19:41:03 +02:00
|
|
|
pkgs.procps
|
2014-04-05 20:41:23 +02:00
|
|
|
pkgs.su
|
2009-05-25 19:41:03 +02:00
|
|
|
pkgs.time
|
2020-11-24 16:29:28 +01:00
|
|
|
pkgs.util-linux
|
2020-08-20 15:45:54 +02:00
|
|
|
pkgs.which
|
2020-04-24 18:13:37 +02:00
|
|
|
pkgs.zstd
|
2009-09-28 20:26:18 +02:00
|
|
|
];
|
2009-06-05 14:57:44 +02:00
|
|
|
|
2021-12-05 22:51:41 +01:00
|
|
|
defaultPackageNames =
|
2023-07-19 13:07:29 +02:00
|
|
|
[ "perl"
|
2021-12-05 22:51:41 +01:00
|
|
|
"rsync"
|
|
|
|
"strace"
|
|
|
|
];
|
|
|
|
defaultPackages =
|
|
|
|
map
|
2024-08-27 20:42:49 +02:00
|
|
|
(n: let pkg = pkgs.${n};in lib.setPrio ((pkg.meta.priority or lib.meta.defaultPriority) + 3) pkg)
|
2021-12-05 22:51:41 +01:00
|
|
|
defaultPackageNames;
|
2024-08-27 20:42:49 +02:00
|
|
|
defaultPackagesText = "[ ${lib.concatMapStringsSep " " (n: "pkgs.${n}") defaultPackageNames } ]";
|
2020-09-05 02:12:43 +02:00
|
|
|
|
2013-09-04 13:05:09 +02:00
|
|
|
in
|
2009-05-25 19:41:03 +02:00
|
|
|
|
2013-09-04 13:05:09 +02:00
|
|
|
{
|
2009-05-25 19:41:03 +02:00
|
|
|
options = {
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
|
2024-08-27 20:42:49 +02:00
|
|
|
systemPackages = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.package;
|
2009-09-28 20:26:18 +02:00
|
|
|
default = [];
|
2024-08-27 20:42:49 +02:00
|
|
|
example = lib.literalExpression "[ pkgs.firefox pkgs.thunderbird ]";
|
2009-05-25 19:41:03 +02:00
|
|
|
description = ''
|
|
|
|
The set of packages that appear in
|
2012-07-16 17:27:59 +02:00
|
|
|
/run/current-system/sw. These packages are
|
2009-05-25 19:41:03 +02:00
|
|
|
automatically available to all users, and are
|
|
|
|
automatically updated every time you rebuild the system
|
|
|
|
configuration. (The latter is the main difference with
|
|
|
|
installing them in the default profile,
|
2011-10-30 16:19:58 +01:00
|
|
|
{file}`/nix/var/nix/profiles/default`.
|
2009-05-25 19:41:03 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-08-27 20:42:49 +02:00
|
|
|
defaultPackages = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.package;
|
2020-09-05 02:12:43 +02:00
|
|
|
default = defaultPackages;
|
2024-08-27 20:42:49 +02:00
|
|
|
defaultText = lib.literalMD ''
|
2022-08-20 22:27:20 +02:00
|
|
|
these packages, with their `meta.priority` numerically increased
|
2021-12-05 22:51:41 +01:00
|
|
|
(thus lowering their installation priority):
|
2022-08-20 22:27:20 +02:00
|
|
|
|
|
|
|
${defaultPackagesText}
|
2021-12-05 22:51:41 +01:00
|
|
|
'';
|
2021-10-03 18:06:03 +02:00
|
|
|
example = [];
|
2020-09-05 02:12:43 +02:00
|
|
|
description = ''
|
2021-10-03 18:06:03 +02:00
|
|
|
Set of default packages that aren't strictly necessary
|
2020-09-09 18:23:34 +02:00
|
|
|
for a running system, entries can be removed for a more
|
|
|
|
minimal NixOS installation.
|
|
|
|
|
|
|
|
Like with systemPackages, packages are installed to
|
|
|
|
{file}`/run/current-system/sw`. They are
|
2020-09-05 02:12:43 +02:00
|
|
|
automatically available to all users, and are
|
|
|
|
automatically updated every time you rebuild the system
|
|
|
|
configuration.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-08-27 20:42:49 +02:00
|
|
|
pathsToLink = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
2010-04-15 17:46:55 +02:00
|
|
|
# Note: We need `/lib' to be among `pathsToLink' for NSS modules
|
|
|
|
# to work.
|
2010-04-16 07:09:10 +02:00
|
|
|
default = [];
|
2009-05-25 19:41:03 +02:00
|
|
|
example = ["/"];
|
2015-10-30 14:13:47 +01:00
|
|
|
description = "List of directories to be symlinked in {file}`/run/current-system/sw`.";
|
2009-05-25 19:41:03 +02:00
|
|
|
};
|
2015-10-30 14:13:47 +01:00
|
|
|
|
2024-08-27 20:42:49 +02:00
|
|
|
extraOutputsToInstall = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
2015-11-27 14:49:54 +01:00
|
|
|
default = [ ];
|
2023-09-25 16:23:01 +02:00
|
|
|
example = [ "dev" "info" ];
|
|
|
|
description = ''
|
|
|
|
Entries listed here will be appended to the `meta.outputsToInstall` attribute for each package in `environment.systemPackages`, and the files from the corresponding derivation outputs symlinked into {file}`/run/current-system/sw`.
|
|
|
|
|
|
|
|
For example, this can be used to install the `dev` and `info` outputs for all packages in the system environment, if they are available.
|
|
|
|
|
|
|
|
To use specific outputs instead of configuring them globally, select the corresponding attribute on the package derivation, e.g. `libxml2.dev` or `coreutils.info`.
|
|
|
|
'';
|
2009-05-25 19:41:03 +02:00
|
|
|
};
|
2015-10-30 14:13:47 +01:00
|
|
|
|
2024-08-27 20:42:49 +02:00
|
|
|
extraSetup = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
2018-08-20 10:23:11 +02:00
|
|
|
default = "";
|
2018-08-15 11:59:44 +02:00
|
|
|
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.";
|
|
|
|
};
|
|
|
|
|
2009-05-25 19:41:03 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
system = {
|
|
|
|
|
2024-08-27 20:42:49 +02:00
|
|
|
path = lib.mkOption {
|
2013-10-23 16:59:33 +02:00
|
|
|
internal = true;
|
2009-05-25 19:41:03 +02:00
|
|
|
description = ''
|
|
|
|
The packages you want in the boot environment.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-05-25 19:41:03 +02:00
|
|
|
};
|
|
|
|
|
2013-09-04 13:05:09 +02:00
|
|
|
config = {
|
2009-05-25 19:41:03 +02:00
|
|
|
|
2020-09-05 02:12:43 +02:00
|
|
|
environment.systemPackages = requiredPackages ++ config.environment.defaultPackages;
|
2009-05-25 19:41:03 +02:00
|
|
|
|
2013-09-04 13:05:09 +02:00
|
|
|
environment.pathsToLink =
|
|
|
|
[ "/bin"
|
|
|
|
"/etc/xdg"
|
2016-04-04 11:11:20 +02:00
|
|
|
"/etc/gtk-2.0"
|
|
|
|
"/etc/gtk-3.0"
|
2015-10-30 15:16:48 +01:00
|
|
|
"/lib" # FIXME: remove and update debug-info.nix
|
2015-04-01 22:46:40 +02:00
|
|
|
"/sbin"
|
2013-09-04 13:05:09 +02:00
|
|
|
"/share/emacs"
|
2020-02-17 03:11:12 +01:00
|
|
|
"/share/hunspell"
|
2014-10-18 11:30:31 +02:00
|
|
|
"/share/org"
|
2015-09-03 00:31:34 +02:00
|
|
|
"/share/themes"
|
2016-10-11 18:50:52 +02:00
|
|
|
"/share/vulkan"
|
2017-08-04 10:39:47 +02:00
|
|
|
"/share/kservices5"
|
|
|
|
"/share/kservicetypes5"
|
|
|
|
"/share/kxmlgui5"
|
2019-08-19 16:05:44 +02:00
|
|
|
"/share/systemd"
|
2021-01-05 01:52:44 +01:00
|
|
|
"/share/thumbnailers"
|
2013-09-04 13:05:09 +02:00
|
|
|
];
|
|
|
|
|
2013-10-23 16:34:38 +02:00
|
|
|
system.path = pkgs.buildEnv {
|
|
|
|
name = "system-path";
|
2016-03-14 12:15:58 +01:00
|
|
|
paths = config.environment.systemPackages;
|
2016-03-14 12:19:37 +01:00
|
|
|
inherit (config.environment) pathsToLink extraOutputsToInstall;
|
2013-10-23 16:34:38 +02:00
|
|
|
ignoreCollisions = true;
|
|
|
|
# !!! Hacky, should modularise.
|
2016-01-28 11:24:18 +01:00
|
|
|
# outputs TODO: note that the tools will often not be linked by default
|
2013-10-23 16:34:38 +02:00
|
|
|
postBuild =
|
|
|
|
''
|
2019-08-30 23:39:52 +02:00
|
|
|
# Remove wrapped binaries, they shouldn't be accessible via PATH.
|
|
|
|
find $out/bin -maxdepth 1 -name ".*-wrapped" -type l -delete
|
|
|
|
|
2013-10-23 16:34:38 +02:00
|
|
|
if [ -x $out/bin/glib-compile-schemas -a -w $out/share/glib-2.0/schemas ]; then
|
|
|
|
$out/bin/glib-compile-schemas $out/share/glib-2.0/schemas
|
|
|
|
fi
|
2018-10-12 03:16:50 +02:00
|
|
|
|
2018-08-15 11:59:44 +02:00
|
|
|
${config.environment.extraSetup}
|
2013-10-23 16:34:38 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2013-09-04 13:05:09 +02:00
|
|
|
};
|
2009-05-25 19:41:03 +02:00
|
|
|
}
|