From 14736fe159e5da8d91df5fcedea8b1e9891898f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Sat, 30 Mar 2024 10:54:12 +0100 Subject: [PATCH] treewide: Format all Nix code according to RFC-166 --- pills/07/simple.txt | 20 +++++++++---------- pills/07/simple_inherit.txt | 18 ++++++++--------- pills/08/autotools-nix.txt | 21 ++++++++++++++----- pills/08/hello-nix-darwin.txt | 30 ++++++++++++++++++---------- pills/08/hello-nix-rev-1.txt | 28 +++++++++++++++++--------- pills/08/hello-nix-rev-2.txt | 12 +++++------ pills/08/hello-nix.txt | 29 +++++++++++++++++---------- pills/10/autotools-nix.txt | 24 ++++++++++++++++------ pills/10/hello-nix.txt | 11 +++++----- pills/12/graphviz-derivation.txt | 5 +++-- pills/12/graphviz-gd-derivation.txt | 5 +++-- pills/12/repository-mkderivation.txt | 22 ++++++++++++++++---- pills/12/repository.txt | 2 +- pills/13/callpackage-usage.txt | 14 ++++++++----- pills/13/repository-derivation.txt | 4 ++-- pills/14/make-overridable-lib.txt | 5 +++-- pills/14/mygraphviz.txt | 15 ++++++++++---- pills/14/rec-make-overridable.txt | 5 +++-- pills/17/config-nix.txt | 5 ++++- pills/17/fix-function.txt | 11 ++++++++-- pills/19/stdenv-hello.txt | 2 +- pills/19/stdenv-mkderivation.txt | 10 +++++++--- pills/20/three-hellos.nix | 13 +++++++----- pills/20/two-hellos.nix | 12 +++++++---- 24 files changed, 212 insertions(+), 111 deletions(-) diff --git a/pills/07/simple.txt b/pills/07/simple.txt index aff3d15..eef5693 100644 --- a/pills/07/simple.txt +++ b/pills/07/simple.txt @@ -1,12 +1,12 @@ let - pkgs = import {}; + pkgs = import { }; in - pkgs.stdenv.mkDerivation { - name = "simple"; - builder = "${pkgs.bash}/bin/bash"; - args = [ ./simple_builder.sh ]; - gcc = pkgs.gcc; - coreutils = pkgs.coreutils; - src = ./simple.c; - system = builtins.currentSystem; -} \ No newline at end of file +pkgs.stdenv.mkDerivation { + name = "simple"; + builder = "${pkgs.bash}/bin/bash"; + args = [ ./simple_builder.sh ]; + gcc = pkgs.gcc; + coreutils = pkgs.coreutils; + src = ./simple.c; + system = builtins.currentSystem; +} diff --git a/pills/07/simple_inherit.txt b/pills/07/simple_inherit.txt index 7abbf03..3f8c4ae 100644 --- a/pills/07/simple_inherit.txt +++ b/pills/07/simple_inherit.txt @@ -1,11 +1,11 @@ let - pkgs = import {}; + pkgs = import { }; in - pkgs.stdenv.mkDerivation { - name = "simple"; - builder = "${pkgs.bash}/bin/bash"; - args = [ ./simple_builder.sh ]; - inherit (pkgs) gcc coreutils; - src = ./simple.c; - system = builtins.currentSystem; -} \ No newline at end of file +pkgs.stdenv.mkDerivation { + name = "simple"; + builder = "${pkgs.bash}/bin/bash"; + args = [ ./simple_builder.sh ]; + inherit (pkgs) gcc coreutils; + src = ./simple.c; + system = builtins.currentSystem; +} diff --git a/pills/08/autotools-nix.txt b/pills/08/autotools-nix.txt index fda44fa..65d3bc5 100644 --- a/pills/08/autotools-nix.txt +++ b/pills/08/autotools-nix.txt @@ -1,10 +1,21 @@ pkgs: attrs: - let defaultAttrs = { +let + defaultAttrs = { builder = "${pkgs.bash}/bin/bash"; args = [ ./builder.sh ]; - baseInputs = with pkgs; [ gnutar gzip gnumake gcc coreutils gawk gnused gnugrep binutils.bintools ]; - buildInputs = []; + baseInputs = with pkgs; [ + gnutar + gzip + gnumake + gcc + coreutils + gawk + gnused + gnugrep + binutils.bintools + ]; + buildInputs = [ ]; system = builtins.currentSystem; }; - in - derivation (defaultAttrs // attrs) +in +derivation (defaultAttrs // attrs) diff --git a/pills/08/hello-nix-darwin.txt b/pills/08/hello-nix-darwin.txt index 79e8b1f..68a11bb 100644 --- a/pills/08/hello-nix-darwin.txt +++ b/pills/08/hello-nix-darwin.txt @@ -1,13 +1,21 @@ let - pkgs = import {}; + pkgs = import { }; in - derivation { - name = "hello"; - builder = "${pkgs.bash}/bin/bash"; - args = [ ./hello_builder.sh ]; - inherit (pkgs) gnutar gzip gnumake coreutils gawk gnused gnugrep; - gcc = pkgs.clang; - bintools = pkgs.clang.bintools.bintools_bin; - src = ./hello-2.12.1.tar.gz; - system = builtins.currentSystem; - } +derivation { + name = "hello"; + builder = "${pkgs.bash}/bin/bash"; + args = [ ./hello_builder.sh ]; + inherit (pkgs) + gnutar + gzip + gnumake + coreutils + gawk + gnused + gnugrep + ; + gcc = pkgs.clang; + bintools = pkgs.clang.bintools.bintools_bin; + src = ./hello-2.12.1.tar.gz; + system = builtins.currentSystem; +} diff --git a/pills/08/hello-nix-rev-1.txt b/pills/08/hello-nix-rev-1.txt index 67b5efd..748ff5d 100644 --- a/pills/08/hello-nix-rev-1.txt +++ b/pills/08/hello-nix-rev-1.txt @@ -1,11 +1,21 @@ let - pkgs = import {}; + pkgs = import { }; in - derivation { - name = "hello"; - builder = "${pkgs.bash}/bin/bash"; - args = [ ./builder.sh ]; - buildInputs = with pkgs; [ gnutar gzip gnumake gcc coreutils gawk gnused gnugrep binutils.bintools ]; - src = ./hello-2.12.1.tar.gz; - system = builtins.currentSystem; - } +derivation { + name = "hello"; + builder = "${pkgs.bash}/bin/bash"; + args = [ ./builder.sh ]; + buildInputs = with pkgs; [ + gnutar + gzip + gnumake + gcc + coreutils + gawk + gnused + gnugrep + binutils.bintools + ]; + src = ./hello-2.12.1.tar.gz; + system = builtins.currentSystem; +} diff --git a/pills/08/hello-nix-rev-2.txt b/pills/08/hello-nix-rev-2.txt index 403b783..8c660f7 100644 --- a/pills/08/hello-nix-rev-2.txt +++ b/pills/08/hello-nix-rev-2.txt @@ -1,8 +1,8 @@ let - pkgs = import {}; + pkgs = import { }; mkDerivation = import ./autotools.nix pkgs; -in - mkDerivation { - name = "hello"; - src = ./hello-2.12.1.tar.gz; - } +in +mkDerivation { + name = "hello"; + src = ./hello-2.12.1.tar.gz; +} diff --git a/pills/08/hello-nix.txt b/pills/08/hello-nix.txt index ba7f10a..948bcfd 100644 --- a/pills/08/hello-nix.txt +++ b/pills/08/hello-nix.txt @@ -1,12 +1,21 @@ let - pkgs = import {}; + pkgs = import { }; in - derivation { - name = "hello"; - builder = "${pkgs.bash}/bin/bash"; - args = [ ./hello_builder.sh ]; - inherit (pkgs) gnutar gzip gnumake gcc coreutils gawk gnused gnugrep; - bintools = pkgs.binutils.bintools; - src = ./hello-2.12.1.tar.gz; - system = builtins.currentSystem; - } +derivation { + name = "hello"; + builder = "${pkgs.bash}/bin/bash"; + args = [ ./hello_builder.sh ]; + inherit (pkgs) + gnutar + gzip + gnumake + gcc + coreutils + gawk + gnused + gnugrep + ; + bintools = pkgs.binutils.bintools; + src = ./hello-2.12.1.tar.gz; + system = builtins.currentSystem; +} diff --git a/pills/10/autotools-nix.txt b/pills/10/autotools-nix.txt index 25b9c07..fc4c43e 100644 --- a/pills/10/autotools-nix.txt +++ b/pills/10/autotools-nix.txt @@ -1,12 +1,24 @@ pkgs: attrs: - let defaultAttrs = { +let + defaultAttrs = { builder = "${pkgs.bash}/bin/bash"; args = [ ./builder.sh ]; setup = ./setup.sh; - baseInputs = with pkgs; [ gnutar gzip gnumake gcc coreutils gawk gnused gnugrep binutils.bintools patchelf findutils ]; - buildInputs = []; + baseInputs = with pkgs; [ + gnutar + gzip + gnumake + gcc + coreutils + gawk + gnused + gnugrep + binutils.bintools + patchelf + findutils + ]; + buildInputs = [ ]; system = builtins.currentSystem; }; - in - derivation (defaultAttrs // attrs) - +in +derivation (defaultAttrs // attrs) diff --git a/pills/10/hello-nix.txt b/pills/10/hello-nix.txt index bf60ab6..8c660f7 100644 --- a/pills/10/hello-nix.txt +++ b/pills/10/hello-nix.txt @@ -1,7 +1,8 @@ let - pkgs = import {}; + pkgs = import { }; mkDerivation = import ./autotools.nix pkgs; -in mkDerivation { - name = "hello"; - src = ./hello-2.12.1.tar.gz; - } +in +mkDerivation { + name = "hello"; + src = ./hello-2.12.1.tar.gz; +} diff --git a/pills/12/graphviz-derivation.txt b/pills/12/graphviz-derivation.txt index 8bd25f6..93e83fc 100644 --- a/pills/12/graphviz-derivation.txt +++ b/pills/12/graphviz-derivation.txt @@ -1,7 +1,8 @@ let - pkgs = import {}; + pkgs = import { }; mkDerivation = import ./autotools.nix pkgs; -in mkDerivation { +in +mkDerivation { name = "graphviz"; src = ./graphviz-2.49.3.tar.gz; } diff --git a/pills/12/graphviz-gd-derivation.txt b/pills/12/graphviz-gd-derivation.txt index f3f2f4d..4ef0a35 100644 --- a/pills/12/graphviz-gd-derivation.txt +++ b/pills/12/graphviz-gd-derivation.txt @@ -1,7 +1,8 @@ let - pkgs = import {}; + pkgs = import { }; mkDerivation = import ./autotools.nix pkgs; -in mkDerivation { +in +mkDerivation { name = "graphviz"; src = ./graphviz-2.49.3.tar.gz; buildInputs = with pkgs; [ diff --git a/pills/12/repository-mkderivation.txt b/pills/12/repository-mkderivation.txt index 3bfe328..4731bf8 100644 --- a/pills/12/repository-mkderivation.txt +++ b/pills/12/repository-mkderivation.txt @@ -1,11 +1,25 @@ let - pkgs = import {}; + pkgs = import { }; mkDerivation = import ./autotools.nix pkgs; -in with pkgs; { +in +with pkgs; +{ hello = import ./hello.nix { inherit mkDerivation; }; - graphviz = import ./graphviz.nix { inherit mkDerivation lib gd pkg-config; }; + graphviz = import ./graphviz.nix { + inherit + mkDerivation + lib + gd + pkg-config + ; + }; graphvizCore = import ./graphviz.nix { - inherit mkDerivation lib gd pkg-config; + inherit + mkDerivation + lib + gd + pkg-config + ; gdSupport = false; }; } diff --git a/pills/12/repository.txt b/pills/12/repository.txt index 5252d48..3068e07 100644 --- a/pills/12/repository.txt +++ b/pills/12/repository.txt @@ -1,4 +1,4 @@ { - hello = import ./hello.nix; + hello = import ./hello.nix; graphviz = import ./graphviz.nix; } diff --git a/pills/13/callpackage-usage.txt b/pills/13/callpackage-usage.txt index 782bf8f..43ad9e7 100644 --- a/pills/13/callpackage-usage.txt +++ b/pills/13/callpackage-usage.txt @@ -1,13 +1,17 @@ let - nixpkgs = import {}; + nixpkgs = import { }; allPkgs = nixpkgs // pkgs; - callPackage = path: overrides: - let f = import path; - in f ((builtins.intersectAttrs (builtins.functionArgs f) allPkgs) // overrides); + callPackage = + path: overrides: + let + f = import path; + in + f ((builtins.intersectAttrs (builtins.functionArgs f) allPkgs) // overrides); pkgs = with nixpkgs; { mkDerivation = import ./autotools.nix nixpkgs; hello = callPackage ./hello.nix { }; graphviz = callPackage ./graphviz.nix { }; graphvizCore = callPackage ./graphviz.nix { gdSupport = false; }; }; -in pkgs +in +pkgs diff --git a/pills/13/repository-derivation.txt b/pills/13/repository-derivation.txt index a5e2c2a..5ce1460 100644 --- a/pills/13/repository-derivation.txt +++ b/pills/13/repository-derivation.txt @@ -1,4 +1,4 @@ rec { - lib1 = import package1.nix { inherit input1 input2 ...; }; - program2 = import package2.nix { inherit inputX inputY lib1 ...; }; + lib1 = import package1.nix { inherit input1 input2; }; + program2 = import package2.nix { inherit inputX inputY lib1; }; } diff --git a/pills/14/make-overridable-lib.txt b/pills/14/make-overridable-lib.txt index e35c0cc..9b60b67 100644 --- a/pills/14/make-overridable-lib.txt +++ b/pills/14/make-overridable-lib.txt @@ -1,7 +1,8 @@ { - makeOverridable = f: origArgs: + makeOverridable = + f: origArgs: let origRes = f origArgs; in - origRes // { override = newArgs: f (origArgs // newArgs); }; + origRes // { override = newArgs: f (origArgs // newArgs); }; } diff --git a/pills/14/mygraphviz.txt b/pills/14/mygraphviz.txt index 408307e..f0eca70 100644 --- a/pills/14/mygraphviz.txt +++ b/pills/14/mygraphviz.txt @@ -1,4 +1,11 @@ -mygraphviz = import ./graphviz.nix { - inherit mkDerivation fontconfig libjpeg bzip2; - gd = customgd; -}; +{ + mygraphviz = import ./graphviz.nix { + inherit + mkDerivation + fontconfig + libjpeg + bzip2 + ; + gd = customgd; + }; +} diff --git a/pills/14/rec-make-overridable.txt b/pills/14/rec-make-overridable.txt index 36f7c6e..f2869a8 100644 --- a/pills/14/rec-make-overridable.txt +++ b/pills/14/rec-make-overridable.txt @@ -1,7 +1,8 @@ rec { - makeOverridable = f: origArgs: + makeOverridable = + f: origArgs: let origRes = f origArgs; in - origRes // { override = newArgs: makeOverridable f (origArgs // newArgs); }; + origRes // { override = newArgs: makeOverridable f (origArgs // newArgs); }; } diff --git a/pills/17/config-nix.txt b/pills/17/config-nix.txt index 5ed063a..078afad 100644 --- a/pills/17/config-nix.txt +++ b/pills/17/config-nix.txt @@ -1,5 +1,8 @@ { packageOverrides = pkgs: { - graphviz = pkgs.graphviz.override { withXorg = false; }; + graphviz = pkgs.graphviz.override { + # disable xorg support + withXorg = false; + }; }; } diff --git a/pills/17/fix-function.txt b/pills/17/fix-function.txt index c3e3340..d1a3b5c 100644 --- a/pills/17/fix-function.txt +++ b/pills/17/fix-function.txt @@ -1,2 +1,9 @@ -# Take a function and evaluate it with its own returned value. -fix = f: let result = f result; in result; +{ + # Take a function and evaluate it with its own returned value. + fix = + f: + let + result = f result; + in + result; +} diff --git a/pills/19/stdenv-hello.txt b/pills/19/stdenv-hello.txt index ca79143..9557c00 100644 --- a/pills/19/stdenv-hello.txt +++ b/pills/19/stdenv-hello.txt @@ -1,4 +1,4 @@ -with import {}; +with import { }; stdenv.mkDerivation { name = "hello"; src = ./hello-2.10.tar.gz; diff --git a/pills/19/stdenv-mkderivation.txt b/pills/19/stdenv-mkderivation.txt index 166c6b3..5722254 100644 --- a/pills/19/stdenv-mkderivation.txt +++ b/pills/19/stdenv-mkderivation.txt @@ -1,7 +1,11 @@ { - ... + # ... builder = attrs.realBuilder or shell; - args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; + args = + attrs.args or [ + "-e" + (attrs.builder or ./default-builder.sh) + ]; stdenv = result; - ... + # ... } diff --git a/pills/20/three-hellos.nix b/pills/20/three-hellos.nix index cc9545b..fe59c44 100644 --- a/pills/20/three-hellos.nix +++ b/pills/20/three-hellos.nix @@ -1,6 +1,6 @@ let - nixpkgs = import {}; + nixpkgs = import { }; inherit (nixpkgs) stdenv fetchurl which; @@ -8,7 +8,7 @@ let name = "hello-2.3"; src = fetchurl { - url = mirror://gnu/hello/hello-2.3.tar.bz2; + url = "mirror://gnu/hello/hello-2.3.tar.bz2"; sha256 = "0c7vijq8y68bpr7g6dh1gny0bff8qq81vnp4ch8pjzvg56wb3js1"; }; }; @@ -28,7 +28,10 @@ let wrappedHello = stdenv.mkDerivation { name = "hello-wrapper"; - buildInputs = [ intermediary which ]; + buildInputs = [ + intermediary + which + ]; unpackPhase = "true"; @@ -39,5 +42,5 @@ let chmod 0755 "$out/bin/hello" ''; }; - -in wrappedHello +in +wrappedHello diff --git a/pills/20/two-hellos.nix b/pills/20/two-hellos.nix index f1e7c97..4a49f3c 100644 --- a/pills/20/two-hellos.nix +++ b/pills/20/two-hellos.nix @@ -1,6 +1,6 @@ let - nixpkgs = import {}; + nixpkgs = import { }; inherit (nixpkgs) stdenv fetchurl which; @@ -8,7 +8,7 @@ let name = "hello-2.3"; src = fetchurl { - url = mirror://gnu/hello/hello-2.3.tar.bz2; + url = "mirror://gnu/hello/hello-2.3.tar.bz2"; sha256 = "0c7vijq8y68bpr7g6dh1gny0bff8qq81vnp4ch8pjzvg56wb3js1"; }; }; @@ -16,7 +16,10 @@ let wrappedHello = stdenv.mkDerivation { name = "hello-wrapper"; - buildInputs = [ actualHello which ]; + buildInputs = [ + actualHello + which + ]; unpackPhase = "true"; @@ -27,5 +30,6 @@ let chmod 0755 "$out/bin/hello" ''; }; +in +wrappedHello -in wrappedHello