liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

overlay.nix (7496B)


      1 final: prev:
      2 let
      3   extraPkgs = import ./pkgs/default.nix {
      4     inherit (final) lib callPackage;
      5   };
      6   inherit (final) fetchpatch;
      7   lua_no_readline = prev.lua5_3.overrideAttrs(o: {
      8     name = "lua-tty";
      9     preBuild = ''
     10       makeFlagsArray+=(PLAT="posix" SYSLIBS="-Wl,-E -ldl"  CFLAGS="-O2 -fPIC -DLUA_USE_POSIX -DLUA_USE_DLOPEN")
     11     '';
     12     # lua in nixpkgs has a postInstall stanza that assumes only
     13     # one output, we need to override that if we're going to
     14     # convert to multi-output
     15     # outputs = ["bin" "man" "out"];
     16     makeFlags =
     17       builtins.filter (x: (builtins.match "(PLAT|MYLIBS).*" x) == null)
     18         o.makeFlags;
     19   });
     20 
     21   s6 = prev.s6.overrideAttrs(o:
     22     let
     23       patch = fetchpatch {
     24         # add "p" directive in s6-log
     25         url = "https://github.com/skarnet/s6/commit/ddc76841398dfd5e18b22943727ad74b880236d3.patch";
     26         hash = "sha256-fBtUinBdp5GqoxgF6fcR44Tu8hakxs/rOShhuZOgokc=";
     27       };
     28       patch_needed = builtins.compareVersions o.version "2.11.1.2" <= 0;
     29     in {
     30       configureFlags = (builtins.filter
     31         (x: (builtins.match ".*shared.*" x) == null)
     32         o.configureFlags) ++
     33       [
     34         "--disable-allstatic"
     35         "--disable-static"
     36         "--enable-shared"
     37       ];
     38       hardeningDisable = ["all"];
     39       stripAllList = [ "sbin" "bin" ];
     40       patches =
     41         (if o ? patches then o.patches else []) ++
     42         (if patch_needed then [ patch ] else []);
     43     });
     44   lua = let s = lua_no_readline.override { self = s; }; in s;
     45 in
     46 extraPkgs // {
     47   # liminix library functions
     48   lim = {
     49     parseInt = s : (builtins.fromTOML "r=${s}").r;
     50   };
     51 
     52   # keep these alphabetical
     53   chrony =
     54     let chrony' = prev.chrony.overrideAttrs(o: {
     55           configureFlags = [
     56             "--chronyvardir=$(out)/var/lib/chrony"
     57             "--disable-readline"
     58             "--disable-editline"
     59           ];
     60         });
     61     in chrony'.override {
     62       gnutls = null;
     63       nss = null;
     64       nspr = null;
     65       readline = null;
     66       libedit = null;
     67       libseccomp = null;
     68       # should texinfo be in nativeBuildInputs instead of
     69       # buildInputs?
     70       texinfo = null;
     71 
     72     };
     73 
     74 
     75   dnsmasq =
     76     let d =  prev.dnsmasq.overrideAttrs(o: {
     77           preBuild =  ''
     78               makeFlagsArray=("COPTS=")
     79           '';
     80         });
     81     in d.override {
     82       dbusSupport = false;
     83       nettle = null;
     84     };
     85 
     86   dropbear = prev.dropbear.overrideAttrs (o: {
     87     postPatch = ''
     88      (echo '#define DSS_PRIV_FILENAME "/run/dropbear/dropbear_dss_host_key"'
     89       echo '#define RSA_PRIV_FILENAME "/run/dropbear/dropbear_rsa_host_key"'
     90       echo '#define ECDSA_PRIV_FILENAME "/run/dropbear/dropbear_ecdsa_host_key"'
     91       echo '#define ED25519_PRIV_FILENAME "/run/dropbear/dropbear_ed25519_host_key"') > localoptions.h
     92     '';
     93   });
     94 
     95   hostapd =
     96     let
     97       config =  [
     98         "CONFIG_DRIVER_NL80211=y"
     99         "CONFIG_IAPP=y"
    100         "CONFIG_IEEE80211AC=y"
    101         "CONFIG_IEEE80211N=y"
    102         "CONFIG_IEEE80211W=y"
    103         "CONFIG_INTERNAL_LIBTOMMATH=y"
    104         "CONFIG_INTERNAL_LIBTOMMATH_FAST=y"
    105         "CONFIG_IPV6=y"
    106         "CONFIG_LIBNL32=y"
    107         "CONFIG_PKCS12=y"
    108         "CONFIG_RSN_PREAUTH=y"
    109         "CONFIG_TLS=internal"
    110       ];
    111       h = prev.hostapd.overrideAttrs(o: {
    112         extraConfig = "";
    113         configurePhase = ''
    114           cat > hostapd/defconfig <<EOF
    115           ${builtins.concatStringsSep "\n" config}
    116           EOF
    117           ${o.configurePhase}
    118         '';
    119       });
    120     in h.override { openssl = null; sqlite = null; };
    121 
    122   kexec-tools-static = prev.kexec-tools.overrideAttrs(o: {
    123     # For kexecboot we copy kexec into a ramdisk on the system being
    124     # upgraded from. This is more likely to work if kexec is
    125     # statically linked so doesn't have dependencies on store paths that
    126     # may not exist on that machine. (We can't nix-copy-closure as
    127     # the store may not be on a writable filesystem)
    128     LDFLAGS = "-static";
    129 
    130     patches = o.patches ++ [
    131       (fetchpatch {
    132         # merge user command line options into DTB chosen
    133         url = "https://patch-diff.githubusercontent.com/raw/horms/kexec-tools/pull/3.patch";
    134         hash = "sha256-MvlJhuex9dlawwNZJ1sJ33YPWn1/q4uKotqkC/4d2tk=";
    135       })
    136       pkgs/kexec-map-file.patch
    137     ];
    138   });
    139 
    140   luaFull = prev.lua;
    141   inherit lua;
    142 
    143   mtdutils = prev.mtdutils.overrideAttrs(o: {
    144     patches = (if o ? patches then o.patches else []) ++ [
    145       ./pkgs/mtdutils/0001-mkfs.jffs2-add-graft-option.patch
    146     ];
    147   });
    148 
    149   nftables = prev.nftables.overrideAttrs(o: {
    150     configureFlags = [
    151       "--disable-debug"
    152       "--disable-python"
    153       "--with-mini-gmp"
    154       "--without-cli"
    155     ];
    156   });
    157 
    158   openssl = prev.openssl.overrideAttrs (o: {
    159     # we want to apply
    160     # https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20273.patch";
    161     # which disables overriding the -march cflags to the wrong values,
    162     # but openssl is used for bootstrapping so that's easier said than
    163     # done. Do it the ugly way..
    164     postPatch =
    165       o.postPatch
    166       + (with final;
    167         lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform)
    168           "\nsed -i.bak 's/linux.*-mips/linux-mops/' Configure\n");
    169   });
    170 
    171   pppBuild = prev.ppp;
    172 
    173   qemuLim = let q = prev.qemu.overrideAttrs (o: {
    174     patches = o.patches ++ [
    175       ./pkgs/qemu/arm-image-friendly-load-addr.patch
    176     ];
    177   }); in q.override { nixosTestRunner = true; sdlSupport = false; };
    178 
    179   rsyncSmall =
    180     let r = prev.rsync.overrideAttrs(o: {
    181           configureFlags = o.configureFlags ++ [
    182             "--disable-openssl"
    183           ];
    184         });
    185     in r.override { openssl = null; };
    186 
    187 
    188   inherit s6;
    189   s6-linux-init = prev.s6-linux-init.override {
    190     skawarePackages = prev.skawarePackages // {
    191       inherit s6;
    192     };
    193   };
    194   s6-rc = prev.s6-rc.override {
    195     skawarePackages = prev.skawarePackages // {
    196       inherit s6;
    197     };
    198   };
    199 
    200   strace = prev.strace.override { libunwind = null; };
    201 
    202   ubootQemuAarch64 = final.buildUBoot {
    203     defconfig = "qemu_arm64_defconfig";
    204     extraMeta.platforms = ["aarch64-linux"];
    205     filesToInstall = ["u-boot.bin"];
    206   };
    207 
    208   ubootQemuArm = final.buildUBoot {
    209     defconfig = "qemu_arm_defconfig";
    210     extraMeta.platforms = ["armv7l-linux"];
    211     filesToInstall = ["u-boot.bin"];
    212     extraConfig = ''
    213       CONFIG_CMD_UBI=y
    214       CONFIG_CMD_UBIFS=y
    215       CONFIG_BOOTSTD=y
    216       CONFIG_BOOTMETH_DISTRO=y
    217       CONFIG_LZMA=y
    218       CONFIG_CMD_LZMADEC=y
    219       CONFIG_SYS_BOOTM_LEN=0x1000000
    220     '';
    221   };
    222 
    223   ubootQemuMips = final.buildUBoot {
    224     defconfig = "malta_defconfig";
    225     extraMeta.platforms = ["mips-linux"];
    226     filesToInstall = ["u-boot.bin"];
    227     # define the prompt to be the same as arm{32,64} so
    228     # we can use the same expect script for both
    229     extraPatches = [ ./pkgs/u-boot/0002-virtio-init-for-malta.patch ];
    230     extraConfig = ''
    231       CONFIG_SYS_PROMPT="=> "
    232       CONFIG_VIRTIO=y
    233       CONFIG_AUTOBOOT=y
    234       CONFIG_DM_PCI=y
    235       CONFIG_VIRTIO_PCI=y
    236       CONFIG_VIRTIO_NET=y
    237       CONFIG_VIRTIO_BLK=y
    238       CONFIG_VIRTIO_MMIO=y
    239       CONFIG_QFW_MMIO=y
    240       CONFIG_FIT=y
    241       CONFIG_LZMA=y
    242       CONFIG_CMD_LZMADEC=y
    243       CONFIG_SYS_BOOTM_LEN=0x1000000
    244       CONFIG_SYS_MALLOC_LEN=0x400000
    245       CONFIG_MIPS_BOOT_FDT=y
    246       CONFIG_OF_LIBFDT=y
    247       CONFIG_OF_STDOUT_VIA_ALIAS=y
    248    '';
    249   };
    250 
    251   util-linux-small = prev.util-linux.override {
    252     ncursesSupport = false;
    253     pamSupport = false;
    254     systemdSupport = false;
    255     nlsSupport = false;
    256     translateManpages = false;
    257     capabilitiesSupport = false;
    258   };
    259 
    260 }