rec { overlays = [ # Make buildGoModules use static compilation by default (final: prev: let buildArgs = { doCheck = false; CGO_ENABLED=0; tags = [ "netgo" "timetzdata" ]; ldflags = [ "-w" "-extldflags=-static" ]; }; in { buildGoModule = args: prev.buildGoModule (buildArgs // args); }) # for whatever reason git checks fail when flake is being used (or maybe # it's crossSystem's fault) (final: prev: { git = prev.git.overrideAttrs (oldAttrs: { installCheckPhase = '' # noop ''; }); }) ]; version = "22.11"; rev = "ce20e9ebe1903ea2ba1ab006ec63093020c761cb"; src = fetchTarball { name = "nixpkgs-${version}"; url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; sha256 = "sha256-eFNm2h6fNbgD7ZpO4MHikCB5pSnCJ7DTmwPisjetmwc="; }; supportedSystems = [ "x86_64-linux" "aarch64-linux" #"armv7l-linux-musl" # rpi, I think? "i686-linux" ]; default = { buildSystem, hostSystem ? buildSystem, }: import src ({ inherit overlays; system = buildSystem; } // (if buildSystem == hostSystem then {} else { # The nixpkgs cache doesn't have any packages where cross-compiling has been # enabled, even if the target platform is actually the same as the build # platform (and therefore it's not really cross-compiling). So we only set # up the cross-compiling config if the target platform is different. crossSystem.config = hostSystem; })); }