Files
nixpkgs/pkgs/by-name/da/dart-sass/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

98 lines
2.1 KiB
Nix

{
lib,
fetchFromGitHub,
buildDartApplication,
buf,
protoc-gen-dart,
writableTmpDirAsHomeHook,
testers,
dart-sass,
runCommand,
writeText,
}:
let
embedded-protocol-version = "3.2.0";
embedded-protocol = fetchFromGitHub {
owner = "sass";
repo = "sass";
tag = "embedded-protocol-${embedded-protocol-version}";
hash = "sha256-yX30i1gbVZalVhefj9c37mpFOIDaQlsLeAh7UnY56ro=";
};
in
buildDartApplication rec {
pname = "dart-sass";
version = "1.93.2";
src = fetchFromGitHub {
owner = "sass";
repo = "dart-sass";
tag = version;
hash = "sha256-YE4s0um3WR6N0KsXgLjvoiqjr8dQg8WOyZRbfoZlbqE=";
};
pubspecLock = lib.importJSON ./pubspec.lock.json;
nativeBuildInputs = [
buf
protoc-gen-dart
writableTmpDirAsHomeHook
];
preConfigure = ''
mkdir -p build
ln -s ${embedded-protocol} build/language
buf generate
'';
dartCompileFlags = [ "--define=version=${version}" ];
postInstall = ''
# dedupe identiall binaries
ln -rsf $out/bin/{,dart-}sass
'';
passthru = {
inherit embedded-protocol-version embedded-protocol;
updateScript = ./update.sh;
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
'';
};
};
};
meta = {
homepage = "https://github.com/sass/dart-sass";
description = "Reference implementation of Sass, written in Dart";
mainProgram = "sass";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ lelgenio ];
};
}