treewide: apply nixpkgs-fmt

This commit is contained in:
Tobias Happ 2022-09-03 17:10:19 +02:00
parent 241632822a
commit 7d1ed0fbaa
23 changed files with 64 additions and 61 deletions

2
ci.nix
View file

@ -5,7 +5,7 @@ with import <nixpkgs> { };
with lib;
let
pkgs = (import ./pkgs {}) // { recurseForDerivations = true; };
pkgs = (import ./pkgs { }) // { recurseForDerivations = true; };
isCacheable = p: !(p.preferLocalBuild or false);
shouldRecurseForDerivations = p: isAttrs p && p.recurseForDerivations or false;

View file

@ -23,10 +23,12 @@ let
];
mkActivationCmds = activation: concatStringsSep "\n" (
mapAttrsToList (name: value: ''
mapAttrsToList
(name: value: ''
noteEcho "Activating ${name}"
${value}
'') activation
'')
activation
);
activationScript = pkgs.writeScript "activation-script" ''
@ -79,7 +81,7 @@ in
build = {
activation = mkOption {
default = {};
default = { };
type = types.attrs;
description = ''
Activation scripts for the nix-on-droid environment.
@ -87,7 +89,7 @@ in
};
activationBefore = mkOption {
default = {};
default = { };
type = types.attrs;
description = ''
Activation scripts for the nix-on-droid environment that
@ -96,7 +98,7 @@ in
};
activationAfter = mkOption {
default = {};
default = { };
type = types.attrs;
description = ''
Activation scripts for the nix-on-droid environment that

View file

@ -38,7 +38,7 @@ with lib;
extraProotOptions = mkOption {
type = types.listOf types.string;
default = [];
default = [ ];
description = "Extra options passed to proot, e.g., extra bind mounts.";
};
};

View file

@ -38,7 +38,7 @@ let
failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions);
module =
if failedAssertions != []
if failedAssertions != [ ]
then throw "\nFailed assertions:\n${concatMapStringsSep "\n" (x: "- ${x}") failedAssertions}"
else showWarnings rawModule.config.warnings rawModule;
in

View file

@ -12,9 +12,7 @@ in
###### interface
options = {
};
options = { };
###### implementation

View file

@ -58,7 +58,8 @@ let
target = mkDefault name;
source = mkIf (config.text != null) (
let name' = "etc-" + baseNameOf name;
in mkDefault (pkgs.writeText name' config.text));
in mkDefault (pkgs.writeText name' config.text)
);
};
}
@ -74,7 +75,7 @@ in
environment = {
etc = mkOption {
type = types.loaOf fileType;
default = {};
default = { };
example = literalExample ''
{
example-configuration-file = {

View file

@ -8,9 +8,7 @@ with lib;
###### interface
options = {
};
options = { };
###### implementation

View file

@ -39,7 +39,7 @@ in
nixPath = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = ''
The default Nix expression search path, used by the Nix
evaluator to look up paths enclosed in angle brackets
@ -108,7 +108,7 @@ in
substituters = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = ''
A list of URLs of substituters. The official NixOS and nix-on-droid
substituters are added by default.
@ -117,7 +117,7 @@ in
trustedPublicKeys = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = ''
A list of public keys. When paths are copied from another Nix store (such as a
binary cache), they must be signed with one of these keys. The official NixOS
@ -165,7 +165,7 @@ in
};
}
(mkIf (cfg.nixPath != []) {
(mkIf (cfg.nixPath != [ ]) {
environment.sessionVariables.NIX_PATH = concatStringsSep ":" cfg.nixPath;
})
];

View file

@ -17,7 +17,7 @@ in
environment = {
packages = mkOption {
type = types.listOf types.package;
default = [];
default = [ ];
description = "List of packages to be installed as user packages.";
};

View file

@ -50,7 +50,7 @@ in
options = {
environment.sessionVariables = mkOption {
default = {};
default = { };
type = types.attrs;
example = { EDITOR = "emacs"; GS_OPTIONS = "-sPAPERSIZE=a4"; };
description = ''

View file

@ -8,9 +8,7 @@ with lib;
###### interface
options = {
};
options = { };
###### implementation

View file

@ -28,23 +28,25 @@ let
optionalAttrs (lhs ? packageOverrides) {
packageOverrides = pkgs:
optCall lhs.packageOverrides pkgs //
optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs;
optCall (attrByPath [ "packageOverrides" ] ({ }) rhs) pkgs;
} //
optionalAttrs (lhs ? perlPackageOverrides) {
perlPackageOverrides = pkgs:
optCall lhs.perlPackageOverrides pkgs //
optCall (attrByPath ["perlPackageOverrides"] ({}) rhs) pkgs;
optCall (attrByPath [ "perlPackageOverrides" ] ({ }) rhs) pkgs;
};
configType = mkOptionType {
name = "nixpkgs-config";
description = "nixpkgs config";
check = x:
let traceXIfNot = c:
let
traceXIfNot = c:
if c x then true
else lib.traceSeqN 1 x false;
in traceXIfNot isConfig;
merge = args: fold (def: mergeConfig def.value) {};
in
traceXIfNot isConfig;
merge = args: fold (def: mergeConfig def.value) { };
};
overlayType = mkOptionType {
@ -161,7 +163,7 @@ in
assertions = [
{
assertion = isFlake -> config.nixpkgs.config == null && (config.nixpkgs.overlays == null || config.nixpkgs.overlays == []);
assertion = isFlake -> config.nixpkgs.config == null && (config.nixpkgs.overlays == null || config.nixpkgs.overlays == [ ]);
message = "In a flake setup, the options nixpkgs.* should not be used. Instead, rely on the provided flake "
+ "outputs and pass in the necessary nixpkgs object.";
}

View file

@ -13,7 +13,7 @@ let
cfg = config.time;
tzdir = "${pkgs.tzdata}/share/zoneinfo";
nospace = str: filter (c: c == " ") (stringToCharacters str) == [];
nospace = str: filter (c: c == " ") (stringToCharacters str) == [ ];
timezoneType = types.nullOr (types.addCheck types.str nospace)
// { description = "null or string without spaces"; };
in

View file

@ -7,7 +7,7 @@ with lib;
let
cfg = config.user;
idsDerivation = pkgs.runCommandLocal "ids.nix" {} ''
idsDerivation = pkgs.runCommandLocal "ids.nix" { } ''
cat > $out <<EOF
{
gid = $(${pkgs.coreutils}/bin/id -g);

View file

@ -4,10 +4,10 @@
runCommand
"nix-on-droid"
{
{
preferLocalBuild = true;
allowSubstitutes = false;
}
}
''
install -D -m755 ${./nix-on-droid.sh} $out/bin/nix-on-droid

View file

@ -7,7 +7,7 @@ let
stdenv = pkgsCross.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv;
in
pkgsCross.callPackage ../proot-termux {
pkgsCross.callPackage ../proot-termux {
talloc = tallocStatic;
inherit stdenv;
}
}

View file

@ -21,7 +21,7 @@ pkgsCross.stdenv.mkDerivation rec {
};
nativeBuildInputs = [ pkg-config python3 wafHook ];
buildInputs = [];
buildInputs = [ ];
wafPath = "./buildtools/bin/waf";
wafConfigureFlags = [

View file

@ -1,7 +1,11 @@
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ stdenv, fetchFromGitHub, talloc,
static ? true, outputBinaryName ? "proot-static" }:
{ stdenv
, fetchFromGitHub
, talloc
, static ? true
, outputBinaryName ? "proot-static"
}:
stdenv.mkDerivation {
pname = "proot-termux";
@ -30,8 +34,8 @@ stdenv.mkDerivation {
patches = [ ./detranslate-empty.patch ];
makeFlags = [ "-Csrc" "V=1" ];
CFLAGS = [ "-O3" "-I../fake-ashmem" ] ++
(if static then [ "-static" ] else []);
LDFLAGS = if static then [ "-static" ] else [];
(if static then [ "-static" ] else [ ]);
LDFLAGS = if static then [ "-static" ] else [ ];
preInstall = "${stdenv.cc.targetPrefix}strip src/proot";
installPhase = "install -D -m 0755 src/proot $out/bin/${outputBinaryName}";
}

View file

@ -14,5 +14,5 @@
nixpkgs.overlays = config.nixpkgs.overlays;
home.packages = with pkgs; [ dash ];
};
nixpkgs.overlays = [];
nixpkgs.overlays = [ ];
}

View file

@ -1,6 +1,6 @@
# Copyright (c) 2019-2022, see AUTHORS. Licensed under MIT License, see LICENSE.
{ pkgs ? (import ../pkgs/lib/load-nixpkgs.nix {}) }:
{ pkgs ? (import ../pkgs/lib/load-nixpkgs.nix { }) }:
pkgs.callPackage ../pkgs/proot-termux {
stdenv = pkgs.stdenv;