diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..7efe6e5 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,12 @@ +# This file contains a list of commits that are not likely what you +# are looking for in a blame, such as mass reformatting or renaming. +# You can set this file as a default ignore file for blame by running +# the following command. +# +# $ git config blame.ignoreRevsFile .git-blame-ignore-revs + +# Reformatted all Nix files +81d712a6c4e020bf545fb931b3106aff64871962 + +# Reformatted all Bash scripts +b1306dd5ae96b0fb934256d91708733c1f850016 diff --git a/default.nix b/default.nix index a684206..d381e7b 100644 --- a/default.nix +++ b/default.nix @@ -4,12 +4,13 @@ in { system ? builtins.currentSystem, nixpkgs ? sources.nixpkgs, + treefmt-nix ? sources.treefmt-nix, }: let pkgs = import nixpkgs { inherit system; - config = {}; - overlays = []; + config = { }; + overlays = [ ]; }; inherit (pkgs) lib; @@ -34,12 +35,28 @@ let # Determine version from Cargo.toml version = (lib.importTOML ./Cargo.toml).package.version; + treefmtEval = (import treefmt-nix).evalModule pkgs { + # Used to find the project root + projectRootFile = ".git/config"; + + programs.rustfmt.enable = true; + programs.nixfmt-rfc-style.enable = true; + programs.shfmt.enable = true; + settings.formatter.shfmt.options = [ "--space-redirects" ]; + }; + results = { # We're using this value as the root result. By default, derivations expose all of their # internal attributes, which is very messy. We prevent this using lib.lazyDerivation build = lib.lazyDerivation { derivation = pkgs.callPackage ./package.nix { - inherit nixpkgsLibPath initNix runtimeExprPath testNixpkgsPath version; + inherit + nixpkgsLibPath + initNix + runtimeExprPath + testNixpkgsPath + version + ; }; }; @@ -51,18 +68,25 @@ let nativeBuildInputs = with pkgs; [ npins rust-analyzer + treefmtEval.config.build.wrapper ]; }; + # This checks that all Git-tracked files are formatted appropriately + treefmt = treefmtEval.config.build.check ( + lib.fileset.toSource { + root = ./.; + fileset = lib.fileset.gitTracked ./.; + } + ); + # Run regularly by CI and turned into a PR autoPrUpdate = let updateScripts = { npins = pkgs.writeShellApplication { name = "update-npins"; - runtimeInputs = with pkgs; [ - npins - ]; + runtimeInputs = with pkgs; [ npins ]; text = '' echo "
npins changes" # Needed because GitHub's rendering of the first body line breaks down otherwise @@ -75,9 +99,7 @@ let }; cargo = pkgs.writeShellApplication { name = "update-cargo"; - runtimeInputs = with pkgs; [ - cargo - ]; + runtimeInputs = with pkgs; [ cargo ]; text = '' echo "
cargo changes" # Needed because GitHub's rendering of the first body line breaks down otherwise @@ -113,21 +135,25 @@ let }; # Tests the tool on the pinned Nixpkgs tree, this is a good sanity check - nixpkgsCheck = pkgs.runCommand "test-nixpkgs-check-by-name" { - nativeBuildInputs = [ - results.build - pkgs.nix - ]; - nixpkgsPath = nixpkgs; - } '' - ${initNix} - nixpkgs-check-by-name --base "$nixpkgsPath" "$nixpkgsPath" - touch $out - ''; + nixpkgsCheck = + pkgs.runCommand "test-nixpkgs-check-by-name" + { + nativeBuildInputs = [ + results.build + pkgs.nix + ]; + nixpkgsPath = nixpkgs; + } + '' + ${initNix} + nixpkgs-check-by-name --base "$nixpkgsPath" "$nixpkgsPath" + touch $out + ''; }; - in -results.build // results // { +results.build +// results +// { # Good for debugging inherit pkgs; diff --git a/npins/default.nix b/npins/default.nix index 4a7c372..ae29155 100644 --- a/npins/default.nix +++ b/npins/default.nix @@ -3,18 +3,32 @@ let data = builtins.fromJSON (builtins.readFile ./sources.json); version = data.version; - mkSource = spec: - assert spec ? type; let + mkSource = + spec: + assert spec ? type; + let path = - if spec.type == "Git" then mkGitSource spec - else if spec.type == "GitRelease" then mkGitSource spec - else if spec.type == "PyPi" then mkPyPiSource spec - else if spec.type == "Channel" then mkChannelSource spec - else builtins.throw "Unknown source type ${spec.type}"; + if spec.type == "Git" then + mkGitSource spec + else if spec.type == "GitRelease" then + mkGitSource spec + else if spec.type == "PyPi" then + mkPyPiSource spec + else if spec.type == "Channel" then + mkChannelSource spec + else + builtins.throw "Unknown source type ${spec.type}"; in spec // { outPath = path; }; - mkGitSource = { repository, revision, url ? null, hash, ... }: + mkGitSource = + { + repository, + revision, + url ? null, + hash, + ... + }: assert repository ? type; # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository # In the latter case, there we will always be an url to the tarball @@ -23,19 +37,23 @@ let inherit url; sha256 = hash; # FIXME: check nix version & use SRI hashes }) - else assert repository.type == "Git"; builtins.fetchGit { - url = repository.url; - rev = revision; - # hash = hash; - }; + else + assert repository.type == "Git"; + builtins.fetchGit { + url = repository.url; + rev = revision; + # hash = hash; + }; - mkPyPiSource = { url, hash, ... }: + mkPyPiSource = + { url, hash, ... }: builtins.fetchurl { inherit url; sha256 = hash; }; - mkChannelSource = { url, hash, ... }: + mkChannelSource = + { url, hash, ... }: builtins.fetchTarball { inherit url; sha256 = hash; diff --git a/npins/sources.json b/npins/sources.json index c428855..888e9a7 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -5,6 +5,18 @@ "name": "nixpkgs-unstable", "url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.05pre612007.2748d22b45a9/nixexprs.tar.xz", "hash": "0l6yzjxvlilidsixqz54110n84yzcjsm74wvrs69pvs73gk1w1xa" + }, + "treefmt-nix": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "numtide", + "repo": "treefmt-nix" + }, + "branch": "main", + "revision": "49dc4a92b02b8e68798abd99184f228243b6e3ac", + "url": "https://github.com/numtide/treefmt-nix/archive/49dc4a92b02b8e68798abd99184f228243b6e3ac.tar.gz", + "hash": "0qlhb0xvcc3al19irclxk7vnppd9m6b5vi3nbjb9dylphs306x1p" } }, "version": 3 diff --git a/package.nix b/package.nix index c6bcce7..479d99b 100644 --- a/package.nix +++ b/package.nix @@ -2,7 +2,6 @@ lib, rustPlatform, nix, - rustfmt, clippy, makeWrapper, @@ -30,7 +29,6 @@ rustPlatform.buildRustPackage { cargoLock.lockFile = ./Cargo.lock; nativeBuildInputs = [ nix - rustfmt clippy makeWrapper ]; @@ -38,7 +36,6 @@ rustPlatform.buildRustPackage { env.NIX_PATH = "test-nixpkgs=${testNixpkgsPath}:test-nixpkgs/lib=${nixpkgsLibPath}"; preCheck = initNix; postCheck = '' - cargo fmt --check # --tests or --all-targets include tests for linting cargo clippy --all-targets -- -D warnings ''; @@ -46,5 +43,4 @@ rustPlatform.buildRustPackage { wrapProgram $out/bin/nixpkgs-check-by-name \ --set NIX_CHECK_BY_NAME_EXPR_PATH "$NIX_CHECK_BY_NAME_EXPR_PATH" ''; - } diff --git a/scripts/release.sh b/scripts/release.sh index b512e07..af6813d 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -32,7 +32,7 @@ fi echo "Building release artifact for system $system" -nix-build "$root" -A build -o "$tmp/build" >/dev/null +nix-build "$root" -A build -o "$tmp/build" > /dev/null readarray -t closure < <(nix-store -qR "$tmp/build") nix-store --export "${closure[@]}" > "$tmp/$system.nar" gzip "$tmp/$system.nar" diff --git a/scripts/update-github-actions.sh b/scripts/update-github-actions.sh index 5e8d4b5..ced0898 100755 --- a/scripts/update-github-actions.sh +++ b/scripts/update-github-actions.sh @@ -22,7 +22,7 @@ trap 'rm -rf "$tmp"' exit # Use dependency groups to update all dependencies together # Note that repo is not used because we pass `--local` on the CLI -cat < "$tmp/input.yml" +cat << EOF > "$tmp/input.yml" job: package-manager: "github_actions" allowed-updates: @@ -39,13 +39,13 @@ job: EOF if create_pull_request=$(LOCAL_GITHUB_ACCESS_TOKEN="$githubToken" \ - dependabot update --file "$tmp/input.yml" --local "$REPO_ROOT" \ - | jq --exit-status 'select(.type == "create_pull_request").data'); then + dependabot update --file "$tmp/input.yml" --local "$REPO_ROOT" | + jq --exit-status 'select(.type == "create_pull_request").data'); then jq --exit-status --raw-output '."pr-body"' <<< "$create_pull_request" - jq --compact-output '."updated-dependency-files"[]' <<< "$create_pull_request" \ - | while read -r fileUpdate; do + jq --compact-output '."updated-dependency-files"[]' <<< "$create_pull_request" | + while read -r fileUpdate; do file=$(jq --exit-status --raw-output '.name' <<< "$fileUpdate") # --join-output makes sure to not output a trailing newline jq --exit-status --raw-output --join-output '.content' <<< "$fileUpdate" > "$REPO_ROOT/$file" diff --git a/src/eval.nix b/src/eval.nix index ab1c41e..5165c8c 100644 --- a/src/eval.nix +++ b/src/eval.nix @@ -2,10 +2,7 @@ # Returns a value containing information on all Nixpkgs attributes # which is decoded on the Rust side. # See ./eval.rs for the meaning of the returned values -{ - attrsPath, - nixpkgsPath, -}: +{ attrsPath, nixpkgsPath }: let attrs = builtins.fromJSON (builtins.readFile attrsPath); @@ -17,7 +14,8 @@ let overlay = final: prev: { # Adds information to each attribute about whether it's manually defined using `callPackage` - callPackage = fn: args: + callPackage = + fn: args: addVariantInfo (prev.callPackage fn args) { # This is a manual definition of the attribute, and it's a callPackage, specifically a semantic callPackage ManualDefinition.is_semantic_call_package = true; @@ -28,20 +26,16 @@ let # used by that overlay. # This overrides the above `callPackage` information (we don't need that # one, since `pkgs/by-name` always uses `callPackage` underneath. - _internalCallByNamePackageFile = file: - addVariantInfo (prev._internalCallByNamePackageFile file) { - AutoDefinition = null; - }; - + _internalCallByNamePackageFile = + file: addVariantInfo (prev._internalCallByNamePackageFile file) { AutoDefinition = null; }; }; # We can't just replace attribute values with their info in the overlay, # because attributes can depend on other attributes, so this would break evaluation. - addVariantInfo = value: variant: + addVariantInfo = + value: variant: if builtins.isAttrs value then - value // { - _callPackageVariant = variant; - } + value // { _callPackageVariant = variant; } else # It's very rare that callPackage doesn't return an attribute set, but it can occur. # In such a case we can't really return anything sensible that would include the info, @@ -61,14 +55,14 @@ let attrInfo = name: value: { location = builtins.unsafeGetAttrPos name pkgs; attribute_variant = - if ! builtins.isAttrs value then + if !builtins.isAttrs value then { NonAttributeSet = null; } else { AttributeSet = { is_derivation = pkgs.lib.isDerivation value; definition_variant = - if ! value ? _callPackageVariant then + if !value ? _callPackageVariant then { ManualDefinition.is_semantic_call_package = false; } else value._callPackageVariant; @@ -77,19 +71,22 @@ let }; # Information on all attributes that are in pkgs/by-name. - byNameAttrs = builtins.listToAttrs (map (name: { - inherit name; - value.ByName = - if ! pkgs ? ${name} then - { Missing = null; } - else - # Evaluation failures are not allowed, so don't try to catch them - { Existing = attrInfo name pkgs.${name}; }; - }) attrs); + byNameAttrs = builtins.listToAttrs ( + map (name: { + inherit name; + value.ByName = + if !pkgs ? ${name} then + { Missing = null; } + else + # Evaluation failures are not allowed, so don't try to catch them + { Existing = attrInfo name pkgs.${name}; }; + }) attrs + ); # Information on all attributes that exist but are not in pkgs/by-name. # We need this to enforce pkgs/by-name for new packages - nonByNameAttrs = builtins.mapAttrs (name: value: + nonByNameAttrs = builtins.mapAttrs ( + name: value: let # Packages outside `pkgs/by-name` often fail evaluation, # so we need to handle that @@ -97,11 +94,7 @@ let result = builtins.tryEval (builtins.deepSeq output null); in { - NonByName = - if result.success then - { EvalSuccess = output; } - else - { EvalFailure = null; }; + NonByName = if result.success then { EvalSuccess = output; } else { EvalFailure = null; }; } ) (builtins.removeAttrs pkgs attrs); diff --git a/tests/aliases/aliases.nix b/tests/aliases/aliases.nix index c70ec23..fd9a09c 100644 --- a/tests/aliases/aliases.nix +++ b/tests/aliases/aliases.nix @@ -1,3 +1 @@ -self: super: { - baz = self.foo; -} +self: super: { baz = self.foo; } diff --git a/tests/aliases/pkgs/top-level/all-packages.nix b/tests/aliases/pkgs/top-level/all-packages.nix index 2cdfcef..c16f435 100644 --- a/tests/aliases/pkgs/top-level/all-packages.nix +++ b/tests/aliases/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - bar = self.foo; -} +self: super: { bar = self.foo; } diff --git a/tests/alt-callPackage/pkgs/top-level/all-packages.nix b/tests/alt-callPackage/pkgs/top-level/all-packages.nix index 399f8ee..a763d3b 100644 --- a/tests/alt-callPackage/pkgs/top-level/all-packages.nix +++ b/tests/alt-callPackage/pkgs/top-level/all-packages.nix @@ -1,7 +1,6 @@ self: super: { - alt.callPackage = self.lib.callPackageWith {}; + alt.callPackage = self.lib.callPackageWith { }; foo = self.alt.callPackage ({ }: self.someDrv) { }; - } diff --git a/tests/broken-autocall/default.nix b/tests/broken-autocall/default.nix index bd4825f..840ae1e 100644 --- a/tests/broken-autocall/default.nix +++ b/tests/broken-autocall/default.nix @@ -1,4 +1 @@ -args: -builtins.removeAttrs - (import { root = ./.; } args) - [ "foo" ] +args: builtins.removeAttrs (import { root = ./.; } args) [ "foo" ] diff --git a/tests/by-name-failure/expected b/tests/by-name-failure/expected index ec9935b..dbf6317 100644 --- a/tests/by-name-failure/expected +++ b/tests/by-name-failure/expected @@ -6,12 +6,12 @@ error: … while evaluating attribute 'ByName' - at src/eval.nix:82:5: + at src/eval.nix:77:7: - 81| inherit name; - 82| value.ByName = - | ^ - 83| if ! pkgs ? ${name} then + 76| inherit name; + 77| value.ByName = + | ^ + 78| if !pkgs ? ${name} then (stack trace truncated; use '--show-trace' to show the full trace) diff --git a/tests/by-name-failure/pkgs/by-name/fo/foo/package.nix b/tests/by-name-failure/pkgs/by-name/fo/foo/package.nix index 8a1fd7a..51081b0 100644 --- a/tests/by-name-failure/pkgs/by-name/fo/foo/package.nix +++ b/tests/by-name-failure/pkgs/by-name/fo/foo/package.nix @@ -1,4 +1,3 @@ { }: # If we caused an actual Nix failure -builtins.trace "This should be on stderr!" -throw "This is an error!" +builtins.trace "This should be on stderr!" throw "This is an error!" diff --git a/tests/callPackage-syntax/pkgs/top-level/all-packages.nix b/tests/callPackage-syntax/pkgs/top-level/all-packages.nix index 306d719..2651346 100644 --- a/tests/callPackage-syntax/pkgs/top-level/all-packages.nix +++ b/tests/callPackage-syntax/pkgs/top-level/all-packages.nix @@ -1,7 +1,10 @@ self: super: { - set = self.callPackages ({ callPackage }: { - foo = callPackage ({ someDrv }: someDrv) { }; - }) { }; + set = self.callPackages ( + { callPackage }: + { + foo = callPackage ({ someDrv }: someDrv) { }; + } + ) { }; inherit (self.set) foo; } diff --git a/tests/mock-nixpkgs.nix b/tests/mock-nixpkgs.nix index bba84db..d67846d 100644 --- a/tests/mock-nixpkgs.nix +++ b/tests/mock-nixpkgs.nix @@ -1,24 +1,22 @@ /* -This file returns a mocked version of Nixpkgs' default.nix for testing purposes. -It does not depend on Nixpkgs itself for the sake of simplicity. + This file returns a mocked version of Nixpkgs' default.nix for testing purposes. + It does not depend on Nixpkgs itself for the sake of simplicity. -It takes one attribute as an argument: -- `root`: The root of Nixpkgs to read other files from, including: - - `./pkgs/by-name`: The `pkgs/by-name` directory to test - - `./all-packages.nix`: A file containing an overlay to mirror the real `pkgs/top-level/all-packages.nix`. - This allows adding overrides on top of the auto-called packages in `pkgs/by-name`. + It takes one attribute as an argument: + - `root`: The root of Nixpkgs to read other files from, including: + - `./pkgs/by-name`: The `pkgs/by-name` directory to test + - `./all-packages.nix`: A file containing an overlay to mirror the real `pkgs/top-level/all-packages.nix`. + This allows adding overrides on top of the auto-called packages in `pkgs/by-name`. -It returns a Nixpkgs-like function that can be auto-called and evaluates to an attribute set. + It returns a Nixpkgs-like function that can be auto-called and evaluates to an attribute set. */ -{ - root, -}: +{ root }: # The arguments for the Nixpkgs function { # Passed by the checker to modify `callPackage` - overlays ? [], + overlays ? [ ], # Passed by the checker to make sure a real Nixpkgs isn't influenced by impurities - config ? {}, + config ? { }, # Passed by the checker to make sure a real Nixpkgs isn't influenced by impurities system ? null, }: @@ -29,7 +27,8 @@ let # The base fixed-point function to populate the resulting attribute set pkgsFun = - self: { + self: + { inherit lib; newScope = extra: lib.callPackageWith (self // extra); callPackage = self.newScope { }; @@ -42,7 +41,9 @@ let # By using `mapAttrs`, `builtins.unsafeGetAttrPos` just returns `null`, # which then doesn't trigger this check // lib.mapAttrs (name: value: value) { - someDrv = { type = "derivation"; }; + someDrv = { + type = "derivation"; + }; }; baseDirectory = root + "/pkgs/by-name"; @@ -53,31 +54,27 @@ let let entries = builtins.readDir baseDirectory; - namesForShard = shard: + namesForShard = + shard: if entries.${shard} != "directory" then # Only README.md is allowed to be a file, but it's not this code's job to check for that { } else - builtins.mapAttrs - (name: _: baseDirectory + "/${shard}/${name}/package.nix") - (builtins.readDir (baseDirectory + "/${shard}")); - + builtins.mapAttrs (name: _: baseDirectory + "/${shard}/${name}/package.nix") ( + builtins.readDir (baseDirectory + "/${shard}") + ); in - builtins.foldl' - (acc: el: acc // el) - { } - (map namesForShard (builtins.attrNames entries)); + builtins.foldl' (acc: el: acc // el) { } (map namesForShard (builtins.attrNames entries)); # Turns autoCalledPackageFiles into an overlay that `callPackage`'s all of them - autoCalledPackages = self: super: + autoCalledPackages = + self: super: { # Needed to be able to detect empty arguments in all-packages.nix # See a more detailed description in pkgs/top-level/by-name-overlay.nix _internalCallByNamePackageFile = file: self.callPackage file { }; } - // builtins.mapAttrs - (name: self._internalCallByNamePackageFile) - autoCalledPackageFiles; + // builtins.mapAttrs (name: self._internalCallByNamePackageFile) autoCalledPackageFiles; # A list optionally containing the `all-packages.nix` file from the test case as an overlay optionalAllPackagesOverlay = @@ -95,13 +92,9 @@ let [ ]; # All the overlays in the right order, including the user-supplied ones - allOverlays = - [ - autoCalledPackages - ] - ++ optionalAllPackagesOverlay - ++ optionalAliasesOverlay - ++ overlays; + allOverlays = [ + autoCalledPackages + ] ++ optionalAllPackagesOverlay ++ optionalAliasesOverlay ++ overlays; # Apply all the overlays in order to the base fixed-point function pkgsFun f = builtins.foldl' (f: overlay: lib.extends overlay f) pkgsFun allOverlays; diff --git a/tests/move-to-non-by-name/pkgs/top-level/all-packages.nix b/tests/move-to-non-by-name/pkgs/top-level/all-packages.nix index cc25378..e01073a 100644 --- a/tests/move-to-non-by-name/pkgs/top-level/all-packages.nix +++ b/tests/move-to-non-by-name/pkgs/top-level/all-packages.nix @@ -1,10 +1,6 @@ self: super: { foo1 = self.callPackage ({ someDrv }: someDrv) { }; foo2 = self.callPackage ./../../without-config.nix { }; - foo3 = self.callPackage ({ someDrv, enableFoo }: someDrv) { - enableFoo = null; - }; - foo4 = self.callPackage ./../../with-config.nix { - enableFoo = null; - }; + foo3 = self.callPackage ({ someDrv, enableFoo }: someDrv) { enableFoo = null; }; + foo4 = self.callPackage ./../../with-config.nix { enableFoo = null; }; } diff --git a/tests/multiple-failures/expected b/tests/multiple-failures/expected index 0105b19..c8fc550 100644 --- a/tests/multiple-failures/expected +++ b/tests/multiple-failures/expected @@ -6,9 +6,9 @@ pkgs/by-name/aa: This is a file, but it should be a directory. pkgs/by-name/ba/bar: This path is a file, but it should be a directory. pkgs/by-name/ba/baz: "package.nix" must be a file. pkgs/by-name/ba/foo: Incorrect directory location, should be pkgs/by-name/fo/foo instead. -pkgs/by-name/ba/foo: File package.nix at line 2 contains the path expression "/bar" which cannot be resolved: No such file or directory (os error 2). -pkgs/by-name/ba/foo: File package.nix at line 3 contains the path expression "../." which may point outside the directory of that package. -pkgs/by-name/ba/foo: File package.nix at line 4 contains the nix search path expression "" which may point outside the directory of that package. -pkgs/by-name/ba/foo: File package.nix at line 5 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. +pkgs/by-name/ba/foo: File package.nix at line 4 contains the path expression "/bar" which cannot be resolved: No such file or directory (os error 2). +pkgs/by-name/ba/foo: File package.nix at line 5 contains the path expression "../." which may point outside the directory of that package. +pkgs/by-name/ba/foo: File package.nix at line 6 contains the nix search path expression "" which may point outside the directory of that package. +pkgs/by-name/ba/foo: File package.nix at line 7 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. pkgs/by-name/fo/foo: Missing required "package.nix" file. This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/multiple-failures/pkgs/by-name/ba/foo/package.nix b/tests/multiple-failures/pkgs/by-name/ba/foo/package.nix index 31b4742..90352b2 100644 --- a/tests/multiple-failures/pkgs/by-name/ba/foo/package.nix +++ b/tests/multiple-failures/pkgs/by-name/ba/foo/package.nix @@ -1,4 +1,6 @@ -{ someDrv }: someDrv // { +{ someDrv }: +someDrv +// { escapeAbsolute = /bar; escapeRelative = ../.; nixPath = ; diff --git a/tests/new-package-non-by-name/base/pkgs/top-level/all-packages.nix b/tests/new-package-non-by-name/base/pkgs/top-level/all-packages.nix index c2665d0..ca0b783 100644 --- a/tests/new-package-non-by-name/base/pkgs/top-level/all-packages.nix +++ b/tests/new-package-non-by-name/base/pkgs/top-level/all-packages.nix @@ -1,5 +1,4 @@ self: super: { before = self.callPackage ({ someDrv }: someDrv) { }; - } diff --git a/tests/new-package-non-by-name/pkgs/top-level/all-packages.nix b/tests/new-package-non-by-name/pkgs/top-level/all-packages.nix index 2e5be38..ecae9e1 100644 --- a/tests/new-package-non-by-name/pkgs/top-level/all-packages.nix +++ b/tests/new-package-non-by-name/pkgs/top-level/all-packages.nix @@ -2,10 +2,6 @@ self: super: { before = self.callPackage ({ someDrv }: someDrv) { }; new1 = self.callPackage ({ someDrv }: someDrv) { }; new2 = self.callPackage ./../../without-config.nix { }; - new3 = self.callPackage ({ someDrv, enableNew }: someDrv) { - enableNew = null; - }; - new4 = self.callPackage ./../../with-config.nix { - enableNew = null; - }; + new3 = self.callPackage ({ someDrv, enableNew }: someDrv) { enableNew = null; }; + new4 = self.callPackage ./../../with-config.nix { enableNew = null; }; } diff --git a/tests/no-eval/base/pkgs/top-level/all-packages.nix b/tests/no-eval/base/pkgs/top-level/all-packages.nix index ac763b4..934d1e6 100644 --- a/tests/no-eval/base/pkgs/top-level/all-packages.nix +++ b/tests/no-eval/base/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - futureEval = throw "foo"; -} +self: super: { futureEval = throw "foo"; } diff --git a/tests/non-by-name-trace/pkgs/top-level/all-packages.nix b/tests/non-by-name-trace/pkgs/top-level/all-packages.nix index e293a33..998451e 100644 --- a/tests/non-by-name-trace/pkgs/top-level/all-packages.nix +++ b/tests/non-by-name-trace/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - foo = self.lib.warn "foo should not be used anymore" null; -} +self: super: { foo = self.lib.warn "foo should not be used anymore" null; } diff --git a/tests/non-syntactical-callPackage-by-name/pkgs/top-level/all-packages.nix b/tests/non-syntactical-callPackage-by-name/pkgs/top-level/all-packages.nix index 7c0e55f..0a55d9c 100644 --- a/tests/non-syntactical-callPackage-by-name/pkgs/top-level/all-packages.nix +++ b/tests/non-syntactical-callPackage-by-name/pkgs/top-level/all-packages.nix @@ -2,5 +2,4 @@ self: super: { bar = (x: x) self.callPackage ./../by-name/fo/foo/package.nix { someFlag = true; }; foo = self.bar; - } diff --git a/tests/only-callPackage-derivations/pkgs/top-level/all-packages.nix b/tests/only-callPackage-derivations/pkgs/top-level/all-packages.nix index 5b1ed9d..ce3842d 100644 --- a/tests/only-callPackage-derivations/pkgs/top-level/all-packages.nix +++ b/tests/only-callPackage-derivations/pkgs/top-level/all-packages.nix @@ -1,5 +1,6 @@ self: super: { - alternateCallPackage = self.myScope.callPackage ({ myScopeValue, someDrv }: + alternateCallPackage = self.myScope.callPackage ( + { myScopeValue, someDrv }: assert myScopeValue; someDrv ) { }; @@ -8,9 +9,12 @@ self: super: { myScopeValue = true; }); - myPackages = self.callPackages ({ someDrv }: { - a = someDrv; - b = someDrv; - }) { }; + myPackages = self.callPackages ( + { someDrv }: + { + a = someDrv; + b = someDrv; + } + ) { }; inherit (self.myPackages) a b; } diff --git a/tests/override-different-file/expected b/tests/override-different-file/expected index 8b18b9a..ac86f32 100644 --- a/tests/override-different-file/expected +++ b/tests/override-different-file/expected @@ -2,7 +2,7 @@ nonDerivation = callPackage ./../by-name/no/nonDerivation/package.nix { /* ... */ }; - However, in this PR, the first `callPackage` argument is the wrong path. See the definition in pkgs/top-level/all-packages.nix:2: + However, in this PR, the first `callPackage` argument is the wrong path. See the definition in pkgs/top-level/all-packages.nix:1: nonDerivation = callPackage ./../../someDrv.nix { /* ... */ }; diff --git a/tests/override-different-file/pkgs/top-level/all-packages.nix b/tests/override-different-file/pkgs/top-level/all-packages.nix index e196d26..da92b68 100644 --- a/tests/override-different-file/pkgs/top-level/all-packages.nix +++ b/tests/override-different-file/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - nonDerivation = self.callPackage ./../../someDrv.nix { }; -} +self: super: { nonDerivation = self.callPackage ./../../someDrv.nix { }; } diff --git a/tests/override-empty-arg-gradual/base/pkgs/top-level/all-packages.nix b/tests/override-empty-arg-gradual/base/pkgs/top-level/all-packages.nix index eaf7e92..ebe25d3 100644 --- a/tests/override-empty-arg-gradual/base/pkgs/top-level/all-packages.nix +++ b/tests/override-empty-arg-gradual/base/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - nonDerivation = self.callPackage ./../by-name/no/nonDerivation/package.nix { }; -} +self: super: { nonDerivation = self.callPackage ./../by-name/no/nonDerivation/package.nix { }; } diff --git a/tests/override-empty-arg-gradual/pkgs/top-level/all-packages.nix b/tests/override-empty-arg-gradual/pkgs/top-level/all-packages.nix index eaf7e92..ebe25d3 100644 --- a/tests/override-empty-arg-gradual/pkgs/top-level/all-packages.nix +++ b/tests/override-empty-arg-gradual/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - nonDerivation = self.callPackage ./../by-name/no/nonDerivation/package.nix { }; -} +self: super: { nonDerivation = self.callPackage ./../by-name/no/nonDerivation/package.nix { }; } diff --git a/tests/override-empty-arg/expected b/tests/override-empty-arg/expected index 7ab86c5..ade92a7 100644 --- a/tests/override-empty-arg/expected +++ b/tests/override-empty-arg/expected @@ -2,7 +2,7 @@ nonDerivation = callPackage ./../by-name/no/nonDerivation/package.nix { /* ... */ }; - However, in this PR, the second argument is empty. See the definition in pkgs/top-level/all-packages.nix:2: + However, in this PR, the second argument is empty. See the definition in pkgs/top-level/all-packages.nix:1: nonDerivation = self.callPackage ./../by-name/no/nonDerivation/package.nix { }; diff --git a/tests/override-empty-arg/pkgs/top-level/all-packages.nix b/tests/override-empty-arg/pkgs/top-level/all-packages.nix index eaf7e92..ebe25d3 100644 --- a/tests/override-empty-arg/pkgs/top-level/all-packages.nix +++ b/tests/override-empty-arg/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - nonDerivation = self.callPackage ./../by-name/no/nonDerivation/package.nix { }; -} +self: super: { nonDerivation = self.callPackage ./../by-name/no/nonDerivation/package.nix { }; } diff --git a/tests/override-no-call-package/expected b/tests/override-no-call-package/expected index 686c84f..193d156 100644 --- a/tests/override-no-call-package/expected +++ b/tests/override-no-call-package/expected @@ -2,7 +2,7 @@ nonDerivation = callPackage ./../by-name/no/nonDerivation/package.nix { /* ... */ }; - However, in this PR, it isn't defined that way. See the definition in pkgs/top-level/all-packages.nix:2 + However, in this PR, it isn't defined that way. See the definition in pkgs/top-level/all-packages.nix:1 nonDerivation = self.someDrv; diff --git a/tests/override-no-call-package/pkgs/top-level/all-packages.nix b/tests/override-no-call-package/pkgs/top-level/all-packages.nix index 853c3a8..4c4a39b 100644 --- a/tests/override-no-call-package/pkgs/top-level/all-packages.nix +++ b/tests/override-no-call-package/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - nonDerivation = self.someDrv; -} +self: super: { nonDerivation = self.someDrv; } diff --git a/tests/override-no-file/expected b/tests/override-no-file/expected index 803eef6..e96d29a 100644 --- a/tests/override-no-file/expected +++ b/tests/override-no-file/expected @@ -2,7 +2,7 @@ nonDerivation = callPackage ./../by-name/no/nonDerivation/package.nix { /* ... */ }; - However, in this PR, the first `callPackage` argument is not a path. See the definition in pkgs/top-level/all-packages.nix:2: + However, in this PR, the first `callPackage` argument is not a path. See the definition in pkgs/top-level/all-packages.nix:1: nonDerivation = self.callPackage ({ someDrv }: someDrv) { }; diff --git a/tests/override-no-file/pkgs/top-level/all-packages.nix b/tests/override-no-file/pkgs/top-level/all-packages.nix index dc07f69..cec4a2b 100644 --- a/tests/override-no-file/pkgs/top-level/all-packages.nix +++ b/tests/override-no-file/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - nonDerivation = self.callPackage ({ someDrv }: someDrv) { }; -} +self: super: { nonDerivation = self.callPackage ({ someDrv }: someDrv) { }; } diff --git a/tests/override-non-path/pkgs/top-level/all-packages.nix b/tests/override-non-path/pkgs/top-level/all-packages.nix index f07e7a4..992ffb3 100644 --- a/tests/override-non-path/pkgs/top-level/all-packages.nix +++ b/tests/override-non-path/pkgs/top-level/all-packages.nix @@ -1,5 +1,4 @@ self: super: { foo = self.callPackage ({ someDrv, someFlag }: someDrv) { someFlag = true; }; - } diff --git a/tests/override-success/pkgs/by-name/fo/foo/package.nix b/tests/override-success/pkgs/by-name/fo/foo/package.nix index c811a72..72cbf0a 100644 --- a/tests/override-success/pkgs/by-name/fo/foo/package.nix +++ b/tests/override-success/pkgs/by-name/fo/foo/package.nix @@ -2,7 +2,4 @@ someDrv, enableBar ? false, }: -if enableBar then - someDrv -else - {} +if enableBar then someDrv else { } diff --git a/tests/override-success/pkgs/top-level/all-packages.nix b/tests/override-success/pkgs/top-level/all-packages.nix index bf01a4b..7777132 100644 --- a/tests/override-success/pkgs/top-level/all-packages.nix +++ b/tests/override-success/pkgs/top-level/all-packages.nix @@ -1,5 +1 @@ -self: super: { - foo = self.callPackage ./../by-name/fo/foo/package.nix { - enableBar = true; - }; -} +self: super: { foo = self.callPackage ./../by-name/fo/foo/package.nix { enableBar = true; }; } diff --git a/tests/package-variants/base/pkgs/top-level/all-packages.nix b/tests/package-variants/base/pkgs/top-level/all-packages.nix index d786f73..c187f10 100644 --- a/tests/package-variants/base/pkgs/top-level/all-packages.nix +++ b/tests/package-variants/base/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: { - foo-variant-unvarianted = self.callPackage ./../by-name/fo/foo/package.nix { }; -} +self: super: { foo-variant-unvarianted = self.callPackage ./../by-name/fo/foo/package.nix { }; } diff --git a/tests/ref-absolute/expected b/tests/ref-absolute/expected index 0bdb00f..a3125b5 100644 --- a/tests/ref-absolute/expected +++ b/tests/ref-absolute/expected @@ -1,2 +1,2 @@ -pkgs/by-name/aa/aa: File package.nix at line 2 contains the path expression "/foo" which cannot be resolved: No such file or directory (os error 2). +pkgs/by-name/aa/aa: File package.nix at line 1 contains the path expression "/foo" which cannot be resolved: No such file or directory (os error 2). This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/ref-absolute/pkgs/by-name/aa/aa/package.nix b/tests/ref-absolute/pkgs/by-name/aa/aa/package.nix index 7a51ba1..ae97501 100644 --- a/tests/ref-absolute/pkgs/by-name/aa/aa/package.nix +++ b/tests/ref-absolute/pkgs/by-name/aa/aa/package.nix @@ -1,3 +1 @@ -{ someDrv }: someDrv // { - escape = /foo; -} +{ someDrv }: someDrv // { escape = /foo; } diff --git a/tests/ref-escape/expected b/tests/ref-escape/expected index 2e4338c..cc67423 100644 --- a/tests/ref-escape/expected +++ b/tests/ref-escape/expected @@ -1,2 +1,2 @@ -pkgs/by-name/aa/aa: File package.nix at line 2 contains the path expression "../." which may point outside the directory of that package. +pkgs/by-name/aa/aa: File package.nix at line 1 contains the path expression "../." which may point outside the directory of that package. This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/ref-escape/pkgs/by-name/aa/aa/package.nix b/tests/ref-escape/pkgs/by-name/aa/aa/package.nix index 5989f52..7a7927a 100644 --- a/tests/ref-escape/pkgs/by-name/aa/aa/package.nix +++ b/tests/ref-escape/pkgs/by-name/aa/aa/package.nix @@ -1,3 +1 @@ -{ someDrv }: someDrv // { - escape = ../.; -} +{ someDrv }: someDrv // { escape = ../.; } diff --git a/tests/ref-nix-path/expected b/tests/ref-nix-path/expected index 3012557..5c8021a 100644 --- a/tests/ref-nix-path/expected +++ b/tests/ref-nix-path/expected @@ -1,2 +1,2 @@ -pkgs/by-name/aa/aa: File package.nix at line 2 contains the nix search path expression "" which may point outside the directory of that package. +pkgs/by-name/aa/aa: File package.nix at line 1 contains the nix search path expression "" which may point outside the directory of that package. This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/ref-nix-path/pkgs/by-name/aa/aa/package.nix b/tests/ref-nix-path/pkgs/by-name/aa/aa/package.nix index 864fdce..1205c5b 100644 --- a/tests/ref-nix-path/pkgs/by-name/aa/aa/package.nix +++ b/tests/ref-nix-path/pkgs/by-name/aa/aa/package.nix @@ -1,3 +1 @@ -{ someDrv }: someDrv // { - nixPath = ; -} +{ someDrv }: someDrv // { nixPath = ; } diff --git a/tests/ref-path-subexpr/expected b/tests/ref-path-subexpr/expected index 6567439..8fec8dc 100644 --- a/tests/ref-path-subexpr/expected +++ b/tests/ref-path-subexpr/expected @@ -1,2 +1,2 @@ -pkgs/by-name/aa/aa: File package.nix at line 2 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. +pkgs/by-name/aa/aa: File package.nix at line 1 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/tests/ref-path-subexpr/pkgs/by-name/aa/aa/package.nix b/tests/ref-path-subexpr/pkgs/by-name/aa/aa/package.nix index a94ba75..8af0f3b 100644 --- a/tests/ref-path-subexpr/pkgs/by-name/aa/aa/package.nix +++ b/tests/ref-path-subexpr/pkgs/by-name/aa/aa/package.nix @@ -1,3 +1 @@ -{ someDrv }: someDrv // { - pathWithSubexpr = ./${"test"}; -} +{ someDrv }: someDrv // { pathWithSubexpr = ./${"test"}; } diff --git a/tests/ref-success/pkgs/by-name/aa/aa/package.nix b/tests/ref-success/pkgs/by-name/aa/aa/package.nix index 474db5b..2660f9a 100644 --- a/tests/ref-success/pkgs/by-name/aa/aa/package.nix +++ b/tests/ref-success/pkgs/by-name/aa/aa/package.nix @@ -1,4 +1,6 @@ -{ someDrv }: someDrv // { +{ someDrv }: +someDrv +// { nixFile = ./file.nix; nonNixFile = ./file; directory = ./dir; diff --git a/tests/unknown-location/pkgs/top-level/all-packages.nix b/tests/unknown-location/pkgs/top-level/all-packages.nix index 3398e97..7349781 100644 --- a/tests/unknown-location/pkgs/top-level/all-packages.nix +++ b/tests/unknown-location/pkgs/top-level/all-packages.nix @@ -1,3 +1 @@ -self: super: builtins.mapAttrs (name: value: value) { - foo = self.someDrv; -} +self: super: builtins.mapAttrs (name: value: value) { foo = self.someDrv; }