mirror of
https://github.com/9001/copyparty.git
synced 2025-10-02 14:42:28 -06:00
copyparty-unstable build in flake.nix
This commit is contained in:
parent
6f6b70ad04
commit
8e97eae6a6
21
flake.nix
21
flake.nix
|
@ -17,12 +17,30 @@
|
||||||
// flake-utils.lib.eachDefaultSystem (
|
// flake-utils.lib.eachDefaultSystem (
|
||||||
system:
|
system:
|
||||||
let
|
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);
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
config = {
|
config = {
|
||||||
allowAliases = false;
|
allowAliases = false;
|
||||||
};
|
};
|
||||||
overlays = [ self.overlays.default ];
|
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
|
in
|
||||||
{
|
{
|
||||||
|
@ -42,6 +60,7 @@
|
||||||
packages = {
|
packages = {
|
||||||
inherit (pkgs)
|
inherit (pkgs)
|
||||||
copyparty
|
copyparty
|
||||||
|
copyparty-unstable
|
||||||
;
|
;
|
||||||
default = self.packages.${system}.copyparty;
|
default = self.packages.${system}.copyparty;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue