Add update-date helper
continuous-integration/drone/push Build is passing Details
continuous-integration/drone Build is passing Details

pull/1/head
mat ess 2022-10-23 12:16:12 -04:00
parent 2245464d76
commit e467718da1
3 changed files with 14 additions and 3 deletions

View File

@ -19,7 +19,7 @@
perSystem = { config, self', inputs', pkgs, system, ... }:
let
inherit (gitignore.lib) gitignoreSource;
inherit (pkgs.callPackage ./nix { }) fonts optimize-images;
inherit (pkgs.callPackage ./nix { }) fonts optimize-images update-date;
inherit (fonts) copyFonts linkFonts;
caddyfile-syntax = "${inputs.caddyfile-syntax}/Caddyfile.sublime-syntax";
buildSite = { prod }:
@ -40,7 +40,7 @@
pname = "personal-site";
version = "2022-10-23";
src = gitignoreSource ./.;
nativeBuildInputs = [ optimize-images zola ];
nativeBuildInputs = [ optimize-images update-date zola ];
configurePhase = copyFonts + ''
mkdir -p extra/syntax
cp ${caddyfile-syntax} extra/syntax
@ -54,7 +54,7 @@
buildPhase = buildSite { prod = false; };
});
devShells.default = with pkgs; mkShell {
packages = [ optimize-images zola ];
packages = [ optimize-images update-date zola ];
shellHook = linkFonts + ''
mkdir -p extra/syntax
ln -snf ${caddyfile-syntax} extra/syntax

View File

@ -1,4 +1,5 @@
{ callPackage }: {
fonts = callPackage ./fonts.nix { };
optimize-images = callPackage ./optimize-images.nix { };
update-date = callPackage ./update-date.nix { };
}

10
nix/update-date.nix Normal file
View File

@ -0,0 +1,10 @@
{ coreutils, sd, writeShellScriptBin }:
writeShellScriptBin "update-date" ''
export VERSION=$1
if [ -z "$VERSION" ]
then
export VERSION=$(${coreutils}/bin/date -I)
fi
${sd}/bin/sd 'version = ".*"' 'version = "'$VERSION'"' flake.nix
''