···313314## Option collision
315checkConfigError \
316- 'The option .set. in module .*/declare-set.nix. would be a parent of the following options, but its type .attribute set of signed integers. does not support nested options.\n\s*- option[(]s[)] with prefix .set.enable. in module .*/declare-enable-nested.nix.' \
317 config.set \
318 ./declare-set.nix ./declare-enable-nested.nix
319
···313314## Option collision
315checkConfigError \
316+ 'The option .set. in module .*/declare-set.nix. would be a parent of the following options, but its type .attribute set of signed integer. does not support nested options.\n\s*- option[(]s[)] with prefix .set.enable. in module .*/declare-enable-nested.nix.' \
317 config.set \
318 ./declare-set.nix ./declare-enable-nested.nix
319
+3-3
lib/types.nix
···397398 listOf = elemType: mkOptionType rec {
399 name = "listOf";
400- description = "list of ${elemType.description}s";
401 check = isList;
402 merge = loc: defs:
403 map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
···426427 attrsOf = elemType: mkOptionType rec {
428 name = "attrsOf";
429- description = "attribute set of ${elemType.description}s";
430 check = isAttrs;
431 merge = loc: defs:
432 mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
···449 # error that it's not defined. Use only if conditional definitions don't make sense.
450 lazyAttrsOf = elemType: mkOptionType rec {
451 name = "lazyAttrsOf";
452- description = "lazy attribute set of ${elemType.description}s";
453 check = isAttrs;
454 merge = loc: defs:
455 zipAttrsWith (name: defs:
···397398 listOf = elemType: mkOptionType rec {
399 name = "listOf";
400+ description = "list of ${elemType.description}";
401 check = isList;
402 merge = loc: defs:
403 map (x: x.value) (filter (x: x ? value) (concatLists (imap1 (n: def:
···426427 attrsOf = elemType: mkOptionType rec {
428 name = "attrsOf";
429+ description = "attribute set of ${elemType.description}";
430 check = isAttrs;
431 merge = loc: defs:
432 mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs:
···449 # error that it's not defined. Use only if conditional definitions don't make sense.
450 lazyAttrsOf = elemType: mkOptionType rec {
451 name = "lazyAttrsOf";
452+ description = "lazy attribute set of ${elemType.description}";
453 check = isAttrs;
454 merge = loc: defs:
455 zipAttrsWith (name: defs:
+21-17
nixos/modules/security/wrappers/wrapper.c
···2#include <stdio.h>
3#include <string.h>
4#include <unistd.h>
05#include <sys/types.h>
6#include <sys/stat.h>
7#include <sys/xattr.h>
8#include <fcntl.h>
9#include <dirent.h>
10-#include <assert.h>
11#include <errno.h>
12#include <linux/capability.h>
13#include <sys/prctl.h>
···16#include <syscall.h>
17#include <byteswap.h>
1819-// Make sure assertions are not compiled out, we use them to codify
20-// invariants about this program and we want it to fail fast and
21-// loudly if they are violated.
22-#undef NDEBUG
2324extern char **environ;
25···37#else
38#define LE32_TO_H(x) (x)
39#endif
0000004041int get_last_cap(unsigned *last_cap) {
42 FILE* file = fopen("/proc/sys/kernel/cap_last_cap", "r");
···167}
168169int main(int argc, char **argv) {
0170 char *self_path = NULL;
171 int self_path_size = readlink_malloc("/proc/self/exe", &self_path);
172 if (self_path_size < 0) {
···181 int len = strlen(wrapper_dir);
182 if (len > 0 && '/' == wrapper_dir[len - 1])
183 --len;
184- assert(!strncmp(self_path, wrapper_dir, len));
185- assert('/' == wrapper_dir[0]);
186- assert('/' == self_path[len]);
187188 // Make *really* *really* sure that we were executed as
189 // `self_path', and not, say, as some other setuid program. That
190 // is, our effective uid/gid should match the uid/gid of
191 // `self_path'.
192 struct stat st;
193- assert(lstat(self_path, &st) != -1);
194195- assert(!(st.st_mode & S_ISUID) || (st.st_uid == geteuid()));
196- assert(!(st.st_mode & S_ISGID) || (st.st_gid == getegid()));
197198 // And, of course, we shouldn't be writable.
199- assert(!(st.st_mode & (S_IWGRP | S_IWOTH)));
200201 // Read the path of the real (wrapped) program from <self>.real.
202 char real_fn[PATH_MAX + 10];
203 int real_fn_size = snprintf(real_fn, sizeof(real_fn), "%s.real", self_path);
204- assert(real_fn_size < sizeof(real_fn));
205206 int fd_self = open(real_fn, O_RDONLY);
207- assert(fd_self != -1);
208209 char source_prog[PATH_MAX];
210 len = read(fd_self, source_prog, PATH_MAX);
211- assert(len != -1);
212- assert(len < sizeof(source_prog));
213- assert(len > 0);
214 source_prog[len] = 0;
215216 close(fd_self);
···2#include <stdio.h>
3#include <string.h>
4#include <unistd.h>
5+#include <stdnoreturn.h>
6#include <sys/types.h>
7#include <sys/stat.h>
8#include <sys/xattr.h>
9#include <fcntl.h>
10#include <dirent.h>
011#include <errno.h>
12#include <linux/capability.h>
13#include <sys/prctl.h>
···16#include <syscall.h>
17#include <byteswap.h>
1819+#define ASSERT(expr) ((expr) ? (void) 0 : assert_failure(#expr))
0002021extern char **environ;
22···34#else
35#define LE32_TO_H(x) (x)
36#endif
37+38+static noreturn void assert_failure(const char *assertion) {
39+ fprintf(stderr, "Assertion `%s` in NixOS's wrapper.c failed.\n", assertion);
40+ fflush(stderr);
41+ abort();
42+}
4344int get_last_cap(unsigned *last_cap) {
45 FILE* file = fopen("/proc/sys/kernel/cap_last_cap", "r");
···170}
171172int main(int argc, char **argv) {
173+ ASSERT(argc >= 1);
174 char *self_path = NULL;
175 int self_path_size = readlink_malloc("/proc/self/exe", &self_path);
176 if (self_path_size < 0) {
···185 int len = strlen(wrapper_dir);
186 if (len > 0 && '/' == wrapper_dir[len - 1])
187 --len;
188+ ASSERT(!strncmp(self_path, wrapper_dir, len));
189+ ASSERT('/' == wrapper_dir[0]);
190+ ASSERT('/' == self_path[len]);
191192 // Make *really* *really* sure that we were executed as
193 // `self_path', and not, say, as some other setuid program. That
194 // is, our effective uid/gid should match the uid/gid of
195 // `self_path'.
196 struct stat st;
197+ ASSERT(lstat(self_path, &st) != -1);
198199+ ASSERT(!(st.st_mode & S_ISUID) || (st.st_uid == geteuid()));
200+ ASSERT(!(st.st_mode & S_ISGID) || (st.st_gid == getegid()));
201202 // And, of course, we shouldn't be writable.
203+ ASSERT(!(st.st_mode & (S_IWGRP | S_IWOTH)));
204205 // Read the path of the real (wrapped) program from <self>.real.
206 char real_fn[PATH_MAX + 10];
207 int real_fn_size = snprintf(real_fn, sizeof(real_fn), "%s.real", self_path);
208+ ASSERT(real_fn_size < sizeof(real_fn));
209210 int fd_self = open(real_fn, O_RDONLY);
211+ ASSERT(fd_self != -1);
212213 char source_prog[PATH_MAX];
214 len = read(fd_self, source_prog, PATH_MAX);
215+ ASSERT(len != -1);
216+ ASSERT(len < sizeof(source_prog));
217+ ASSERT(len > 0);
218 source_prog[len] = 0;
219220 close(fd_self);
+1-1
nixos/modules/services/misc/nitter.nix
···277 Add settings here to override NixOS module generated settings.
278279 Check the official repository for the available settings:
280- https://github.com/zedeus/nitter/blob/master/nitter.conf
281 '';
282 };
283
···277 Add settings here to override NixOS module generated settings.
278279 Check the official repository for the available settings:
280+ https://github.com/zedeus/nitter/blob/master/nitter.example.conf
281 '';
282 };
283
···5 /* Do not use "dev" as a version. If you do, Tilt will consider itself
6 running in development environment and try to serve assets from the
7 source tree, which is not there once build completes. */
8- version = "0.26.3";
910 src = fetchFromGitHub {
11 owner = "tilt-dev";
12 repo = pname;
13 rev = "v${version}";
14- sha256 = "sha256-jrVf6vNlEkTgALS93o3kIiticvsyFHm5oA2Fh1edAGY=";
15 };
16 vendorSha256 = null;
17
···5 /* Do not use "dev" as a version. If you do, Tilt will consider itself
6 running in development environment and try to serve assets from the
7 source tree, which is not there once build completes. */
8+ version = "0.30.0";
910 src = fetchFromGitHub {
11 owner = "tilt-dev";
12 repo = pname;
13 rev = "v${version}";
14+ sha256 = "sha256-bZYm9T3NRNNtT8RDGwnXcXC7Rb/GuIxI/U06By4gR/w=";
15 };
16 vendorSha256 = null;
17
···8283 # needed for relative paths for some packages
84 cd tests
00085 '';
8687 # uvloop usage is buggy
···8283 # needed for relative paths for some packages
84 cd tests
85+ '' + lib.optionalString stdenv.isDarwin ''
86+ # OSError: [Errno 24] Too many open files
87+ ulimit -n 1024
88 '';
8990 # uvloop usage is buggy