blog/flake.nix

68 lines
2 KiB
Nix
Raw Normal View History

2024-04-11 23:31:44 +00:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
};
outputs =
2024-11-21 21:39:44 +00:00
{ self, nixpkgs }:
let
lib = nixpkgs.lib;
makePkgs =
system:
import nixpkgs {
2024-04-11 23:31:44 +00:00
inherit system;
overlays = [ self.overlays.default ];
};
2024-11-21 21:39:44 +00:00
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 ]); };
});
2024-04-11 23:31:44 +00:00
overlays.default = final: prev: {
artemist-blog =
let
2024-04-12 05:35:52 +00:00
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};
2024-04-11 23:31:44 +00:00
jekyllEnv = final.bundlerEnv {
name = "artemist-blog-env";
inherit (final) ruby;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
2024-04-12 05:35:52 +00:00
gemConfig.sass-embedded = attrs: { DART_SASS = dartSass; };
2024-04-11 23:31:44 +00:00
};
in
final.stdenv.mkDerivation {
name = "artemist-blog";
src = ./.;
2024-04-12 05:35:52 +00:00
buildInputs = [ jekyllEnv ];
2024-04-11 23:31:44 +00:00
buildPhase = ''
bundle exec jekyll build
'';
installPhase = ''
cp -r _site $out
'';
};
};
};
}