Skip to content

Commit

Permalink
ncps: 0.0.12 -> 0.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
42LoCo42 committed Dec 12, 2024
1 parent 654eac9 commit e2a8369
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ A personal collection of unusual things
|`mspgcc-ti`|`9.3.1.11`|Open Source Compiler for MSP Microcontrollers|https://www.ti.com/tool/MSP430-GCC-OPENSOURCE|
|`my-htop`|`5d778ea`|htop with sorting in tree mode fixed|https://htop.dev|
|`nchess`|`0.0`|A curses based, UCI compatible, chess gui|https://github.com/spinojara/nchess|
|`ncps`|`0.0.12`|Nix binary cache proxy service -- with local caching and signing|https://github.com/kalbasit/ncps|
|`ncps`|`0.0.13`|Nix binary cache proxy service -- with local caching and signing|https://github.com/kalbasit/ncps|
|`nvflash`|`5.833.0`|NVIDIA NVFlash is used to flash the graphics card BIOS on Ampere, Turing, Pascal and all older NVIDIA cards|https://www.techpowerup.com/download/nvidia-nvflash|
|`pcr-oracle`|`0.5.4`|Predict TPM PCR values for future boot|https://github.com/okirch/pcr-oracle|
|`photoview`|`v2.4.0`|Photo gallery for self-hosted personal servers|https://photoview.github.io|
Expand Down
26 changes: 0 additions & 26 deletions packages/ncps.nix

This file was deleted.

25 changes: 25 additions & 0 deletions packages/ncps/db-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

cache="${CACHE_DATA_PATH:-}"

args=("$@")
while (($#)); do
case "$1" in
--cache-data-path)
shift
cache="$1"
;;
esac
shift
done

if [ -z "$cache" ]; then
echo "ERROR: no cache path specified!"
exit 1
fi

db="$cache/var/ncps/db/db.sqlite"
mkdir -p "$(dirname "$db")"
dbmate --url "sqlite:$db" --migrations-dir "@src@/db/migrations" up

exec "@bin@" "${args[@]}"
44 changes: 44 additions & 0 deletions packages/ncps/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
pkgs: pkgs.buildGoModule rec {
pname = "ncps";
version = "0.0.13";

src = (pkgs.fetchFromGitHub {
owner = "kalbasit";
repo = pname;
rev = "v${version}";
hash = "sha256-PEylbJRZudBToIkXtVDk/rSQL9LUd8IGiRfa5qQ4aUk=";
}).overrideAttrs (old: {
postFetch = old.postFetch + ''
cd $out
find -name '*_test.go' -delete
rm -rf testdata devbox.lock
'';
});

ldflags = [ "-s" "-w" ];
vendorHash = "sha256-RRbiiSo8n/Xtms80rSbXuU8X1Rxe+XYWC6gk2lmhz/8=";

postInstall =
let inherit (pkgs.lib) getExe pipe; in
pipe ./db-helper.sh [
(x: pkgs.writeShellApplication {
name = "${pname}-db-helper";
runtimeInputs = with pkgs; [ dbmate ];
text = builtins.readFile x;
})
(x: ''
cd $out/bin
sed '
s|@bin@|${placeholder "out"}/bin/${pname}|g;
s|@src@|${src}|g;
' < ${getExe x} > ${pname}-db-helper
chmod +x ${pname}-db-helper
'')
];

meta = {
description = "Nix binary cache proxy service -- with local caching and signing";
homepage = "https://github.com/kalbasit/ncps";
mainProgram = pname;
};
}

0 comments on commit e2a8369

Please sign in to comment.