diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2018-10-17 14:43:49 -0500 |
---|---|---|
committer | Matthew Bauer <mjbauer95@gmail.com> | 2018-10-17 14:43:49 -0500 |
commit | 45cc6e2a4286276387d0bcb768a1e45086719210 (patch) | |
tree | 72d580f09588e5f48637da91bdfcad8f5c0440fa /lib/systems/default.nix | |
parent | e3de8a92325620e65039d98281047a83fa07c9dd (diff) |
lib/systems: use lookup for uname.system
This is a little bit cleaner and avoids the if ... else if ... chain.
Diffstat (limited to 'lib/systems/default.nix')
-rw-r--r-- | lib/systems/default.nix | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix index 6c6ce5c6ef62..8f5ef44ae72f 100644 --- a/lib/systems/default.nix +++ b/lib/systems/default.nix @@ -50,13 +50,14 @@ rec { # Output from uname uname = { # uname -s - system = if final.isLinux then "Linux" - else if final.isDarwin then "Darwin" - else if final.isWindows then "Windows" - else if final.isFreeBSD then "FreeBSD" - else if final.isNetBSD then "NetBSD" - else if final.isOpenBSD then "OpenBSD" - else null; + system = { + "linux" = "Linux"; + "windows" = "Windows"; + "darwin" = "Darwin"; + "netbsd" = "NetBSD"; + "freebsd" = "FreeBSD"; + "openbsd" = "OpenBSD"; + }.${final.parsed.kernel.name} or null; # uname -p processor = final.parsed.cpu.name; |