[fix] *.nix: reformat with alejandra
This commit is contained in:
parent
876dc45719
commit
39c2fb096c
26 changed files with 565 additions and 562 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue