1
Fork 0
satellite/pkgs/homer.nix

40 lines
1.3 KiB
Nix
Raw Permalink Normal View History

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:27:19 +01:00
] ++
lib.optional (extraAssets != [ ])
(runCommandLocal "homer-assets${nameSuffix}" { }
(builtins.concatStringsSep "\n" (map
(asset: ''
mkdir -p $out/assets/${dirOf asset}
ln -s ${asset} $out/assets/${asset}
'')
extraAssets)));
2024-02-24 03:51:35 +01:00
};
};
};
in
homer