From a40b7d07e9013fcc21d54cbb4a01bcfc9c6e68cb Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Mon, 20 Mar 2017 20:18:47 +0300 Subject: makeQtWrapper, kdeWrapper: add GTK3 dependencies --- pkgs/build-support/kde/wrapper.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pkgs/build-support') diff --git a/pkgs/build-support/kde/wrapper.nix b/pkgs/build-support/kde/wrapper.nix index f5add12e8eca..228eb696bd9a 100644 --- a/pkgs/build-support/kde/wrapper.nix +++ b/pkgs/build-support/kde/wrapper.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, makeWrapper, buildEnv }: +{ stdenv, lib, makeWrapper, buildEnv, gtk3, dconf }: packages: @@ -47,10 +47,11 @@ stdenv.mkDerivation { --argv0 '"$0"' \ --suffix PATH : "$env/bin" \ --prefix XDG_CONFIG_DIRS : "$env/etc/xdg" \ - --prefix XDG_DATA_DIRS : "$env/share" \ + --prefix XDG_DATA_DIRS : "$env/share:${gtk3}/share/gsettings-schemas/${gtk3.name}" \ --set QML_IMPORT_PATH "$env/lib/qt5/imports" \ --set QML2_IMPORT_PATH "$env/lib/qt5/qml" \ - --set QT_PLUGIN_PATH "$env/lib/qt5/plugins" + --set QT_PLUGIN_PATH "$env/lib/qt5/plugins" \ + --prefix GIO_EXTRA_MODULES : "${dconf.lib}/lib/gio/modules" good="1" break fi -- cgit 1.4.1 From f6669da3cfcf328e573b5be9dde56a638c3a0c95 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Fri, 24 Mar 2017 08:40:16 +0100 Subject: fetchrepoproject: fix evaluation --- pkgs/build-support/fetchrepoproject/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'pkgs/build-support') diff --git a/pkgs/build-support/fetchrepoproject/default.nix b/pkgs/build-support/fetchrepoproject/default.nix index f0bc02cf66df..01d7fe1d0f55 100644 --- a/pkgs/build-support/fetchrepoproject/default.nix +++ b/pkgs/build-support/fetchrepoproject/default.nix @@ -15,11 +15,10 @@ stdenv.mkDerivation { done export HOME=.repo - repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle'' - + ${optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"} - + ${optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"} - + ${optionalString (referenceDir != "") " --reference=${referenceDir}"} - + '' + repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle + ${optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"} + ${optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"} + ${optionalString (referenceDir != "") " --reference=${referenceDir}"} repo sync --jobs=$NIX_BUILD_CORES --current-branch rm -rf $out/.repo ''; -- cgit 1.4.1 From 9a777013d1d34acc4ea217a7f09bfab96c6be50f Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Thu, 23 Mar 2017 08:56:12 -0400 Subject: Add setupSystemdUnits function. Allows setting up and managing a set of systemd units on any systemd distribution. --- pkgs/build-support/setup-systemd-units.nix | 83 ++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 85 insertions(+) create mode 100644 pkgs/build-support/setup-systemd-units.nix (limited to 'pkgs/build-support') diff --git a/pkgs/build-support/setup-systemd-units.nix b/pkgs/build-support/setup-systemd-units.nix new file mode 100644 index 000000000000..4fa2f42c39dc --- /dev/null +++ b/pkgs/build-support/setup-systemd-units.nix @@ -0,0 +1,83 @@ +# | Build a script to install and start a set of systemd units on any +# systemd-based system. +# +# Creates a symlink at /etc/systemd-static/${namespace} for slightly +# improved atomicity. +{ writeScriptBin +, bash +, coreutils +, systemd +, runCommand +, lib +}: + { units # : AttrSet String (Either Path { path : Path, wanted-by : [ String ] }) + # ^ A set whose names are unit names and values are + # either paths to the corresponding unit files or a set + # containing the path and the list of units this unit + # should be wanted-by (none by default). + # + # The names should include the unit suffix + # (e.g. ".service") + , namespace # : String + # The namespace for the unit files, to allow for + # multiple independent unit sets managed by + # `setupSystemdUnits`. + }: + let static = runCommand "systemd-static" {} + '' + mkdir -p $out + ${lib.concatStringsSep "\n" (lib.mapAttrsToList (nm: file: + "ln -sv ${file.path or file} $out/${nm}" + ) units)} + ''; + add-unit-snippet = name: file: + '' + oldUnit=$(readlink -f "$unitDir/${name}" || echo "$unitDir/${name}") + if [ -f "$oldUnit" -a "$oldUnit" != "${file.path or file}" ]; then + unitsToStop+=("${name}") + fi + ln -sf "/etc/systemd-static/${namespace}/${name}" \ + "$unitDir/.${name}.tmp" + mv -T "$unitDir/.${name}.tmp" "$unitDir/${name}" + ${lib.concatStringsSep "\n" (map (unit: + '' + mkdir -p "$unitDir/${unit}.wants" + ln -sf "../${name}" \ + "$unitDir/${unit}.wants/.${name}.tmp" + mv -T "$unitDir/${unit}.wants/.${name}.tmp" \ + "$unitDir/${unit}.wants/${name}" + '' + ) file.wanted-by or [])} + unitsToStart+=("${name}") + ''; + in + writeScriptBin "setup-systemd-units" + '' + #!${bash}/bin/bash -e + export PATH=${coreutils}/bin:${systemd}/bin + + unitDir=/etc/systemd/system + if [ ! -w "$unitDir" ]; then + unitDir=/etc/systemd-mutable/system + mkdir -p "$unitDir" + fi + declare -a unitsToStop unitsToStart + + oldStatic=$(readlink -f /etc/systemd-static/${namespace} || true) + if [ "$oldStatic" != "${static}" ]; then + ${lib.concatStringsSep "\n" + (lib.mapAttrsToList add-unit-snippet units)} + if [ ''${#unitsToStop[@]} -ne 0 ]; then + echo "Stopping unit(s) ''${unitsToStop[@]}" >&2 + systemctl stop "''${unitsToStop[@]}" + fi + mkdir -p /etc/systemd-static + ln -sfT ${static} /etc/systemd-static/.${namespace}.tmp + mv -T /etc/systemd-static/.${namespace}.tmp /etc/systemd-static/${namespace} + systemctl daemon-reload + echo "Starting unit(s) ''${unitsToStart[@]}" >&2 + systemctl start "''${unitsToStart[@]}" + else + echo "Units unchanged, doing nothing" >&2 + fi + '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 923676aa1545..552f9d4158e3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -281,6 +281,8 @@ with pkgs; pathsFromGraph = ../build-support/kernel/paths-from-graph.pl; + setupSystemdUnits = callPackage ../build-support/setup-systemd-units.nix { }; + singularity-tools = callPackage ../build-support/singularity-tools { }; srcOnly = args: callPackage ../build-support/src-only args; -- cgit 1.4.1 From 2078c34dad8ecdb8955572e2662ecb4eef750d70 Mon Sep 17 00:00:00 2001 From: Sophie Taylor Date: Fri, 24 Mar 2017 18:27:18 +1000 Subject: fetchRepoProject: Fix buildCommand --- pkgs/build-support/fetchrepoproject/default.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'pkgs/build-support') diff --git a/pkgs/build-support/fetchrepoproject/default.nix b/pkgs/build-support/fetchrepoproject/default.nix index 01d7fe1d0f55..33adb5ab1dd4 100644 --- a/pkgs/build-support/fetchrepoproject/default.nix +++ b/pkgs/build-support/fetchrepoproject/default.nix @@ -15,10 +15,11 @@ stdenv.mkDerivation { done export HOME=.repo - repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle - ${optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}"} - ${optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}"} - ${optionalString (referenceDir != "") " --reference=${referenceDir}"} + repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle'' + + optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}" + + optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}" + + optionalString (referenceDir != "") " --reference=${referenceDir}" + + '' repo sync --jobs=$NIX_BUILD_CORES --current-branch rm -rf $out/.repo ''; -- cgit 1.4.1 From 00f472a563c030d0232bfd39af8b3f5411169a5d Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Sat, 25 Mar 2017 00:35:20 +0100 Subject: fetchrepoproject: cleanup extra flags --- pkgs/build-support/fetchrepoproject/default.nix | 31 ++++++++++++++++--------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'pkgs/build-support') diff --git a/pkgs/build-support/fetchrepoproject/default.nix b/pkgs/build-support/fetchrepoproject/default.nix index 33adb5ab1dd4..78a46d4ac9bd 100644 --- a/pkgs/build-support/fetchrepoproject/default.nix +++ b/pkgs/build-support/fetchrepoproject/default.nix @@ -1,25 +1,34 @@ -{stdenv, git, gitRepo, gnupg ? null, cacert}: +{ stdenv, git, gitRepo, gnupg ? null, cacert }: -{name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "", -localManifests ? [] }: +{ name, manifest, rev ? "HEAD", sha256 ? "", repoRepoURL ? "", repoRepoRev ? "", referenceDir ? "" +, localManifests ? [] +}: assert repoRepoRev != "" -> repoRepoURL != ""; +with stdenv.lib; + +let + extraRepoInitFlags = [ + (optionalString (repoRepoURL != "") "--repo-url=${repoRepoURL}") + (optionalString (repoRepoRev != "") "--repo-branch=${repoRepoRev}") + (optionalString (referenceDir != "") "--reference=${referenceDir}") + ]; +in + stdenv.mkDerivation { - buildCommand = with stdenv.lib; '' + buildCommand = '' mkdir ./.repo mkdir ./.repo/local_manifests - for local_manifest in ${concatMapStringsSep " " (x: "${x}") localManifests} + for local_manifest in ${concatMapStringsSep " " toString localManifests} do cp $local_manifest ./.repo/local_manifests/$(stripHash $local_manifest; echo $strippedName) done export HOME=.repo - repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle'' - + optionalString (repoRepoURL != "") " --repo-url=${repoRepoURL}" - + optionalString (repoRepoRev != "") " --repo-branch=${repoRepoRev}" - + optionalString (referenceDir != "") " --reference=${referenceDir}" - + '' + repo init --manifest-url=${manifest} --manifest-branch=${rev} --depth=1 --no-clone-bundle \ + ${concatStringsSep " " extraRepoInitFlags} + repo sync --jobs=$NIX_BUILD_CORES --current-branch rm -rf $out/.repo ''; @@ -30,7 +39,7 @@ stdenv.mkDerivation { "GIT_PROXY_COMMAND" "SOCKS_SERVER" ]; - buildInputs = [git gitRepo cacert] ++ stdenv.lib.optional (gnupg != null) [gnupg] ; + buildInputs = [git gitRepo cacert] ++ optional (gnupg != null) [gnupg] ; outputHashAlgo = "sha256"; outputHashMode = "recursive"; -- cgit 1.4.1 From f087b7594150998652f6b7945b0ca86bceba9e79 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sat, 25 Mar 2017 11:13:25 -0400 Subject: nix-buffer support: Make process-environment changes actually local --- pkgs/build-support/emacs/buffer.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkgs/build-support') diff --git a/pkgs/build-support/emacs/buffer.nix b/pkgs/build-support/emacs/buffer.nix index 1cbac0709a66..6c5e0570fd0d 100644 --- a/pkgs/build-support/emacs/buffer.nix +++ b/pkgs/build-support/emacs/buffer.nix @@ -39,6 +39,8 @@ (make-local-variable 'process-environment) (put 'process-environment 'permanent-local t) (inherit-local 'process-environment) + ; setenv modifies in place, so copy the environment first + (setq process-environment (copy-tree process-environment)) (setenv "PATH" (concat "${lib.makeSearchPath "bin" pkgs}:" (getenv "PATH"))) (inherit-local-permanent exec-path (append '(${builtins.concatStringsSep " " (map (p: "\"${p}/bin\"") pkgs)}) exec-path)) -- cgit 1.4.1