2024-02-24 04:03:21 +01:00
|
|
|
# Taken from this comment: https://github.com/NixOS/nixpkgs/issues/152343#issuecomment-1367069827
|
2024-02-24 03:51:35 +01:00
|
|
|
{ lib, fetchzip, writeTextFile, runCommandLocal, symlinkJoin }:
|
|
|
|
|
|
|
|
let
|
|
|
|
homer = fetchzip rec {
|
|
|
|
pname = "homer";
|
|
|
|
version = "24.02.1";
|
|
|
|
url =
|
|
|
|
"https://github.com/bastienwirtz/${pname}/releases/download/v${version}/${pname}.zip";
|
|
|
|
hash = "sha256-McMJuZ84B3BlGHLQf+/ttRe5xAzQuR6qHrH8IjGys2Q=";
|
|
|
|
stripRoot = false;
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
withAssets = { name ? null, config, extraAssets ? [ ] }:
|
|
|
|
let nameSuffix = lib.optionalString (name != null) "-${name}";
|
|
|
|
in
|
|
|
|
symlinkJoin {
|
|
|
|
name = "homer-root${nameSuffix}";
|
|
|
|
paths = [
|
|
|
|
homer
|
|
|
|
(writeTextFile {
|
|
|
|
name = "homer-configuration${nameSuffix}";
|
|
|
|
text = builtins.toJSON config;
|
|
|
|
destination = "/assets/config.yml";
|
|
|
|
})
|
2024-02-24 04:19:35 +01:00
|
|
|
] ++ extraAssets;
|
|
|
|
|
|
|
|
postBuid = lib.concatStringsSep "\n" (map
|
|
|
|
(asset: ''
|
|
|
|
mv $out/${asset} $out/assets/${asset}
|
|
|
|
'')
|
|
|
|
extraAssets);
|
2024-02-24 03:51:35 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
homer
|