|
19 | 19 | eachDefaultSystem = |
20 | 20 | perSystem: |
21 | 21 | lib.pipe |
22 | | - [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ] |
| 22 | + [ |
| 23 | + "x86_64-linux" |
| 24 | + "x86_64-darwin" |
| 25 | + "aarch64-linux" |
| 26 | + "aarch64-darwin" |
| 27 | + ] |
23 | 28 | [ |
24 | 29 | (map (sys: builtins.mapAttrs (_: value: { ${sys} = value; }) (perSystem sys))) |
25 | | - (builtins.foldl' nixpkgs.lib.recursiveUpdate { }) |
| 30 | + (builtins.foldl' lib.recursiveUpdate { }) |
26 | 31 | ]; |
27 | 32 | in |
28 | 33 | eachDefaultSystem ( |
|
36 | 41 | }; |
37 | 42 | in |
38 | 43 | { |
39 | | - packages = { |
40 | | - inherit (pkgs) |
41 | | - purs |
42 | | - purs-unstable |
43 | | - spago |
44 | | - spago-unstable |
45 | | - purs-tidy |
46 | | - purs-tidy-unstable |
47 | | - purs-backend-es |
48 | | - purs-backend-es-unstable |
49 | | - purescript-language-server |
50 | | - purescript-language-server-unstable |
51 | | - ; |
52 | | - } |
53 | | - // pkgs.purs-bin |
54 | | - // pkgs.spago-bin |
55 | | - // pkgs.purs-tidy-bin |
56 | | - // pkgs.purs-backend-es-bin |
57 | | - // pkgs.purescript-language-server-bin; |
| 44 | + # Filter out null values (packages unavailable on this system) |
| 45 | + packages = lib.filterAttrs (_: v: v != null) ( |
| 46 | + { |
| 47 | + inherit (pkgs) |
| 48 | + purs |
| 49 | + purs-unstable |
| 50 | + spago |
| 51 | + spago-unstable |
| 52 | + purs-tidy |
| 53 | + purs-tidy-unstable |
| 54 | + purs-backend-es |
| 55 | + purs-backend-es-unstable |
| 56 | + purescript-language-server |
| 57 | + purescript-language-server-unstable |
| 58 | + ; |
| 59 | + } |
| 60 | + // pkgs.purs-bin |
| 61 | + // pkgs.spago-bin |
| 62 | + // pkgs.purs-tidy-bin |
| 63 | + // pkgs.purs-backend-es-bin |
| 64 | + // pkgs.purescript-language-server-bin |
| 65 | + ); |
58 | 66 |
|
59 | 67 | apps = |
60 | 68 | let |
|
64 | 72 | meta = bin.meta or { }; |
65 | 73 | }; |
66 | 74 | in |
67 | | - pkgs.lib.mapAttrs (_: mkApp) self.packages.${system}; |
| 75 | + lib.mapAttrs (_: mkApp) self.packages.${system}; |
68 | 76 |
|
69 | 77 | checks = |
70 | 78 | let |
71 | | - package-checks = |
72 | | - lib.mapAttrs |
73 | | - ( |
74 | | - key: bin: |
75 | | - let |
76 | | - name = bin.pname or bin.name; |
77 | | - version = bin.version or "0.0.0"; |
78 | | - in |
79 | | - pkgs.runCommand "test-${name}-${version}" { } '' |
80 | | - touch $out |
81 | | - set -e |
82 | | - set -x |
83 | | -
|
84 | | - # Some package versions are not supported on some systems, ie. the |
85 | | - # "stable" version of Spago is not supported on aarch64. |
86 | | - if [ ${builtins.toString (builtins.hasAttr "unsupported" bin)} ]; then |
87 | | - echo "Skipping ${bin.name} because it is not supported on ${system}" |
88 | | - exit 0 |
89 | | - fi |
| 79 | + package-checks = lib.mapAttrs ( |
| 80 | + _: bin: |
| 81 | + let |
| 82 | + name = bin.pname or bin.name; |
| 83 | + version = bin.version or "0.0.0"; |
| 84 | + in |
| 85 | + pkgs.runCommand "test-${name}-${version}" { } '' |
| 86 | + touch $out |
| 87 | + set -e |
| 88 | + set -x |
90 | 89 |
|
91 | | - # Different packages at different versions use different 'version' |
92 | | - # flags to print their version |
93 | | - if [ ${builtins.toString (name == "spago" && pkgs.lib.versionOlder version "0.90.0")} ]; then |
94 | | - VERSION="$(${lib.getExe bin} version --global-cache skip)" |
95 | | - # [email protected] incorrectly reports its version |
96 | | - elif [ ${builtins.toString (name == "spago" && version == "0.93.21")} ]; then |
97 | | - VERSION="0.93.21" |
98 | | - else |
99 | | - # spago-next writes --version to stderr, oddly enough, so we need to |
100 | | - # capture both in the VERSION var. |
101 | | - VERSION="$(${lib.getExe bin} --version 2>&1)" |
102 | | - fi |
| 90 | + # Different packages at different versions use different 'version' |
| 91 | + # flags to print their version |
| 92 | + if [ ${builtins.toString (name == "spago" && lib.versionOlder version "0.90.0")} ]; then |
| 93 | + VERSION="$(${lib.getExe bin} version --global-cache skip)" |
| 94 | + # [email protected] incorrectly reports its version |
| 95 | + elif [ ${builtins.toString (name == "spago" && version == "0.93.21")} ]; then |
| 96 | + VERSION="0.93.21" |
| 97 | + else |
| 98 | + # spago-next writes --version to stderr, oddly enough, so we need to |
| 99 | + # capture both in the VERSION var. |
| 100 | + VERSION="$(${lib.getExe bin} --version 2>&1)" |
| 101 | + fi |
103 | 102 |
|
104 | | - # purs-tidy includes a 'v' prefix in its output beginning with version 0.9.0 |
105 | | - if [ ${builtins.toString (name == "purs-tidy" && !(pkgs.lib.versionOlder version "0.9.0"))} ]; then |
106 | | - EXPECTED_VERSION="v${version}" |
107 | | - # purs-backend-es always includes it |
108 | | - elif [ ${builtins.toString (name == "purs-backend-es")} ]; then |
109 | | - EXPECTED_VERSION="v${version}" |
110 | | - else |
111 | | - EXPECTED_VERSION="${version}" |
112 | | - fi |
| 103 | + # purs-tidy includes a 'v' prefix in its output beginning with version 0.9.0 |
| 104 | + if [ ${builtins.toString (name == "purs-tidy" && !(lib.versionOlder version "0.9.0"))} ]; then |
| 105 | + EXPECTED_VERSION="v${version}" |
| 106 | + # purs-backend-es always includes it |
| 107 | + elif [ ${builtins.toString (name == "purs-backend-es")} ]; then |
| 108 | + EXPECTED_VERSION="v${version}" |
| 109 | + else |
| 110 | + EXPECTED_VERSION="${version}" |
| 111 | + fi |
113 | 112 |
|
114 | | - echo "$VERSION should match expected output $EXPECTED_VERSION" |
115 | | - test "$VERSION" = "$EXPECTED_VERSION" |
116 | | - '' |
117 | | - ) |
118 | | - # TODO: Remove once the purescript build of spago is stable |
119 | | - ( |
120 | | - pkgs.lib.filterAttrs (k: v: !(k == "spago" && system == "aarch64-darwin")) self.packages.${system} |
121 | | - ); |
| 113 | + echo "$VERSION should match expected output $EXPECTED_VERSION" |
| 114 | + test "$VERSION" = "$EXPECTED_VERSION" |
| 115 | + '' |
| 116 | + ) (lib.filterAttrs (k: _: !(k == "spago" && system == "aarch64-darwin")) self.packages.${system}); |
| 117 | + # TODO: Remove filter once the purescript build of spago is stable on aarch64-darwin |
122 | 118 |
|
123 | 119 | format-checks = { |
124 | 120 | nix-format = |
|
0 commit comments