NixOS: Use runCommand instead of mkDerivation in a few places

Changed files
+89 -140
nixos
doc
manual
modules
i18n
input-method
installer
services
hardware
system
x11
desktop-managers
display-managers
lightdm-greeters
system
+28 -49
nixos/doc/manual/default.nix
···
"--stringparam chunk.toc ${toc}"
];
-
olinkDB = stdenv.mkDerivation {
-
name = "manual-olinkdb";
-
-
inherit sources;
-
-
buildInputs = [ libxml2 libxslt ];
-
-
buildCommand = ''
+
olinkDB = runCommand "manual-olinkdb"
+
{ inherit sources;
+
buildInputs = [ libxml2 libxslt ];
+
}
+
''
${copySources}
xsltproc \
···
</targetset>
EOF
'';
-
};
in rec {
# The NixOS options in JSON format.
-
optionsJSON = stdenv.mkDerivation {
-
name = "options-json";
-
-
buildCommand = ''
+
optionsJSON = runCommand "options-json"
+
{ meta.description = "List of NixOS options in JSON format";
+
}
+
''
# Export list of options in different format.
dst=$out/share/doc/nixos
mkdir -p $dst
···
echo "file json $dst/options.json" >> $out/nix-support/hydra-build-products
''; # */
-
meta.description = "List of NixOS options in JSON format";
-
};
-
# Generate the NixOS manual.
-
manual = stdenv.mkDerivation {
-
name = "nixos-manual";
-
-
inherit sources;
-
-
buildInputs = [ libxml2 libxslt ];
-
-
buildCommand = ''
+
manual = runCommand "nixos-manual"
+
{ inherit sources;
+
buildInputs = [ libxml2 libxslt ];
+
meta.description = "The NixOS manual in HTML format";
+
allowedReferences = ["out"];
+
}
+
''
${copySources}
# Check the validity of the manual sources.
···
echo "doc manual $dst" >> $out/nix-support/hydra-build-products
''; # */
-
meta.description = "The NixOS manual in HTML format";
-
allowedReferences = ["out"];
-
};
-
-
-
manualEpub = stdenv.mkDerivation {
-
name = "nixos-manual-epub";
-
-
inherit sources;
-
-
buildInputs = [ libxml2 libxslt zip ];
-
-
buildCommand = ''
+
manualEpub = runCommand "nixos-manual-epub"
+
{ inherit sources;
+
buildInputs = [ libxml2 libxslt zip ];
+
}
+
''
${copySources}
# Check the validity of the manual sources.
···
mkdir -p $out/nix-support
echo "doc-epub manual $manual" >> $out/nix-support/hydra-build-products
'';
-
};
-
# Generate the NixOS manpages.
-
manpages = stdenv.mkDerivation {
-
name = "nixos-manpages";
-
-
inherit sources;
-
-
buildInputs = [ libxml2 libxslt ];
-
buildCommand = ''
+
# Generate the NixOS manpages.
+
manpages = runCommand "nixos-manpages"
+
{ inherit sources;
+
buildInputs = [ libxml2 libxslt ];
+
allowedReferences = ["out"];
+
}
+
''
${copySources}
# Check the validity of the man pages sources.
···
${docbook5_xsl}/xml/xsl/docbook/manpages/docbook.xsl \
./man-pages.xml
'';
-
-
allowedReferences = ["out"];
-
};
}
+15 -14
nixos/modules/i18n/input-method/default.nix
···
with lib;
let
cfg = config.i18n.inputMethod;
-
gtk2_cache = pkgs.stdenv.mkDerivation {
-
preferLocalBuild = true;
-
allowSubstitutes = false;
-
name = "gtk2-immodule.cache";
-
buildInputs = [ pkgs.gtk2 cfg.package ];
-
buildCommand = ''
+
+
gtk2_cache = pkgs.runCommand "gtk2-immodule.cache"
+
{ preferLocalBuild = true;
+
allowSubstitutes = false;
+
buildInputs = [ pkgs.gtk2 cfg.package ];
+
}
+
''
mkdir -p $out/etc/gtk-2.0/
GTK_PATH=${cfg.package}/lib/gtk-2.0/ gtk-query-immodules-2.0 > $out/etc/gtk-2.0/immodules.cache
'';
-
};
-
gtk3_cache = pkgs.stdenv.mkDerivation {
-
preferLocalBuild = true;
-
allowSubstitutes = false;
-
name = "gtk3-immodule.cache";
-
buildInputs = [ pkgs.gtk3 cfg.package ];
-
buildCommand = ''
+
+
gtk3_cache = pkgs.runCommand "gtk3-immodule.cache"
+
{ preferLocalBuild = true;
+
allowSubstitutes = false;
+
buildInputs = [ pkgs.gtk3 cfg.package ];
+
}
+
''
mkdir -p $out/etc/gtk-3.0/
GTK_PATH=${cfg.package}/lib/gtk-3.0/ gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache
'';
-
};
+
in
{
options.i18n = {
+3 -5
nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix
···
'';
in
-
pkgs.stdenv.mkDerivation {
-
inherit (pkg) name meta;
-
-
buildCommand = ''
+
pkgs.runCommand pkg.name
+
{ inherit (pkg) meta; }
+
''
mkdir -p $out
cp -prf ${pkg}/* $out/
chmod a+w $out/share/apps/plasma-desktop/init
cp -f ${plasmaInit} $out/share/apps/plasma-desktop/init/00-defaultLayout.js
'';
-
};
}
+10 -16
nixos/modules/services/hardware/udev.nix
···
'';
# Perform substitutions in all udev rules files.
-
udevRules = stdenv.mkDerivation {
-
name = "udev-rules";
-
-
preferLocalBuild = true;
-
allowSubstitutes = false;
-
-
buildCommand = ''
+
udevRules = pkgs.runCommand "udev-rules"
+
{ preferLocalBuild = true;
+
allowSubstitutes = false;
+
}
+
''
mkdir -p $out
shopt -s nullglob
set +o pipefail
···
ln -s /dev/null $out/80-drivers.rules
''}
''; # */
-
};
-
hwdbBin = stdenv.mkDerivation {
-
name = "hwdb.bin";
-
-
preferLocalBuild = true;
-
allowSubstitutes = false;
-
-
buildCommand = ''
+
hwdbBin = pkgs.runCommand "hwdb.bin"
+
{ preferLocalBuild = true;
+
allowSubstitutes = false;
+
}
+
''
mkdir -p etc/udev/hwdb.d
for i in ${toString ([udev] ++ cfg.packages)}; do
echo "Adding hwdb files for package $i"
···
${udev}/bin/udevadm hwdb --update --root=$(pwd)
mv etc/udev/hwdb.bin $out
'';
-
};
# Udev has a 512-character limit for ENV{PATH}, so create a symlink
# tree to work around this.
+5 -8
nixos/modules/services/system/dbus.nix
···
"<includedir>${d}/etc/dbus-1/session.d</includedir>"
]));
-
configDir = pkgs.stdenv.mkDerivation {
-
name = "dbus-conf";
-
-
preferLocalBuild = true;
-
allowSubstitutes = false;
-
-
buildCommand = ''
+
configDir = pkgs.runCommand "dbus-conf"
+
{ preferLocalBuild = true;
+
allowSubstitutes = false;
+
}
+
''
mkdir -p $out
sed '${./dbus-system-local.conf.in}' \
···
-e 's,@extra@,${sessionExtraxml},' \
> "$out/session-local.conf"
'';
-
};
in
+2 -4
nixos/modules/services/x11/desktop-managers/gnome3.nix
···
'';
};
-
nixos-gsettings-desktop-schemas = pkgs.stdenv.mkDerivation {
-
name = "nixos-gsettings-desktop-schemas";
-
buildCommand = ''
+
nixos-gsettings-desktop-schemas = pkgs.runCommand "nixos-gsettings-desktop-schemas" {}
+
''
mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
cp -rf ${gnome3.gsettings_desktop_schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
···
${pkgs.glib.dev}/bin/glib-compile-schemas $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/
'';
-
};
in {
+10 -12
nixos/modules/services/x11/display-managers/kdm.nix
···
''}
'';
-
kdmrc = pkgs.stdenv.mkDerivation {
-
name = "kdmrc";
-
config = defaultConfig + cfg.extraConfig;
-
preferLocalBuild = true;
-
buildCommand =
-
''
-
echo "$config" > $out
+
kdmrc = pkgs.runCommand "kdmrc"
+
{ config = defaultConfig + cfg.extraConfig;
+
preferLocalBuild = true;
+
}
+
''
+
echo "$config" > $out
-
# The default kdmrc would add "-nolisten tcp", and we already
-
# have that managed by nixos. Hence the grep.
-
cat ${kdebase_workspace}/share/config/kdm/kdmrc | grep -v nolisten >> $out
-
'';
-
};
+
# The default kdmrc would add "-nolisten tcp", and we already
+
# have that managed by nixos. Hence the grep.
+
cat ${kdebase_workspace}/share/config/kdm/kdmrc | grep -v nolisten >> $out
+
'';
in
+3 -6
nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix
···
# The default greeter provided with this expression is the GTK greeter.
# Again, we need a few things in the environment for the greeter to run with
# fonts/icons.
-
wrappedGtkGreeter = stdenv.mkDerivation {
-
name = "lightdm-gtk-greeter";
-
buildInputs = [ pkgs.makeWrapper ];
-
-
buildCommand = ''
+
wrappedGtkGreeter = pkgs.runCommand "lightdm-gtk-greeter"
+
{ buildInputs = [ pkgs.makeWrapper ]; }
+
''
# This wrapper ensures that we actually get themes
makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \
$out/greeter \
···
Type=Application
EOF
'';
-
};
gtkGreeterConf = writeText "lightdm-gtk-greeter.conf"
''
+2 -4
nixos/modules/services/x11/display-managers/slim.nix
···
# Unpack the SLiM theme, or use the default.
slimThemesDir =
let
-
unpackedTheme = pkgs.stdenv.mkDerivation {
-
name = "slim-theme";
-
buildCommand = ''
+
unpackedTheme = pkgs.runCommand "slim-theme" {}
+
''
mkdir -p $out
cd $out
unpackFile ${cfg.theme}
ln -s * default
'';
-
};
in if cfg.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
in
+5 -10
nixos/modules/services/x11/xserver.nix
···
monitors = reverseList (foldl mkMonitor [] xrandrHeads);
in concatMapStrings (getAttr "value") monitors;
-
configFile = pkgs.stdenv.mkDerivation {
-
name = "xserver.conf";
-
-
xfs = optionalString (cfg.useXFS != false)
-
''FontPath "${toString cfg.useXFS}"'';
-
-
inherit (cfg) config;
-
-
buildCommand =
+
configFile = pkgs.runCommand "xserver.conf"
+
{ xfs = optionalString (cfg.useXFS != false)
+
''FontPath "${toString cfg.useXFS}"'';
+
inherit (cfg) config;
+
}
''
echo 'Section "Files"' >> $out
echo $xfs >> $out
···
echo "$config" >> $out
''; # */
-
};
in
+6 -12
nixos/modules/system/boot/stage-1.nix
···
''; # */
-
udevRules = pkgs.stdenv.mkDerivation {
-
name = "udev-rules";
-
allowedReferences = [ extraUtils ];
-
buildCommand = ''
+
udevRules = pkgs.runCommand "udev-rules"
+
{ allowedReferences = [ extraUtils ]; }
+
''
mkdir -p $out
echo 'ENV{LD_LIBRARY_PATH}="${extraUtils}/lib"' > $out/00-env.rules
···
substituteInPlace $out/60-persistent-storage.rules \
--replace ID_CDROM_MEDIA_TRACK_COUNT_DATA ID_CDROM_MEDIA
''; # */
-
};
# The init script of boot stage 1 (loading kernel modules for
···
{ object = pkgs.writeText "mdadm.conf" config.boot.initrd.mdadmConf;
symlink = "/etc/mdadm.conf";
}
-
{ object = pkgs.stdenv.mkDerivation {
-
name = "initrd-kmod-blacklist-ubuntu";
-
builder = pkgs.writeText "builder.sh" ''
-
source $stdenv/setup
+
{ object = pkgs.runCommand "initrd-kmod-blacklist-ubuntu"
+
{ src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; }
+
''
target=$out
-
${pkgs.perl}/bin/perl -0pe 's/## file: iwlwifi.conf(.+?)##/##/s;' $src > $out
'';
-
src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf";
-
};
symlink = "/etc/modprobe.d/ubuntu.conf";
}
{ object = pkgs.kmod-debian-aliases;