Set patched alejandra to be the flakes default formatter

This commit is contained in:
SebastianStork 2024-03-23 20:37:24 +01:00
parent 9541e99a78
commit cb9463a57b
2 changed files with 12 additions and 15 deletions

View file

@ -46,6 +46,17 @@
};
};
formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra.overrideAttrs {
passthru.tests.version = {};
postPatch = ''
substituteInPlace src/alejandra/src/builder.rs \
--replace '2 * build_ctx.indentation' '4 * build_ctx.indentation'
substituteInPlace src/alejandra/src/rules/string.rs \
--replace 'format!(" {}", line)' 'format!(" {}", line)'
rm -r src/alejandra/tests
'';
};
devShells.${system}.default = pkgs.mkShell {
packages = [pkgs.sops];
};

View file

@ -7,21 +7,7 @@
options.myConfig.vscode.enable = lib.mkEnableOption "";
config = lib.mkIf config.myConfig.vscode.enable {
home.packages = let
alejandra4 = pkgs.alejandra.overrideAttrs {
passthru.tests.version = lib.mkForce {};
postPatch = ''
substituteInPlace src/alejandra/src/builder.rs \
--replace '2 * build_ctx.indentation' '4 * build_ctx.indentation'
substituteInPlace src/alejandra/src/rules/string.rs \
--replace 'format!(" {}", line)' 'format!(" {}", line)'
rm -r src/alejandra/tests
'';
};
in [
pkgs.nil
alejandra4
];
home.packages = [pkgs.nil];
programs.vscode = {
enable = true;