NixOS: Use runCommand instead of mkDerivation in a few places
This commit is contained in:
parent
750195db7f
commit
75a1ec8a65
|
@ -94,14 +94,11 @@ let
|
||||||
"--stringparam chunk.toc ${toc}"
|
"--stringparam chunk.toc ${toc}"
|
||||||
];
|
];
|
||||||
|
|
||||||
olinkDB = stdenv.mkDerivation {
|
olinkDB = runCommand "manual-olinkdb"
|
||||||
name = "manual-olinkdb";
|
{ inherit sources;
|
||||||
|
buildInputs = [ libxml2 libxslt ];
|
||||||
inherit sources;
|
}
|
||||||
|
''
|
||||||
buildInputs = [ libxml2 libxslt ];
|
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
${copySources}
|
${copySources}
|
||||||
|
|
||||||
xsltproc \
|
xsltproc \
|
||||||
|
@ -133,15 +130,14 @@ let
|
||||||
</targetset>
|
</targetset>
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
in rec {
|
in rec {
|
||||||
|
|
||||||
# The NixOS options in JSON format.
|
# The NixOS options in JSON format.
|
||||||
optionsJSON = stdenv.mkDerivation {
|
optionsJSON = runCommand "options-json"
|
||||||
name = "options-json";
|
{ meta.description = "List of NixOS options in JSON format";
|
||||||
|
}
|
||||||
buildCommand = ''
|
''
|
||||||
# Export list of options in different format.
|
# Export list of options in different format.
|
||||||
dst=$out/share/doc/nixos
|
dst=$out/share/doc/nixos
|
||||||
mkdir -p $dst
|
mkdir -p $dst
|
||||||
|
@ -154,18 +150,14 @@ in rec {
|
||||||
echo "file json $dst/options.json" >> $out/nix-support/hydra-build-products
|
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.
|
# Generate the NixOS manual.
|
||||||
manual = stdenv.mkDerivation {
|
manual = runCommand "nixos-manual"
|
||||||
name = "nixos-manual";
|
{ inherit sources;
|
||||||
|
buildInputs = [ libxml2 libxslt ];
|
||||||
inherit sources;
|
meta.description = "The NixOS manual in HTML format";
|
||||||
|
allowedReferences = ["out"];
|
||||||
buildInputs = [ libxml2 libxslt ];
|
}
|
||||||
|
''
|
||||||
buildCommand = ''
|
|
||||||
${copySources}
|
${copySources}
|
||||||
|
|
||||||
# Check the validity of the manual sources.
|
# Check the validity of the manual sources.
|
||||||
|
@ -192,20 +184,12 @@ in rec {
|
||||||
echo "doc manual $dst" >> $out/nix-support/hydra-build-products
|
echo "doc manual $dst" >> $out/nix-support/hydra-build-products
|
||||||
''; # */
|
''; # */
|
||||||
|
|
||||||
meta.description = "The NixOS manual in HTML format";
|
|
||||||
|
|
||||||
allowedReferences = ["out"];
|
manualEpub = runCommand "nixos-manual-epub"
|
||||||
};
|
{ inherit sources;
|
||||||
|
buildInputs = [ libxml2 libxslt zip ];
|
||||||
|
}
|
||||||
manualEpub = stdenv.mkDerivation {
|
''
|
||||||
name = "nixos-manual-epub";
|
|
||||||
|
|
||||||
inherit sources;
|
|
||||||
|
|
||||||
buildInputs = [ libxml2 libxslt zip ];
|
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
${copySources}
|
${copySources}
|
||||||
|
|
||||||
# Check the validity of the manual sources.
|
# Check the validity of the manual sources.
|
||||||
|
@ -234,17 +218,15 @@ in rec {
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
echo "doc-epub manual $manual" >> $out/nix-support/hydra-build-products
|
echo "doc-epub manual $manual" >> $out/nix-support/hydra-build-products
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
# Generate the NixOS manpages.
|
# Generate the NixOS manpages.
|
||||||
manpages = stdenv.mkDerivation {
|
manpages = runCommand "nixos-manpages"
|
||||||
name = "nixos-manpages";
|
{ inherit sources;
|
||||||
|
buildInputs = [ libxml2 libxslt ];
|
||||||
inherit sources;
|
allowedReferences = ["out"];
|
||||||
|
}
|
||||||
buildInputs = [ libxml2 libxslt ];
|
''
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
${copySources}
|
${copySources}
|
||||||
|
|
||||||
# Check the validity of the man pages sources.
|
# Check the validity of the man pages sources.
|
||||||
|
@ -264,7 +246,4 @@ in rec {
|
||||||
./man-pages.xml
|
./man-pages.xml
|
||||||
'';
|
'';
|
||||||
|
|
||||||
allowedReferences = ["out"];
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,26 +3,27 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.i18n.inputMethod;
|
cfg = config.i18n.inputMethod;
|
||||||
gtk2_cache = pkgs.stdenv.mkDerivation {
|
|
||||||
preferLocalBuild = true;
|
gtk2_cache = pkgs.runCommand "gtk2-immodule.cache"
|
||||||
allowSubstitutes = false;
|
{ preferLocalBuild = true;
|
||||||
name = "gtk2-immodule.cache";
|
allowSubstitutes = false;
|
||||||
buildInputs = [ pkgs.gtk2 cfg.package ];
|
buildInputs = [ pkgs.gtk2 cfg.package ];
|
||||||
buildCommand = ''
|
}
|
||||||
|
''
|
||||||
mkdir -p $out/etc/gtk-2.0/
|
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
|
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 {
|
gtk3_cache = pkgs.runCommand "gtk3-immodule.cache"
|
||||||
preferLocalBuild = true;
|
{ preferLocalBuild = true;
|
||||||
allowSubstitutes = false;
|
allowSubstitutes = false;
|
||||||
name = "gtk3-immodule.cache";
|
buildInputs = [ pkgs.gtk3 cfg.package ];
|
||||||
buildInputs = [ pkgs.gtk3 cfg.package ];
|
}
|
||||||
buildCommand = ''
|
''
|
||||||
mkdir -p $out/etc/gtk-3.0/
|
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
|
GTK_PATH=${cfg.package}/lib/gtk-3.0/ gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.i18n = {
|
options.i18n = {
|
||||||
|
|
|
@ -96,15 +96,13 @@ with lib;
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.runCommand pkg.name
|
||||||
inherit (pkg) name meta;
|
{ inherit (pkg) meta; }
|
||||||
|
''
|
||||||
buildCommand = ''
|
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -prf ${pkg}/* $out/
|
cp -prf ${pkg}/* $out/
|
||||||
chmod a+w $out/share/apps/plasma-desktop/init
|
chmod a+w $out/share/apps/plasma-desktop/init
|
||||||
cp -f ${plasmaInit} $out/share/apps/plasma-desktop/init/00-defaultLayout.js
|
cp -f ${plasmaInit} $out/share/apps/plasma-desktop/init/00-defaultLayout.js
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,13 +32,11 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Perform substitutions in all udev rules files.
|
# Perform substitutions in all udev rules files.
|
||||||
udevRules = stdenv.mkDerivation {
|
udevRules = pkgs.runCommand "udev-rules"
|
||||||
name = "udev-rules";
|
{ preferLocalBuild = true;
|
||||||
|
allowSubstitutes = false;
|
||||||
preferLocalBuild = true;
|
}
|
||||||
allowSubstitutes = false;
|
''
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
set +o pipefail
|
set +o pipefail
|
||||||
|
@ -130,15 +128,12 @@ let
|
||||||
ln -s /dev/null $out/80-drivers.rules
|
ln -s /dev/null $out/80-drivers.rules
|
||||||
''}
|
''}
|
||||||
''; # */
|
''; # */
|
||||||
};
|
|
||||||
|
|
||||||
hwdbBin = stdenv.mkDerivation {
|
hwdbBin = pkgs.runCommand "hwdb.bin"
|
||||||
name = "hwdb.bin";
|
{ preferLocalBuild = true;
|
||||||
|
allowSubstitutes = false;
|
||||||
preferLocalBuild = true;
|
}
|
||||||
allowSubstitutes = false;
|
''
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
mkdir -p etc/udev/hwdb.d
|
mkdir -p etc/udev/hwdb.d
|
||||||
for i in ${toString ([udev] ++ cfg.packages)}; do
|
for i in ${toString ([udev] ++ cfg.packages)}; do
|
||||||
echo "Adding hwdb files for package $i"
|
echo "Adding hwdb files for package $i"
|
||||||
|
@ -151,7 +146,6 @@ let
|
||||||
${udev}/bin/udevadm hwdb --update --root=$(pwd)
|
${udev}/bin/udevadm hwdb --update --root=$(pwd)
|
||||||
mv etc/udev/hwdb.bin $out
|
mv etc/udev/hwdb.bin $out
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
# Udev has a 512-character limit for ENV{PATH}, so create a symlink
|
# Udev has a 512-character limit for ENV{PATH}, so create a symlink
|
||||||
# tree to work around this.
|
# tree to work around this.
|
||||||
|
|
|
@ -20,13 +20,11 @@ let
|
||||||
"<includedir>${d}/etc/dbus-1/session.d</includedir>"
|
"<includedir>${d}/etc/dbus-1/session.d</includedir>"
|
||||||
]));
|
]));
|
||||||
|
|
||||||
configDir = pkgs.stdenv.mkDerivation {
|
configDir = pkgs.runCommand "dbus-conf"
|
||||||
name = "dbus-conf";
|
{ preferLocalBuild = true;
|
||||||
|
allowSubstitutes = false;
|
||||||
preferLocalBuild = true;
|
}
|
||||||
allowSubstitutes = false;
|
''
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
||||||
sed '${./dbus-system-local.conf.in}' \
|
sed '${./dbus-system-local.conf.in}' \
|
||||||
|
@ -38,7 +36,6 @@ let
|
||||||
-e 's,@extra@,${sessionExtraxml},' \
|
-e 's,@extra@,${sessionExtraxml},' \
|
||||||
> "$out/session-local.conf"
|
> "$out/session-local.conf"
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,8 @@ let
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nixos-gsettings-desktop-schemas = pkgs.stdenv.mkDerivation {
|
nixos-gsettings-desktop-schemas = pkgs.runCommand "nixos-gsettings-desktop-schemas" {}
|
||||||
name = "nixos-gsettings-desktop-schemas";
|
''
|
||||||
buildCommand = ''
|
|
||||||
mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/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
|
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
|
||||||
|
|
||||||
|
@ -46,7 +45,6 @@ let
|
||||||
|
|
||||||
${pkgs.glib.dev}/bin/glib-compile-schemas $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 {
|
in {
|
||||||
|
|
||||||
|
|
|
@ -54,19 +54,17 @@ let
|
||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
kdmrc = pkgs.stdenv.mkDerivation {
|
kdmrc = pkgs.runCommand "kdmrc"
|
||||||
name = "kdmrc";
|
{ config = defaultConfig + cfg.extraConfig;
|
||||||
config = defaultConfig + cfg.extraConfig;
|
preferLocalBuild = true;
|
||||||
preferLocalBuild = true;
|
}
|
||||||
buildCommand =
|
''
|
||||||
''
|
echo "$config" > $out
|
||||||
echo "$config" > $out
|
|
||||||
|
|
||||||
# The default kdmrc would add "-nolisten tcp", and we already
|
# The default kdmrc would add "-nolisten tcp", and we already
|
||||||
# have that managed by nixos. Hence the grep.
|
# have that managed by nixos. Hence the grep.
|
||||||
cat ${kdebase_workspace}/share/config/kdm/kdmrc | grep -v nolisten >> $out
|
cat ${kdebase_workspace}/share/config/kdm/kdmrc | grep -v nolisten >> $out
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,9 @@ let
|
||||||
# The default greeter provided with this expression is the GTK greeter.
|
# 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
|
# Again, we need a few things in the environment for the greeter to run with
|
||||||
# fonts/icons.
|
# fonts/icons.
|
||||||
wrappedGtkGreeter = stdenv.mkDerivation {
|
wrappedGtkGreeter = pkgs.runCommand "lightdm-gtk-greeter"
|
||||||
name = "lightdm-gtk-greeter";
|
{ buildInputs = [ pkgs.makeWrapper ]; }
|
||||||
buildInputs = [ pkgs.makeWrapper ];
|
''
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
# This wrapper ensures that we actually get themes
|
# This wrapper ensures that we actually get themes
|
||||||
makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \
|
makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \
|
||||||
$out/greeter \
|
$out/greeter \
|
||||||
|
@ -40,7 +38,6 @@ let
|
||||||
Type=Application
|
Type=Application
|
||||||
EOF
|
EOF
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
gtkGreeterConf = writeText "lightdm-gtk-greeter.conf"
|
gtkGreeterConf = writeText "lightdm-gtk-greeter.conf"
|
||||||
''
|
''
|
||||||
|
|
|
@ -26,15 +26,13 @@ let
|
||||||
# Unpack the SLiM theme, or use the default.
|
# Unpack the SLiM theme, or use the default.
|
||||||
slimThemesDir =
|
slimThemesDir =
|
||||||
let
|
let
|
||||||
unpackedTheme = pkgs.stdenv.mkDerivation {
|
unpackedTheme = pkgs.runCommand "slim-theme" {}
|
||||||
name = "slim-theme";
|
''
|
||||||
buildCommand = ''
|
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cd $out
|
cd $out
|
||||||
unpackFile ${cfg.theme}
|
unpackFile ${cfg.theme}
|
||||||
ln -s * default
|
ln -s * default
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
in if cfg.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
|
in if cfg.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
|
@ -71,15 +71,11 @@ let
|
||||||
monitors = reverseList (foldl mkMonitor [] xrandrHeads);
|
monitors = reverseList (foldl mkMonitor [] xrandrHeads);
|
||||||
in concatMapStrings (getAttr "value") monitors;
|
in concatMapStrings (getAttr "value") monitors;
|
||||||
|
|
||||||
configFile = pkgs.stdenv.mkDerivation {
|
configFile = pkgs.runCommand "xserver.conf"
|
||||||
name = "xserver.conf";
|
{ xfs = optionalString (cfg.useXFS != false)
|
||||||
|
''FontPath "${toString cfg.useXFS}"'';
|
||||||
xfs = optionalString (cfg.useXFS != false)
|
inherit (cfg) config;
|
||||||
''FontPath "${toString cfg.useXFS}"'';
|
}
|
||||||
|
|
||||||
inherit (cfg) config;
|
|
||||||
|
|
||||||
buildCommand =
|
|
||||||
''
|
''
|
||||||
echo 'Section "Files"' >> $out
|
echo 'Section "Files"' >> $out
|
||||||
echo $xfs >> $out
|
echo $xfs >> $out
|
||||||
|
@ -102,7 +98,6 @@ let
|
||||||
|
|
||||||
echo "$config" >> $out
|
echo "$config" >> $out
|
||||||
''; # */
|
''; # */
|
||||||
};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
|
@ -134,10 +134,9 @@ let
|
||||||
''; # */
|
''; # */
|
||||||
|
|
||||||
|
|
||||||
udevRules = pkgs.stdenv.mkDerivation {
|
udevRules = pkgs.runCommand "udev-rules"
|
||||||
name = "udev-rules";
|
{ allowedReferences = [ extraUtils ]; }
|
||||||
allowedReferences = [ extraUtils ];
|
''
|
||||||
buildCommand = ''
|
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
|
|
||||||
echo 'ENV{LD_LIBRARY_PATH}="${extraUtils}/lib"' > $out/00-env.rules
|
echo 'ENV{LD_LIBRARY_PATH}="${extraUtils}/lib"' > $out/00-env.rules
|
||||||
|
@ -176,7 +175,6 @@ let
|
||||||
substituteInPlace $out/60-persistent-storage.rules \
|
substituteInPlace $out/60-persistent-storage.rules \
|
||||||
--replace ID_CDROM_MEDIA_TRACK_COUNT_DATA ID_CDROM_MEDIA
|
--replace ID_CDROM_MEDIA_TRACK_COUNT_DATA ID_CDROM_MEDIA
|
||||||
''; # */
|
''; # */
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
# The init script of boot stage 1 (loading kernel modules for
|
# The init script of boot stage 1 (loading kernel modules for
|
||||||
|
@ -230,16 +228,12 @@ let
|
||||||
{ object = pkgs.writeText "mdadm.conf" config.boot.initrd.mdadmConf;
|
{ object = pkgs.writeText "mdadm.conf" config.boot.initrd.mdadmConf;
|
||||||
symlink = "/etc/mdadm.conf";
|
symlink = "/etc/mdadm.conf";
|
||||||
}
|
}
|
||||||
{ object = pkgs.stdenv.mkDerivation {
|
{ object = pkgs.runCommand "initrd-kmod-blacklist-ubuntu"
|
||||||
name = "initrd-kmod-blacklist-ubuntu";
|
{ src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; }
|
||||||
builder = pkgs.writeText "builder.sh" ''
|
''
|
||||||
source $stdenv/setup
|
|
||||||
target=$out
|
target=$out
|
||||||
|
|
||||||
${pkgs.perl}/bin/perl -0pe 's/## file: iwlwifi.conf(.+?)##/##/s;' $src > $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";
|
symlink = "/etc/modprobe.d/ubuntu.conf";
|
||||||
}
|
}
|
||||||
{ object = pkgs.kmod-debian-aliases;
|
{ object = pkgs.kmod-debian-aliases;
|
||||||
|
|
Loading…
Reference in a new issue