blog/flake.nix

68 lines
2 KiB
Nix

{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
};
outputs =
{ self, nixpkgs }:
let
lib = nixpkgs.lib;
makePkgs =
system:
import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
forAllSystems = f: lib.genAttrs lib.systems.flakeExposed (system: f (makePkgs system));
in
{
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
packages = forAllSystems (pkgs: {
default = pkgs.artemist-blog;
});
devShells = forAllSystems (pkgs: {
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
'';
};
};
};
}