3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos
sternenseemann 48965506a1 lib/asserts: use throw to display message for assertMsg
`assert` has the annoying property that it dumps a lot of code at the
user without the built in capability to display a nicer message. We have
worked around this using `assertMsg` which would *additionally* display
a nice message. We can do even better: By using `throw` we can make
evaluation fail before assert draws its conclusions and prevent it from
displaying the code making up the assert condition, so we get the nicer
message of `throw` and the syntactical convenience of `assert`.

Before:

    nix-repl> python.override { reproducibleBuild = true; stripBytecode = false; }
    trace: Deterministic builds require stripping bytecode.
    error: assertion (((lib).assertMsg  (reproducibleBuild -> stripBytecode))  "Deterministic builds require stripping bytecode.") failed at /home/lukas/src/nix/nixpkgs/pkgs/development/interpreters/python/cpython/2.7/default.nix:45:1

After:

    nix-repl> python.override { reproducibleBuild = true; stripBytecode = false; }
    error: Deterministic builds require stripping bytecode.
2022-01-19 00:50:06 +01:00
..
doc lib/asserts: use throw to display message for assertMsg 2022-01-19 00:50:06 +01:00
lib Merge pull request #151082 from hercules-ci/nixos-cleanup-vmWithBootLoader 2022-01-14 18:49:27 +01:00
maintainers create-amis.sh: possible deprecation 2021-11-11 09:04:29 -07:00
modules Merge pull request #155367 from talyz/keycloak-loadcredential 2022-01-19 00:47:58 +03:00
tests Merge pull request #138386 from Yarny0/tsm-client 2022-01-18 20:50:28 +01:00
COPYING
default.nix nixos: Make system.build.vm a standard attribute based on vmVariant 2021-12-17 14:49:31 +01:00
README
release-combined.nix
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.