feat: Change nix formatter to alejandra

This commit is contained in:
ulic-youthlic 2025-11-09 06:25:03 +08:00
parent 0b8b647f05
commit b4c3dfec42
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
229 changed files with 2528 additions and 2884 deletions

View file

@ -2,8 +2,7 @@
lib,
inputs,
...
}:
{
}: {
imports =
(with inputs; [
sops-nix.homeManagerModules.sops

View file

@ -2,11 +2,9 @@
lib,
config,
...
}:
let
}: let
cfg = config.youthlic.programs.atuin;
in
{
in {
options = {
youthlic.programs.atuin = {
enable = lib.mkEnableOption "atuin";

View file

@ -3,11 +3,9 @@
lib,
pkgs,
...
}:
let
}: let
cfg = config.youthlic.programs.awscli;
in
{
in {
options = {
youthlic.programs.awscli = {
enable = lib.mkEnableOption "awscli";
@ -18,7 +16,7 @@ in
};
};
config = lib.mkIf cfg.enable {
sops.secrets."awscli" = { };
sops.secrets."awscli" = {};
programs.awscli = {
enable = true;
credentials = {

View file

@ -2,11 +2,9 @@
config,
lib,
...
}:
let
}: let
cfg = config.youthlic.programs.bash;
in
{
in {
options = {
youthlic.programs.bash = {
enable = lib.mkEnableOption "bash";

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.direnv;
in
{
config,
lib,
...
}: let
cfg = config.youthlic.programs.direnv;
in {
options = {
youthlic.programs.direnv = {
enable = lib.mkEnableOption "direnv";

View file

@ -2,14 +2,12 @@
config,
lib,
...
}:
let
}: let
cfg = config.youthlic.programs.eza;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
ion-cfg = config.youthlic.programs.ion;
in
{
in {
options = {
youthlic.programs.eza = {
enable = lib.mkEnableOption "eza";

View file

@ -3,11 +3,9 @@
lib,
pkgs,
...
}:
let
}: let
cfg = config.youthlic.programs.fish;
in
{
in {
options = {
youthlic.programs.fish = {
enable = lib.mkEnableOption "fish";
@ -25,7 +23,8 @@ in
{
name = with pkgs.fishPlugins.foreign-env; pname + "-" + version;
src = pkgs.fishPlugins.foreign-env.overrideAttrs {
postInstall = # bash
postInstall =
# bash
''
ln -s $out/share/fish/vendor_functions.d $out/functions
'';
@ -41,7 +40,8 @@ in
body = '''';
};
};
shellInitLast = # fish
shellInitLast =
# fish
''
if test -e ~/.config/guix/current/bin/guix
fish_add_path -pPm ~/.config/guix/current/bin

View file

@ -2,13 +2,11 @@
config,
lib,
...
}:
let
}: let
cfg = config.youthlic.programs.fzf;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
in
{
in {
options = {
youthlic.programs.fzf = {
enable = lib.mkEnableOption "fzf";

View file

@ -2,8 +2,7 @@
config,
lib,
...
}:
{
}: {
options = {
youthlic.programs.git = {
email = lib.mkOption {
@ -31,10 +30,9 @@
encrypt-credential = lib.mkEnableOption "encrypt git credential";
};
};
config =
let
cfg = config.youthlic.programs.git;
in
config = let
cfg = config.youthlic.programs.git;
in
lib.mkMerge [
{
programs = {

View file

@ -4,17 +4,15 @@
lib,
outputs,
...
}:
{
}: {
options = {
youthlic.programs.gpg = {
enable = lib.mkEnableOption "gpg";
};
};
config =
let
cfg = config.youthlic.programs.gpg;
in
config = let
cfg = config.youthlic.programs.gpg;
in
lib.mkIf cfg.enable {
services.gpg-agent = lib.mkMerge [
{

View file

@ -3,26 +3,23 @@
pkgs,
config,
...
}:
let
}: let
cfg = config.youthlic.programs.helix;
defaultLanguagesSettings = config.programs.helix.package.passthru.languages.language;
in
{
in {
options = {
youthlic.programs.helix = {
enable = lib.mkEnableOption "helix";
languageSettings = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule (
{ ... }:
{
{...}: {
freeformType = lib.types.anything;
options = {
language-servers = lib.mkOption {
type = lib.types.listOf (lib.types.either lib.types.str lib.types.anything);
default = [ "typos-lsp" ];
example = [ "rust-analyzer" ];
default = ["typos-lsp"];
example = ["rust-analyzer"];
apply = lib.unique;
};
};
@ -30,17 +27,16 @@ in
)
);
default = lib.pipe defaultLanguagesSettings [
(map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang [ "name" ])))
(map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang ["name"])))
lib.listToAttrs
];
apply = lib.mapAttrsToList (name: value: { inherit name; } // value);
apply = lib.mapAttrsToList (name: value: {inherit name;} // value);
};
extraPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
default = [];
example = (
with pkgs;
[
with pkgs; [
deno
]
);
@ -56,8 +52,7 @@ in
enable = true;
defaultEditor = true;
extraPackages = cfg.extraPackages;
settings =
with lib;
settings = with lib;
pipe ./config.toml [
builtins.readFile
builtins.fromTOML
@ -86,200 +81,200 @@ in
command = "typos-lsp";
};
};
} { language = cfg.languageSettings; };
} {language = cfg.languageSettings;};
};
})
(lib.mkIf cfg.enable {
youthlic.programs.helix.languageSettings = lib.pipe defaultLanguagesSettings [
(map ({ name, ... }: lib.nameValuePair name { language-servers = [ "typos-lsp" ]; }))
(map ({name, ...}: lib.nameValuePair name {language-servers = ["typos-lsp"];}))
lib.listToAttrs
];
})
(lib.mkIf cfg.enable {
youthlic.programs.helix.languageSettings =
lib.recursiveUpdate
(lib.pipe defaultLanguagesSettings [
(map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang [ "name" ])))
lib.listToAttrs
])
{
cmake = {
language-servers = [
"neocmakelsp"
"cmake-language-server"
(lib.pipe defaultLanguagesSettings [
(map (lang: lib.nameValuePair lang.name (lib.removeAttrs lang ["name"])))
lib.listToAttrs
])
{
cmake = {
language-servers = [
"neocmakelsp"
"cmake-language-server"
];
};
kdl = {
formatter = {
command = "kdlfmt";
args = [
"format"
"-"
];
};
kdl = {
formatter = {
command = "kdlfmt";
args = [
"format"
"-"
];
};
};
just = {
formatter = {
command = "just";
args = [
"--dump"
];
};
};
nix = {
formatter = {
command = "nixfmt";
};
};
xml = {
formatter = {
command = "xmllint";
args = [
"--format"
"-"
];
};
};
typst = {
formatter = {
command = "typstyle";
};
};
c = {
formatter = {
command = "clang-format";
};
};
cpp = {
formatter = {
command = "clang-format";
};
};
python = {
formatter = {
command = "ruff";
args = [
"format"
"-s"
"--line-length"
"88"
"-"
];
};
language-servers = [
"pyright"
"ruff"
"ty"
];
};
go = {
formatter = {
command = "goimports";
};
};
awk = {
formatter = {
command = "awk";
timeout = 5;
args = [
"--file=/dev/stdin"
"--pretty-print=/dev/stdout"
];
};
};
fish = {
language-servers = [
"fish-lsp"
];
};
yaml = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"yaml"
];
};
};
html = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"html"
];
};
language-servers = [
"vscode-html-language-server"
];
};
css = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"css"
];
};
language-servers = [
"vscode-css-language-server"
];
};
toml = {
formatter = {
command = "taplo";
args = [
"fmt"
"-"
];
};
};
markdown = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"md"
];
};
};
json = {
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"json"
];
};
};
jsonc = {
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"jsonc"
];
};
};
};
just = {
formatter = {
command = "just";
args = [
"--dump"
];
};
};
nix = {
formatter = {
command = "nixfmt";
};
};
xml = {
formatter = {
command = "xmllint";
args = [
"--format"
"-"
];
};
};
typst = {
formatter = {
command = "typstyle";
};
};
c = {
formatter = {
command = "clang-format";
};
};
cpp = {
formatter = {
command = "clang-format";
};
};
python = {
formatter = {
command = "ruff";
args = [
"format"
"-s"
"--line-length"
"88"
"-"
];
};
language-servers = [
"pyright"
"ruff"
"ty"
];
};
go = {
formatter = {
command = "goimports";
};
};
awk = {
formatter = {
command = "awk";
timeout = 5;
args = [
"--file=/dev/stdin"
"--pretty-print=/dev/stdout"
];
};
};
fish = {
language-servers = [
"fish-lsp"
];
};
yaml = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"yaml"
];
};
};
html = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"html"
];
};
language-servers = [
"vscode-html-language-server"
];
};
css = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"css"
];
};
language-servers = [
"vscode-css-language-server"
];
};
toml = {
formatter = {
command = "taplo";
args = [
"fmt"
"-"
];
};
};
markdown = {
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"md"
];
};
};
json = {
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"json"
];
};
};
jsonc = {
language-servers = [
"vscode-json-language-server"
];
formatter = {
command = "deno";
args = [
"fmt"
"-"
"--ext"
"jsonc"
];
};
};
};
})
];
}

View file

@ -2,11 +2,9 @@
lib,
config,
...
}:
let
}: let
cfg = config.youthlic.programs.ion;
in
{
in {
options = {
youthlic.programs.ion = {
enable = lib.mkEnableOption "ion";

View file

@ -3,11 +3,9 @@
config,
lib,
...
}:
let
}: let
cfg = config.youthlic.programs.jujutsu;
in
{
in {
options = {
youthlic.programs.jujutsu = {
enable = lib.mkEnableOption "jujutsu";

View file

@ -2,11 +2,9 @@
config,
lib,
...
}:
let
}: let
cfg = config.youthlic.programs.kvm;
in
{
in {
options = {
youthlic.programs.kvm = {
enable = lib.mkEnableOption "kvm";
@ -16,8 +14,8 @@ in
dconf = {
settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
autoconnect = ["qemu:///system"];
uris = ["qemu:///system"];
};
};
};

View file

@ -3,22 +3,20 @@
lib,
pkgs,
...
}:
let
}: let
cfg = config.youthlic.programs.rustypaste-cli;
in
{
in {
options = {
youthlic.programs.rustypaste-cli = {
enable = lib.mkEnableOption "rustypaste-cli";
};
};
config = lib.mkIf cfg.enable {
home.packages = [ pkgs.rustypaste-cli ];
home.packages = [pkgs.rustypaste-cli];
sops = {
secrets = {
"rustypaste/auth" = { };
"rustypaste/delete" = { };
"rustypaste/auth" = {};
"rustypaste/delete" = {};
};
templates."rustypaste-config.toml" = {
path = "${config.xdg.configHome}/rustypaste/config.toml";

View file

@ -4,8 +4,7 @@
pkgs,
rootPath,
...
}:
{
}: {
options = {
youthlic.programs.sops = {
enable = lib.mkOption {
@ -25,14 +24,12 @@
};
};
};
config =
let
cfg = config.youthlic.programs.sops;
in
config = let
cfg = config.youthlic.programs.sops;
in
lib.mkIf cfg.enable {
home.packages = (
with pkgs;
[
with pkgs; [
sops
age
]

View file

@ -1,8 +1,10 @@
{ config, lib, ... }:
let
cfg = config.youthlic.programs.spotifyd;
in
{
config,
lib,
...
}: let
cfg = config.youthlic.programs.spotifyd;
in {
options = {
youthlic.programs.spotifyd = {
enable = lib.mkEnableOption "spotifyd";

View file

@ -2,14 +2,12 @@
lib,
config,
...
}:
let
}: let
cfg = config.youthlic.programs.starship;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
ion-cfg = config.youthlic.programs.ion;
in
{
in {
options = {
youthlic.programs.starship = {
enable = lib.mkEnableOption "starship";
@ -20,10 +18,9 @@ in
programs.starship = {
enable = true;
enableTransience = true;
settings =
let
config-file = builtins.readFile ./config.toml;
in
settings = let
config-file = builtins.readFile ./config.toml;
in
builtins.fromTOML config-file;
};
})

View file

@ -3,13 +3,11 @@
lib,
pkgs,
...
}:
let
}: let
cfg = config.youthlic.programs.yazi;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
in
{
in {
options = {
youthlic.programs.yazi = {
enable = lib.mkEnableOption "yazi";
@ -23,7 +21,8 @@ in
programs.yazi = {
enable = true;
plugins = {
inherit (pkgs.yaziPlugins)
inherit
(pkgs.yaziPlugins)
ouch
starship
piper
@ -81,7 +80,7 @@ in
desc = "Chmod on selected files";
}
{
on = [ "l" ];
on = ["l"];
run = "plugin smart-enter";
desc = "Enter the child directory, or open the file";
}

View file

@ -2,13 +2,11 @@
config,
lib,
...
}:
let
}: let
cfg = config.youthlic.programs.zoxide;
fish-cfg = config.youthlic.programs.fish;
bash-cfg = config.youthlic.programs.bash;
in
{
in {
options = {
youthlic.programs.zoxide = {
enable = lib.mkEnableOption "zoxide";

View file

@ -2,11 +2,9 @@
lib,
config,
...
}:
let
}: let
cfg = config.youthlic.xdg-dirs;
in
{
in {
options = {
youthlic.xdg-dirs = {
enable = lib.mkEnableOption "xdg-dirs";