Format project with official nixfmt formatter (#21)

* Set nix official formatter for the flake

* format the entire project
This commit is contained in:
Gaétan Lepage
2025-10-15 22:09:51 +02:00
committed by GitHub
parent 98b3c63572
commit fba993c589
34 changed files with 375 additions and 281 deletions
+4 -4
View File
@@ -33,7 +33,7 @@ lib: {
};
};
};
default = {};
default = { };
description = "Theme overrides including wallpaper path for generated themes";
};
primary_font = lib.mkOption {
@@ -42,11 +42,11 @@ lib: {
};
vscode_settings = lib.mkOption {
type = lib.types.attrs;
default = {};
default = { };
};
monitors = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
default = [ ];
};
scale = lib.mkOption {
type = lib.types.int;
@@ -80,7 +80,7 @@ lib: {
};
exclude_packages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
default = [ ];
description = "Packages to exclude from the default system packages";
};
};
+15 -7
View File
@@ -9,20 +9,26 @@
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
outputs =
inputs@{
self,
nixpkgs,
hyprland,
nix-colors,
home-manager,
}: {
}:
{
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
nixosModules = {
default = {
default =
{
config,
lib,
pkgs,
...
}: {
}:
{
imports = [
(import ./modules/nixos/default.nix inputs)
];
@@ -35,13 +41,15 @@
};
homeManagerModules = {
default = {
default =
{
config,
lib,
pkgs,
osConfig ? {},
osConfig ? { },
...
}: {
}:
{
imports = [
nix-colors.homeManagerModules.default
(import ./modules/home-manager/default.nix inputs)
+14 -6
View File
@@ -1,4 +1,5 @@
config: let
config:
let
cfg = config.omarchy;
wallpapers = {
"tokyo-night" = [
@@ -22,11 +23,18 @@ config: let
};
# Handle wallpaper path for generated themes and overrides
wallpaper_path = if (cfg.theme == "generated_light" || cfg.theme == "generated_dark") || (cfg.theme_overrides.wallpaper_path != null)
then toString cfg.theme_overrides.wallpaper_path
else let
wallpaper_path =
if
(cfg.theme == "generated_light" || cfg.theme == "generated_dark")
|| (cfg.theme_overrides.wallpaper_path != null)
then
toString cfg.theme_overrides.wallpaper_path
else
let
selected_wallpaper = builtins.elemAt (wallpapers.${cfg.theme}) 0;
in "~/Pictures/Wallpapers/${selected_wallpaper}";
in {
in
"~/Pictures/Wallpapers/${selected_wallpaper}";
in
{
inherit wallpaper_path;
}
+4 -2
View File
@@ -2,10 +2,12 @@
config,
pkgs,
...
}: let
}:
let
cfg = config.omarchy;
palette = config.colorScheme.palette;
in {
in
{
home.file = {
".config/btop/themes/${cfg.theme}.theme" = {
text = ''
+25 -13
View File
@@ -1,26 +1,36 @@
inputs: {
inputs:
{
config,
pkgs,
lib,
...
}: let
packages = import ../packages.nix {inherit pkgs lib; exclude_packages = config.omarchy.exclude_packages;};
}:
let
packages = import ../packages.nix {
inherit pkgs lib;
exclude_packages = config.omarchy.exclude_packages;
};
themes = import ../themes.nix;
# Handle theme selection - either predefined or generated
selectedTheme = if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark")
then null
else themes.${config.omarchy.theme};
selectedTheme =
if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark") then
null
else
themes.${config.omarchy.theme};
# Generate color scheme from wallpaper for generated themes
generatedColorScheme = if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark")
then (inputs.nix-colors.lib.contrib { inherit pkgs; }).colorSchemeFromPicture {
generatedColorScheme =
if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark") then
(inputs.nix-colors.lib.contrib { inherit pkgs; }).colorSchemeFromPicture {
path = config.omarchy.theme_overrides.wallpaper_path;
variant = if config.omarchy.theme == "generated_light" then "light" else "dark";
}
else null;
in {
else
null;
in
{
imports = [
(import ./hyprland.nix inputs)
(import ./hyprlock.nix inputs)
@@ -47,9 +57,11 @@ in {
};
home.packages = packages.homePackages;
colorScheme = if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark")
then generatedColorScheme
else inputs.nix-colors.colorSchemes.${selectedTheme.base16-theme};
colorScheme =
if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark") then
generatedColorScheme
else
inputs.nix-colors.colorSchemes.${selectedTheme.base16-theme};
gtk = {
enable = true;
+2 -1
View File
@@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
programs.direnv = {
enable = true;
enableZshIntegration = true;
+5 -4
View File
@@ -1,10 +1,11 @@
{...}: {
{ ... }:
{
fonts.fontconfig = {
enable = true;
defaultFonts = {
serif = ["Noto Serif"];
sansSerif = ["Noto Sans"];
monospace = ["Caskaydia Mono Nerd Font"];
serif = [ "Noto Serif" ];
sansSerif = [ "Noto Sans" ];
monospace = [ "Caskaydia Mono Nerd Font" ];
};
};
}
+4 -2
View File
@@ -2,10 +2,12 @@
config,
pkgs,
...
}: let
}:
let
cfg = config.omarchy;
palette = config.colorScheme.palette;
in {
in
{
programs.ghostty = {
enable = true;
settings = {
+4 -2
View File
@@ -1,6 +1,8 @@
{config, ...}: let
{ config, ... }:
let
cfg = config.omarchy;
in {
in
{
programs.git = {
enable = true;
userName = cfg.full_name;
+2 -1
View File
@@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
services.hypridle = {
enable = true;
settings = {
+5 -3
View File
@@ -1,9 +1,11 @@
inputs: {
inputs:
{
config,
pkgs,
...
}: {
imports = [./hyprland/configuration.nix];
}:
{
imports = [ ./hyprland/configuration.nix ];
wayland.windowManager.hyprland = {
enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland;
+2 -1
View File
@@ -2,7 +2,8 @@
config,
pkgs,
...
}: {
}:
{
wayland.windowManager.hyprland.settings = {
exec-once = [
# "hypridle & mako & waybar & fcitx5"
+5 -5
View File
@@ -2,13 +2,13 @@
config,
pkgs,
...
}: let
}:
let
cfg = config.omarchy;
in {
in
{
wayland.windowManager.hyprland.settings = {
bind =
cfg.quick_app_bindings
++ [
bind = cfg.quick_app_bindings ++ [
"SUPER, space, exec, wofi --show drun --sort-order=alphabetical"
"SUPER SHIFT, SPACE, exec, pkill -SIGUSR1 waybar"
# "SUPER CTRL, SPACE, exec, ~/.local/share/omarchy/bin/swaybg-next"
@@ -3,9 +3,11 @@
pkgs,
lib,
...
}: let
}:
let
cfg = config.omarchy;
in {
in
{
imports = [
./autostart.nix
./bindings.nix
+6 -6
View File
@@ -2,9 +2,10 @@
config,
lib,
pkgs,
osConfig ? {},
osConfig ? { },
...
}: let
}:
let
cfg = config.omarchy;
hasNvidiaDrivers = builtins.elem "nvidia" osConfig.services.xserver.videoDrivers;
nvidiaEnv = [
@@ -12,12 +13,11 @@
"LIBVA_DRIVER_NAME,nvidia"
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
];
in {
in
{
wayland.windowManager.hyprland.settings = {
# Environment variables
env =
(lib.optionals hasNvidiaDrivers nvidiaEnv)
++ [
env = (lib.optionals hasNvidiaDrivers nvidiaEnv) ++ [
"GDK_SCALE,${toString cfg.scale}"
# Cursor size
+2 -1
View File
@@ -3,7 +3,8 @@
lib,
pkgs,
...
}: {
}:
{
wayland.windowManager.hyprland.settings = {
# Environment variables
# https://wiki.hyprland.org/Configuring/Variables/#input
+9 -4
View File
@@ -2,13 +2,18 @@
config,
pkgs,
...
}: let
hexToRgba = hex: alpha: let
in "rgba(${hex}${alpha})";
}:
let
hexToRgba =
hex: alpha:
let
in
"rgba(${hex}${alpha})";
inactiveBorder = hexToRgba config.colorScheme.palette.base09 "aa";
activeBorder = hexToRgba config.colorScheme.palette.base0D "aa";
in {
in
{
wayland.windowManager.hyprland.settings = {
general = {
gaps_in = 5;
+2 -1
View File
@@ -2,7 +2,8 @@
config,
pkgs,
...
}: {
}:
{
wayland.windowManager.hyprland.settings = {
windowrule = [
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
+6 -3
View File
@@ -1,9 +1,11 @@
inputs: {
inputs:
{
config,
pkgs,
lib,
...
}: let
}:
let
palette = config.colorScheme.palette;
convert = inputs.nix-colors.lib.conversions.hexToRGBString;
selected_wallpaper_path = (import ../../lib/selected-wallpaper.nix config).wallpaper_path;
@@ -12,7 +14,8 @@ inputs: {
surfaceRgb = "rgb(${convert ", " palette.base02})";
foregroundRgb = "rgb(${convert ", " palette.base05})";
foregroundMutedRgb = "rgb(${convert ", " palette.base04})";
in {
in
{
programs.hyprlock = {
enable = true;
settings = {
+4 -2
View File
@@ -2,9 +2,11 @@
config,
pkgs,
...
}: let
}:
let
selected_wallpaper_path = (import ../../lib/selected-wallpaper.nix config).wallpaper_path;
in {
in
{
home.file = {
"Pictures/Wallpapers" = {
source = ../../config/themes/wallpapers;
+4 -2
View File
@@ -2,9 +2,11 @@
config,
pkgs,
...
}: let
}:
let
cfg = config.omarchy;
in {
in
{
services.mako = {
enable = true;
+2 -1
View File
@@ -1,3 +1,4 @@
{...}: {
{ ... }:
{
programs.starship.enable = true;
}
+6 -3
View File
@@ -2,11 +2,13 @@
config,
pkgs,
...
}: let
}:
let
cfg = config.omarchy;
themes = import ../themes.nix;
theme = themes.${cfg.theme};
in {
in
{
programs.vscode = {
enable = true;
profiles.default = {
@@ -23,7 +25,8 @@ in {
# // cfg.vscode_settings;
extensions = with pkgs.vscode-extensions;
extensions =
with pkgs.vscode-extensions;
[
bbenoist.nix
vscodevim.vim
+21 -10
View File
@@ -1,13 +1,16 @@
inputs: {
inputs:
{
config,
pkgs,
...
}: let
}:
let
palette = config.colorScheme.palette;
convert = inputs.nix-colors.lib.conversions.hexToRGBString;
backgroundRgb = "rgb(${convert ", " palette.base00})";
foregroundRgb = "rgb(${convert ", " palette.base05})";
in {
in
{
home.file = {
".config/waybar/" = {
source = ../../config/waybar;
@@ -68,11 +71,11 @@ in {
active = "󱓻";
};
persistent-workspaces = {
"1" = [];
"2" = [];
"3" = [];
"4" = [];
"5" = [];
"1" = [ ];
"2" = [ ];
"3" = [ ];
"4" = [ ];
"5" = [ ];
};
};
cpu = {
@@ -86,7 +89,13 @@ in {
tooltip = false;
};
network = {
format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"];
format-icons = [
"󰤯"
"󰤟"
"󰤢"
"󰤥"
"󰤨"
];
format = "{icon}";
format-wifi = "{icon}";
format-ethernet = "󰀂";
@@ -155,7 +164,9 @@ in {
on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; # Updated command
max-volume = 150; # Optional: allow volume over 100%
};
tray = {spacing = 13;};
tray = {
spacing = 13;
};
power-profiles-daemon = {
format = "{icon}";
tooltip-format = "Power profile: {profile}";
+2 -1
View File
@@ -2,7 +2,8 @@
config,
pkgs,
...
}: {
}:
{
home.file = {
".config/wofi/style.css" = {
text = ''
+2 -1
View File
@@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
programs.zoxide = {
enable = true;
enableZshIntegration = true;
+4 -3
View File
@@ -1,4 +1,5 @@
{...}: {
{ ... }:
{
programs.zsh = {
enable = true;
autosuggestion.enable = true;
@@ -7,11 +8,11 @@
plugins = [
{
name = "plugins/git";
tags = [from:oh-my-zsh];
tags = [ "from:oh-my-zsh" ];
}
{
name = "fdellwing/zsh-bat";
tags = [as:command];
tags = [ "as:command" ];
}
];
};
+3 -2
View File
@@ -1,9 +1,10 @@
{...}: {
{ ... }:
{
programs = {
_1password.enable = true;
_1password-gui.enable = true;
# TODO: Dynamically get user names
_1password-gui.polkitPolicyOwners = ["henry"];
_1password-gui.polkitPolicyOwners = [ "henry" ];
};
}
+2 -1
View File
@@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
virtualisation.containers.enable = true;
virtualisation = {
docker.enable = true;
+7 -4
View File
@@ -1,11 +1,14 @@
inputs: {
inputs:
{
config,
pkgs,
...
}: let
}:
let
cfg = config.omarchy;
packages = import ../packages.nix {inherit pkgs;};
in {
packages = import ../packages.nix { inherit pkgs; };
in
{
imports = [
(import ./hyprland.nix inputs)
(import ./system.nix)
+4 -2
View File
@@ -1,8 +1,10 @@
inputs: {
inputs:
{
config,
pkgs,
...
}: {
}:
{
programs.hyprland = {
enable = true;
# package = inputs.hyprland.packages.${pkgs.system}.hyprland;
+8 -3
View File
@@ -3,10 +3,15 @@
pkgs,
lib,
...
}: let
}:
let
cfg = config.omarchy;
packages = import ../packages.nix {inherit pkgs lib; exclude_packages = cfg.exclude_packages;};
in {
packages = import ../packages.nix {
inherit pkgs lib;
exclude_packages = cfg.exclude_packages;
};
in
{
security.rtkit.enable = true;
services.pulseaudio.enable = false;
services.pipewire = {
+12 -4
View File
@@ -1,4 +1,8 @@
{pkgs, lib, exclude_packages ? []}:
{
pkgs,
lib,
exclude_packages ? [ ],
}:
let
# Essential Hyprland packages - cannot be excluded
hyprlandPackages = with pkgs; [
@@ -33,7 +37,9 @@ let
];
# Discretionary packages - can be excluded by user
discretionaryPackages = with pkgs; [
discretionaryPackages =
with pkgs;
[
# TUIs
lazygit
lazydocker
@@ -54,7 +60,8 @@ let
# Containers
docker-compose
ffmpeg
] ++ lib.optionals (pkgs.system == "x86_64-linux") [
]
++ lib.optionals (pkgs.system == "x86_64-linux") [
typora
dropbox
spotify
@@ -63,7 +70,8 @@ let
# Only allow excluding discretionary packages to prevent breaking the system
filteredDiscretionaryPackages = lib.lists.subtractLists exclude_packages discretionaryPackages;
allSystemPackages = hyprlandPackages ++ systemPackages ++ filteredDiscretionaryPackages;
in {
in
{
# Regular packages
systemPackages = allSystemPackages;