Distro for Linux for WebAssembly
at main 78 lines 2.2 kB view raw
1{ 2 description = "Packages for Linux on WebAssembly"; 3 4 inputs = { 5 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 6 # keep-sorted start block=yes 7 flake-parts = { 8 url = "github:hercules-ci/flake-parts"; 9 inputs.nixpkgs-lib.follows = "nixpkgs"; 10 }; 11 git-hooks = { 12 url = "github:cachix/git-hooks.nix"; 13 inputs.nixpkgs.follows = "nixpkgs"; 14 }; 15 make-shell = { 16 url = "github:nicknovitski/make-shell"; 17 }; 18 treefmt-nix = { 19 url = "github:numtide/treefmt-nix"; 20 inputs.nixpkgs.follows = "nixpkgs"; 21 }; 22 # keep-sorted end 23 }; 24 25 nixConfig = { 26 extra-substituters = [ "https://linuxwasm.cachix.org" ]; 27 extra-trusted-public-keys = [ 28 "linuxwasm.cachix.org-1:+z2SehaESo/3sYp7afTgyXBHUkSj/Y+BokzAkWZEmeM=" 29 ]; 30 }; 31 32 outputs = 33 inputs: 34 inputs.flake-parts.lib.mkFlake { inherit inputs; } { 35 imports = [ 36 # keep-sorted start 37 ./flake/apps.nix 38 ./flake/format.nix 39 ./flake/git-hooks.nix 40 ./flake/shell.nix 41 # keep-sorted end 42 ]; 43 44 systems = [ 45 "x86_64-linux" 46 "aarch64-linux" 47 "x86_64-darwin" 48 "aarch64-darwin" 49 ]; 50 51 perSystem = 52 { 53 pkgs, 54 system, 55 config, 56 lib, 57 ... 58 }: 59 { 60 # For better or for worse, nixpkgs has established the pattern of 61 # a legacyPackages attribute that does not contain legacy packages at all, 62 # but rather an attribute set that's just not the shape of the typical packages attribute. 63 # In our case, we have a handful of non-package attributes that we still want to expose under the pkgs object. 64 legacyPackages = import ./all-packages.nix { 65 inherit (inputs.nixpkgs) lib; 66 currentSystem = system; 67 hostpkgs = import ./host-packages.nix { 68 inherit pkgs; 69 wasmpkgs = config.legacyPackages; 70 }; 71 }; 72 73 # and then expose a filtered version of that attribute set with just the actual packages. 74 packages = lib.filterAttrs (_name: value: value ? drvPath) config.legacyPackages; 75 checks = config.packages; 76 }; 77 }; 78}