diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 99601a60..37923320 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -29,8 +29,8 @@ jobs: - name: Cache install Nix packages uses: rikhuijzer/cache-install@249745afd54c8e2be0eb99aa6032b52629239b48 with: - key: nix-${{ hashFiles('packages.nix') }} - nix_file: 'packages.nix' + key: nix-${{ hashFiles('nix/*.nix') }} + nix_file: 'nix/packages.nix' - name: Set environment variable run: "export LANG=en_US.UTF-8" - name: Build site diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 47e8919f..294e8c71 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -27,8 +27,8 @@ jobs: - name: Cache install Nix packages uses: rikhuijzer/cache-install@249745afd54c8e2be0eb99aa6032b52629239b48 with: - key: nix-${{ hashFiles('packages.nix') }} - nix_file: 'packages.nix' + key: nix-${{ hashFiles('nix/*.nix') }} + nix_file: 'nix/packages.nix' - name: Set environment variable run: "export LANG=en_US.UTF-8" - name: Build site diff --git a/Gemfile b/Gemfile index fae4ac4e..33c48b2a 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,6 @@ gem 'kramdown' # Kramdown math mode gems gem 'kramdown-math-katex' -gem 'sassc' gem 'typogruby' # Needed for atom_feed in blogging helper diff --git a/Gemfile.lock b/Gemfile.lock index 0d766ea4..79909bbf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,8 +53,8 @@ GEM http_parser.rb (0.6.0) icalendar (2.7.1) ice_cube (~> 0.16) - ice_cube (0.16.3) - json (2.6.0) + ice_cube (0.16.4) + json (2.6.1) json_schema (0.21.0) katex (0.8.0) execjs (~> 2.7) @@ -124,7 +124,7 @@ GEM public_suffix (4.0.6) puma (5.5.2) nio4r (~> 2.0) - racc (1.5.2) + racc (1.6.0) rack (2.2.3) rack-livereload (0.3.17) rack @@ -135,8 +135,6 @@ GEM ref (2.0.0) rexml (3.2.5) rubypants (0.7.1) - sassc (2.4.0) - ffi (~> 1.9) shellany (0.0.1) slow_enumerator_tools (1.1.0) terminal-notifier (2.0.0) @@ -159,7 +157,7 @@ GEM rexml (~> 3.2) words_counted (1.0.3) yui-compressor (0.12.0) - zeitwerk (2.4.2) + zeitwerk (2.5.1) PLATFORMS ruby @@ -179,7 +177,6 @@ DEPENDENCIES pandoc-ruby puma rainpress - sassc terminal-notifier terminal-notifier-guard typogruby @@ -190,4 +187,4 @@ DEPENDENCIES yui-compressor BUNDLED WITH - 2.2.3 + 2.1.4 diff --git a/Rules b/Rules index 7aa75507..19e15c50 100644 --- a/Rules +++ b/Rules @@ -208,14 +208,7 @@ ignore '/assets/stylesheets/includes/**/*' compile '/assets/stylesheets/**/*.scss' do # This filter is necessary for the workaround present in main.scss and deals with out of date dependencies filter :erb - - sass_opts = { - syntax: :scss, - load_paths: ['content/assets/stylesheets'] - } - sass_opts[:style] = :compressed if production? - filter :sassc, sass_opts - + filter :dart_sass filter :autoprefixer if production? write ext: 'css' end diff --git a/gemset.nix b/gemset.nix index 0b1d51bb..90cb37fe 100644 --- a/gemset.nix +++ b/gemset.nix @@ -274,20 +274,20 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1rzfydzgy6jppqvzzr76skfk07nmlszpcjzzn4wlzpsgmagmf0wq"; + sha256 = "1dri4mcya1fwzrr9nzic8hj1jr28a2szjag63f9k7p2bw9fpw4fs"; type = "gem"; }; - version = "0.16.3"; + version = "0.16.4"; }; json = { groups = ["default" "test"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0a7p95md8j8lbgxx9dzygysxmrg1s80895f46f1y47k9kq9q56ry"; + sha256 = "1z9grvjyfz16ag55hg522d3q4dh07hf391sf9s96npc0vfi85xkz"; type = "gem"; }; - version = "2.6.0"; + version = "2.6.1"; }; json_schema = { groups = ["default" "development" "nanoc"]; @@ -549,10 +549,10 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "178k7r0xn689spviqzhvazzvxfq6fyjldxb3ywjbgipbfi4s8j1g"; + sha256 = "0la56m0z26j3mfn1a9lf2l03qx1xifanndf9p3vx1azf6sqy7v9d"; type = "gem"; }; - version = "1.5.2"; + version = "1.6.0"; }; rack = { groups = ["default" "development"]; @@ -636,17 +636,6 @@ }; version = "0.7.1"; }; - sassc = { - dependencies = ["ffi"]; - groups = ["default"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0gpqv48xhl8mb8qqhcifcp0pixn206a7imc07g48armklfqa4q2c"; - type = "gem"; - }; - version = "2.4.0"; - }; shellany = { groups = ["default" "nanoc"]; platforms = []; @@ -807,9 +796,9 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1746czsjarixq0x05f7p3hpzi38ldg6wxnxxw74kbjzh1sdjgmpl"; + sha256 = "18l4r6layck0d80ydc692mv1lxak5xbf6w2paj1x7m2ggbggzxgj"; type = "gem"; }; - version = "2.4.2"; + version = "2.5.1"; }; } diff --git a/lib/filters/dart_sass.rb b/lib/filters/dart_sass.rb new file mode 100644 index 00000000..2265d7df --- /dev/null +++ b/lib/filters/dart_sass.rb @@ -0,0 +1,5 @@ +Nanoc::Filter.define(:dart_sass) do |_content, _params| + result = `sass -I. content/#{@item.identifier} --style compressed` + raise "Dart-sass has failed" unless $?.success? + result +end diff --git a/lib/filters/sassc.rb b/lib/filters/sassc.rb deleted file mode 100644 index eb1d35d1..00000000 --- a/lib/filters/sassc.rb +++ /dev/null @@ -1,4 +0,0 @@ -require 'sassc' -Nanoc::Filter.define(:sassc) do |content, params| - SassC::Engine.new(content, params).render -end diff --git a/nix/dart-sass.nix b/nix/dart-sass.nix new file mode 100644 index 00000000..1700fec8 --- /dev/null +++ b/nix/dart-sass.nix @@ -0,0 +1,31 @@ +{ pkgs ? (import (builtins.fetchTarball { + # Descriptive name to make the store path easier to identify + name = "nixos-unstable-2021-11-02"; + # Commit hash for nixos-unstable as of 2018-09-12 + url = "https://github.com/nixos/nixpkgs/archive/1380230a378043ecd55c3d50a0bfa1f401d80efc.tar.gz"; + # Hash obtained using `nix-prefetch-url --unpack ` + sha256 = "062ix9661gq7ysgs4a2wppspvxdn2wcaf0l2pfiwpg8jkl3rgfnb"; + }) {}) +, sha256 ? "0d8ks6x4a32v906p0xb5nn0hkivyi6gr6nyiq10sz1zxx8gkcl7v" +, version ? "1.43.4" }: +with pkgs; +stdenv.mkDerivation { + name = "dart-sass-${version}"; + inherit version; + + src = fetchurl { + inherit sha256; + url = "https://github.com/sass/dart-sass/archive/${version}.tar.gz"; + }; + + buildPhase = '' + export PUB_CACHE=$PWD/.pub-cache + export PUB_ENVIRONMENT=nix:install + ${dart}/bin/dart pub get + ${dart}/bin/dart compile exe -Dversion=${version} bin/sass.dart -o sass + ''; + installPhase = '' + cp -r . $out + ln -s $out/sass $out/bin/sass + ''; +} diff --git a/packages.nix b/nix/packages.nix similarity index 81% rename from packages.nix rename to nix/packages.nix index 0a87994b..3989a09f 100644 --- a/packages.nix +++ b/nix/packages.nix @@ -6,10 +6,10 @@ let gems = pkgs.bundlerEnv { name = "zeus.ugent.be"; inherit ruby; - gemdir = ./.; + gemdir = ../.; }; in with pkgs; [ - gems libxml2 nodejs yarn cacert git glibcLocales + gems libxml2 nodejs yarn cacert git glibcLocales (import ./dart-sass.nix {}) pandoc (texlive.combine { inherit (texlive) scheme-basic xetex unicode-math enumitem booktabs ulem; }) ] ++ (if stdenv.isDarwin then [terminal-notifier] else []) diff --git a/shell.nix b/shell.nix index c055eb4e..cce11a4f 100644 --- a/shell.nix +++ b/shell.nix @@ -1,5 +1,5 @@ let - build-deps = import ./packages.nix; + build-deps = import ./nix/packages.nix; rev = "70904d4a9927a4d6e05c72c4aaac4370e05107f3"; nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; pkgs = import nixpkgs {};