mirror of
https://github.com/9001/copyparty.git
synced 2025-10-02 14:42:28 -06:00
83 lines
2.7 KiB
Nix
83 lines
2.7 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "nixpkgs/nixos-25.05";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
}:
|
|
{
|
|
nixosModules.default = ./contrib/nixos/modules/copyparty.nix;
|
|
overlays.default = import ./contrib/package/nix/overlay.nix;
|
|
}
|
|
// flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
lib = import "${nixpkgs}/lib";
|
|
inherit (self) lastModifiedDate;
|
|
year = lib.toIntBase10 (builtins.substring 0 4 lastModifiedDate);
|
|
month = lib.toIntBase10 (builtins.substring 4 2 lastModifiedDate);
|
|
day = lib.toIntBase10 (builtins.substring 6 2 lastModifiedDate);
|
|
fullAttrs = {
|
|
withHashedPasswords = true;
|
|
withCertgen = true;
|
|
withThumbnails = true;
|
|
withFastThumbnails = true;
|
|
withMediaProcessing = true;
|
|
withBasicAudioMetadata = true;
|
|
withZeroMQ = true;
|
|
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;
|
|
};
|
|
|
|
formatter = pkgs.nixfmt-tree;
|
|
}
|
|
);
|
|
}
|