-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix --stdin behaviour to match the Rust version #310
Comments
I don't think this is fixed, or maybe I'm running into a different issue? Version 1:
Version 2:
Edit Not related specifically to
|
@nifoc 🤔 thanks for the test case; I think I have some time this afternoon to look at this. |
@nifoc in the meantime can you run your test command with I just checked out the ✦ ❯ cat flake.nix | nix run .# -- --config-file test/examples/nixpkgs.toml --stdin flake.nix
{
description = "Treefmt: once CLI to format your repo";
nixConfig = {
extra-substituters = [ "https://numtide.cachix.org" ];
extra-trusted-public-keys = [ "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" ];
};
inputs = {
blueprint = {
url = "github:numtide/blueprint";
inputs.nixpkgs.follows = "nixpkgs";
};
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
gomod2nix = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "devshell/flake-utils";
};
flake-compat.url = "github:nix-community/flake-compat";
nix-filter.url = "github:numtide/nix-filter";
nix-github-actions = {
url = "github:nix-community/nix-github-actions";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs:
let
inherit (inputs.nixpkgs) lib;
in
inputs.blueprint
{
inherit inputs;
prefix = "nix/";
nixpkgs.config = {
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "terraform" ];
};
}
// {
githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
checks =
lib.getAttrs [
"x86_64-linux"
"x86_64-darwin"
]
inputs.self.checks;
};
};
} |
@nifoc and can you provide your |
Not sure if it's relevant, but I make use of I also tried
Config:
|
The path that was matched: DEBU format | nixpkgs-fmt: match: /var/folders/wf/l_vqfv6976qc30_9bc10y_0w0000gn/T/3014005140.nix The same path passed to the formatter is truncated: DEBU format | nixpkgs-fmt: executing: /nix/store/0zgggwjqgxisg5ba8g902z18jkf580df-nixpkgs-fmt-1.3.0/bin/nixpkgs-fmt _9bc10y_0w0000gn/T/3014005140.nix I ran this on my mac: ❯ cat flake.nix | result/bin/treefmt --config-file test/examples/nixpkgs.toml -stdin flake.nix -vv
DEBU format: config-file=/Users/brian/Development/com/github/numtide/treefmt/test/examples/nixpkgs.toml tree-root=/Users/brian/Development/com/github/numtide/treefmt/test/examples
DEBU format | nixpkgs-fmt[2]: match: /var/folders/3r/0x4fl3z97l3ffql__8xst2cm0000gn/T/3984232970.nix
DEBU format | deadnix[1]: match: /var/folders/3r/0x4fl3z97l3ffql__8xst2cm0000gn/T/3984232970.nix
DEBU format | deadnix[1]: executing: /nix/store/wlqykhn3yvq9hcn8sf1d2s34d732cjfy-devshell-dir/bin/deadnix --edit ../../../../../../../../../var/folders/3r/0x4fl3z97l3ffql__8xst2cm0000gn/T/3984232970.nix
INFO format | deadnix[1]: 1 files processed in 5.322125ms
DEBU format | nixpkgs-fmt[2]: executing: /nix/store/wlqykhn3yvq9hcn8sf1d2s34d732cjfy-devshell-dir/bin/nixpkgs-fmt ../../../../../../../../../var/folders/3r/0x4fl3z97l3ffql__8xst2cm0000gn/T/3984232970.nix
INFO format | nixpkgs-fmt[2]: 1 files processed in 5.374042ms
{
description = "Treefmt: once CLI to format your repo";
nixConfig = {
extra-substituters = [ "https://numtide.cachix.org" ];
extra-trusted-public-keys = [ "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" ];
};
inputs = {
blueprint = {
url = "github:numtide/blueprint";
inputs.nixpkgs.follows = "nixpkgs";
};
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
gomod2nix = {
url = "github:nix-community/gomod2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "devshell/flake-utils";
};
flake-compat.url = "github:nix-community/flake-compat";
nix-filter.url = "github:numtide/nix-filter";
nix-github-actions = {
url = "github:nix-community/nix-github-actions";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs:
let
inherit (inputs.nixpkgs) lib;
in
inputs.blueprint
{
inherit inputs;
prefix = "nix/";
nixpkgs.config = {
allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "terraform" ];
};
}
// {
githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
checks =
lib.getAttrs [
"x86_64-linux"
"x86_64-darwin"
]
inputs.self.checks;
};
};
} It is able to resolve the relative path to the temp file, unlike in your example. 🤔 |
@nifoc I'm pretty sure this is the culprit: Lines 22 to 29 in 65152cb
|
Sorry for not being able to respond earlier. It works for me, too. Thank you for the very quick fix! |
Describe the bug
See #274 for more info, but the short version is that
--stdin
doesn't work as it's supposed to.The text was updated successfully, but these errors were encountered: