nixpkgs/nixos
Jules Aguillon df590070b0 types.singleLineStr: strings that don't contain '\n'
Add a new type, inheriting 'types.str' but checking whether the value
doesn't contain any newline characters.

The motivation comes from a problem with the
'users.users.${u}.openssh.authorizedKeys' option.
It is easy to unintentionally insert a newline character at the end of a
string, or even in the middle, for example:

    restricted_ssh_keys = command: keys:
      let
        prefix = ''
          command="${command}",no-pty,no-agent-forwarding,no-port-forwarding,no-X11-forwarding
        '';
      in map (key: "${prefix} ${key}") keys;

The 'prefix' string ends with a newline, which ends up in the middle of
a key entry after a few manipulations.

This is problematic because the key file is built by concatenating all
the keys with 'concatStringsSep "\n"', with result in two entries for
the faulty key:

    ''
      command="...",options...
      MY_KEY
    ''

This is hard to debug and might be dangerous. This is now caught at
build time.
2022-01-18 22:06:34 +01:00
..
doc Merge pull request #149532 from pennae/split-docs-build 2022-01-04 22:33:23 +01:00
lib nixos/make-options-doc: treat missing descriptions as errors by default 2022-01-02 19:46:13 +01:00
maintainers create-amis.sh: possible deprecation 2021-11-11 09:04:29 -07:00
modules types.singleLineStr: strings that don't contain '\n' 2022-01-18 22:06:34 +01:00
tests Merge pull request #153281 from delroth/sudo-1.9.8p2 2022-01-04 21:09:04 +01:00
COPYING
default.nix
README
release-combined.nix release-combined.tested: Add the Sway test 2021-05-27 13:36:48 +02:00
release-small.nix
release.nix lxdImage: split from docker profile, use generators.toYAML 2021-11-03 07:49:54 +01:00

*** NixOS ***

NixOS is a Linux distribution based on the purely functional package
management system Nix.  More information can be found at
https://nixos.org/nixos and in the manual in doc/manual.