reorganize checks in flake.nix

This commit is contained in:
Shelvacu 2025-09-28 10:04:54 -07:00 committed by Shelvacu on fw
parent 8e97eae6a6
commit f1366a026e

View file

@ -22,30 +22,7 @@
year = lib.toIntBase10 (builtins.substring 0 4 lastModifiedDate);
month = lib.toIntBase10 (builtins.substring 4 2 lastModifiedDate);
day = lib.toIntBase10 (builtins.substring 6 2 lastModifiedDate);
pkgs = import nixpkgs {
inherit system;
config = {
allowAliases = false;
};
overlays = [ self.overlays.default ] ++ lib.singleton (old: new: {
# This is here in flake.nix rather than common/packages/nix because it needs to access the flake metadata to get the date of the most recent commit (lastModifiedDate)
copyparty-unstable = new.copyparty.overrideAttrs (finalAttrs: previousAttrs: {
version = "${previousAttrs.version}-unstable-${self.lastModifiedDate}";
src = self;
postPatch = ''
old_src="$(mktemp -d)"
tar -C "$old_src" -xvf ${new.copyparty.src}
cp -r "$old_src"/*/copyparty/web/deps/* copyparty/web/deps
sed -i 's/^BUILD_DT =.*$/BUILD_DT = (${toString year}, ${toString month}, ${toString day})/' copyparty/__version__.py
sed -i 's/^CODENAME =.*$/CODENAME = "unstable"/' copyparty/__version__.py
'';
});
});
};
in
{
# check that copyparty builds with all optionals turned on
checks.copyparty-full = self.packages.${system}.copyparty.override {
fullAttrs = {
withHashedPasswords = true;
withCertgen = true;
withThumbnails = true;
@ -56,11 +33,45 @@
withFTPS = true;
withSMB = true;
};
pkgs = import nixpkgs {
inherit system;
config = {
allowAliases = false;
};
overlays = [ self.overlays.default ] ++ lib.singleton (final: prev: {
# This is here in flake.nix rather than common/packages/nix because it needs to access the flake metadata to get the date of the most recent commit (lastModifiedDate)
copyparty-unstable = final.copyparty.overrideAttrs (finalAttrs: previousAttrs: {
version = "${previousAttrs.version}-unstable-${self.lastModifiedDate}";
src = self;
postPatch = ''
old_src="$(mktemp -d)"
tar -C "$old_src" -xvf ${previousAttrs.src}
cp -r "$old_src"/*/copyparty/web/deps/* copyparty/web/deps
sed -i 's/^BUILD_DT =.*$/BUILD_DT = (${toString year}, ${toString month}, ${toString day})/' copyparty/__version__.py
sed -i 's/^CODENAME =.*$/CODENAME = "unstable"/' copyparty/__version__.py
'';
});
copyparty-full = final.copyparty.overrideAttrs fullAttrs;
copyparty-unstable-full = final.copyparty-unstable.overrideAttrs fullAttrs;
});
};
in
{
# check that copyparty builds with all optionals turned on
checks = {
inherit (pkgs)
copyparty-full
copyparty-unstable-full
;
};
packages = {
inherit (pkgs)
copyparty
copyparty-full
copyparty-unstable
copyparty-unstable-full
;
default = self.packages.${system}.copyparty;
};