ci: rework flake integration

Now Use flake part and integrate a build system using nix package building and treefmt-nix as a flake-part module
This commit is contained in:
Yorick Barbanneau 2025-01-07 00:56:34 +01:00
parent 440e26fb63
commit ffea2b6857
8 changed files with 268 additions and 79 deletions

View file

@ -1,68 +1,24 @@
{
description = "Development shell for Personal blog";
description = "Nix flake for my personal blog";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
flake-utils = {
url = "github:numtide/flake-utils";
};
nixpkgs.url = "nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs = { nixpkgs , flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
pelicanplugins-neighbors = ( with pkgs; stdenv.mkDerivation {
pname = "pelicanplugins-neighbors";
version = "1.2.0";
src = pkgs.fetchFromGitHub {
owner = "pelican-plugins";
repo = "neighbors";
rev = "60649ac6f3494d01a37b9c6d3d455f9dc2502d55";
hash = "sha256-c6etuRqve9xj6NhGRAim2A0ae8xv6mI/yez+suQuZ8U=";
};
installPhase = ''
cp -r $src/pelican/plugins/neighbors $out
'';
});
pelicanplugins-md_include = ( with pkgs; stdenv.mkDerivation {
pname = "pelicanplugins-md_include";
version = "1.0.4";
src = pkgs.fetchFromGitHub {
owner = "pelican-plugins";
repo = "markdown-include";
rev = "df0b3e55c45471283ca62d6e157b61a8caa35e37";
hash = "sha256-y0dIvyEYLbYqkm+6yJOUYI3apzEMJ/N/JUwWTqjdsNg=";
};
installPhase = ''
cp -r $src/pelican/plugins/md_include $out
'';
});
in {
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
lefthook
go-task
convco
typos
shellcheck
shfmt
python3
python3Packages.pelican
python3Packages.markdown-include
python3Packages.typogrify
python3Packages.livereload
python3Packages.invoke
rsync
];
shellHook = ''
mkdir -p plugins
ln -snf "${pelicanplugins-neighbors}" "plugins/neighbors"
ln -snf "${pelicanplugins-md_include}" "plugins/md_include"
'';
};
outputs =
inputs@{
nixpkgs,
flake-parts,
systems,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" ];
imports = [
inputs.treefmt-nix.flakeModule
./nix/default.nix
];
};
});
}