summaryrefslogtreecommitdiffstats
path: root/res/cross-build-2.nix
blob: 722596484a9510cbf89dcde9c1cea5a94f2c18dc (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
# This one is much better than the first
#
# TODO: get `nix build -f cross-build-2.nix vm` to work

{ nixos ? import <unstable/nixos>, ... }:

let
  # https://github.com/NixOS/nixpkgs/blob/master/lib/systems/examples.nix
  target = "armv7l-unknown-linux-gnueabihf";

  configuration = { lib, ... }:
  {
    nixpkgs.crossSystem = lib.systems.elaborate { config = target; };
    nixpkgs.overlays = with lib; singleton (const (super: {
      polkit = super.polkit.override { withGnome = false; };

      # pkcs11 needs opensc which depends on libXt? which fails to build and is X library
      rng-tools = super.rng-tools.override { withPkcs11 = false; };

      nix = super.nix.override { withAWS = false; };

      gobject-introspection = super.callPackage /tmp/gobject-introspection.nix { inherit (darwin) cctools; };
    }));


    environment.noXlibs = true;
    documentation.enable = false;

    # btrfs-progs fails to build
    services.udisks2.enable = false;

    fonts.fontconfig.enable = false;

    fileSystems."/".fsType = "tmpfs";

    boot = {
      loader.grub.enable = false;
      enableContainers = false;
      hardwareScan = false;
    };

    powerManagement.enable = false;
  };

in
  nixos { inherit configuration; }