2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, buildDartApplication
|
2023-07-15 17:15:38 +00:00
|
|
|
, buf
|
|
|
|
, protoc-gen-dart
|
2023-08-22 20:05:09 +00:00
|
|
|
, testers
|
|
|
|
, dart-sass
|
|
|
|
, runCommand
|
|
|
|
, writeText
|
2023-05-24 13:37:59 +00:00
|
|
|
}:
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
let
|
2024-01-25 14:12:00 +00:00
|
|
|
embedded-protocol-version = "2.4.0";
|
|
|
|
|
|
|
|
embedded-protocol = fetchFromGitHub {
|
2023-07-15 17:15:38 +00:00
|
|
|
owner = "sass";
|
|
|
|
repo = "sass";
|
2024-01-25 14:12:00 +00:00
|
|
|
rev = "refs/tags/embedded-protocol-${embedded-protocol-version}";
|
|
|
|
hash = "sha256-19YQTda5su2PI2vLzVRCn7fQoH5vEg3539gXEeLLvV8=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
in
|
2023-05-24 13:37:59 +00:00
|
|
|
buildDartApplication rec {
|
|
|
|
pname = "dart-sass";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "1.70.0";
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sass";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-JLVcoDAngP1y8EC4K6fIJdPu2Xm8LLAxUm8BTK5tSVk=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
pubspecLock = lib.importJSON ./pubspec.lock.json;
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
buf
|
|
|
|
protoc-gen-dart
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
mkdir -p build
|
2024-01-25 14:12:00 +00:00
|
|
|
ln -s ${embedded-protocol} build/language
|
2023-07-15 17:15:38 +00:00
|
|
|
HOME="$TMPDIR" buf generate
|
|
|
|
'';
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
dartCompileFlags = [ "--define=version=${version}" ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/sass/dart-sass";
|
|
|
|
description = "The reference implementation of Sass, written in Dart";
|
|
|
|
mainProgram = "sass";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ lelgenio ];
|
|
|
|
};
|
2023-08-22 20:05:09 +00:00
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
passthru = {
|
|
|
|
inherit embedded-protocol-version embedded-protocol;
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
tests = {
|
|
|
|
version = testers.testVersion {
|
|
|
|
package = dart-sass;
|
|
|
|
command = "dart-sass --version";
|
|
|
|
};
|
2023-08-22 20:05:09 +00:00
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
simple = testers.testEqualContents {
|
|
|
|
assertion = "dart-sass compiles a basic scss file";
|
|
|
|
expected = writeText "expected" ''
|
|
|
|
body h1{color:#123}
|
|
|
|
'';
|
|
|
|
actual = runCommand "actual"
|
|
|
|
{
|
|
|
|
nativeBuildInputs = [ dart-sass ];
|
|
|
|
base = writeText "base" ''
|
|
|
|
body {
|
|
|
|
$color: #123;
|
|
|
|
h1 {
|
|
|
|
color: $color;
|
|
|
|
}
|
2024-01-13 08:15:51 +00:00
|
|
|
}
|
2024-01-25 14:12:00 +00:00
|
|
|
'';
|
|
|
|
} ''
|
|
|
|
dart-sass --style=compressed $base > $out
|
|
|
|
'';
|
|
|
|
};
|
2023-08-22 20:05:09 +00:00
|
|
|
};
|
|
|
|
};
|
2023-05-24 13:37:59 +00:00
|
|
|
}
|