nixfmt-rfc-style

There is nothing in this commit except for the changes made by
nix-shell -p nixfmt-rfc-style --run "nixfmt ."

If this has mucked up your open branches then sorry about that. You
can probably nixfmt them to match before merging
This commit is contained in:
Daniel Barlow
2025-02-10 21:55:08 +00:00
parent 13cc5a8992
commit 7e2b0068e6
211 changed files with 6049 additions and 4355 deletions

View File

@@ -1,29 +1,29 @@
final: prev:
let
isCross = final.stdenv.buildPlatform != final.stdenv.hostPlatform;
crossOnly = pkg : amendFn : if isCross then (amendFn pkg) else pkg;
crossOnly = pkg: amendFn: if isCross then (amendFn pkg) else pkg;
extraPkgs = import ./pkgs/default.nix {
inherit (final) lib callPackage;
};
inherit (final) fetchpatch lib;
luaHost =
let
l = prev.lua5_3.overrideAttrs(o: {
l = prev.lua5_3.overrideAttrs (o: {
name = "lua-tty";
preBuild = ''
makeFlagsArray+=(PLAT="posix" SYSLIBS="-Wl,-E -ldl" CFLAGS="-O2 -fPIC -DLUA_USE_POSIX -DLUA_USE_DLOPEN")
'';
'';
# lua in nixpkgs has a postInstall stanza that assumes only
# one output, we need to override that if we're going to
# convert to multi-output
# outputs = ["bin" "man" "out"];
makeFlags =
builtins.filter (x: (builtins.match "(PLAT|MYLIBS).*" x) == null)
o.makeFlags;
makeFlags = builtins.filter (x: (builtins.match "(PLAT|MYLIBS).*" x) == null) o.makeFlags;
});
in l.override { self = l; };
in
l.override { self = l; };
s6 = prev.s6.overrideAttrs(o:
s6 = prev.s6.overrideAttrs (
o:
let
patch = fetchpatch {
# add "p" directive in s6-log
@@ -31,100 +31,116 @@ let
hash = "sha256-fBtUinBdp5GqoxgF6fcR44Tu8hakxs/rOShhuZOgokc=";
};
patch_needed = builtins.compareVersions o.version "2.11.1.2" <= 0;
in {
configureFlags = (builtins.filter
(x: (builtins.match ".*shared.*" x) == null)
o.configureFlags) ++
[
"--disable-allstatic"
"--disable-static"
"--enable-shared"
in
{
configureFlags =
(builtins.filter (x: (builtins.match ".*shared.*" x) == null) o.configureFlags)
++ [
"--disable-allstatic"
"--disable-static"
"--enable-shared"
];
hardeningDisable = [ "all" ];
stripAllList = [
"sbin"
"bin"
];
hardeningDisable = ["all"];
stripAllList = [ "sbin" "bin" ];
patches =
(if o ? patches then o.patches else []) ++
(if patch_needed then [ patch ] else []);
});
patches = (if o ? patches then o.patches else [ ]) ++ (if patch_needed then [ patch ] else [ ]);
}
);
in
extraPkgs // {
extraPkgs
// {
# liminix library functions
lim = {
parseInt = s: (builtins.fromTOML "r=${s}").r;
orEmpty = x: if x != null then x else [];
orEmpty = x: if x != null then x else [ ];
};
# keep these alphabetical
btrfs-progs = crossOnly prev.btrfs-progs (
d: d.override {
d:
d.override {
udevSupport = false;
udev = null;
}
);
chrony =
let chrony' = prev.chrony.overrideAttrs(o: {
configureFlags = [
"--chronyvardir=$(out)/var/lib/chrony"
"--disable-readline"
"--disable-editline"
];
});
in chrony'.override {
let
chrony' = prev.chrony.overrideAttrs (o: {
configureFlags = [
"--chronyvardir=$(out)/var/lib/chrony"
"--disable-readline"
"--disable-editline"
];
});
in
chrony'.override {
gnutls = null;
libedit = null;
libseccomp = null;
# should texinfo be in nativeBuildInputs instead of
# buildInputs?
texinfo = null;
} // lib.optionalAttrs (lib.versionOlder lib.version "24.10") {
}
// lib.optionalAttrs (lib.versionOlder lib.version "24.10") {
nss = null;
nspr = null;
readline = null;
};
# clevis without luks/tpm
clevis = crossOnly prev.clevis
(d: let c = d.overrideAttrs(o: {
outputs = ["out"];
preConfigure = ''
rm -rf src/luks
sed -i -e '/luks/d' src/meson.build
'';
}); in c.override {
asciidoc = null;
cryptsetup = null;
luksmeta = null;
tpm2-tools = null;
});
clevis = crossOnly prev.clevis (
d:
let
c = d.overrideAttrs (o: {
outputs = [ "out" ];
preConfigure = ''
rm -rf src/luks
sed -i -e '/luks/d' src/meson.build
'';
});
in
c.override {
asciidoc = null;
cryptsetup = null;
luksmeta = null;
tpm2-tools = null;
}
);
# luarocks wants a cross-compiled cmake (which seems like a bug,
# we're never going to run luarocks on the device, but ...)
# but https://github.com/NixOS/nixpkgs/issues/284734
# so we do surgery on the cmake derivation until that's fixed
cmake = crossOnly prev.cmake
(d: d.overrideAttrs(o: {
cmake = crossOnly prev.cmake (
d:
d.overrideAttrs (o: {
preConfigure =
builtins.replaceStrings
["$configureFlags"] ["$configureFlags $cmakeFlags"] o.preConfigure;
}
));
builtins.replaceStrings [ "$configureFlags" ] [ "$configureFlags $cmakeFlags" ]
o.preConfigure;
})
);
dnsmasq =
let d = prev.dnsmasq.overrideAttrs(o: {
preBuild = ''
makeFlagsArray=("COPTS=")
'';
});
in d.override {
let
d = prev.dnsmasq.overrideAttrs (o: {
preBuild = ''
makeFlagsArray=("COPTS=")
'';
});
in
d.override {
dbusSupport = false;
nettle = null;
};
dropbear = crossOnly prev.dropbear
(d: d.overrideAttrs (o: rec {
dropbear = crossOnly prev.dropbear (
d:
d.overrideAttrs (o: rec {
version = "2024.85";
src = final.fetchurl {
url = "https://matt.ucc.asn.au/dropbear/releases/dropbear-${version}.tar.bz2";
@@ -132,34 +148,41 @@ extraPkgs // {
};
patches =
# need to update nixpkgs patch for new version of dropbear
let passPath = final.runCommand "pass-path" {} ''
sed < ${builtins.head o.patches} -e 's,svr-chansession.c,src/svr-chansession.c,g' > $out
'';
in [
let
passPath = final.runCommand "pass-path" { } ''
sed < ${builtins.head o.patches} -e 's,svr-chansession.c,src/svr-chansession.c,g' > $out
'';
in
[
passPath
./pkgs/dropbear/add-authkeyfile-option.patch
];
postPatch = ''
(echo '#define DSS_PRIV_FILENAME "/run/dropbear/dropbear_dss_host_key"'
echo '#define RSA_PRIV_FILENAME "/run/dropbear/dropbear_rsa_host_key"'
echo '#define ECDSA_PRIV_FILENAME "/run/dropbear/dropbear_ecdsa_host_key"'
echo '#define ED25519_PRIV_FILENAME "/run/dropbear/dropbear_ed25519_host_key"') > localoptions.h
(echo '#define DSS_PRIV_FILENAME "/run/dropbear/dropbear_dss_host_key"'
echo '#define RSA_PRIV_FILENAME "/run/dropbear/dropbear_rsa_host_key"'
echo '#define ECDSA_PRIV_FILENAME "/run/dropbear/dropbear_ecdsa_host_key"'
echo '#define ED25519_PRIV_FILENAME "/run/dropbear/dropbear_ed25519_host_key"') > localoptions.h
'';
}));
})
);
elfutils = crossOnly prev.elfutils
(d: let e = d.overrideAttrs(o: {
configureFlags = o.configureFlags ++[
"ac_cv_has_stdatomic=no"
];
});
in e.override {
enableDebuginfod = false;
});
elfutils = crossOnly prev.elfutils (
d:
let
e = d.overrideAttrs (o: {
configureFlags = o.configureFlags ++ [
"ac_cv_has_stdatomic=no"
];
});
in
e.override {
enableDebuginfod = false;
}
);
hostapd =
let
config = [
config = [
"CONFIG_DRIVER_NL80211=y"
"CONFIG_IAPP=y"
"CONFIG_IEEE80211AC=y"
@@ -174,7 +197,7 @@ extraPkgs // {
"CONFIG_RSN_PREAUTH=y"
"CONFIG_TLS=internal"
];
h = prev.hostapd.overrideAttrs(o: {
h = prev.hostapd.overrideAttrs (o: {
extraConfig = "";
configurePhase = ''
cat > hostapd/defconfig <<EOF
@@ -183,13 +206,17 @@ extraPkgs // {
${o.configurePhase}
'';
});
in h.override { openssl = null; sqlite = null; };
in
h.override {
openssl = null;
sqlite = null;
};
# berlekey db needs libatomic which we haven't figured out yet.
# disabling it means we don't have arpd
iproute2 = crossOnly prev.iproute2 (d: d.override { db = null; });
kexec-tools-static = prev.kexec-tools.overrideAttrs(o: {
kexec-tools-static = prev.kexec-tools.overrideAttrs (o: {
# For kexecboot we copy kexec into a ramdisk on the system being
# upgraded from. This is more likely to work if kexec is
# statically linked so doesn't have dependencies on store paths that
@@ -209,7 +236,7 @@ extraPkgs // {
lua = crossOnly prev.lua5_3 (_: luaHost);
luaossl' = luaHost.pkgs.luaossl.overrideAttrs(o: {
luaossl' = luaHost.pkgs.luaossl.overrideAttrs (o: {
patches = [
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/wahern/luaossl/pull/218.patch";
@@ -218,13 +245,15 @@ extraPkgs // {
] ++ final.lib.optionals (o ? patches) o.patches;
});
mtdutils = (prev.mtdutils.overrideAttrs(o: {
patches = (if o ? patches then o.patches else []) ++ [
./pkgs/mtdutils/0001-mkfs.jffs2-add-graft-option.patch
];
})).override { util-linux = final.util-linux-small ; };
mtdutils =
(prev.mtdutils.overrideAttrs (o: {
patches = (if o ? patches then o.patches else [ ]) ++ [
./pkgs/mtdutils/0001-mkfs.jffs2-add-graft-option.patch
];
})).override
{ util-linux = final.util-linux-small; };
nftables = prev.nftables.overrideAttrs(o: {
nftables = prev.nftables.overrideAttrs (o: {
configureFlags = [
"--disable-debug"
"--disable-python"
@@ -233,27 +262,29 @@ extraPkgs // {
];
});
openssl = crossOnly prev.openssl
(d: d.overrideAttrs (o:
with final; {
# we want to apply
# https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20273.patch";
# which disables overriding the -march cflags to the wrong values,
# but openssl is used for bootstrapping so that's easier said than
# done. Do it the ugly way..
postPatch =
o.postPatch
+ ''
sed -i.bak 's/linux.*-mips/linux-mops/' Configure
'';
# openssl with threads requires stdatomic which drags in libgcc
# as a dependency
configureFlags = ["no-threads"] ++ o.configureFlags;
openssl = crossOnly prev.openssl (
d:
d.overrideAttrs (
o: with final; {
# we want to apply
# https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20273.patch";
# which disables overriding the -march cflags to the wrong values,
# but openssl is used for bootstrapping so that's easier said than
# done. Do it the ugly way..
postPatch =
o.postPatch
+ ''
sed -i.bak 's/linux.*-mips/linux-mops/' Configure
'';
# openssl with threads requires stdatomic which drags in libgcc
# as a dependency
configureFlags = [ "no-threads" ] ++ o.configureFlags;
# don't need or want this bash script
postInstall = o.postInstall + "rm $bin/bin/c_rehash\n";
# don't need or want this bash script
postInstall = o.postInstall + "rm $bin/bin/c_rehash\n";
}
));
)
);
pppBuild = prev.ppp;
@@ -269,23 +300,29 @@ extraPkgs // {
})
];
});
overrides = {
nixosTestRunner = true;
hostCpuTargets = map (f: "${f}-softmmu") [
"arm" "aarch64" "mips" "mipsel"
];
sdlSupport = false;
numaSupport = false;
seccompSupport = false;
usbredirSupport = false;
libiscsiSupport = false;
tpmSupport = false;
uringSupport = false;
capstoneSupport = false;
} // lib.optionalAttrs (lib.versionOlder lib.version "24.10") {
texinfo = null;
};
in q.override overrides;
overrides =
{
nixosTestRunner = true;
hostCpuTargets = map (f: "${f}-softmmu") [
"arm"
"aarch64"
"mips"
"mipsel"
];
sdlSupport = false;
numaSupport = false;
seccompSupport = false;
usbredirSupport = false;
libiscsiSupport = false;
tpmSupport = false;
uringSupport = false;
capstoneSupport = false;
}
// lib.optionalAttrs (lib.versionOlder lib.version "24.10") {
texinfo = null;
};
in
q.override overrides;
rsyncSmall =
let
r = prev.rsync.overrideAttrs (o: {
@@ -358,15 +395,19 @@ extraPkgs // {
};
libusb1 = crossOnly prev.libusb1 (
d: let u = d.overrideAttrs(o: {
# don't use gcc libatomic because it vastly increases the
# closure size
preConfigure = "sed -i.bak /__atomic_fetch_add_4/c\: configure.ac";
});
in u.override {
enableUdev = false;
withDocs = false;
});
d:
let
u = d.overrideAttrs (o: {
# don't use gcc libatomic because it vastly increases the
# closure size
preConfigure = "sed -i.bak /__atomic_fetch_add_4/c\: configure.ac";
});
in
u.override {
enableUdev = false;
withDocs = false;
}
);
util-linux-small = prev.util-linux.override {
ncursesSupport = false;
@@ -377,7 +418,7 @@ extraPkgs // {
capabilitiesSupport = false;
};
xl2tpd = prev.xl2tpd.overrideAttrs(o: {
xl2tpd = prev.xl2tpd.overrideAttrs (o: {
patches = [ ./pkgs/xl2tpd-exit-on-close.patch ];
});
}