diff options
author | Rodney Lorrimar <dev@rodney.id.au> | 2016-03-26 15:33:30 +0000 |
---|---|---|
committer | Rodney Lorrimar <dev@rodney.id.au> | 2016-03-28 08:25:44 +0100 |
commit | b22e94c2008bca19b62d86d9e7264ea478daf91c (patch) | |
tree | 8676426ca9c5d8f177e6c89e9d2e91d4a01dfdb7 | |
parent | 457eddd18f180af2a2fd6285feeae7250b535281 (diff) |
Add pkgs.buildBowerComponents function
-rw-r--r-- | pkgs/development/bower-modules/generic/default.nix | 49 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 4 |
2 files changed, 53 insertions, 0 deletions
diff --git a/pkgs/development/bower-modules/generic/default.nix b/pkgs/development/bower-modules/generic/default.nix new file mode 100644 index 000000000000..ba15b5881602 --- /dev/null +++ b/pkgs/development/bower-modules/generic/default.nix @@ -0,0 +1,49 @@ +{ pkgs }: + +{ buildInputs ? [], generated, ... } @ attrs: + +let + # Fetches the bower packages. `generated` should be the result of a + # `bower2nix` command. + bowerPackages = import generated { + inherit (pkgs) buildEnv fetchbower; + }; + +in pkgs.stdenv.mkDerivation ( + attrs + // + { + name = "bower_components-" + attrs.name; + + inherit bowerPackages; + + builder = builtins.toFile "builder.sh" '' + source $stdenv/setup + + # The project's bower.json is required + cp $src/bower.json . + + # Dereference symlinks -- bower doesn't like them + cp --recursive --reflink=auto \ + --dereference --no-preserve=mode \ + $bowerPackages bc + + # Bower install in offline mode -- links together the fetched + # bower packages. + HOME=$PWD bower \ + --config.storage.packages=bc/packages \ + --config.storage.registry=bc/registry \ + --offline install + + # Sets up a single bower_components directory within + # the output derivation. + mkdir -p $out + mv bower_components $out + ''; + + buildInputs = buildInputs ++ [ + pkgs.git + pkgs.nodePackages.bower + ]; + } +) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1ec3fa9cd968..bccceb12e04e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9150,6 +9150,10 @@ in yuicompressor = callPackage ../development/tools/yuicompressor { }; + ### DEVELOPMENT / BOWER MODULES (JAVASCRIPT) + + buildBowerComponents = callPackage ../development/bower-modules/generic { }; + ### DEVELOPMENT / GO MODULES go14Packages = callPackage ./go-packages.nix { |