
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
64 lines
2.1 KiB
Nix
64 lines
2.1 KiB
Nix
{
|
|
stdenv,
|
|
lib,
|
|
replaceVarsWith,
|
|
coreutils,
|
|
getopt,
|
|
runtimeShell,
|
|
modDirVersion ? "",
|
|
forPlatform ? stdenv.buildPlatform,
|
|
}:
|
|
|
|
replaceVarsWith {
|
|
name = "uname";
|
|
|
|
src = ./deterministic-uname.sh;
|
|
|
|
dir = "bin";
|
|
isExecutable = true;
|
|
|
|
replacements = {
|
|
inherit coreutils getopt runtimeShell;
|
|
|
|
uSystem = if forPlatform.uname.system != null then forPlatform.uname.system else "unknown";
|
|
inherit (forPlatform.uname) processor;
|
|
|
|
# uname -o
|
|
# maybe add to lib/systems/default.nix uname attrset
|
|
# https://github.com/coreutils/coreutils/blob/7fc84d1c0f6b35231b0b4577b70aaa26bf548a7c/src/uname.c#L373-L374
|
|
# https://stackoverflow.com/questions/61711186/where-does-host-operating-system-in-uname-c-comes-from
|
|
# https://github.com/coreutils/gnulib/blob/master/m4/host-os.m4
|
|
operatingSystem =
|
|
if forPlatform.isLinux then
|
|
"GNU/Linux"
|
|
else if forPlatform.isDarwin then
|
|
"Darwin" # darwin isn't in host-os.m4 so where does this come from?
|
|
else if forPlatform.isFreeBSD then
|
|
"FreeBSD"
|
|
else
|
|
"unknown";
|
|
|
|
# in os-specific/linux module packages
|
|
# --replace '$(shell uname -r)' "${kernel.modDirVersion}" \
|
|
# is a common thing to do.
|
|
modDirVersion = if modDirVersion != "" then modDirVersion else "unknown";
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Print certain system information (hardcoded with lib/system values)";
|
|
mainProgram = "uname";
|
|
longDescription = ''
|
|
This package provides a replacement for `uname` whose output depends only
|
|
on `stdenv.buildPlatform`, or a configurable `forPlatform`. It is meant
|
|
to be used from within derivations. Many packages' build processes run
|
|
`uname` at compile time and embed its output into the result of the build.
|
|
Since `uname` calls into the kernel, and the Nix sandbox currently does
|
|
not intercept these calls, builds made on different kernels will produce
|
|
different results.
|
|
'';
|
|
license = [ licenses.mit ];
|
|
maintainers = with maintainers; [ artturin ];
|
|
platforms = platforms.all;
|
|
};
|
|
}
|