[fix] *.nix: reformat with alejandra

This commit is contained in:
Jalil David Salamé Messina 2024-05-04 20:57:33 +02:00
parent 876dc45719
commit 39c2fb096c
Signed by: jalil
GPG key ID: F016B9E770737A0B
26 changed files with 565 additions and 562 deletions

View file

@ -1,12 +1,13 @@
{ 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:
filterVisible = toplevelOption: option:
option // {visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption;};
home-eval = lib.evalModules {
modules = [../home/options.nix];
@ -20,19 +21,21 @@ let
(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";

View file

@ -33,8 +33,7 @@
inputs.neovim-flake.inputs.nixpkgs.follows = "nixpkgs";
# Flake outputs that other flakes can use
outputs =
{
outputs = {
self,
nixpkgs,
stylix,
@ -44,16 +43,14 @@
audiomenu,
nixvim,
neovim-flake,
}:
let
}: let
inherit (nixpkgs) lib;
# Helpers for producing system-specific outputs
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
];
forEachSupportedSystem =
f:
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
@ -62,11 +59,12 @@
}
);
overlays = builtins.attrValues self.overlays;
in
{
in {
checks = forEachSupportedSystem (
{ pkgs, system }:
{
pkgs,
system,
}: {
nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule {
pkgs = import nixpkgs {inherit system overlays;};
module = ./nvim/nixvim.nix;
@ -77,9 +75,12 @@
);
packages = forEachSupportedSystem (
{ pkgs, system }:
{
inherit (import ./docs { inherit pkgs lib; })
pkgs,
system,
}: {
inherit
(import ./docs {inherit pkgs lib;})
docs
nixos-markdown
nvim-markdown
@ -102,11 +103,10 @@
};
# Nix files formatter (run `nix fmt`)
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
formatter = forEachSupportedSystem ({pkgs, ...}: pkgs.alejandra);
# Example vm configuration
nixosConfigurations.vm =
let
nixosConfigurations.vm = let
system = "x86_64-linux";
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["steam-original"];
pkgs = import nixpkgs {inherit system overlays config;};
@ -144,8 +144,7 @@
];
};
nixosModules =
let
nixosModules = let
nvim-config.imports = [
nixvim.homeManagerModules.nixvim
./nvim
@ -189,8 +188,10 @@
// machineModules;
devShells = forEachSupportedSystem (
{ pkgs, system }:
{
pkgs,
system,
}: {
default = pkgs.mkShell {
buildInputs = with pkgs; [
just

View file

@ -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;

View file

@ -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

View file

@ -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'";
@ -52,12 +54,9 @@ let
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:
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,17 +65,23 @@ let
# Resize window
resizeWindowKeybinds = map (genArrowAndKey modCtrlKeybind (dir: dir2resize.${dir})) dirs;
# Move container to workspace
moveWorkspaceKeybindings = map (genKeybind modShiftKeybind (
moveWorkspaceKeybindings =
map (genKeybind modShiftKeybind (
number: "move container to workspace number ${number}"
)) workspaces;
))
workspaces;
# Focus workspace
focusWorkspaceKeybindings = map (genKeybind modKeybind (
focusWorkspaceKeybindings =
map (genKeybind modKeybind (
number: "workspace number ${number}"
)) workspaces;
))
workspaces;
# Move container to Workspace and focus on it
moveFocusWorkspaceKeybindings = map (genKeybind modCtrlShiftKeybind (
moveFocusWorkspaceKeybindings =
map (genKeybind modCtrlShiftKeybind (
number: "move container to workspace number ${number}; workspace number ${number}"
)) workspaces;
))
workspaces;
in
builtins.foldl' (l: r: l // r)
{

View file

@ -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,8 +18,7 @@ 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
configure-gtk = let
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in
@ -43,8 +43,7 @@ let
inherit command;
always = true;
};
in
{
in {
inherit modifier terminal menu;
keybindings = import ./keybindings.nix {inherit config pkgs;};
# Appearance
@ -73,9 +72,12 @@ in
}
];
# Startup scripts
startup = [
startup =
[
(cmdAlways "${configure-gtk}/bin/configure-gtk")
] ++ (builtins.map cmdAlways cfg.exec.always) ++ (builtins.map cmdOnce cfg.exec.once);
]
++ (builtins.map cmdAlways cfg.exec.always)
++ (builtins.map cmdOnce cfg.exec.once);
# Keyboard configuration
input."type:keyboard" = {
repeat_delay = "300";

View file

@ -1,21 +1,25 @@
{ 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 = [
mainBar.modules-right =
[
"pulseaudio"
"backlight"
"battery"
"sway/language"
"memory"
] ++ lib.optional (cfg.tempInfo != null) "temperature" ++ [ "tray" ];
]
++ 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" = [];

View file

@ -1,13 +1,16 @@
{ 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;
)
defaultPkgsPath;
defaultText = lib.literalExpression "[ ${text} ]";
default = builtins.map (pkgPath: lib.attrsets.getAttrFromPath pkgPath pkgs) defaultPkgsPath;
in
@ -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;
@ -135,8 +138,7 @@ let
];
};
};
in
{
in {
options.jhome = lib.mkOption {
description = "Jalil's default home-manager configuration.";
default = {};

View file

@ -1,5 +1,8 @@
{ config, lib, ... }:
let
{
config,
lib,
...
}: let
inherit (config) jhome;
inherit (cfg.defaultIdentity) signingKey;
@ -8,8 +11,7 @@ let
hasKey = signingKey != null;
gpgHome = config.programs.gpg.homedir;
unlockKey = hasConfig && cfg.gpg.unlockKeys != [];
in
{
in {
config = lib.mkMerge [
(lib.mkIf hasConfig {
programs.git = {

View file

@ -1,5 +1,4 @@
{ nixos-hardware }:
{
{nixos-hardware}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix

View file

@ -6,8 +6,7 @@
lib,
modulesPath,
...
}:
{
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot.initrd.availableKernelModules = [

View file

@ -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

View file

@ -6,8 +6,7 @@
lib,
modulesPath,
...
}:
{
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot.initrd.availableKernelModules = [

View file

@ -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

View file

@ -7,9 +7,7 @@
pkgs,
modulesPath,
...
}:
{
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
boot.initrd.availableKernelModules = [

View file

@ -1,5 +1,4 @@
{ ... }:
{
{...}: {
services.qemuGuest.enable = true;
boot.initrd.availableKernelModules = [

View file

@ -38,11 +38,9 @@
group = "lspConfig";
event = "LspAttach";
pattern = "*";
callback =
let
callback = let
opts = "noremap = true, buffer = bufnr";
in
{
in {
__raw = ''
function(opts)
local bufnr = opts.buf

View file

@ -1,5 +1,4 @@
{ pkgs, ... }@opts:
{
{pkgs, ...} @ opts: {
imports = [./options.nix];
config.programs.nixvim = (import ./nixvim.nix opts).config;

View file

@ -3,16 +3,14 @@
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
{
in {
imports = [./options.nix];
config = lib.mkMerge [
@ -52,12 +50,10 @@ in
plugins = import ./plugins.nix {inherit lib pkgs;};
keymaps = import ./mappings.nix;
inherit (import ./augroups.nix) autoGroups autoCmd;
extraPlugins =
let
extraPlugins = let
jjdescription = pkgs.callPackage ./vim-jjdescription.nix {};
in
with pkgs.vimPlugins;
[
with pkgs.vimPlugins; [
nvim-web-devicons
jjdescription
];

View file

@ -1,6 +1,7 @@
{ lib, ... }:
{
options.jhome.nvim.enable = lib.mkEnableOption "jalil's neovim configuration" // {
{lib, ...}: {
options.jhome.nvim.enable =
lib.mkEnableOption "jalil's neovim configuration"
// {
default = true;
example = false;
};

View file

@ -1,5 +1,7 @@
{ lib, pkgs }:
{
lib,
pkgs,
}: {
bacon = {
enable = true;
settings.quickfix.enabled = true;
@ -196,11 +198,9 @@
enable = true;
indent = true;
incrementalSelection.enable = true;
grammarPackages =
let
grammarPackages = let
parsers = pkgs.vimPlugins.nvim-treesitter-parsers;
in
[
in [
parsers.asm
parsers.bash
# parsers.bibtex

View file

@ -1,4 +1,7 @@
{ vimUtils, fetchFromGitHub }:
{
vimUtils,
fetchFromGitHub,
}:
vimUtils.buildVimPlugin {
name = "jjdescription";
src = fetchFromGitHub {

View file

@ -1,13 +1,12 @@
{ stylix }:
{
{stylix}: {
config,
pkgs,
lib,
...
}:
let
}: let
cfg = config.jconfig;
keysFromGithub = lib.attrsets.mapAttrs' (username: sha256: {
keysFromGithub =
lib.attrsets.mapAttrs' (username: sha256: {
name = "pubkeys/${username}";
value = {
mode = "0755";
@ -16,9 +15,9 @@ let
url = "https://github.com/${username}.keys";
};
};
}) cfg.importSSHKeysFromGithub;
in
{
})
cfg.importSSHKeysFromGithub;
in {
imports = [
./options.nix
./gui

View file

@ -3,20 +3,20 @@
lib,
pkgs,
...
}:
let
}: let
cfg = config.jconfig.gui;
enable = config.jconfig.enable && cfg.enable;
in
{
in {
config = lib.mkMerge [
(lib.mkIf enable {
environment.systemPackages = [
environment.systemPackages =
[
pkgs.gnome.adwaita-icon-theme
pkgs.adwaita-qt
pkgs.nordzy-cursor-theme
pkgs.pinentry-qt
] ++ lib.optional cfg.ydotool.enable pkgs.ydotool;
]
++ lib.optional cfg.ydotool.enable pkgs.ydotool;
systemd.user.services.ydotool = lib.mkIf cfg.ydotool.enable {
enable = cfg.ydotool.autoStart;

View file

@ -1,16 +1,13 @@
{ 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 =
{
mkImageOption = {
description,
url,
sha256 ? "",
@ -93,8 +90,7 @@ let
type = types.attrsOf types.str;
};
};
in
{
in {
options.jconfig = lib.mkOption {
description = "Jalil's default NixOS configuration.";
default = {};

View file

@ -1,13 +1,14 @@
{ config, pkgs }:
let
{
config,
pkgs,
}: let
cfg = config.jconfig.styling;
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";