Re: [Nix-dev] fetchgit
Hi Profpatsch, Here is the tree of my private package: ./local/bcupkgs/ ├── default.nix └── pkgs ├── build-support │ └── fetchgit │ ├── builder.sh │ ├── default.nix │ └── nix-prefetch-git └── development └── libraries └── lima-core ├── 0001-removed-Python-modules-from-install.inc.patch ├── config.patch └── default.nix I've attached all the nix script I've wrote so fare. Thanks for your help, SEB On 03/09/2017 06:02 PM, Profpatsch wrote: > I cannot tell you anything without a patch or at least > a code sample. diff --git a/pkgs/build-support/fetchgit/builder.sh b/pkgs/build-support/fetchgit/builder.sh index 4bbef1d..da46106 100644 --- a/pkgs/build-support/fetchgit/builder.sh +++ b/pkgs/build-support/fetchgit/builder.sh @@ -10,6 +10,7 @@ $SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" \ ${leaveDotGit:+--leave-dotGit} \ ${deepClone:+--deepClone} \ ${fetchSubmodules:+--fetch-submodules} \ - ${branchName:+--branch-name "$branchName"} + ${branchName:+--branch-name "$branchName"} \ + ${submodulesList:+--submodules-list "$submodulesList"} stopNest diff --git a/pkgs/build-support/fetchgit/default.nix b/pkgs/build-support/fetchgit/default.nix index 7f98c97..01f7da2 100644 --- a/pkgs/build-support/fetchgit/default.nix +++ b/pkgs/build-support/fetchgit/default.nix @@ -12,7 +12,8 @@ in "${if matched == null then base else builtins.head matched}${appendShort}"; in { url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? deepClone -, fetchSubmodules ? true, deepClone ? false +, fetchSubmodules ? true, submodulesList ? "" +, deepClone ? false , branchName ? null , name ? urlToName url rev }: @@ -52,7 +53,7 @@ stdenv.mkDerivation { outputHashMode = "recursive"; outputHash = if sha256 == "" then md5 else sha256; - inherit url rev leaveDotGit fetchSubmodules deepClone branchName; + inherit url rev leaveDotGit fetchSubmodules submodulesList deepClone branchName; GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt"; diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git index 705d84c..52f6c4d 100755 --- a/pkgs/build-support/fetchgit/nix-prefetch-git +++ b/pkgs/build-support/fetchgit/nix-prefetch-git @@ -9,6 +9,7 @@ hashType=$NIX_HASH_ALGO deepClone=$NIX_PREFETCH_GIT_DEEP_CLONE leaveDotGit=$NIX_PREFETCH_GIT_LEAVE_DOT_GIT fetchSubmodules= +submodulesList= builder= branchName=$NIX_PREFETCH_GIT_BRANCH_NAME @@ -46,6 +47,7 @@ Options: --no-deepClone Make a shallow clone of just the required ref. --leave-dotGit Keep the .git directories. --fetch-submodules Fetch submodules. + --submodules-list list of submodules to fetch (empty means all). --builder Clone as fetchgit does, but url, rev, and out option are mandatory. " exit 1 @@ -66,6 +68,7 @@ for arg; do --no-deepClone) deepClone=false;; --leave-dotGit) leaveDotGit=true;; --fetch-submodules) fetchSubmodules=true;; + --submodules-list) argfun=submodulesList;; --builder) builder=true;; --help) usage; exit;; *) @@ -84,6 +87,9 @@ for arg; do var=${argfun#set_} eval $var=$arg ;; + submodulesList) + submodulesList="$arg" + ;; esac argfun="" fi @@ -186,12 +192,15 @@ init_submodules(){ # checkout each submodule hash=$(echo "$l" | awk '{print substr($1,2)}') dir=$(echo "$l" | awk '{print $2}') -name=$( -git config -f .gitmodules --get-regexp submodule\..*\.path | -sed -n "s,^\(.*\)\.path $dir\$,\\1,p") -url=$(git config --get "${name}.url") - -clone "$dir" "$url" "$hash" "" + match=$(echo $submodulesList|grep $dir || true) + if [ -z "$submodulesList" ] || [ -n "$match" ] ; then + name=$( + git config -f .gitmodules --get-regexp submodule\..*\.path | + sed -n "s,^\(.*\)\.path $dir\$,\\1,p") + url=$(git config --get "${name}.url") + + clone "$dir" "$url" "$hash" "" + fi done } { system ? builtins.currentSystem}: let pkgs = import { inherit system; }; callPackage = pkgs.lib.callPackageWith (pkgs // bcuPackages); callPackages = pkgs.lib.callPackagesWith (pkgs // bcuPackages); python27Packages = pkgs.recurseIntoAttrs ( callPackage ./python_packages.nix { python = pkgs.python27; self = combinedPythonPackages; }); pythonPackages = python27Packages; combinedPythonPackages = pkgs.python27Packages // python27Packages // bcuPackages; bcuPackages = { tango = callPackage ./pkgs/development/libraries/tango {}; pytango = pythonPackages.pytango; inherit (callPackages ./pkgs/tools/package-management/nix-prefetch-scripts { }) nix-prefetch-git
Re: [Nix-dev] fetchgit
Hi Profpatsch, Yes I'm in the folder where I changed fetchgit but it doesn't call my modification version. How can I make sure that my package (lima-core) call my modify version? Is there a way to do that? SEB On 03/09/2017 12:08 PM, Profpatsch wrote: > If you’re in the folder of the nixpkgs where you changed fetchgit, > it should work. If it doesn’t, maybe your changes are not calling > your modified version of fetchgit. <> signature.asc Description: OpenPGP digital signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] fetchgit
Hi Teo, No, it's not a fork. It contain only few private package + fetchgit with the modification. SEB On 03/09/2017 11:57 AM, Teo Klestrup wrote: > Is bcupkgs a fork of Nixpkgs? If so then you probably want to override > Nixpkgs in your NIX_PATH by setting NIX_PATH=nixpkgs=~/local/bcupkgs. <> signature.asc Description: OpenPGP digital signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
[Nix-dev] fetchgit
Hi, I've modify fetchgit module to add an optional argument to filter submodule. And I would like to use this optional argument to build my local package. Unfortunately, nix-build still get fetchgit from the main channel instead of ~/local/bcupckgs: -> nix-build --show-trace ~/local/bcupkgs --cores 8 -A lima-core error: while evaluating the attribute ‘src’ of the derivation ‘lima-core-1.7’ at /users/blissadm/local/bcupkgs/pkgs/development/libraries/lima-core/default.nix:10:3: anonymous function at /nix/store/apyslcfxrq2s4hsbbidk04jgjlw5vl6n-nixpkgs-17.09pre102884.b94e253/nixpkgs/pkgs/build-support/fetchgit/default.nix:14:1 called with unexpected argument ‘submodulesList’, at /users/blissadm/local/bcupkgs/pkgs/development/libraries/lima-core/default.nix:12:9 it didn't get the "good one" which is in ~/local/bcupkgs/pkgs/build-support/fetchgit. I've tried to install nix-prefetch-git locally but it doesn't change anything. What is the good way to archive this? Regards, SEB <> signature.asc Description: OpenPGP digital signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] newbie question nix private package
Hi Danylo, Thanks a lot for your help. After understanding your point, I managed to fix my problem. Sorry for the late answer. Regards, SEB On 02/23/2017 11:56 PM, Danylo Hlynskyi wrote: > self = { > > tango = callPackage ./development/libraries/tango {}; > > pytango = pythonPackages.pytango {}; >}; > > > Key insight here is: pythonPackages.pytango is a derivation, not a function. <> signature.asc Description: OpenPGP digital signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
[Nix-dev] newbie question nix private package
Hello, I tried to create a set of private nix packages following this example (https://gist.github.com/benley/4d7f01805e60b39c2556). Unfortunately, when I try to build the only package I have, nix build give me an error: nix-build --show-trace ~/local/bcupkgs -A pytango error: attempt to call something which is not a function but a set, at ~/local/bcupkgs/default.nix:21:12 I pretty sure that I wrote something stupid but I can find where. Is there someone who can help me with this? Kinds regards, SEB My private packages look like this: ├── default.nix ├── development │ └── python-modules │ └── pytango │ ├── default.nix │ └── setup.patch └── python_packages.nix with default.nix: { system ? builtins.currentSystem}: let pkgs = import { inherit system; }; callPackage = pkgs.lib.callPackageWith (pkgs // self); python27Packages = pkgs.recurseIntoAttrs ( callPackage ./python_packages.nix { python = pkgs.python27; self = combinedPython27Packages; }); pythonPackages = python27Packages; combinedPython27Packages = pkgs.python27Packages // python27Packages; self = { tango = callPackage ./development/libraries/tango {}; pytango = pythonPackages.pytango {}; }; in self with pytango/default.nix { stdenv, fetchurl, pkgconfig, python, buildPythonPackage, boost, numpy, omniorb, zeromq }: let version = "9.2.0b"; in buildPythonPackage rec { name = "pytango-${version}"; src = fetchurl { url = "https://github.com/tango-cs/pytango/archive/v${version}.tar.gz";; sha256 = "01wnb9bxszw2pr7jcxcbjdds4y4w7q8cx8ibj73lj6dbjl3ai116"; }; BOOST_ROOT = ""; patches = [ ./setup.patch ]; buildInputs = [ pkgconfig boost python omniorb zeromq ]; propagatedBuildInputs = [ numpy ]; buildFlags = "BOOST_LIB=boost_python"; #postInstall = '' #patchelf --set-rpath "${zeromq}/lib:${omniorb}/lib:$(patchelf --print-rpath $out/lib/python2.7/site-packages/PyTango/_PyTango.so)" $out/lib/python2.7/site-packages/PyTango/_PyTango.so #''; meta = with stdenv.lib; { description = "Python bindings for Tango Control System"; homepage = http://www.esrf.eu/computing/cs/tango/tango_doc/kernel_doc/pytango/latest/index.html; license = licenses.lgpl3; maintainers = [ ]; platforms = platforms.linux; }; } and with the python_packages.nix: { pkgs, stdenv, python, python27Packages, self }: with pkgs.lib; with { inherit (python27Packages) isPyPy isPy33; }; let buildPythonPackage = python27Packages.buildPythonPackage; callPackage = pkgs.lib.callPackageWith (pkgs // self); in rec { modules = python.modules; setupPyBaseBuildFlags = ["--build-base=$out"]; pytango = callPackage ./development/python-modules/pytango { }; } <> signature.asc Description: OpenPGP digital signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev