2023-05-02 01:12:24 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
2023-05-04 23:22:22 +00:00
|
|
|
, buildDartApplication
|
2023-06-07 23:49:08 +00:00
|
|
|
, buf
|
|
|
|
, protoc-gen-dart
|
2023-07-20 17:04:17 +00:00
|
|
|
, testers
|
|
|
|
, dart-sass
|
|
|
|
, runCommand
|
|
|
|
, writeText
|
2023-05-02 01:12:24 +00:00
|
|
|
}:
|
|
|
|
|
2023-06-07 23:49:08 +00:00
|
|
|
let
|
|
|
|
sass-language = fetchFromGitHub {
|
|
|
|
owner = "sass";
|
|
|
|
repo = "sass";
|
2023-10-05 23:52:33 +00:00
|
|
|
rev = "refs/tags/embedded-protocol-2.3.0";
|
|
|
|
hash = "sha256-J2heASfIwj4lxjsRs/0zRHSaF2tij9bO7IgXp0u/eiI=";
|
2023-06-07 23:49:08 +00:00
|
|
|
};
|
|
|
|
in
|
2023-05-04 23:22:22 +00:00
|
|
|
buildDartApplication rec {
|
2023-05-02 01:12:24 +00:00
|
|
|
pname = "dart-sass";
|
2023-10-05 23:52:33 +00:00
|
|
|
version = "1.69.0";
|
2023-05-02 01:12:24 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sass";
|
|
|
|
repo = pname;
|
2023-05-04 23:22:22 +00:00
|
|
|
rev = version;
|
2023-10-05 23:52:33 +00:00
|
|
|
hash = "sha256-kn3cwi1k2CkzbS+Q/JaYy8Nq3Ej0GyWifG1Bq5ZEVHA=";
|
2023-05-02 01:12:24 +00:00
|
|
|
};
|
|
|
|
|
2023-05-04 23:22:22 +00:00
|
|
|
pubspecLockFile = ./pubspec.lock;
|
2023-10-21 11:30:23 +00:00
|
|
|
depsListFile = ./deps.json;
|
2023-10-05 23:52:33 +00:00
|
|
|
vendorHash = "sha256-PQvY+qFXovSXH5wuc60wCrt5RiooKcaGKYzbjKSvqso=";
|
2023-06-07 23:49:08 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
buf
|
|
|
|
protoc-gen-dart
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
mkdir -p build
|
|
|
|
ln -s ${sass-language} build/language
|
|
|
|
HOME="$TMPDIR" buf generate
|
|
|
|
'';
|
2023-05-02 01:12:24 +00:00
|
|
|
|
2023-05-30 00:13:23 +00:00
|
|
|
dartCompileFlags = [ "--define=version=${version}" ];
|
2023-05-02 01:12:24 +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-07-20 17:04:17 +00:00
|
|
|
|
|
|
|
passthru.tests = {
|
|
|
|
version = testers.testVersion {
|
|
|
|
package = dart-sass;
|
|
|
|
command = "dart-sass --version";
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
} ''
|
|
|
|
dart-sass --style=compressed $base > $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2023-05-04 23:22:22 +00:00
|
|
|
}
|