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; with lib;
let let
pkgs = (import ./pkgs {}) // { recurseForDerivations = true; }; pkgs = (import ./pkgs { }) // { recurseForDerivations = true; };
isCacheable = p: !(p.preferLocalBuild or false); isCacheable = p: !(p.preferLocalBuild or false);
shouldRecurseForDerivations = p: isAttrs p && p.recurseForDerivations or false; shouldRecurseForDerivations = p: isAttrs p && p.recurseForDerivations or false;

View file

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

View file

@ -38,7 +38,7 @@ with lib;
extraProotOptions = mkOption { extraProotOptions = mkOption {
type = types.listOf types.string; type = types.listOf types.string;
default = []; default = [ ];
description = "Extra options passed to proot, e.g., extra bind mounts."; 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); failedAssertions = map (x: x.message) (filter (x: !x.assertion) rawModule.config.assertions);
module = module =
if failedAssertions != [] if failedAssertions != [ ]
then throw "\nFailed assertions:\n${concatMapStringsSep "\n" (x: "- ${x}") failedAssertions}" then throw "\nFailed assertions:\n${concatMapStringsSep "\n" (x: "- ${x}") failedAssertions}"
else showWarnings rawModule.config.warnings rawModule; else showWarnings rawModule.config.warnings rawModule;
in in

View file

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

View file

@ -58,7 +58,8 @@ let
target = mkDefault name; target = mkDefault name;
source = mkIf (config.text != null) ( source = mkIf (config.text != null) (
let name' = "etc-" + baseNameOf name; 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 = { environment = {
etc = mkOption { etc = mkOption {
type = types.loaOf fileType; type = types.loaOf fileType;
default = {}; default = { };
example = literalExample '' example = literalExample ''
{ {
example-configuration-file = { example-configuration-file = {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -28,23 +28,25 @@ let
optionalAttrs (lhs ? packageOverrides) { optionalAttrs (lhs ? packageOverrides) {
packageOverrides = pkgs: packageOverrides = pkgs:
optCall lhs.packageOverrides pkgs // optCall lhs.packageOverrides pkgs //
optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; optCall (attrByPath [ "packageOverrides" ] ({ }) rhs) pkgs;
} // } //
optionalAttrs (lhs ? perlPackageOverrides) { optionalAttrs (lhs ? perlPackageOverrides) {
perlPackageOverrides = pkgs: perlPackageOverrides = pkgs:
optCall lhs.perlPackageOverrides pkgs // optCall lhs.perlPackageOverrides pkgs //
optCall (attrByPath ["perlPackageOverrides"] ({}) rhs) pkgs; optCall (attrByPath [ "perlPackageOverrides" ] ({ }) rhs) pkgs;
}; };
configType = mkOptionType { configType = mkOptionType {
name = "nixpkgs-config"; name = "nixpkgs-config";
description = "nixpkgs config"; description = "nixpkgs config";
check = x: check = x:
let traceXIfNot = c: let
traceXIfNot = c:
if c x then true if c x then true
else lib.traceSeqN 1 x false; else lib.traceSeqN 1 x false;
in traceXIfNot isConfig; in
merge = args: fold (def: mergeConfig def.value) {}; traceXIfNot isConfig;
merge = args: fold (def: mergeConfig def.value) { };
}; };
overlayType = mkOptionType { overlayType = mkOptionType {
@ -161,7 +163,7 @@ in
assertions = [ 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 " 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."; + "outputs and pass in the necessary nixpkgs object.";
} }

View file

@ -13,7 +13,7 @@ let
cfg = config.time; cfg = config.time;
tzdir = "${pkgs.tzdata}/share/zoneinfo"; 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) timezoneType = types.nullOr (types.addCheck types.str nospace)
// { description = "null or string without spaces"; }; // { description = "null or string without spaces"; };
in in

View file

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

View file

@ -4,10 +4,10 @@
runCommand runCommand
"nix-on-droid" "nix-on-droid"
{ {
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = false; allowSubstitutes = false;
} }
'' ''
install -D -m755 ${./nix-on-droid.sh} $out/bin/nix-on-droid 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; stdenv = pkgsCross.stdenvAdapters.makeStaticBinaries pkgsCross.stdenv;
in in
pkgsCross.callPackage ../proot-termux { pkgsCross.callPackage ../proot-termux {
talloc = tallocStatic; talloc = tallocStatic;
inherit stdenv; inherit stdenv;
} }

View file

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

View file

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

View file

@ -14,5 +14,5 @@
nixpkgs.overlays = config.nixpkgs.overlays; nixpkgs.overlays = config.nixpkgs.overlays;
home.packages = with pkgs; [ dash ]; 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. # 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 { pkgs.callPackage ../pkgs/proot-termux {
stdenv = pkgs.stdenv; stdenv = pkgs.stdenv;