flake: Move helper derivations in a separate directory (#544)

This commit is contained in:
traxys 2023-08-24 12:47:03 +02:00 committed by GitHub
parent fd88522893
commit 09cefd2751
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 48 deletions

16
helpers/default.nix Normal file
View file

@ -0,0 +1,16 @@
pkgs: rec {
rust-analyzer-config = pkgs.callPackage ./rust-analyzer {};
autogenerated-configs = pkgs.callPackage ({stdenv}:
stdenv.mkDerivation {
pname = "autogenerated-configs";
version = "master";
dontUnpack = true;
dontBuild = true;
installPhase = ''
mkdir -p $out
cp ${rust-analyzer-config}/share/* $out
'';
}) {};
}

View file

@ -0,0 +1,39 @@
{
stdenv,
python3,
rust-analyzer,
alejandra,
}: let
extract = stdenv.mkDerivation {
pname = "extract_rust_analyzer";
version = "1";
src = ./extract.py;
dontUnpack = true;
dontBuild = true;
buildInputs = [python3];
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/extract_rust_analyzer.py
'';
};
in
stdenv.mkDerivation {
pname = "rust-analyzer-config";
inherit (rust-analyzer) version src;
nativeBuildInputs = [alejandra extract];
buildPhase = ''
extract_rust_analyzer.py editors/code/package.json |
alejandra --quiet > rust-analyzer-config.nix
'';
installPhase = ''
mkdir -p $out/share
cp rust-analyzer-config.nix $out/share
'';
}