Skip to content

Commit

Permalink
openbsd: many new small packages (NixOS#371699)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbsds authored Jan 17, 2025
2 parents fe3ad25 + dd9e65d commit b7c35fc
Show file tree
Hide file tree
Showing 70 changed files with 531 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/cap_mkdb.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/cap_mkdb";
meta.mainProgram = "cap_mkdb";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/cat.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/cat";
}
24 changes: 24 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/chmod/no-sbin.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/bin/chmod/Makefile b/bin/chmod/Makefile
index 82854bae3a3..39813dc8882 100644
--- a/bin/chmod/Makefile
+++ b/bin/chmod/Makefile
@@ -3,17 +3,8 @@
PROG= chmod
MAN= chmod.1 chgrp.1 chown.8 chflags.1
LINKS= ${BINDIR}/chmod ${BINDIR}/chgrp \
- ${BINDIR}/chmod /sbin/chown
-
-# XXX compatibility
-afterinstall:
- (cd ${DESTDIR}/usr/sbin && \
- ln -sf ../../sbin/chown . && \
- ln -sf ../../bin/chgrp . && \
- chown -h ${BINOWN}:${BINGRP} chown chgrp)
- (cd ${DESTDIR}/usr/bin && \
- ln -sf ../../bin/chmod chflags && \
- chown -h ${BINOWN}:${BINGRP} chflags)
+ ${BINDIR}/chmod ${BINDIR}/chown \
+ ${BINDIR}/chmod ${BINDIR}/chflags


.include <bsd.prog.mk>
6 changes: 6 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/chmod/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{ mkDerivation }:
mkDerivation {
path = "bin/chmod";

patches = [ ./no-sbin.patch ];
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/cmp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/cmp";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/cp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/cp";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/date.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/date";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/dd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/dd";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/dev_mkdb.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.sbin/dev_mkdb";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/df.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/df";
}
7 changes: 7 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/dhcpleasectl.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ mkDerivation }:
mkDerivation {
path = "usr.sbin/dhcpleasectl";

extraPaths = [ "sbin/dhcpleased" ];

}
15 changes: 15 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/dhcpleased.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
mkDerivation,
libevent,
byacc,
}:
mkDerivation {
path = "sbin/dhcpleased";

postPatch = ''
sed -i 's/DPADD/#DPADD/' $BSDSRCDIR/sbin/dhcpleased/Makefile
'';

buildInputs = [ libevent ];
extraNativeBuildInputs = [ byacc ];
}
10 changes: 10 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/dmesg.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ mkDerivation, libkvm }:
mkDerivation {
path = "sbin/dmesg";

buildInputs = [ libkvm ];

postPatch = ''
sed -i /DPADD/d $BSDSRCDIR/sbin/dmesg/Makefile
'';
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/domainname.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/domainname";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/echo.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/echo";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/ed.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/ed";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/expr.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/expr";
}
1 change: 1 addition & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/getent.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ mkDerivation }: mkDerivation { path = "usr.bin/getent"; }
21 changes: 21 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/getty.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
mkDerivation,
login,
}:
mkDerivation {
path = "libexec/getty";
extraPaths = [ "etc/gettytab" ];

postPatch = ''
substituteInPlace $BSDSRCDIR/libexec/getty/pathnames.h \
--replace-fail "/usr/libexec/getty" "$out/bin/getty" \
--replace-fail "/usr/bin/login" "${login}/bin/login"
'';

postInstall = ''
mkdir -p $out/etc
cp $BSDSRCDIR/etc/gettytab $out/etc/gettytab
'';

meta.mainProgram = "getty";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/hostname.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/hostname";
}
6 changes: 6 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/id.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
mkDerivation,
}:
mkDerivation {
path = "usr.bin/id";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/ifconfig.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "sbin/ifconfig";
}
8 changes: 8 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/kdump.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/kdump";
extraPaths = [
"sys"
"usr.bin/ktrace"
];
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/kill.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/kill";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/ktrace.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/ktrace";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/kvm_mkdb.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.sbin/kvm_mkdb";
}
2 changes: 2 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/libc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
libm,
librpcsvc,
libutil,
libexecinfo,
rtld,
version,
}:
Expand Down Expand Up @@ -36,6 +37,7 @@ symlinkJoin rec {
librthread
librpcsvc
libutil
libexecinfo
]
++ (lib.optional (!stdenvNoLibc.hostPlatform.isStatic) rtld)
);
Expand Down
13 changes: 13 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/libcurses.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
lib,
mkDerivation,
buildPackages,
}:
mkDerivation {
path = "lib/libcurses";

makeFlags = [
"AWK=${lib.getBin buildPackages.gawk}/bin/awk"
"HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc"
];
}
7 changes: 7 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/libevent.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ mkDerivation }:
mkDerivation {
path = "lib/libevent";
preInstall = ''
mkdir -p $out/include
'';
}
22 changes: 22 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/libexecinfo.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
lib,
mkDerivation,
}:

mkDerivation {
path = "gnu/lib/libexecinfo";
extraPaths = [
"gnu/llvm/libunwind"
"gnu/llvm/libcxx"
"gnu/lib/libcxx"
];

libcMinimal = true;

outputs = [
"out"
"man"
];

meta.platforms = lib.platforms.openbsd;
}
6 changes: 6 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/libkvm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
mkDerivation,
}:
mkDerivation {
path = "lib/libkvm";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/ln.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/ln";
}
12 changes: 12 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/login.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
mkDerivation,
libutil,
}:
mkDerivation {
path = "usr.bin/login";
buildInputs = [
libutil
];

meta.mainProgram = "login";
}
10 changes: 10 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/login_passwd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
mkDerivation,
}:
mkDerivation {
path = "libexec/login_passwd";

postPatch = ''
sed -i 's/4555/0555/' $BSDSRCDIR/libexec/login_passwd/Makefile
'';
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/ls.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/ls";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/md5.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/md5";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mkdir.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/mkdir";
}
9 changes: 9 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mount/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
mkDerivation,
}:

mkDerivation {
path = "sbin/mount";
meta.mainProgram = "mount";
patches = [ ./search-path.patch ];
}
39 changes: 39 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mount/search-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index eaff190b572..4bce21559f6 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -338,12 +338,6 @@ mountfs(const char *vfstype, const char *spec, const char *name,
{
char *cp;

- /* List of directories containing mount_xxx subcommands. */
- static const char *edirs[] = {
- _PATH_SBIN,
- _PATH_USRSBIN,
- NULL
- };
const char **argv, **edir;
struct statfs sf;
pid_t pid;
@@ -427,15 +421,12 @@ mountfs(const char *vfstype, const char *spec, const char *name,
return (1);
case 0: /* Child. */
/* Go find an executable. */
- edir = edirs;
- do {
- (void)snprintf(execname,
- sizeof(execname), "%s/mount_%s", *edir, vfstype);
- argv[0] = execname;
- execv(execname, (char * const *)argv);
- if (errno != ENOENT)
- warn("exec %s for %s", execname, name);
- } while (*++edir != NULL);
+ (void)snprintf(execname,
+ sizeof(execname), "mount_%s", vfstype);
+ argv[0] = execname;
+ execvp(execname, (char * const *)argv);
+ if (errno != ENOENT)
+ warn("exec %s for %s", execname, name);

if (errno == ENOENT)
warn("no mount helper program found for %s", vfstype);
8 changes: 8 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mount_ffs/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
mkDerivation,
}:

mkDerivation {
path = "sbin/mount_ffs";
extraPaths = [ "sbin/mount" ];
}
8 changes: 8 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mount_tmpfs/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
mkDerivation,
}:

mkDerivation {
path = "sbin/mount_tmpfs";
extraPaths = [ "sbin/mount" ];
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/mt";
}
6 changes: 6 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mtree/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
mkDerivation,
}:
mkDerivation {
path = "usr.sbin/mtree";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/mv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "bin/mv";
}
4 changes: 4 additions & 0 deletions pkgs/os-specific/bsd/openbsd/pkgs/newsyslog.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ mkDerivation }:
mkDerivation {
path = "usr.bin/newsyslog";
}
Loading

0 comments on commit b7c35fc

Please sign in to comment.