@@ -118,6 +118,56 @@ func TestJsonifyConfigPackages(t *testing.T) {
118
118
},
119
119
},
120
120
},
121
+ {
122
+ name : "map-with-platforms-and-excluded-platforms-local-flake" ,
123
+ jsonConfig : `{"packages":{"path:my-php-flake#hello":{"version":"latest",` +
124
+ `"platforms":["x86_64-darwin","aarch64-linux"],` +
125
+ `"excluded_platforms":["x86_64-linux"]}}}` ,
126
+ expected : Packages {
127
+ jsonKind : jsonMap ,
128
+ Collection : []Package {
129
+ NewPackage ("path:my-php-flake#hello" , map [string ]any {
130
+ "version" : "latest" ,
131
+ "platforms" : []string {"x86_64-darwin" , "aarch64-linux" },
132
+ "excluded_platforms" : []string {"x86_64-linux" },
133
+ }),
134
+ },
135
+ },
136
+ },
137
+ {
138
+ name : "map-with-platforms-and-excluded-platforms-remote-flake" ,
139
+ jsonConfig : `{"packages":{"github:F1bonacc1/process-compose/v0.43.1":` +
140
+ `{"version":"latest",` +
141
+ `"platforms":["x86_64-darwin","aarch64-linux"],` +
142
+ `"excluded_platforms":["x86_64-linux"]}}}` ,
143
+ expected : Packages {
144
+ jsonKind : jsonMap ,
145
+ Collection : []Package {
146
+ NewPackage ("github:F1bonacc1/process-compose/v0.43.1" , map [string ]any {
147
+ "version" : "latest" ,
148
+ "platforms" : []string {"x86_64-darwin" , "aarch64-linux" },
149
+ "excluded_platforms" : []string {"x86_64-linux" },
150
+ }),
151
+ },
152
+ },
153
+ },
154
+ {
155
+ name : "map-with-platforms-and-excluded-platforms-nixpkgs-reference" ,
156
+ jsonConfig : `{"packages":{"github:nixos/nixpkgs/5233fd2ba76a3accb5aaa999c00509a11fd0793c#hello":` +
157
+ `{"version":"latest",` +
158
+ `"platforms":["x86_64-darwin","aarch64-linux"],` +
159
+ `"excluded_platforms":["x86_64-linux"]}}}` ,
160
+ expected : Packages {
161
+ jsonKind : jsonMap ,
162
+ Collection : []Package {
163
+ NewPackage ("github:nixos/nixpkgs/5233fd2ba76a3accb5aaa999c00509a11fd0793c#hello" , map [string ]any {
164
+ "version" : "latest" ,
165
+ "platforms" : []string {"x86_64-darwin" , "aarch64-linux" },
166
+ "excluded_platforms" : []string {"x86_64-linux" },
167
+ }),
168
+ },
169
+ },
170
+ },
121
171
}
122
172
123
173
for _ , testCase := range testCases {
@@ -195,6 +245,24 @@ func TestParseVersionedName(t *testing.T) {
195
245
expectedName : "emacsPackages.@" ,
196
246
expectedVersion : "" ,
197
247
},
248
+ {
249
+ name : "local-flake" ,
250
+ input : "path:my-php-flake#hello" ,
251
+ expectedName : "path:my-php-flake#hello" ,
252
+ expectedVersion : "" ,
253
+ },
254
+ {
255
+ name : "remote-flake" ,
256
+ input : "github:F1bonacc1/process-compose/v0.43.1" ,
257
+ expectedName : "github:F1bonacc1/process-compose/v0.43.1" ,
258
+ expectedVersion : "" ,
259
+ },
260
+ {
261
+ name : "nixpkgs-reference" ,
262
+ input : "github:nixos/nixpkgs/5233fd2ba76a3accb5aaa999c00509a11fd0793c#hello" ,
263
+ expectedName : "github:nixos/nixpkgs/5233fd2ba76a3accb5aaa999c00509a11fd0793c#hello" ,
264
+ expectedVersion : "" ,
265
+ },
198
266
}
199
267
200
268
for _ , testCase := range testCases {
0 commit comments