blog/flake.nix
2024-04-12 05:35:52 +00:00

72 lines
2 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
utils,
}:
(utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
formatter = pkgs.nixfmt-rfc-style;
packages.default = pkgs.artemist-blog;
devShells.default = pkgs.mkShell {
buildInputs = pkgs.artemist-blog.buildInputs ++ (with pkgs; [ bundix ]);
};
}
))
// {
overlays.default = final: prev: {
artemist-blog =
let
dartSass =
final.fetchurl
({
x86_64-linux = {
url = "https://github.com/sass/dart-sass/releases/download/1.75.0/dart-sass-1.75.0-linux-x64.tar.gz";
hash = "sha256-FTvUgQ+7YiD/F1nU1pQbzirNcfspMDua2bxuzjnDDig=";
};
aarch64-linux = {
url = "https://github.com/sass/dart-sass/releases/download/1.75.0/dart-sass-1.75.0-linux-arm64.tar.gz";
hash = "sha256-OXkxW2Vz1vWsV3eXPmY+nrijSGwSY3X3Kv6tKmfOmPs=";
};
}).${final.stdenv.hostPlatform.system};
jekyllEnv = final.bundlerEnv {
name = "artemist-blog-env";
inherit (final) ruby;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
gemConfig.sass-embedded = attrs: { DART_SASS = dartSass; };
};
in
final.stdenv.mkDerivation {
name = "artemist-blog";
src = ./.;
buildInputs = [ jekyllEnv ];
buildPhase = ''
bundle exec jekyll build
'';
installPhase = ''
cp -r _site $out
'';
};
};
};
}