liminix

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

overlay.nix (7620B)


      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 
     54   btrfs-progs = prev.btrfs-progs.override {
     55     udevSupport = false;
     56     udev = null;
     57   };
     58 
     59   chrony =
     60     let chrony' = prev.chrony.overrideAttrs(o: {
     61           configureFlags = [
     62             "--chronyvardir=$(out)/var/lib/chrony"
     63             "--disable-readline"
     64             "--disable-editline"
     65           ];
     66         });
     67     in chrony'.override {
     68       gnutls = null;
     69       nss = null;
     70       nspr = null;
     71       readline = null;
     72       libedit = null;
     73       libseccomp = null;
     74       # should texinfo be in nativeBuildInputs instead of
     75       # buildInputs?
     76       texinfo = null;
     77 
     78     };
     79 
     80 
     81   dnsmasq =
     82     let d =  prev.dnsmasq.overrideAttrs(o: {
     83           preBuild =  ''
     84               makeFlagsArray=("COPTS=")
     85           '';
     86         });
     87     in d.override {
     88       dbusSupport = false;
     89       nettle = null;
     90     };
     91 
     92   dropbear = prev.dropbear.overrideAttrs (o: {
     93     postPatch = ''
     94      (echo '#define DSS_PRIV_FILENAME "/run/dropbear/dropbear_dss_host_key"'
     95       echo '#define RSA_PRIV_FILENAME "/run/dropbear/dropbear_rsa_host_key"'
     96       echo '#define ECDSA_PRIV_FILENAME "/run/dropbear/dropbear_ecdsa_host_key"'
     97       echo '#define ED25519_PRIV_FILENAME "/run/dropbear/dropbear_ed25519_host_key"') > localoptions.h
     98     '';
     99   });
    100 
    101   hostapd =
    102     let
    103       config =  [
    104         "CONFIG_DRIVER_NL80211=y"
    105         "CONFIG_IAPP=y"
    106         "CONFIG_IEEE80211AC=y"
    107         "CONFIG_IEEE80211AX=y"
    108         "CONFIG_IEEE80211N=y"
    109         "CONFIG_IEEE80211W=y"
    110         "CONFIG_INTERNAL_LIBTOMMATH=y"
    111         "CONFIG_INTERNAL_LIBTOMMATH_FAST=y"
    112         "CONFIG_IPV6=y"
    113         "CONFIG_LIBNL32=y"
    114         "CONFIG_PKCS12=y"
    115         "CONFIG_RSN_PREAUTH=y"
    116         "CONFIG_TLS=internal"
    117       ];
    118       h = prev.hostapd.overrideAttrs(o: {
    119         extraConfig = "";
    120         configurePhase = ''
    121           cat > hostapd/defconfig <<EOF
    122           ${builtins.concatStringsSep "\n" config}
    123           EOF
    124           ${o.configurePhase}
    125         '';
    126       });
    127     in h.override { openssl = null; sqlite = null; };
    128 
    129   kexec-tools-static = prev.kexec-tools.overrideAttrs(o: {
    130     # For kexecboot we copy kexec into a ramdisk on the system being
    131     # upgraded from. This is more likely to work if kexec is
    132     # statically linked so doesn't have dependencies on store paths that
    133     # may not exist on that machine. (We can't nix-copy-closure as
    134     # the store may not be on a writable filesystem)
    135     LDFLAGS = "-static";
    136 
    137     patches = o.patches ++ [
    138       (fetchpatch {
    139         # merge user command line options into DTB chosen
    140         url = "https://patch-diff.githubusercontent.com/raw/horms/kexec-tools/pull/3.patch";
    141         hash = "sha256-MvlJhuex9dlawwNZJ1sJ33YPWn1/q4uKotqkC/4d2tk=";
    142       })
    143       pkgs/kexec-map-file.patch
    144     ];
    145   });
    146 
    147   luaFull = prev.lua;
    148   inherit lua;
    149 
    150   mtdutils = prev.mtdutils.overrideAttrs(o: {
    151     patches = (if o ? patches then o.patches else []) ++ [
    152       ./pkgs/mtdutils/0001-mkfs.jffs2-add-graft-option.patch
    153     ];
    154   });
    155 
    156   nftables = prev.nftables.overrideAttrs(o: {
    157     configureFlags = [
    158       "--disable-debug"
    159       "--disable-python"
    160       "--with-mini-gmp"
    161       "--without-cli"
    162     ];
    163   });
    164 
    165   openssl = prev.openssl.overrideAttrs (o: {
    166     # we want to apply
    167     # https://patch-diff.githubusercontent.com/raw/openssl/openssl/pull/20273.patch";
    168     # which disables overriding the -march cflags to the wrong values,
    169     # but openssl is used for bootstrapping so that's easier said than
    170     # done. Do it the ugly way..
    171     postPatch =
    172       o.postPatch
    173       + (with final;
    174         lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform)
    175           "\nsed -i.bak 's/linux.*-mips/linux-mops/' Configure\n");
    176   });
    177 
    178   pppBuild = prev.ppp;
    179 
    180   qemuLim = let q = prev.qemu.overrideAttrs (o: {
    181     patches = o.patches ++ [
    182       ./pkgs/qemu/arm-image-friendly-load-addr.patch
    183     ];
    184   }); in q.override { nixosTestRunner = true; sdlSupport = false; };
    185 
    186   rsyncSmall =
    187     let r = prev.rsync.overrideAttrs(o: {
    188           configureFlags = o.configureFlags ++ [
    189             "--disable-openssl"
    190           ];
    191         });
    192     in r.override { openssl = null; };
    193 
    194 
    195   inherit s6;
    196   s6-linux-init = prev.s6-linux-init.override {
    197     skawarePackages = prev.skawarePackages // {
    198       inherit s6;
    199     };
    200   };
    201   s6-rc = prev.s6-rc.override {
    202     skawarePackages = prev.skawarePackages // {
    203       inherit s6;
    204     };
    205   };
    206 
    207   strace = prev.strace.override { libunwind = null; };
    208 
    209   ubootQemuAarch64 = final.buildUBoot {
    210     defconfig = "qemu_arm64_defconfig";
    211     extraMeta.platforms = ["aarch64-linux"];
    212     filesToInstall = ["u-boot.bin"];
    213   };
    214 
    215   ubootQemuArm = final.buildUBoot {
    216     defconfig = "qemu_arm_defconfig";
    217     extraMeta.platforms = ["armv7l-linux"];
    218     filesToInstall = ["u-boot.bin"];
    219     extraConfig = ''
    220       CONFIG_CMD_UBI=y
    221       CONFIG_CMD_UBIFS=y
    222       CONFIG_BOOTSTD=y
    223       CONFIG_BOOTMETH_DISTRO=y
    224       CONFIG_LZMA=y
    225       CONFIG_CMD_LZMADEC=y
    226       CONFIG_SYS_BOOTM_LEN=0x1000000
    227     '';
    228   };
    229 
    230   ubootQemuMips = final.buildUBoot {
    231     defconfig = "malta_defconfig";
    232     extraMeta.platforms = ["mips-linux"];
    233     filesToInstall = ["u-boot.bin"];
    234     # define the prompt to be the same as arm{32,64} so
    235     # we can use the same expect script for both
    236     extraPatches = [ ./pkgs/u-boot/0002-virtio-init-for-malta.patch ];
    237     extraConfig = ''
    238       CONFIG_SYS_PROMPT="=> "
    239       CONFIG_VIRTIO=y
    240       CONFIG_AUTOBOOT=y
    241       CONFIG_DM_PCI=y
    242       CONFIG_VIRTIO_PCI=y
    243       CONFIG_VIRTIO_NET=y
    244       CONFIG_VIRTIO_BLK=y
    245       CONFIG_VIRTIO_MMIO=y
    246       CONFIG_QFW_MMIO=y
    247       CONFIG_FIT=y
    248       CONFIG_LZMA=y
    249       CONFIG_CMD_LZMADEC=y
    250       CONFIG_SYS_BOOTM_LEN=0x1000000
    251       CONFIG_SYS_MALLOC_LEN=0x400000
    252       CONFIG_MIPS_BOOT_FDT=y
    253       CONFIG_OF_LIBFDT=y
    254       CONFIG_OF_STDOUT_VIA_ALIAS=y
    255    '';
    256   };
    257 
    258   util-linux-small = prev.util-linux.override {
    259     ncursesSupport = false;
    260     pamSupport = false;
    261     systemdSupport = false;
    262     nlsSupport = false;
    263     translateManpages = false;
    264     capabilitiesSupport = false;
    265   };
    266 
    267 }