From 39c2fb096cd0a33890bc90362e3eb7f76b76b6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 4 May 2024 20:57:33 +0200 Subject: [PATCH] [fix] *.nix: reformat with alejandra --- docs/default.nix | 31 +- flake.nix | 309 +++++++++--------- home/default.nix | 15 +- home/gui/default.nix | 25 +- home/gui/keybindings.nix | 69 ++-- home/gui/sway-config.nix | 44 +-- home/gui/waybar-settings.nix | 48 +-- home/options.nix | 78 ++--- home/users.nix | 14 +- machines/capricorn/default.nix | 7 +- machines/capricorn/hardware-configuration.nix | 17 +- machines/gemini/default.nix | 12 +- machines/gemini/hardware-configuration.nix | 19 +- machines/libra/default.nix | 11 +- machines/libra/hardware-configuration.nix | 20 +- machines/vm/default.nix | 3 +- nvim/augroups.nix | 96 +++--- nvim/default.nix | 5 +- nvim/nixvim.nix | 24 +- nvim/options.nix | 13 +- nvim/plugins.nix | 154 ++++----- nvim/vim-jjdescription.nix | 5 +- system/default.nix | 35 +- system/gui/default.nix | 26 +- system/options.nix | 36 +- system/stylix-config.nix | 11 +- 26 files changed, 565 insertions(+), 562 deletions(-) diff --git a/docs/default.nix b/docs/default.nix index bd7cbba..c0d51b2 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -1,38 +1,41 @@ -{ pkgs, lib }: -let +{ + pkgs, + lib, +}: let # can be removed once https://github.com/rust-lang/mdBook/pull/2262 lands highlight = pkgs.fetchurl { url = "https://raw.githubusercontent.com/rust-lang/mdBook/7b9bd5049ce15ae5f301d5a40c50ce8359d9e9a8/src/theme/highlight.js"; hash = "sha256-pLP73zlmGkbC/zV6bwnB6ijRf9gVkj5/VYMGLhiQ1/Q="; }; - filterVisible = - toplevelOption: option: - option // { visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption; }; + filterVisible = toplevelOption: option: + option // {visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption;}; home-eval = lib.evalModules { - modules = [ ../home/options.nix ]; + modules = [../home/options.nix]; specialArgs = { inherit pkgs; }; }; - nvim-eval = lib.evalModules { modules = [ ../nvim/options.nix ]; }; - nixos-eval = lib.evalModules { modules = [ ../system/options.nix ]; }; + nvim-eval = lib.evalModules {modules = [../nvim/options.nix];}; + nixos-eval = lib.evalModules {modules = [../system/options.nix];}; home-markdown = (pkgs.nixosOptionsDoc { inherit (home-eval) options; transformOptions = filterVisible "jhome"; - }).optionsCommonMark; + }) + .optionsCommonMark; nvim-markdown = (pkgs.nixosOptionsDoc { inherit (nvim-eval) options; transformOptions = filterVisible "jhome"; - }).optionsCommonMark; + }) + .optionsCommonMark; nixos-markdown = (pkgs.nixosOptionsDoc { inherit (nixos-eval) options; transformOptions = filterVisible "jconfig"; - }).optionsCommonMark; -in -{ + }) + .optionsCommonMark; +in { inherit nixos-markdown nvim-markdown home-markdown; docs = pkgs.stdenvNoCC.mkDerivation { name = "nixos-configuration-book"; @@ -54,7 +57,7 @@ in sed -f sed-cmds <${nixos-markdown} >> ./src/nixos-options.md ''; - nativeBuildInputs = [ pkgs.mdbook-toc ]; + nativeBuildInputs = [pkgs.mdbook-toc]; buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out"; }; } diff --git a/flake.nix b/flake.nix index af32c8e..daf46d0 100644 --- a/flake.nix +++ b/flake.nix @@ -33,172 +33,173 @@ inputs.neovim-flake.inputs.nixpkgs.follows = "nixpkgs"; # Flake outputs that other flakes can use - outputs = - { - self, - nixpkgs, - stylix, - home-manager, - nixos-hardware, - jpassmenu, - audiomenu, - nixvim, - neovim-flake, - }: - let - inherit (nixpkgs) lib; - # Helpers for producing system-specific outputs - supportedSystems = [ - "x86_64-linux" - "aarch64-linux" - ]; - forEachSupportedSystem = - f: - nixpkgs.lib.genAttrs supportedSystems ( - system: + outputs = { + self, + nixpkgs, + stylix, + home-manager, + nixos-hardware, + jpassmenu, + audiomenu, + nixvim, + neovim-flake, + }: let + inherit (nixpkgs) lib; + # Helpers for producing system-specific outputs + supportedSystems = [ + "x86_64-linux" + "aarch64-linux" + ]; + forEachSupportedSystem = f: + nixpkgs.lib.genAttrs supportedSystems ( + system: f { inherit system; - pkgs = import nixpkgs { inherit system; }; + pkgs = import nixpkgs {inherit system;}; } - ); - overlays = builtins.attrValues self.overlays; + ); + overlays = builtins.attrValues self.overlays; + in { + checks = forEachSupportedSystem ( + { + pkgs, + system, + }: { + nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule { + pkgs = import nixpkgs {inherit system overlays;}; + module = ./nvim/nixvim.nix; + }; + # alejandra = {}; + # typos = {}; + } + ); + + packages = forEachSupportedSystem ( + { + pkgs, + system, + }: { + inherit + (import ./docs {inherit pkgs lib;}) + docs + nixos-markdown + nvim-markdown + home-markdown + ; + # Nvim standalone module + nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule { + pkgs = import nixpkgs {inherit system overlays;}; + module = ./nvim/nixvim.nix; + }; + } + ); + + # Provide necessary overlays + overlays = { + nixvim = nixvim.overlays.default; + neovim-nightly = neovim-flake.overlay; + jpassmenu = jpassmenu.overlays.default; + audiomenu = audiomenu.overlays.default; + }; + + # Nix files formatter (run `nix fmt`) + formatter = forEachSupportedSystem ({pkgs, ...}: pkgs.alejandra); + + # Example vm configuration + nixosConfigurations.vm = let + system = "x86_64-linux"; + config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["steam-original"]; + pkgs = import nixpkgs {inherit system overlays config;}; in - { - checks = forEachSupportedSystem ( - { pkgs, system }: - { - nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule { - pkgs = import nixpkgs { inherit system overlays; }; - module = ./nvim/nixvim.nix; - }; - # alejandra = {}; - # typos = {}; - } - ); + lib.nixosSystem { + inherit system pkgs; + modules = [ + self.nixosModules.vm # import vm module + { + time.timeZone = "Europe/Berlin"; + i18n.defaultLocale = "en_US.UTF-8"; - packages = forEachSupportedSystem ( - { pkgs, system }: - { - inherit (import ./docs { inherit pkgs lib; }) - docs - nixos-markdown - nvim-markdown - home-markdown - ; - # Nvim standalone module - nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule { - pkgs = import nixpkgs { inherit system overlays; }; - module = ./nvim/nixvim.nix; - }; - } - ); + users.users.jdoe.password = "example"; + users.users.jdoe.isNormalUser = true; + users.users.jdoe.extraGroups = [ + "wheel" + "video" + "networkmanager" + ]; - # Provide necessary overlays - overlays = { - nixvim = nixvim.overlays.default; - neovim-nightly = neovim-flake.overlay; - jpassmenu = jpassmenu.overlays.default; - audiomenu = audiomenu.overlays.default; + home-manager.users.jdoe = { + home.username = "jdoe"; + home.homeDirectory = "/home/jdoe"; + + jhome.enable = true; + jhome.gui.enable = true; + jhome.dev.rust.enable = true; + }; + + nix.registry.nixpkgs.flake = nixpkgs; + + jconfig.enable = true; + jconfig.gui.enable = true; + } + ]; }; - # Nix files formatter (run `nix fmt`) - formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt-rfc-style); + nixosModules = let + nvim-config.imports = [ + nixvim.homeManagerModules.nixvim + ./nvim + ]; + overlays = builtins.attrValues self.overlays; + homeManagerModuleSandalone = import ./home {inherit overlays nvim-config stylix;}; + homeManagerModuleNixOS = import ./home {inherit overlays nvim-config;}; + nixosModule = { + imports = [ + (import ./system {inherit stylix;}) + home-manager.nixosModules.home-manager + ]; - # Example vm configuration - nixosConfigurations.vm = - let - system = "x86_64-linux"; - config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "steam-original" ]; - pkgs = import nixpkgs { inherit system overlays config; }; - in - lib.nixosSystem { - inherit system pkgs; - modules = [ - self.nixosModules.vm # import vm module - { - time.timeZone = "Europe/Berlin"; - i18n.defaultLocale = "en_US.UTF-8"; + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.sharedModules = [homeManagerModuleNixOS]; - users.users.jdoe.password = "example"; - users.users.jdoe.isNormalUser = true; - users.users.jdoe.extraGroups = [ - "wheel" - "video" - "networkmanager" - ]; + # Pin nixpkgs + nix.registry.nixpkgs.flake = nixpkgs; + }; - home-manager.users.jdoe = { - home.username = "jdoe"; - home.homeDirectory = "/home/jdoe"; + machines = [ + "capricorn" + "gemini" + "libra" + "vm" + ]; + mkMachine = hostname: { + imports = [ + nixosModule + (import (./machines + "/${hostname}") {inherit nixos-hardware;}) + ]; + home-manager.sharedModules = [{jhome.hostName = hostname;}]; + }; + machineModules = lib.genAttrs machines mkMachine; + in + { + default = nixosModule; + inherit nixosModule homeManagerModuleNixOS homeManagerModuleSandalone; + } + // machineModules; - jhome.enable = true; - jhome.gui.enable = true; - jhome.dev.rust.enable = true; - }; - - nix.registry.nixpkgs.flake = nixpkgs; - - jconfig.enable = true; - jconfig.gui.enable = true; - } + devShells = forEachSupportedSystem ( + { + pkgs, + system, + }: { + default = pkgs.mkShell { + buildInputs = with pkgs; [ + just + self.packages.${system}.nvim ]; + QEMU_OPTS_WL = "-smp 4 -device virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=2G,wsi=headless"; }; - - nixosModules = - let - nvim-config.imports = [ - nixvim.homeManagerModules.nixvim - ./nvim - ]; - overlays = builtins.attrValues self.overlays; - homeManagerModuleSandalone = import ./home { inherit overlays nvim-config stylix; }; - homeManagerModuleNixOS = import ./home { inherit overlays nvim-config; }; - nixosModule = { - imports = [ - (import ./system { inherit stylix; }) - home-manager.nixosModules.home-manager - ]; - - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.sharedModules = [ homeManagerModuleNixOS ]; - - # Pin nixpkgs - nix.registry.nixpkgs.flake = nixpkgs; - }; - - machines = [ - "capricorn" - "gemini" - "libra" - "vm" - ]; - mkMachine = hostname: { - imports = [ - nixosModule - (import (./machines + "/${hostname}") { inherit nixos-hardware; }) - ]; - home-manager.sharedModules = [ { jhome.hostName = hostname; } ]; - }; - machineModules = lib.genAttrs machines mkMachine; - in - { - default = nixosModule; - inherit nixosModule homeManagerModuleNixOS homeManagerModuleSandalone; - } - // machineModules; - - devShells = forEachSupportedSystem ( - { pkgs, system }: - { - default = pkgs.mkShell { - buildInputs = with pkgs; [ - just - self.packages.${system}.nvim - ]; - QEMU_OPTS_WL = "-smp 4 -device virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=2G,wsi=headless"; - }; - } - ); - }; + } + ); + }; } diff --git a/home/default.nix b/home/default.nix index 77fb0da..f9f80eb 100644 --- a/home/default.nix +++ b/home/default.nix @@ -2,18 +2,15 @@ overlays, nvim-config, stylix ? null, -}: -{ +}: { config, pkgs, lib, ... -}: -let +}: let cfg = config.jhome; devcfg = cfg.dev; -in -{ +in { imports = [ # Apply overlays @@ -82,7 +79,9 @@ in services.gpg-agent.enable = true; services.gpg-agent.maxCacheTtl = 86400; services.gpg-agent.pinentryPackage = - if config.jhome.gui.enable then pkgs.pinentry-qt else pkgs.pinentry-curses; + if config.jhome.gui.enable + then pkgs.pinentry-qt + else pkgs.pinentry-curses; services.gpg-agent.extraConfig = "allow-preset-passphrase"; # Spotifyd services.spotifyd.enable = true; @@ -173,7 +172,7 @@ in }; }) (lib.mkIf (cfg.enable && devcfg.enable && devcfg.rust.enable) { - home.packages = [ pkgs.rustup ] ++ devcfg.rust.extraPackages; + home.packages = [pkgs.rustup] ++ devcfg.rust.extraPackages; # Background code checker (for Rust) programs.bacon = { enable = true; diff --git a/home/gui/default.nix b/home/gui/default.nix index b6758ca..fb23557 100644 --- a/home/gui/default.nix +++ b/home/gui/default.nix @@ -4,22 +4,25 @@ pkgs, osConfig ? null, ... -}: -let +}: let inherit (config) jhome; - flatpakEnabled = if osConfig != null then osConfig.services.flatpak.enable else false; + flatpakEnabled = + if osConfig != null + then osConfig.services.flatpak.enable + else false; osSway = osConfig == null && !osConfig.programs.sway.enable; - swayPkg = if osSway then pkgs.sway else null; + swayPkg = + if osSway + then pkgs.sway + else null; cfg = jhome.gui; cursor.package = pkgs.nordzy-cursor-theme; cursor.name = "Nordzy-cursors"; iconTheme.name = "Papirus-Dark"; iconTheme.package = pkgs.papirus-icon-theme; -in -{ +in { config = lib.mkIf (jhome.enable && cfg.enable) { - home.packages = - with pkgs; + home.packages = with pkgs; [ webcord ferdium @@ -48,13 +51,13 @@ in # Video player programs.mpv = { enable = true; - scripts = builtins.attrValues { inherit (pkgs.mpvScripts) uosc thumbfast; }; + scripts = builtins.attrValues {inherit (pkgs.mpvScripts) uosc thumbfast;}; }; # Status bar programs.waybar = { enable = true; systemd.enable = true; - settings = import ./waybar-settings.nix { inherit config lib; }; + settings = import ./waybar-settings.nix {inherit config lib;}; }; # Terminal programs.wezterm = { @@ -103,7 +106,7 @@ in wayland.windowManager.sway = { enable = true; package = swayPkg; # no sway package if it comes from the OS - config = import ./sway-config.nix { inherit config pkgs; }; + config = import ./sway-config.nix {inherit config pkgs;}; }; # Set cursor style diff --git a/home/gui/keybindings.nix b/home/gui/keybindings.nix index dce4366..c0a2aef 100644 --- a/home/gui/keybindings.nix +++ b/home/gui/keybindings.nix @@ -1,5 +1,7 @@ -{ pkgs, config }: -let +{ + pkgs, + config, +}: let cfg = config.jhome.gui.sway; passmenu = "${pkgs.jpassmenu}/bin/jpassmenu"; selectAudio = "${pkgs.audiomenu}/bin/audiomenu --menu 'fuzzel --dmenu'"; @@ -18,21 +20,21 @@ let ]; dirs = map - (dir: { - key = swayconf.${dir}; - arrow = dir; - direction = dir; - }) - [ - "up" - "down" - "left" - "right" - ]; + (dir: { + key = swayconf.${dir}; + arrow = dir; + direction = dir; + }) + [ + "up" + "down" + "left" + "right" + ]; joinKeys = builtins.concatStringsSep "+"; # Generate a keybind from a modifier prefix and a key - keycombo = prefix: key: joinKeys (prefix ++ [ key ]); - modKeybind = keycombo [ mod ]; + keycombo = prefix: key: joinKeys (prefix ++ [key]); + modKeybind = keycombo [mod]; modCtrlKeybind = keycombo [ mod "Ctrl" @@ -51,13 +53,10 @@ let dir2resize.right = "resize grow width"; dir2resize.left = "resize shrink width"; # Bind a key combo to an action - genKeybind = prefix: action: key: { "${prefix key}" = "${action key}"; }; - genKey = - prefix: action: genKeybind ({ key, ... }: prefix key) ({ direction, ... }: action direction); - genArrow = - prefix: action: genKeybind ({ arrow, ... }: prefix arrow) ({ direction, ... }: action direction); - genArrowAndKey = - prefix: action: key: + genKeybind = prefix: action: key: {"${prefix key}" = "${action key}";}; + genKey = prefix: action: genKeybind ({key, ...}: prefix key) ({direction, ...}: action direction); + genArrow = prefix: action: genKeybind ({arrow, ...}: prefix arrow) ({direction, ...}: action direction); + genArrowAndKey = prefix: action: key: (genKey prefix action key) // (genArrow prefix action key); # Move window moveWindowKeybinds = map (genArrowAndKey modShiftKeybind (dir: "move ${dir}")) dirs; @@ -66,19 +65,25 @@ let # Resize window resizeWindowKeybinds = map (genArrowAndKey modCtrlKeybind (dir: dir2resize.${dir})) dirs; # Move container to workspace - moveWorkspaceKeybindings = map (genKeybind modShiftKeybind ( - number: "move container to workspace number ${number}" - )) workspaces; + moveWorkspaceKeybindings = + map (genKeybind modShiftKeybind ( + number: "move container to workspace number ${number}" + )) + workspaces; # Focus workspace - focusWorkspaceKeybindings = map (genKeybind modKeybind ( - number: "workspace number ${number}" - )) workspaces; + focusWorkspaceKeybindings = + map (genKeybind modKeybind ( + number: "workspace number ${number}" + )) + workspaces; # Move container to Workspace and focus on it - moveFocusWorkspaceKeybindings = map (genKeybind modCtrlShiftKeybind ( - number: "move container to workspace number ${number}; workspace number ${number}" - )) workspaces; + moveFocusWorkspaceKeybindings = + map (genKeybind modCtrlShiftKeybind ( + number: "move container to workspace number ${number}; workspace number ${number}" + )) + workspaces; in -builtins.foldl' (l: r: l // r) + builtins.foldl' (l: r: l // r) { "${mod}+Return" = "exec ${swayconf.terminal}"; "${mod}+D" = "exec ${swayconf.menu}"; diff --git a/home/gui/sway-config.nix b/home/gui/sway-config.nix index 6b5d041..c3d48f6 100644 --- a/home/gui/sway-config.nix +++ b/home/gui/sway-config.nix @@ -1,15 +1,16 @@ -{ config, pkgs }: -let +{ + config, + pkgs, +}: let cfg = config.jhome.gui.sway; modifier = "Mod4"; terminal = config.jhome.gui.terminal; termCmd = - if terminal == "wezterm" then - "wezterm start" - else if terminal == "alacritty" then - "alacritty -e" - else - builtins.abort "no command configured for ${terminal}"; + if terminal == "wezterm" + then "wezterm start" + else if terminal == "alacritty" + then "alacritty -e" + else builtins.abort "no command configured for ${terminal}"; menu = "${pkgs.fuzzel}/bin/fuzzel --terminal '${termCmd}'"; # currently, there is some friction between sway and gtk: # https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland @@ -17,11 +18,10 @@ let # for gsettings to work, we need to tell it where the schemas are # using the XDG_DATA_DIR environment variable # run at the end of sway config - configure-gtk = - let - schema = pkgs.gsettings-desktop-schemas; - datadir = "${schema}/share/gsettings-schemas/${schema.name}"; - in + configure-gtk = let + schema = pkgs.gsettings-desktop-schemas; + datadir = "${schema}/share/gsettings-schemas/${schema.name}"; + in pkgs.writers.writeDashBin "configure-gtk" '' export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS gnome_schema=org.gnome.desktop.interface @@ -38,17 +38,16 @@ let ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name" ${pkgs.glib}/bin/gsettings set "$gnome_schema" color-scheme prefer-dark ''; - cmdOnce = command: { inherit command; }; + cmdOnce = command: {inherit command;}; cmdAlways = command: { inherit command; always = true; }; -in -{ +in { inherit modifier terminal menu; - keybindings = import ./keybindings.nix { inherit config pkgs; }; + keybindings = import ./keybindings.nix {inherit config pkgs;}; # Appearance - bars = [ ]; # Waybar is started as a systemd service + bars = []; # Waybar is started as a systemd service gaps = { smartGaps = true; smartBorders = "on"; @@ -73,9 +72,12 @@ in } ]; # Startup scripts - startup = [ - (cmdAlways "${configure-gtk}/bin/configure-gtk") - ] ++ (builtins.map cmdAlways cfg.exec.always) ++ (builtins.map cmdOnce cfg.exec.once); + startup = + [ + (cmdAlways "${configure-gtk}/bin/configure-gtk") + ] + ++ (builtins.map cmdAlways cfg.exec.always) + ++ (builtins.map cmdOnce cfg.exec.once); # Keyboard configuration input."type:keyboard" = { repeat_delay = "300"; diff --git a/home/gui/waybar-settings.nix b/home/gui/waybar-settings.nix index ca46845..b2a0968 100644 --- a/home/gui/waybar-settings.nix +++ b/home/gui/waybar-settings.nix @@ -1,31 +1,35 @@ -{ config, lib }: -let - cfg = config.jhome.gui; -in { + config, + lib, +}: let + cfg = config.jhome.gui; +in { mainBar.layer = "top"; mainBar.position = "top"; mainBar.margin = "2 2 2 2"; # Choose the order of the modules - mainBar.modules-left = [ "sway/workspaces" ]; - mainBar.modules-center = [ "clock" ]; - mainBar.modules-right = [ - "pulseaudio" - "backlight" - "battery" - "sway/language" - "memory" - ] ++ lib.optional (cfg.tempInfo != null) "temperature" ++ [ "tray" ]; + mainBar.modules-left = ["sway/workspaces"]; + mainBar.modules-center = ["clock"]; + mainBar.modules-right = + [ + "pulseaudio" + "backlight" + "battery" + "sway/language" + "memory" + ] + ++ lib.optional (cfg.tempInfo != null) "temperature" + ++ ["tray"]; mainBar."sway/workspaces".disable-scroll = true; - mainBar."sway/workspaces".persistent-workspaces."1" = [ ]; - mainBar."sway/workspaces".persistent-workspaces."2" = [ ]; - mainBar."sway/workspaces".persistent-workspaces."3" = [ ]; - mainBar."sway/workspaces".persistent-workspaces."4" = [ ]; - mainBar."sway/workspaces".persistent-workspaces."5" = [ ]; - mainBar."sway/workspaces".persistent-workspaces."6" = [ ]; - mainBar."sway/workspaces".persistent-workspaces."7" = [ ]; - mainBar."sway/workspaces".persistent-workspaces."8" = [ ]; - mainBar."sway/workspaces".persistent-workspaces."9" = [ ]; + mainBar."sway/workspaces".persistent-workspaces."1" = []; + mainBar."sway/workspaces".persistent-workspaces."2" = []; + mainBar."sway/workspaces".persistent-workspaces."3" = []; + mainBar."sway/workspaces".persistent-workspaces."4" = []; + mainBar."sway/workspaces".persistent-workspaces."5" = []; + mainBar."sway/workspaces".persistent-workspaces."6" = []; + mainBar."sway/workspaces".persistent-workspaces."7" = []; + mainBar."sway/workspaces".persistent-workspaces."8" = []; + mainBar."sway/workspaces".persistent-workspaces."9" = []; mainBar."sway/language".format = "{} "; mainBar."sway/language".min-length = 5; mainBar."sway/language".tooltip = false; diff --git a/home/options.nix b/home/options.nix index d809d5d..4b85acb 100644 --- a/home/options.nix +++ b/home/options.nix @@ -1,21 +1,24 @@ -{ lib, pkgs, ... }: -let +{ + lib, + pkgs, + ... +}: let inherit (lib) types; - mkExtraPackagesOption = - name: defaultPkgsPath: - let - text = lib.strings.concatMapStringsSep " " ( + mkExtraPackagesOption = name: defaultPkgsPath: let + text = + lib.strings.concatMapStringsSep " " ( pkgPath: "pkgs." + (lib.strings.concatStringsSep "." pkgPath) - ) defaultPkgsPath; - defaultText = lib.literalExpression "[ ${text} ]"; - default = builtins.map (pkgPath: lib.attrsets.getAttrFromPath pkgPath pkgs) defaultPkgsPath; - in + ) + defaultPkgsPath; + defaultText = lib.literalExpression "[ ${text} ]"; + default = builtins.map (pkgPath: lib.attrsets.getAttrFromPath pkgPath pkgs) defaultPkgsPath; + in lib.mkOption { description = "Extra ${name} Packages."; type = types.listOf types.package; inherit default defaultText; - example = [ ]; + example = []; }; identity.options = { @@ -47,12 +50,12 @@ let enable = lib.mkEnableOption "Jalil's default user configuration"; gpg = lib.mkOption { description = "GnuPG Configuration."; - default = { }; + default = {}; type = types.submodule { options.unlockKeys = lib.mkOption { description = "Keygrips of keys to unlock through `pam-gnupg` when logging in."; - default = [ ]; - example = [ "6F4ABB77A88E922406BCE6627AFEEE2363914B76" ]; + default = []; + example = ["6F4ABB77A88E922406BCE6627AFEEE2363914B76"]; type = types.listOf types.str; }; }; @@ -93,20 +96,20 @@ let }; exec = lib.mkOption { description = "Run commands when starting sway."; - default = { }; + default = {}; type = types.submodule { options = { once = lib.mkOption { description = "Programs to start only once (`exec`)."; type = types.listOf types.str; - default = [ ]; - example = [ "signal-desktop --start-in-tray" ]; + default = []; + example = ["signal-desktop --start-in-tray"]; }; always = lib.mkOption { description = "Programs to start whenever the config is sourced (`exec_always`)."; type = types.listOf types.str; - default = [ ]; - example = [ "signal-desktop --start-in-tray" ]; + default = []; + example = ["signal-desktop --start-in-tray"]; }; }; }; @@ -114,7 +117,7 @@ let }; gui.options = { - enable = lib.mkEnableOption ("GUI applications"); + enable = lib.mkEnableOption "GUI applications"; tempInfo = lib.mkOption { description = "Temperature info to display in the statusbar."; default = null; @@ -122,7 +125,7 @@ let }; sway = lib.mkOption { description = "Sway window manager configuration."; - default = { }; + default = {}; type = types.submodule sway; }; terminal = lib.mkOption { @@ -135,11 +138,10 @@ let ]; }; }; -in -{ +in { options.jhome = lib.mkOption { description = "Jalil's default home-manager configuration."; - default = { }; + default = {}; type = types.submodule { options = { enable = lib.mkEnableOption "jalil's home defaults"; @@ -151,29 +153,29 @@ in }; dev = lib.mkOption { description = "Setup development environment for programming languages."; - default = { }; + default = {}; type = types.submodule { options.enable = lib.mkEnableOption "development settings"; options.neovimAsManPager = lib.mkEnableOption "neovim as the man pager"; options.extraPackages = mkExtraPackagesOption "dev" [ - [ "jq" ] # json parser - [ "just" ] # just a command runner - [ "typos" ] # low false positive rate typo checker - [ "git-absorb" ] # fixup! but automatic - [ "man-pages" ] # gimme the man pages - [ "man-pages-posix" ] # I said gimme the man pages!!! + ["jq"] # json parser + ["just"] # just a command runner + ["typos"] # low false positive rate typo checker + ["git-absorb"] # fixup! but automatic + ["man-pages"] # gimme the man pages + ["man-pages-posix"] # I said gimme the man pages!!! ]; options.rust = lib.mkOption { description = "Jalil's default rust configuration."; - default = { }; + default = {}; type = types.submodule { options.enable = lib.mkEnableOption "rust development settings"; options.extraPackages = mkExtraPackagesOption "Rust" [ - [ "cargo-kcov" ] # code coverage - [ "cargo-msrv" ] # minimum supported version - [ "cargo-nextest" ] # better testing harness - [ "cargo-sort" ] # sort deps and imports - [ "cargo-watch" ] # watch for file changes and run commands + ["cargo-kcov"] # code coverage + ["cargo-msrv"] # minimum supported version + ["cargo-nextest"] # better testing harness + ["cargo-sort"] # sort deps and imports + ["cargo-watch"] # watch for file changes and run commands ]; }; }; @@ -186,7 +188,7 @@ in }; gui = lib.mkOption { description = "Jalil's default GUI configuration."; - default = { }; + default = {}; type = types.submodule gui; }; }; diff --git a/home/users.nix b/home/users.nix index dc36346..0bd3526 100644 --- a/home/users.nix +++ b/home/users.nix @@ -1,5 +1,8 @@ -{ config, lib, ... }: -let +{ + config, + lib, + ... +}: let inherit (config) jhome; inherit (cfg.defaultIdentity) signingKey; @@ -7,9 +10,8 @@ let hasConfig = jhome.enable && cfg != null; hasKey = signingKey != null; gpgHome = config.programs.gpg.homedir; - unlockKey = hasConfig && cfg.gpg.unlockKeys != [ ]; -in -{ + unlockKey = hasConfig && cfg.gpg.unlockKeys != []; +in { config = lib.mkMerge [ (lib.mkIf hasConfig { programs.git = { @@ -21,7 +23,7 @@ in }; }; programs.jujutsu.settings = { - user = lib.mkIf (cfg.defaultIdentity != null) { inherit (cfg.defaultIdentity) name email; }; + user = lib.mkIf (cfg.defaultIdentity != null) {inherit (cfg.defaultIdentity) name email;}; signing = lib.mkIf hasKey { sign-all = true; backend = "gpg"; diff --git a/machines/capricorn/default.nix b/machines/capricorn/default.nix index b1e28e7..1960898 100644 --- a/machines/capricorn/default.nix +++ b/machines/capricorn/default.nix @@ -1,5 +1,4 @@ -{ nixos-hardware }: -{ +{nixos-hardware}: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -10,8 +9,8 @@ ]; # Setup extra filesystem options - fileSystems."/".options = [ "compress=zstd" ]; - fileSystems."/home".options = [ "compress=zstd" ]; + fileSystems."/".options = ["compress=zstd"]; + fileSystems."/home".options = ["compress=zstd"]; fileSystems."/nix".options = [ "compress=zstd" "noatime" diff --git a/machines/capricorn/hardware-configuration.nix b/machines/capricorn/hardware-configuration.nix index a0078fd..c622743 100644 --- a/machines/capricorn/hardware-configuration.nix +++ b/machines/capricorn/hardware-configuration.nix @@ -6,9 +6,8 @@ lib, modulesPath, ... -}: -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; boot.initrd.availableKernelModules = [ "xhci_pci" @@ -16,20 +15,20 @@ "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-intel"]; + boot.extraModulePackages = []; fileSystems."/" = { device = "/dev/disk/by-label/NIXROOT"; fsType = "btrfs"; - options = [ "subvol=root" ]; + options = ["subvol=root"]; }; fileSystems."/nix" = { device = "/dev/disk/by-label/NIXROOT"; fsType = "btrfs"; - options = [ "subvol=nix" ]; + options = ["subvol=nix"]; }; fileSystems."/home" = { @@ -42,7 +41,7 @@ fsType = "vfat"; }; - swapDevices = [ { device = "/dev/disk/by-label/NIXSWAP"; } ]; + swapDevices = [{device = "/dev/disk/by-label/NIXSWAP";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/machines/gemini/default.nix b/machines/gemini/default.nix index 6c30272..55f6968 100644 --- a/machines/gemini/default.nix +++ b/machines/gemini/default.nix @@ -1,9 +1,7 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ nixos-hardware }: -{ pkgs, ... }: -{ +{nixos-hardware}: {pkgs, ...}: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -14,9 +12,9 @@ nixos-hardware.nixosModules.common-gpu-amd ]; - fileSystems."/".options = [ "compress=zstd" ]; - fileSystems."/steam".options = [ "compress=zstd" ]; - fileSystems."/home".options = [ "compress=zstd" ]; + fileSystems."/".options = ["compress=zstd"]; + fileSystems."/steam".options = ["compress=zstd"]; + fileSystems."/home".options = ["compress=zstd"]; fileSystems."/nix".options = [ "compress=zstd" "noatime" @@ -46,7 +44,7 @@ # }; services.openssh.enable = true; services.openssh.startWhenNeeded = true; - services.openssh.settings.AllowUsers = [ "jalil" ]; + services.openssh.settings.AllowUsers = ["jalil"]; # Enable CUPS to print documents. services.printing.enable = true; diff --git a/machines/gemini/hardware-configuration.nix b/machines/gemini/hardware-configuration.nix index f14d428..4482eba 100644 --- a/machines/gemini/hardware-configuration.nix +++ b/machines/gemini/hardware-configuration.nix @@ -6,9 +6,8 @@ lib, modulesPath, ... -}: -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; boot.initrd.availableKernelModules = [ "nvme" @@ -18,15 +17,15 @@ "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; fileSystems."/" = { # device = "/dev/disk/by-label/NIXOSROOT"; device = "/dev/disk/by-label/NIXOSHOME"; fsType = "btrfs"; - options = [ "subvol=root" ]; + options = ["subvol=root"]; }; fileSystems."/steam" = { @@ -37,13 +36,13 @@ fileSystems."/home" = { device = "/dev/disk/by-label/NIXOSHOME"; fsType = "btrfs"; - options = [ "subvol=home" ]; + options = ["subvol=home"]; }; fileSystems."/nix" = { device = "/dev/disk/by-label/NIXOSROOT"; fsType = "btrfs"; - options = [ "subvol=nix" ]; + options = ["subvol=nix"]; }; fileSystems."/boot" = { @@ -51,7 +50,7 @@ fsType = "vfat"; }; - swapDevices = [ { device = "/dev/disk/by-label/SWAP"; } ]; + swapDevices = [{device = "/dev/disk/by-label/SWAP";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/machines/libra/default.nix b/machines/libra/default.nix index b5e471b..3a16dd2 100644 --- a/machines/libra/default.nix +++ b/machines/libra/default.nix @@ -1,10 +1,7 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page, on # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). - -{ nixos-hardware }: -{ pkgs, ... }: -{ +{nixos-hardware}: {pkgs, ...}: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -16,8 +13,8 @@ ]; fileSystems = { - "/".options = [ "compress=zstd" ]; - "/home".options = [ "compress=zstd" ]; + "/".options = ["compress=zstd"]; + "/home".options = ["compress=zstd"]; "/nix".options = [ "compress=zstd" "noatime" @@ -25,7 +22,7 @@ }; boot.kernelPackages = pkgs.linuxPackages_latest; - boot.kernelParams = [ "amdgpu.dcdebugmask=0x10" ]; # Fixes graphical issues + boot.kernelParams = ["amdgpu.dcdebugmask=0x10"]; # Fixes graphical issues hardware.opengl.enable = true; hardware.bluetooth.enable = true; diff --git a/machines/libra/hardware-configuration.nix b/machines/libra/hardware-configuration.nix index d56d8ab..cd5d174 100644 --- a/machines/libra/hardware-configuration.nix +++ b/machines/libra/hardware-configuration.nix @@ -7,10 +7,8 @@ pkgs, modulesPath, ... -}: - -{ - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; +}: { + imports = [(modulesPath + "/installer/scan/not-detected.nix")]; boot.initrd.availableKernelModules = [ "nvme" @@ -18,26 +16,26 @@ "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; fileSystems."/" = { device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e"; fsType = "btrfs"; - options = [ "subvol=root" ]; + options = ["subvol=root"]; }; fileSystems."/home" = { device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e"; fsType = "btrfs"; - options = [ "subvol=home" ]; + options = ["subvol=home"]; }; fileSystems."/nix" = { device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e"; fsType = "btrfs"; - options = [ "subvol=nix" ]; + options = ["subvol=nix"]; }; fileSystems."/boot" = { @@ -45,7 +43,7 @@ fsType = "vfat"; }; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/machines/vm/default.nix b/machines/vm/default.nix index 43e36a9..b50326b 100644 --- a/machines/vm/default.nix +++ b/machines/vm/default.nix @@ -1,5 +1,4 @@ -{ ... }: -{ +{...}: { services.qemuGuest.enable = true; boot.initrd.availableKernelModules = [ diff --git a/nvim/augroups.nix b/nvim/augroups.nix index 1a41ddf..05d781b 100644 --- a/nvim/augroups.nix +++ b/nvim/augroups.nix @@ -1,7 +1,7 @@ { - autoGroups."highlightOnYank" = { }; - autoGroups."lspConfig" = { }; - autoGroups."restoreCursorPosition" = { }; + autoGroups."highlightOnYank" = {}; + autoGroups."lspConfig" = {}; + autoGroups."restoreCursorPosition" = {}; autoCmd = [ { group = "highlightOnYank"; @@ -38,53 +38,51 @@ group = "lspConfig"; event = "LspAttach"; pattern = "*"; - callback = - let - opts = "noremap = true, buffer = bufnr"; - in - { - __raw = '' - function(opts) - local bufnr = opts.buf - local client = vim.lsp.get_client_by_id(opts.data.client_id) - local capabilities = client.server_capabilities - -- Set Omnifunc if supported - if capabilities.completionProvider then - vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc" - end - -- Enable inlay hints if supported - if capabilities.inlayHintProvider then - vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) - end - -- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless - vim.keymap.set('n', 'ht', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(0), { bufnr = 0 }) - end, - { desc = '[H]ints [T]oggle', ${opts} } - ) - -- Enable hover if supported - if capabilities.hoverProvider then - vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} }) - end - -- Enable rename if supported - if capabilities.renameProvider then - vim.keymap.set('n', 'r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} }) - end - -- Enable code actions if supported - if capabilities.codeActionProvider then - vim.keymap.set({ 'n', 'v' }, 'fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} }) - end - -- Enable formatting if supported - if capabilities.documentFormattingProvider then - vim.keymap.set('n', 'w', function() vim.lsp.buf.format { async = true } end, { desc = 'Format Buffer', ${opts} }) - end - -- Other keybinds - vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} }) - vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} }) - vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} }) + callback = let + opts = "noremap = true, buffer = bufnr"; + in { + __raw = '' + function(opts) + local bufnr = opts.buf + local client = vim.lsp.get_client_by_id(opts.data.client_id) + local capabilities = client.server_capabilities + -- Set Omnifunc if supported + if capabilities.completionProvider then + vim.bo[bufnr].omnifunc = "v:lua.vim.lsp.omnifunc" end - ''; - }; + -- Enable inlay hints if supported + if capabilities.inlayHintProvider then + vim.lsp.inlay_hint.enable(true, { bufnr = bufnr }) + end + -- Some Lsp servers do not advertise inlay hints properly so enable this keybinding regardless + vim.keymap.set('n', 'ht', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled(0), { bufnr = 0 }) + end, + { desc = '[H]ints [T]oggle', ${opts} } + ) + -- Enable hover if supported + if capabilities.hoverProvider then + vim.keymap.set('n', 'K', vim.lsp.buf.hover, { desc = 'Hover Documentation', ${opts} }) + end + -- Enable rename if supported + if capabilities.renameProvider then + vim.keymap.set('n', 'r', vim.lsp.buf.rename, { desc = '[R]ename', ${opts} }) + end + -- Enable code actions if supported + if capabilities.codeActionProvider then + vim.keymap.set({ 'n', 'v' }, 'fa', vim.lsp.buf.code_action, { desc = '[F]ind Code [A]ctions', ${opts} }) + end + -- Enable formatting if supported + if capabilities.documentFormattingProvider then + vim.keymap.set('n', 'w', function() vim.lsp.buf.format { async = true } end, { desc = 'Format Buffer', ${opts} }) + end + -- Other keybinds + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, { desc = '[G]o to [D]efinition', ${opts} }) + vim.keymap.set('n', 'gt', vim.lsp.buf.type_definition, { desc = '[G]o to [T]ype Definition', ${opts} }) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, { desc = '[G]o to [I]mplementation', ${opts} }) + end + ''; + }; } ]; } diff --git a/nvim/default.nix b/nvim/default.nix index 46de68f..0ee923e 100644 --- a/nvim/default.nix +++ b/nvim/default.nix @@ -1,6 +1,5 @@ -{ pkgs, ... }@opts: -{ - imports = [ ./options.nix ]; +{pkgs, ...} @ opts: { + imports = [./options.nix]; config.programs.nixvim = (import ./nixvim.nix opts).config; } diff --git a/nvim/nixvim.nix b/nvim/nixvim.nix index 304466c..2c0238c 100644 --- a/nvim/nixvim.nix +++ b/nvim/nixvim.nix @@ -3,21 +3,19 @@ lib, config, ... -}@args: -let +} @ args: let cfg = config.jhome.nvim; hmAvailable = args ? hmConfig; nixosAvailable = args ? nixosConfig; darwinAvailable = args ? darwinConfig; canSetAsDefault = hmAvailable || nixosAvailable; notStandalone = hmAvailable || nixosAvailable || darwinAvailable; -in -{ - imports = [ ./options.nix ]; +in { + imports = [./options.nix]; config = lib.mkMerge [ - (lib.optionalAttrs canSetAsDefault { defaultEditor = lib.mkDefault true; }) - (lib.optionalAttrs notStandalone { enable = lib.mkDefault true; }) + (lib.optionalAttrs canSetAsDefault {defaultEditor = lib.mkDefault true;}) + (lib.optionalAttrs notStandalone {enable = lib.mkDefault true;}) (lib.mkIf cfg.enable { # package = pkgs.neovim-nightly; globals.mapleader = " "; @@ -49,15 +47,13 @@ in # Enable local configuration :h 'exrc' exrc = true; # safe since nvim 0.9 }; - plugins = import ./plugins.nix { inherit lib pkgs; }; + plugins = import ./plugins.nix {inherit lib pkgs;}; keymaps = import ./mappings.nix; inherit (import ./augroups.nix) autoGroups autoCmd; - extraPlugins = - let - jjdescription = pkgs.callPackage ./vim-jjdescription.nix { }; - in - with pkgs.vimPlugins; - [ + extraPlugins = let + jjdescription = pkgs.callPackage ./vim-jjdescription.nix {}; + in + with pkgs.vimPlugins; [ nvim-web-devicons jjdescription ]; diff --git a/nvim/options.nix b/nvim/options.nix index c1e1048..5fa0ebf 100644 --- a/nvim/options.nix +++ b/nvim/options.nix @@ -1,7 +1,8 @@ -{ lib, ... }: -{ - options.jhome.nvim.enable = lib.mkEnableOption "jalil's neovim configuration" // { - default = true; - example = false; - }; +{lib, ...}: { + options.jhome.nvim.enable = + lib.mkEnableOption "jalil's neovim configuration" + // { + default = true; + example = false; + }; } diff --git a/nvim/plugins.nix b/nvim/plugins.nix index 4243adf..7debe12 100644 --- a/nvim/plugins.nix +++ b/nvim/plugins.nix @@ -1,5 +1,7 @@ -{ lib, pkgs }: { + lib, + pkgs, +}: { bacon = { enable = true; settings.quickfix.enabled = true; @@ -10,15 +12,15 @@ "/" = { mapping.__raw = "cmp.mapping.preset.cmdline()"; sources = [ - { name = "rg"; } - { name = "buffer"; } + {name = "rg";} + {name = "buffer";} ]; }; ":" = { mapping.__raw = "cmp.mapping.preset.cmdline()"; sources = [ - { name = "path"; } - { name = "cmdline"; } + {name = "path";} + {name = "cmdline";} ]; }; }; @@ -118,16 +120,16 @@ conform-nvim = { enable = true; formattersByFt = { - "_" = [ "trim_whitespace" ]; - c = [ "clang_format" ]; - cpp = [ "clang_format" ]; - lua = [ "stylua" ]; - nix = [ "nixpkgs_fmt" ]; - rust = [ "rustfmt" ]; - sh = [ "shfmt" ]; - toml = [ "taplo" ]; - yaml = [ "yamlfmt" ]; - zig = [ "zigfmt" ]; + "_" = ["trim_whitespace"]; + c = ["clang_format"]; + cpp = ["clang_format"]; + lua = ["stylua"]; + nix = ["nixpkgs_fmt"]; + rust = ["rustfmt"]; + sh = ["shfmt"]; + toml = ["taplo"]; + yaml = ["yamlfmt"]; + zig = ["zigfmt"]; }; }; gitsigns.enable = true; @@ -196,66 +198,64 @@ enable = true; indent = true; incrementalSelection.enable = true; - grammarPackages = - let - parsers = pkgs.vimPlugins.nvim-treesitter-parsers; - in - [ - parsers.asm - parsers.bash - # parsers.bibtex - parsers.c - parsers.comment - parsers.commonlisp - parsers.cpp - parsers.css - parsers.csv - # parsers.d - parsers.diff - parsers.dockerfile - parsers.dot - parsers.doxygen - parsers.git_config - parsers.git_rebase - parsers.gitattributes - parsers.gitcommit - parsers.gitignore - parsers.go - parsers.gomod - parsers.gosum - parsers.gowork - parsers.html - parsers.ini - parsers.json - parsers.json5 - parsers.jsonc - # parsers.latex - parsers.lua - parsers.luadoc - parsers.luap - parsers.luau - parsers.make - parsers.markdown - parsers.markdown_inline - parsers.meson - parsers.nix - parsers.ocaml - parsers.ocaml_interface - parsers.pem - parsers.python - parsers.rust - parsers.scheme - parsers.sql - parsers.ssh_config - parsers.toml - parsers.tsv - parsers.vim - parsers.vimdoc - parsers.wgsl - parsers.wgsl_bevy - parsers.yaml - parsers.zig - ]; + grammarPackages = let + parsers = pkgs.vimPlugins.nvim-treesitter-parsers; + in [ + parsers.asm + parsers.bash + # parsers.bibtex + parsers.c + parsers.comment + parsers.commonlisp + parsers.cpp + parsers.css + parsers.csv + # parsers.d + parsers.diff + parsers.dockerfile + parsers.dot + parsers.doxygen + parsers.git_config + parsers.git_rebase + parsers.gitattributes + parsers.gitcommit + parsers.gitignore + parsers.go + parsers.gomod + parsers.gosum + parsers.gowork + parsers.html + parsers.ini + parsers.json + parsers.json5 + parsers.jsonc + # parsers.latex + parsers.lua + parsers.luadoc + parsers.luap + parsers.luau + parsers.make + parsers.markdown + parsers.markdown_inline + parsers.meson + parsers.nix + parsers.ocaml + parsers.ocaml_interface + parsers.pem + parsers.python + parsers.rust + parsers.scheme + parsers.sql + parsers.ssh_config + parsers.toml + parsers.tsv + parsers.vim + parsers.vimdoc + parsers.wgsl + parsers.wgsl_bevy + parsers.yaml + parsers.zig + ]; }; trouble = { enable = true; @@ -264,12 +264,12 @@ lint = { enable = true; lintersByFt = { - rust = [ "typos" ]; + rust = ["typos"]; latex = [ "chktex" "typos" ]; - markdown = [ "typos" ]; + markdown = ["typos"]; }; }; } diff --git a/nvim/vim-jjdescription.nix b/nvim/vim-jjdescription.nix index 1c69502..e550eda 100644 --- a/nvim/vim-jjdescription.nix +++ b/nvim/vim-jjdescription.nix @@ -1,4 +1,7 @@ -{ vimUtils, fetchFromGitHub }: +{ + vimUtils, + fetchFromGitHub, +}: vimUtils.buildVimPlugin { name = "jjdescription"; src = fetchFromGitHub { diff --git a/system/default.nix b/system/default.nix index 02a515c..05d6e6f 100644 --- a/system/default.nix +++ b/system/default.nix @@ -1,30 +1,29 @@ -{ stylix }: -{ +{stylix}: { config, pkgs, lib, ... -}: -let +}: let cfg = config.jconfig; - keysFromGithub = lib.attrsets.mapAttrs' (username: sha256: { - name = "pubkeys/${username}"; - value = { - mode = "0755"; - source = builtins.fetchurl { - inherit sha256; - url = "https://github.com/${username}.keys"; + keysFromGithub = + lib.attrsets.mapAttrs' (username: sha256: { + name = "pubkeys/${username}"; + value = { + mode = "0755"; + source = builtins.fetchurl { + inherit sha256; + url = "https://github.com/${username}.keys"; + }; }; - }; - }) cfg.importSSHKeysFromGithub; -in -{ + }) + cfg.importSSHKeysFromGithub; +in { imports = [ ./options.nix ./gui stylix.nixosModules.stylix # FIXME(https://github.com/danth/stylix/issues/216): Must configure stylix - { stylix = import ./stylix-config.nix { inherit config pkgs; }; } + {stylix = import ./stylix-config.nix {inherit config pkgs;};} ]; config = lib.mkIf cfg.enable { @@ -85,8 +84,8 @@ in users.defaultUserShell = pkgs.zsh; # Open ports for spotifyd - networking.firewall.allowedUDPPorts = [ 5353 ]; - networking.firewall.allowedTCPPorts = [ 2020 ]; + networking.firewall.allowedUDPPorts = [5353]; + networking.firewall.allowedTCPPorts = [2020]; # Nix Settings nix.gc.automatic = true; diff --git a/system/gui/default.nix b/system/gui/default.nix index fcd39d6..9f8723f 100644 --- a/system/gui/default.nix +++ b/system/gui/default.nix @@ -3,24 +3,24 @@ lib, pkgs, ... -}: -let +}: let cfg = config.jconfig.gui; enable = config.jconfig.enable && cfg.enable; -in -{ +in { config = lib.mkMerge [ (lib.mkIf enable { - environment.systemPackages = [ - pkgs.gnome.adwaita-icon-theme - pkgs.adwaita-qt - pkgs.nordzy-cursor-theme - pkgs.pinentry-qt - ] ++ lib.optional cfg.ydotool.enable pkgs.ydotool; + environment.systemPackages = + [ + pkgs.gnome.adwaita-icon-theme + pkgs.adwaita-qt + pkgs.nordzy-cursor-theme + pkgs.pinentry-qt + ] + ++ lib.optional cfg.ydotool.enable pkgs.ydotool; systemd.user.services.ydotool = lib.mkIf cfg.ydotool.enable { enable = cfg.ydotool.autoStart; - wantedBy = [ "default.target" ]; + wantedBy = ["default.target"]; description = "Generic command-line automation tool"; documentation = [ "man:ydotool(1)" @@ -45,7 +45,7 @@ in programs.dconf.enable = true; programs.sway.enable = cfg.sway; - programs.sway.extraPackages = [ ]; # No extra packages (by default it adds foot, dmenu, and other stuff) + programs.sway.extraPackages = []; # No extra packages (by default it adds foot, dmenu, and other stuff) programs.sway.wrapperFeatures.base = true; programs.sway.wrapperFeatures.gtk = true; @@ -65,7 +65,7 @@ in # XDG portals xdg.portal.enable = true; xdg.portal.wlr.enable = true; - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; # Default to the gtk portal xdg.portal.config.preferred.default = "gtk"; # Use wlr for screenshots and screen recording diff --git a/system/options.nix b/system/options.nix index 98456e2..97be879 100644 --- a/system/options.nix +++ b/system/options.nix @@ -1,24 +1,21 @@ -{ lib, ... }: -let +{lib, ...}: let inherit (lib) types; # Like mkEnableOption but defaults to true - mkDisableOption = - option: + mkDisableOption = option: (lib.mkEnableOption option) // { default = true; example = false; }; - mkImageOption = - { - description, - url, - sha256 ? "", - }: + mkImageOption = { + description, + url, + sha256 ? "", + }: lib.mkOption { inherit description; type = types.path; - default = builtins.fetchurl { inherit url sha256; }; + default = builtins.fetchurl {inherit url sha256;}; defaultText = lib.literalMD "![${description}](${url})"; }; @@ -31,7 +28,7 @@ let steamHardwareSupport = mkDisableOption "steam hardware support"; ydotool = lib.mkOption { description = "Jalil's default ydotool configuration."; - default = { }; + default = {}; type = types.submodule { options.enable = mkDisableOption "ydotool"; options.autoStart = mkDisableOption "autostarting ydotool at login"; @@ -59,17 +56,17 @@ let enable = lib.mkEnableOption "jalil's default configuration."; dev = lib.mkOption { description = "Options for setting up a dev environment"; - default = { }; - type = types.submodule { options.enable = lib.mkEnableOption "dev configuration"; }; + default = {}; + type = types.submodule {options.enable = lib.mkEnableOption "dev configuration";}; }; gui = lib.mkOption { description = "Jalil's default configuration for a NixOS gui."; - default = { }; + default = {}; type = types.submodule gui; }; styling = lib.mkOption { description = "Jalil's styling options"; - default = { }; + default = {}; type = types.submodule styling; }; importSSHKeysFromGithub = lib.mkOption { @@ -86,18 +83,17 @@ let `users.users..openssh.authorizedKeys.keyFiles` on the users you want to allow ssh logins. ''; - default = { }; + default = {}; example = { "jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; }; type = types.attrsOf types.str; }; }; -in -{ +in { options.jconfig = lib.mkOption { description = "Jalil's default NixOS configuration."; - default = { }; + default = {}; type = types.submodule config; }; } diff --git a/system/stylix-config.nix b/system/stylix-config.nix index b32efea..f15c672 100644 --- a/system/stylix-config.nix +++ b/system/stylix-config.nix @@ -1,13 +1,14 @@ -{ config, pkgs }: -let +{ + config, + pkgs, +}: let cfg = config.jconfig.styling; - nerdFontSymbols = pkgs.nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }; + nerdFontSymbols = pkgs.nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];}; fallbackSymbols = { name = "Symbols Nerd Font"; package = nerdFontSymbols; }; -in -{ +in { autoEnable = cfg.enable; image = cfg.wallpaper; base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";