nixos-configs/scopedPackages/lovelace-components/custom-sidebar/default.nix
matt1432 018a5aee9e
All checks were successful
Discord / discord commits (push) Has been skipped
feat(update): get rid of updateCustomPackage func
2025-02-16 20:40:18 -05:00

53 lines
1 KiB
Nix

{
concatTextFile,
custom-sidebar-src,
nodejs,
pnpm,
stdenv,
nix-update-script,
...
}: let
inherit (builtins) fromJSON readFile;
package = fromJSON (readFile "${custom-sidebar-src}/package.json");
in
stdenv.mkDerivation (finalAttrs: {
pname = "custom-sidebar";
version = "${package.version}+${custom-sidebar-src.shortRev}";
src = custom-sidebar-src;
nativeBuildInputs = [
nodejs
pnpm.configHook
];
buildPhase = ''
npm run build
'';
installPhase = ''
mkdir $out
cp ./dist/* $out
'';
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
hash = "sha256-II8expO942jHylgbiePr5+V+t+UVh7fenffoyVFn/8k=";
};
passthru.updateScript = let
script = "${concatTextFile {
name = "update";
files = [./update.sh];
executable = true;
destination = "/bin/update";
}}/bin/update";
in
nix-update-script {
extraArgs = [
"--version=skip"
"; ${script}"
];
};
})