about summary refs log tree commit diff
path: root/pkgs/os-specific/bsd/netbsd/default.nix
blob: fd5e24aa7102a9b7fa60e9158dd15cbe3718e31b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
{ stdenv, lib, stdenvNoCC
, makeScopeWithSplicing', generateSplicesForMkScope
, buildPackages
, fetchcvs
}:

makeScopeWithSplicing' {
  otherSplices = generateSplicesForMkScope "netbsd";
  f = (self: lib.packagesFromDirectoryRecursive {
    callPackage = self.callPackage;
    directory = ./pkgs;
  } // (let inherit (self) mkDerivation; in {

    fetchNetBSD = path: version: sha256: fetchcvs {
      cvsRoot = ":pserver:anoncvs@anoncvs.NetBSD.org:/cvsroot";
      module = "src/${path}";
      inherit sha256;
      tag = "netbsd-${lib.replaceStrings ["."] ["-"] version}-RELEASE";
    };

    defaultMakeFlags = [
      "MKSOFTFLOAT=${if stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft"
        then "yes"
        else "no"}"
    ];

    compatIfNeeded = lib.optional (!stdenvNoCC.hostPlatform.isNetBSD) self.compat;

    # The manual callPackages below should in principle be unnecessary because
    # they're just selecting arguments that would be selected anyway. However,
    # if we don't perform these manual calls, we get infinite recursion issues
    # because of the splices.

    mkDerivation = self.callPackage ./pkgs/mkDerivation.nix {
      inherit stdenv stdenvNoCC;
      inherit (buildPackages.netbsd) netbsdSetupHook makeMinimal install tsort lorder;
      inherit (buildPackages) mandoc;
      inherit (buildPackages.buildPackages) rsync;

    };

    makeMinimal = self.callPackage ./pkgs/makeMinimal.nix {
      inherit (self) make;
    };

    compat = self.callPackage ./pkgs/compat/package.nix {
      inherit (buildPackages) coreutils;
      inherit (buildPackages.darwin) cctools-port;
      inherit (buildPackages.buildPackages) rsync;
      inherit (buildPackages.netbsd) makeMinimal;
      inherit (self) install include libc libutil;
    };

    install = self.callPackage ./pkgs/install/package.nix {
      inherit (self) fts mtree make compatIfNeeded;
      inherit (buildPackages.buildPackages) rsync;
      inherit (buildPackages.netbsd) makeMinimal;
    };

    # See note in pkgs/stat/package.nix
    stat = self.callPackage ./pkgs/stat/package.nix {
      inherit (buildPackages.netbsd) makeMinimal install;
      inherit (buildPackages.buildPackages) rsync;
    };

    # See note in pkgs/stat/hook.nix
    statHook = self.callPackage ./pkgs/stat/hook.nix {
      inherit (self) stat;
    };

    tsort = self.callPackage ./pkgs/tsort.nix {
      inherit (buildPackages.netbsd) makeMinimal install;
      inherit (buildPackages.buildPackages) rsync;
    };

    lorder = self.callPackage ./pkgs/lorder.nix {
      inherit (buildPackages.netbsd) makeMinimal install;
      inherit (buildPackages.buildPackages) rsync;
    };

    config = self.callPackage ./pkgs/config.nix {
      inherit (buildPackages.netbsd) makeMinimal install;
      inherit (buildPackages.buildPackages) rsync;
      inherit (self) cksum;
    };

    include = self.callPackage ./pkgs/include.nix {
      inherit (buildPackages.netbsd)
        makeMinimal install nbperf rpcgen;
      inherit (buildPackages) stdenv;
      inherit (buildPackages.buildPackages) rsync;
    };

    sys-headers = self.callPackage ./pkgs/sys/headers.nix {
      inherit (buildPackages.netbsd)
        makeMinimal install tsort lorder statHook uudecode config genassym;
      inherit (buildPackages.buildPackages) rsync;
    };

    libutil = self.callPackage ./pkgs/libutil.nix {
      inherit (self) libc sys;
    };

    libpthread-headers = self.callPackage ./pkgs/libpthread/headers.nix { };

    csu = self.callPackage ./pkgs/csu.nix {
      inherit (self) headers sys ld_elf_so;
      inherit (buildPackages.netbsd)
        netbsdSetupHook
        makeMinimal
        install
        genassym gencat lorder tsort statHook;
      inherit (buildPackages.buildPackages) rsync;
    };

    _mainLibcExtraPaths = with self; [
        common i18n_module.src sys.src
        ld_elf_so.src libpthread.src libm.src libresolv.src
        librpcsvc.src libutil.src librt.src libcrypt.src
    ];

    libc = self.callPackage ./pkgs/libc.nix {
      inherit (self) headers csu librt;
      inherit (buildPackages.netbsd)
        netbsdSetupHook
        makeMinimal
        install
        genassym gencat lorder tsort statHook rpcgen;
      inherit (buildPackages.buildPackages) rsync;
    };

    mtree = self.callPackage ./pkgs/mtree.nix {
      inherit (self) mknod;
    };

  }));
}