chore(make-sysext): create content and package lists

This commit is contained in:
Lars Sjöström 2025-06-17 10:17:19 +02:00
commit d5fb0de315
No known key found for this signature in database
3 changed files with 35 additions and 9 deletions

View file

@ -30,7 +30,7 @@ let
path,
destpath ? null,
}:
"do_copy ${prefix} ${drv} ${path}" + lib.optionalString (destpath != null) " ${destpath}";
"do_copy ${prefix} ${drv} ${path} ${drv.name} " + builtins.concatStringsSep "," (map (l: l.shortName or "unknown") (lib.toList (drv.meta.license or []))) + lib.optionalString (destpath != null) " ${destpath}";
in
@ -43,6 +43,7 @@ runCommand name
nativeBuildInputs = [
pkgs.erofs-utils
pkgs.cryptsetup
pkgs.jq
];
}
@ -52,7 +53,9 @@ runCommand name
local prefix="$1"
local drv="$2"
local path="$3"
local destpath="''${4:-$path}"
local pkgname="$4"
local license="$5"
local destpath="''${6:-$path}"
local srcfile
local destdir
@ -61,6 +64,8 @@ runCommand name
destfile="$out/tree/$prefix/$destpath"
destdir="$(dirname -- "$destfile")"
echo "pkgname=\"$pkgname\",licenses=\""$license"\"" >> $out/.tmp-pkgs.txt
mkdir -pv "$destdir"
# recursively copy if ending with /
@ -97,9 +102,9 @@ runCommand name
local content="$2"
mkdir -p $out/tree/usr/lib/systemd/system/multi-user.target.wants/
echo "$content" > $out/tree/usr/lib/systemd/system/"$unit".service
echo "$content" > $out/tree/usr/lib/systemd/system/$unit
# enable in multi-user.target
ln -s ../"$unit".service $out/tree/usr/lib/systemd/system/multi-user.target.wants/"$unit".service
ln -s ../$unit $out/tree/usr/lib/systemd/system/multi-user.target.wants/$unit
}
mkdir -p $out/tree
@ -121,12 +126,20 @@ runCommand name
# openssl smime -sign -nocerts -noattr -binary -in ${name}.roothash \
# -inkey key.pem -signer cert.pem -outform der -out ${name}.roothash.p7s
# create contents list
pushd tree
find . -ls > $out/"$name"_contents.txt
popd
# create nixpkgs packages list
sort -u $out/.tmp-pkgs.txt > $out/"$name"_packages.txt
rm -f $out/.tmp-pkgs.txt
jq -R -s 'split("\n") | map(select(length > 0)) | map(capture("pkgname=\"(?<name>[^\"]*)\",licenses=\"(?<licenses>[^\"]*)\"") | .licenses |= split(",")) | map(select(. != null))' $out/"$name"_packages.txt > $out/"$name"_packages.json
rm -rf tree
sha256sum * > SHA256SUMS
ln -s SHA256SUMS SHA256SUMS.asc
# TODO: add gpg signature
popd
''

View file

@ -50,4 +50,5 @@ stdenv.mkDerivation (finalAttrs: {
export DESTDIR=${placeholder "out"}
'';
meta = pkgs.glibc.meta;
})

View file

@ -1,7 +1,17 @@
{ pkgs, version, revision,... }:
{
pkgs,
version,
revision,
...
}:
let
versionString = "${version}-${revision}";
in
pkgs.callPackage ../../lib/make-sysext.nix {
name = "patos-debug-tools";
version = "${version}-${revision}";
version = versionString;
packages = [
{ drv = pkgs.curl; path = "bin/"; }
{ drv = pkgs.bash; path = "bin/"; }
@ -10,8 +20,8 @@ pkgs.callPackage ../../lib/make-sysext.nix {
{ drv = pkgs.strace; path = "bin/"; }
{ drv = pkgs.cryptsetup; path = "bin/"; }
{ drv = pkgs.erofs-utils; path = "bin/"; }
{ drv = pkgs.dropbear.override { sftpPath = "/usr/bin/sftp-server";}; path = "bin/"; }
{ drv = pkgs.openssh; path = "libexec/sftp-server"; destpath="bin/sftp-server"; }
{ drv = pkgs.openssh; path = "libexec/sftp-server"; destpath="lib/ssh/sftp-server"; }
{ drv = pkgs.dropbear.override { sftpPath = "/usr/lib/ssh/sftp-server";}; path = "bin/"; }
{ drv = pkgs.ldns; path = "bin/"; }
{ drv = pkgs.ldns; path = "lib/"; }
{ drv = pkgs.binutils-unwrapped; path = "bin/"; }
@ -38,9 +48,10 @@ pkgs.callPackage ../../lib/make-sysext.nix {
{ drv = pkgs.ncurses.out; path = "lib/"; }
{ drv = pkgs.ncurses.out; path = "share/terminfo/"; }
];
services = [
{
unit = "dropbear";
unit = "dropbear.service";
content = ''
[Unit]
Description=Dropbear SSH server
@ -62,4 +73,5 @@ pkgs.callPackage ../../lib/make-sysext.nix {
'';
}
];
}