From fd500041fa5d6824e54472368eed3bca37bf6562 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Fri, 3 Mar 2023 22:20:59 +0000 Subject: [PATCH] move new packages to pkgs/default.nix --- overlay.nix | 65 ++++-------------------------------- pkgs/default.nix | 40 ++++++++++++++++++++++ pkgs/lzma/default.nix | 13 ++++++++ pkgs/service-fns/default.nix | 10 ++++++ 4 files changed, 70 insertions(+), 58 deletions(-) create mode 100644 pkgs/default.nix create mode 100644 pkgs/lzma/default.nix create mode 100644 pkgs/service-fns/default.nix diff --git a/overlay.nix b/overlay.nix index 7ec77e4..a0662c8 100644 --- a/overlay.nix +++ b/overlay.nix @@ -1,17 +1,8 @@ -final: prev: { - pseudofile = final.callPackage ./pkgs/pseudofile {}; +final: prev: +let extraPkgs = import ./pkgs/default.nix { inherit (final) callPackage; }; +in +extraPkgs // { strace = prev.strace.override { libunwind = null; }; - liminix = { - services = final.callPackage ./pkgs/liminix-tools/services {}; - networking = final.callPackage ./pkgs/liminix-tools/networking {}; - builders = { - squashfs = final.callPackage ./pkgs/liminix-tools/builders/squashfs.nix {}; - kernel = final.callPackage ./pkgs/kernel {}; - }; - }; - writeAshScript = final.callPackage ./pkgs/write-ash-script {}; - s6-init-bin = final.callPackage ./pkgs/s6-init-bin {}; - s6-rc-database = final.callPackage ./pkgs/s6-rc-database {}; dnsmasq = let d = prev.dnsmasq.overrideAttrs(o: { @@ -20,15 +11,9 @@ final: prev: { ''; }); in d.override { - dbusSupport = false; - nettle = null; - }; - - mips-vm = final.callPackage ./pkgs/mips-vm {}; - pppoe = final.callPackage ./pkgs/pppoe {}; - - kernel-backport = final.callPackage ./pkgs/kernel-backport {}; - mac80211 = final.callPackage ./pkgs/mac80211 {}; + dbusSupport = false; + nettle = null; + }; pppBuild = prev.ppp; ppp = @@ -68,40 +53,4 @@ final: prev: { ''; postFixup = ""; }); - - - # we need to build real lzma instead of using xz, because the lzma - # decoder in u-boot doesn't understand streaming lzma archives - # ("Stream with EOS marker is not supported") and xz can't create - # non-streaming ones. See - # https://sourceforge.net/p/squashfs/mailman/message/26599379/ - - lzma = final.stdenv.mkDerivation { - pname = "lzma"; - version = "4.32.7"; - configureFlags = [ "--enable-static" "--disable-shared"]; - src = final.buildPackages.fetchurl { - url = "https://tukaani.org/lzma/lzma-4.32.7.tar.gz"; - sha256 = "0b03bdvm388kwlcz97aflpr3ir1zpa3m0bq3s6cd3pp5a667lcwz"; - }; - }; - - netlink-lua = final.callPackage ./pkgs/netlink-lua {}; - ifwait = final.callPackage ./pkgs/ifwait {}; - - serviceFns = final.writeText "service-fns.sh" '' - output() { cat $1/.outputs/$2; } - output_path() { echo $(realpath $1/.outputs)/$2; } - mkoutputs() { - d=/run/service-state/$1 - mkdir -m 2750 -p $d && chown root:system $d - echo $d - } - ''; - - # these are packages for the build system not the host/target - - tufted = final.callPackage ./pkgs/tufted {}; - routeros = final.callPackage ./pkgs/routeros {}; - go-l2tp = final.callPackage ./pkgs/go-l2tp {}; } diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..332bb75 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,40 @@ +{ + callPackage +}: +{ + pseudofile = callPackage ./pseudofile {}; + liminix = { + services = callPackage ./liminix-tools/services {}; + networking = callPackage ./liminix-tools/networking {}; + builders = { + squashfs = callPackage ./liminix-tools/builders/squashfs.nix {}; + kernel = callPackage ./kernel {}; + }; + }; + writeAshScript = callPackage ./write-ash-script {}; + s6-init-bin = callPackage ./s6-init-bin {}; + s6-rc-database = callPackage ./s6-rc-database {}; + mips-vm = callPackage ./mips-vm {}; + pppoe = callPackage ./pppoe {}; + + kernel-backport = callPackage ./kernel-backport {}; + mac80211 = callPackage ./mac80211 {}; + netlink-lua = callPackage ./netlink-lua {}; + ifwait = callPackage ./ifwait {}; + + serviceFns = callPackage ./service-fns {}; + + # these are packages for the build system not the host/target + + tufted = callPackage ./tufted {}; + routeros = callPackage ./routeros {}; + go-l2tp = callPackage ./go-l2tp {}; + + # we need to build real lzma instead of using xz, because the lzma + # decoder in u-boot doesn't understand streaming lzma archives + # ("Stream with EOS marker is not supported") and xz can't create + # non-streaming ones. See + # https://sourceforge.net/p/squashfs/mailman/message/26599379/ + lzma = callPackage ./lzma {}; + +} diff --git a/pkgs/lzma/default.nix b/pkgs/lzma/default.nix new file mode 100644 index 0000000..27210c9 --- /dev/null +++ b/pkgs/lzma/default.nix @@ -0,0 +1,13 @@ +{ + stdenv +, fetchurl +}: +stdenv.mkDerivation { + pname = "lzma"; + version = "4.32.7"; + configureFlags = [ "--enable-static" "--disable-shared"]; + src = fetchurl { + url = "https://tukaani.org/lzma/lzma-4.32.7.tar.gz"; + sha256 = "0b03bdvm388kwlcz97aflpr3ir1zpa3m0bq3s6cd3pp5a667lcwz"; + }; +} diff --git a/pkgs/service-fns/default.nix b/pkgs/service-fns/default.nix new file mode 100644 index 0000000..2c6dd36 --- /dev/null +++ b/pkgs/service-fns/default.nix @@ -0,0 +1,10 @@ +{writeText}: +writeText "service-fns.sh" '' + output() { cat $1/.outputs/$2; } + output_path() { echo $(realpath $1/.outputs)/$2; } + mkoutputs() { + d=/run/service-state/$1 + mkdir -m 2750 -p $d && chown root:system $d + echo $d + } +''