aboutsummaryrefslogtreecommitdiff
path: root/nixos/modules/compile.nix
blob: 6a6b7b265707e9cee4108d2d039e5231d7dbfea2 (plain)
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
{
  config,
  lib,
  pkgs,
  ...
}:
with lib; {
  options = {
    cynerd.compile = mkOption {
      type = types.bool;
      default = false;
      description = "If machine is about to be used for compilation.";
    };
  };

  config = mkIf config.cynerd.compile {
    nix.settings = {
      max-jobs = 32;
      cores = 0;
    };
    boot.binfmt.registrations = {
      aarch64-linux = {
        fixBinary = true;
        wrapInterpreterInShell = false;
        interpreter = (lib.systems.elaborate {system = "aarch64-linux";}).emulator pkgs;
        magicOrExtension = "\\x7fELF\\x02\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\xb7\\x00";
        mask = "\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xfe\\xff\\xff\\xff";
      };
      armv7l-linux = {
        fixBinary = true;
        wrapInterpreterInShell = false;
        interpreter = (lib.systems.elaborate {system = "armv7l-linux";}).emulator pkgs;
        magicOrExtension = "\\x7fELF\\x01\\x01\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x28\\x00";
        mask = "\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xff\\xff\\xff\\xff\\xff\\x00\\xff\\xfe\\xff\\xff\\xff";
      };
    };
    nix.settings.extra-platforms = [
      "aarch64-linux"
      "armv7l-linux"
    ];

    environment.systemPackages = with pkgs; [
      # Tools
      git
      bash
      #uroot
      qemu

      # Python
      python3Packages.pip
    ];
  };
}