1
0
Fork 0
mirror of https://github.com/ryanccn/flake.git synced 2026-01-26 19:56:29 +01:00

style: switch to nixfmt-rfc-style

This commit is contained in:
Ryan Cao 2024-06-17 10:52:56 +08:00
parent 3404601a4a
commit 02e3e3a7ac
Signed by: ryanccn
SSH key fingerprint: SHA256:NtP/BlVhoQq4xU6BEcZeT8nIPvHntkJ3lIc2yB+F09E
17 changed files with 117 additions and 112 deletions

3
.gitignore vendored
View file

@ -1,3 +1,6 @@
.DS_Store .DS_Store
result* result*
.vscode/
.idea/

View file

@ -84,25 +84,27 @@
}; };
}; };
outputs = { outputs =
self, {
nix-darwin, self,
home-manager, nix-darwin,
darwin-custom-icons, home-manager,
... darwin-custom-icons,
} @ inputs: { ...
darwinConfigurations.Ryans-MacBook-Pro = nix-darwin.lib.darwinSystem { }@inputs:
modules = [ {
home-manager.darwinModules.home-manager darwinConfigurations.Ryans-MacBook-Pro = nix-darwin.lib.darwinSystem {
darwin-custom-icons.darwinModules.default modules = [
./system.nix home-manager.darwinModules.home-manager
]; darwin-custom-icons.darwinModules.default
./system.nix
];
specialArgs = { specialArgs = {
inherit self inputs; inherit self inputs;
};
}; };
};
overlays = import ./overlays; overlays = import ./overlays;
}; };
} }

View file

@ -1,3 +1,4 @@
{config, ...}: { { config, ... }:
{
home.file."${config.xdg.configHome}/ghostty/config".source = ./ghostty.conf; home.file."${config.xdg.configHome}/ghostty/config".source = ./ghostty.conf;
} }

View file

@ -3,7 +3,8 @@
lib, lib,
self, self,
... ...
}: let }:
let
extensions = [ extensions = [
# "antfu.icons-carbon" # "antfu.icons-carbon"
"antfu.unocss" "antfu.unocss"
@ -52,7 +53,8 @@
# "xaver.clang-format" # "xaver.clang-format"
"yoavbls.pretty-ts-errors" "yoavbls.pretty-ts-errors"
]; ];
in { in
{
programs.vscode = { programs.vscode = {
enable = true; enable = true;
package = pkgs.stdenvNoCC.mkDerivation { package = pkgs.stdenvNoCC.mkDerivation {
@ -64,7 +66,7 @@ in {
''; '';
}; };
extensions = []; extensions = [ ];
mutableExtensionsDir = true; mutableExtensionsDir = true;
userSettings = { userSettings = {
@ -197,7 +199,7 @@ in {
"nix.serverPath" = lib.getExe pkgs.nixd; "nix.serverPath" = lib.getExe pkgs.nixd;
"nix.serverSettings" = { "nix.serverSettings" = {
nixd = { nixd = {
formatting.command = [(lib.getExe pkgs.alejandra)]; formatting.command = [ (lib.getExe pkgs.alejandra) ];
nixpkgs.expr = "(builtins.getFlake \"${self}\").pkgs"; nixpkgs.expr = "(builtins.getFlake \"${self}\").pkgs";
}; };
}; };
@ -209,7 +211,7 @@ in {
}; };
home.activation = { home.activation = {
vscodeExtensions = lib.hm.dag.entryAfter ["writeBoundary"] '' vscodeExtensions = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
code_bin="/usr/local/bin/code" code_bin="/usr/local/bin/code"
if ! command -v "$code_bin" &> /dev/null; then if ! command -v "$code_bin" &> /dev/null; then
@ -222,19 +224,15 @@ in {
currentExtensions["$extension"]=1; currentExtensions["$extension"]=1;
done done
${builtins.concatStringsSep ${builtins.concatStringsSep "\n" (
"\n" builtins.map (ext: ''
( if [[ -z "''${currentExtensions[${ext}]+unset}" ]]; then
builtins.map echo "installing ${ext}"
(ext: '' $DRY_RUN_CMD "$code_bin" --install-extension ${ext} &> /dev/null
if [[ -z "''${currentExtensions[${ext}]+unset}" ]]; then fi
echo "installing ${ext}" unset 'currentExtensions[${ext}]'
$DRY_RUN_CMD "$code_bin" --install-extension ${ext} &> /dev/null '') extensions
fi )}
unset 'currentExtensions[${ext}]'
'')
extensions
)}
for ext in "''${!currentExtensions[@]}"; do for ext in "''${!currentExtensions[@]}"; do
echo "uninstalling $ext" echo "uninstalling $ext"

View file

@ -1,8 +1,5 @@
{ config, inputs, ... }:
{ {
config,
inputs,
...
}: {
programs.home-manager.enable = true; programs.home-manager.enable = true;
imports = [ imports = [

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
home.packages = with pkgs; [ home.packages = with pkgs; [
inter inter
public-sans public-sans
@ -16,8 +17,6 @@
''; '';
}) })
(nerdfonts.override { (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; })
fonts = ["NerdFontsSymbolsOnly"];
})
]; ];
} }

View file

@ -2,6 +2,6 @@ _: {
programs.eza = { programs.eza = {
enable = true; enable = true;
icons = true; icons = true;
extraOptions = ["--all"]; extraOptions = [ "--all" ];
}; };
} }

View file

@ -1,8 +1,14 @@
{lib, ...}: let { lib, ... }:
let
aliases = import ./aliases.nix; aliases = import ./aliases.nix;
shellAbbrs = builtins.mapAttrs (_: a: a.command) (lib.filterAttrs (_: b: !(b.fishAlias or false)) aliases); shellAbbrs = builtins.mapAttrs (_: a: a.command) (
shellAliases = builtins.mapAttrs (_: a: a.command) (lib.filterAttrs (_: b: builtins.hasAttr "fishAlias" b && b.fishAlias) aliases); lib.filterAttrs (_: b: !(b.fishAlias or false)) aliases
in { );
shellAliases = builtins.mapAttrs (_: a: a.command) (
lib.filterAttrs (_: b: builtins.hasAttr "fishAlias" b && b.fishAlias) aliases
);
in
{
programs.fish = { programs.fish = {
enable = true; enable = true;
catppuccin.enable = true; catppuccin.enable = true;

View file

@ -1,3 +1 @@
_: { _: { programs.glamour.catppuccin.enable = true; }
programs.glamour.catppuccin.enable = true;
}

View file

@ -3,18 +3,21 @@
lib, lib,
config, config,
... ...
}: let }:
toml = pkgs.formats.toml {}; let
in { toml = pkgs.formats.toml { };
in
{
home.file."${config.xdg.dataHome}/cargo/config.toml".source = toml.generate "config.toml" { home.file."${config.xdg.dataHome}/cargo/config.toml".source = toml.generate "config.toml" {
linker = "${lib.getExe pkgs.clang}"; linker = "${lib.getExe pkgs.clang}";
rustflags = ["-C" "link-arg=-fuse-ld=${lib.getExe pkgs.mold}"]; rustflags = [
"-C"
"link-arg=-fuse-ld=${lib.getExe pkgs.mold}"
];
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
(rust-bin.stable.latest.default.override { (rust-bin.stable.latest.default.override { extensions = [ "llvm-tools-preview" ]; })
extensions = ["llvm-tools-preview"];
})
cargo-bloat cargo-bloat
cargo-cache cargo-cache

View file

@ -1,10 +1,8 @@
{ { config, inputs, ... }:
config, let
inputs,
...
}: let
shellAliases = builtins.mapAttrs (_: alias: alias.command) (import ./aliases.nix); shellAliases = builtins.mapAttrs (_: alias: alias.command) (import ./aliases.nix);
in { in
{
programs.zsh = { programs.zsh = {
enable = true; enable = true;
dotDir = ".config/zsh"; dotDir = ".config/zsh";

View file

@ -1,4 +1,5 @@
{config, ...}: { { config, ... }:
{
home.sessionVariables = { home.sessionVariables = {
NEXT_TELEMETRY_DISABLED = "1"; NEXT_TELEMETRY_DISABLED = "1";
NUXT_TELEMETRY_DISABLED = "1"; NUXT_TELEMETRY_DISABLED = "1";

View file

@ -20,22 +20,22 @@ _: {
"ttfautohint" "ttfautohint"
]; ];
casks = let casks =
noQuarantine = name: { let
inherit name; noQuarantine = name: {
args = { inherit name;
no_quarantine = true; args = {
no_quarantine = true;
};
}; };
}; in
in [ [
"blackhole-16ch" "blackhole-16ch"
(noQuarantine "eloston-chromium") (noQuarantine "eloston-chromium")
"sf-symbols" "sf-symbols"
"1password/tap/1password-cli" "1password/tap/1password-cli"
]; ];
taps = [ taps = [ "1password/tap" ];
"1password/tap"
];
}; };
} }

View file

@ -4,7 +4,8 @@
inputs, inputs,
config, config,
... ...
}: { }:
{
services.nix-daemon.enable = true; services.nix-daemon.enable = true;
nix.package = pkgs.nixVersions.latest; nix.package = pkgs.nixVersions.latest;
@ -12,27 +13,24 @@
n.flake = inputs.nixpkgs; n.flake = inputs.nixpkgs;
}; };
nix.nixPath = [ nix.nixPath = [ "nixpkgs=${inputs.nixpkgs.outPath}" ];
"nixpkgs=${inputs.nixpkgs.outPath}"
];
nix.settings = { nix.settings = {
experimental-features = "nix-command flakes"; experimental-features = "nix-command flakes";
auto-optimise-store = true; auto-optimise-store = true;
extra-platforms = ["x86_64-darwin" "aarch64-darwin"]; extra-platforms = [
"x86_64-darwin"
"aarch64-darwin"
];
build-users-group = "nixbld"; build-users-group = "nixbld";
trusted-users = ["ryanccn"]; trusted-users = [ "ryanccn" ];
sandbox = true; sandbox = true;
use-xdg-base-directories = true; use-xdg-base-directories = true;
extra-substituters = [ extra-substituters = [ "https://cache.lix.systems" ];
"https://cache.lix.systems"
];
extra-trusted-public-keys = [ extra-trusted-public-keys = [ "cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o=" ];
"cache.lix.systems:aBnZUw8zA7H35Cz2RyKFVs3H4PlGTLawyY5KRbvJR8o="
];
nix-path = config.nix.nixPath; nix-path = config.nix.nixPath;
}; };

View file

@ -1,13 +1,11 @@
{ pkgs, inputs, ... }:
{ {
pkgs,
inputs,
...
}: {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
inputs.home-manager.packages.${pkgs.system}.home-manager inputs.home-manager.packages.${pkgs.system}.home-manager
alejandra alejandra
nixpkgs-fmt nixpkgs-fmt
nixfmt-rfc-style
statix statix
deadnix deadnix
@ -19,7 +17,7 @@
deno deno
bun bun
(python312.withPackages (ps: with ps; [pip])) (python312.withPackages (ps: with ps; [ pip ]))
ruff ruff
yt-dlp yt-dlp
xkcdpass xkcdpass

View file

@ -1,15 +1,15 @@
_: prev: let _: prev:
let
version = "2024.05.26"; version = "2024.05.26";
mkFontVariant = { mkFontVariant =
variant, { variant, hash }:
hash, prev.callPackage (
}: {
prev.callPackage ({ lib,
lib, fetchzip,
fetchzip, stdenvNoCC,
stdenvNoCC, }:
}:
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
pname = variant; pname = variant;
inherit version; inherit version;
@ -30,8 +30,10 @@ _: prev: let
platforms = platforms.all; platforms = platforms.all;
license = licenses.ofl; license = licenses.ofl;
}; };
}) {}; }
in { ) { };
in
{
ryan-mono-bin = prev.symlinkJoin { ryan-mono-bin = prev.symlinkJoin {
name = "ryan-mono-bin-${version}"; name = "ryan-mono-bin-${version}";

View file

@ -3,7 +3,8 @@
inputs, inputs,
self, self,
... ...
}: { }:
{
imports = [ imports = [
./modules/nix.nix ./modules/nix.nix
./modules/packages.nix ./modules/packages.nix