From e8fd233a30c02bdb2aa2494081bef87cf1812314 Mon Sep 17 00:00:00 2001 From: Leyla Becker Date: Wed, 18 Feb 2026 16:10:54 -0600 Subject: [PATCH] fix: fixed publish dates for builds --- flake.nix | 12 +++++++++--- nix/configuration.nix | 5 +++-- nix/module.nix | 9 ++++++++- nix/package.nix | 29 ++++++++++++++++++++++++++--- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index c9f9e13..3592fde 100644 --- a/flake.nix +++ b/flake.nix @@ -18,16 +18,21 @@ f { pkgs = import nixpkgs {inherit overlays system;}; }); + + realSrc = /. + (builtins.getEnv "PWD"); in { packages = forEachSupportedSystem ({pkgs}: { default = pkgs.callPackage ./nix/package.nix { siteUrl = "https://blog.jan-leila.com"; + sourcePath = realSrc; }; blog = pkgs.callPackage ./nix/package.nix { siteUrl = "https://blog.jan-leila.com"; + sourcePath = realSrc; }; volpe = pkgs.callPackage ./nix/package.nix { siteUrl = "https://volpe.jan-leila.com"; + sourcePath = realSrc; }; }); @@ -46,7 +51,7 @@ {nixpkgs.overlays = overlays;} ./nix/configuration.nix ]; - specialArgs = {inherit inputs;}; + specialArgs = {inherit inputs realSrc;}; }; # Deployment helper - use with: nix run .#deploy @@ -58,9 +63,10 @@ echo "Building and deploying to cyberian@69.61.19.180..." nixos-rebuild switch --flake .#volpe \ --target-host cyberian@69.61.19.180 \ - --sudo + --sudo \ + --impure ''); }; }); }; -} +} \ No newline at end of file diff --git a/nix/configuration.nix b/nix/configuration.nix index a585d45..cff0f3c 100644 --- a/nix/configuration.nix +++ b/nix/configuration.nix @@ -1,4 +1,4 @@ -{inputs, ...}: { +{inputs, realSrc, ...}: { imports = [ ./hardware-configuration.nix ./module.nix @@ -41,6 +41,7 @@ ]; enableACME = true; acmeEmail = "leyla@jan-leila.com"; + sourcePath = realSrc; }; services.tor = { @@ -80,4 +81,4 @@ enable = true; capacity = 100; }; -} +} \ No newline at end of file diff --git a/nix/module.nix b/nix/module.nix index d24834f..553974f 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -28,6 +28,7 @@ in pkgs.callPackage ./package.nix { siteUrl = "${protocol}://${domain}"; + sourcePath = cfg.sourcePath; }; allDomains = [cfg.domain] ++ cfg.extraDomains; @@ -118,6 +119,12 @@ in { default = ""; description = "Email address for ACME certificate registration."; }; + + sourcePath = lib.mkOption { + type = lib.types.path; + default = ./..; + description = "Path to the source directory. Pass a path with .git for correct dates."; + }; }; config = lib.mkIf cfg.enable { @@ -214,4 +221,4 @@ in { networking.firewall.allowedTCPPorts = [80 443]; }; -} +} \ No newline at end of file diff --git a/nix/package.nix b/nix/package.nix index 2621ebc..3556b28 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -5,26 +5,49 @@ pnpm_10, fetchPnpmDeps, pnpmConfigHook, + git, siteUrl, + sourcePath ? ./.. }: let nodejs = nodejs_latest; pnpm = pnpm_10; + + # Filter source: use cleanSourceFilter as base, but include .git and exclude _site + filteredSrc = lib.cleanSourceWith { + src = sourcePath; + filter = path: type: + let + baseName = baseNameOf path; + # Always include .git directory + isGit = baseName == ".git" || lib.hasInfix "/.git/" path || lib.hasSuffix "/.git" path; + in + isGit || ( + # Apply base cleanSourceFilter + lib.cleanSourceFilter path type && + # Additional exclusions + baseName != "_site" && + baseName != "node_modules" + ); + }; in stdenv.mkDerivation (finalAttrs: { pname = "volpe"; version = "1.0.0"; - src = lib.cleanSource ./..; + src = filteredSrc; nativeBuildInputs = [ nodejs pnpm pnpmConfigHook + git ]; # fetchPnpmDeps creates the offline store + # Use clean source (excludes .git, _site, node_modules) pnpmDeps = fetchPnpmDeps { - inherit (finalAttrs) pname version src; + inherit (finalAttrs) pname version; + src = lib.cleanSource sourcePath; hash = "sha256-rN8P6g/Wuug+fv0rm/qbKN01NgcbpgEQmhDFe2X42uA="; fetcherVersion = 3; # pnpm store version }; @@ -45,4 +68,4 @@ in runHook postInstall ''; - }) + }) \ No newline at end of file