fix: Format according to nixfmt-rfc-style

This commit is contained in:
Jalil David Salamé Messina 2024-04-05 11:55:35 +02:00
parent e3e96bbf40
commit ce37942672
Signed by: jalil
GPG key ID: F016B9E770737A0B
24 changed files with 606 additions and 302 deletions

View file

@ -5,13 +5,32 @@ let
url = "https://raw.githubusercontent.com/rust-lang/mdBook/7b9bd5049ce15ae5f301d5a40c50ce8359d9e9a8/src/theme/highlight.js"; url = "https://raw.githubusercontent.com/rust-lang/mdBook/7b9bd5049ce15ae5f301d5a40c50ce8359d9e9a8/src/theme/highlight.js";
hash = "sha256-pLP73zlmGkbC/zV6bwnB6ijRf9gVkj5/VYMGLhiQ1/Q="; hash = "sha256-pLP73zlmGkbC/zV6bwnB6ijRf9gVkj5/VYMGLhiQ1/Q=";
}; };
filterVisible = toplevelOption: option: option // { visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption; }; filterVisible =
home-eval = lib.evalModules { modules = [ ../home/options.nix ]; specialArgs = { inherit pkgs; }; }; toplevelOption: option:
option // { visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption; };
home-eval = lib.evalModules {
modules = [ ../home/options.nix ];
specialArgs = {
inherit pkgs;
};
};
nvim-eval = lib.evalModules { modules = [ ../nvim/options.nix ]; }; nvim-eval = lib.evalModules { modules = [ ../nvim/options.nix ]; };
nixos-eval = lib.evalModules { modules = [ ../system/options.nix ]; }; nixos-eval = lib.evalModules { modules = [ ../system/options.nix ]; };
home-markdown = (pkgs.nixosOptionsDoc { inherit (home-eval) options; transformOptions = filterVisible "jhome"; }).optionsCommonMark; home-markdown =
nvim-markdown = (pkgs.nixosOptionsDoc { inherit (nvim-eval) options; transformOptions = filterVisible "jhome"; }).optionsCommonMark; (pkgs.nixosOptionsDoc {
nixos-markdown = (pkgs.nixosOptionsDoc { inherit (nixos-eval) options; transformOptions = filterVisible "jconfig"; }).optionsCommonMark; inherit (home-eval) options;
transformOptions = filterVisible "jhome";
}).optionsCommonMark;
nvim-markdown =
(pkgs.nixosOptionsDoc {
inherit (nvim-eval) options;
transformOptions = filterVisible "jhome";
}).optionsCommonMark;
nixos-markdown =
(pkgs.nixosOptionsDoc {
inherit (nixos-eval) options;
transformOptions = filterVisible "jconfig";
}).optionsCommonMark;
in in
{ {
inherit nixos-markdown nvim-markdown home-markdown; inherit nixos-markdown nvim-markdown home-markdown;

110
flake.nix
View file

@ -36,48 +36,72 @@
# Flake outputs that other flakes can use # Flake outputs that other flakes can use
outputs = outputs =
{ self {
, nixpkgs self,
, stylix nixpkgs,
, home-manager stylix,
, nixos-hardware home-manager,
, pre-commit-hooks nixos-hardware,
, jpassmenu pre-commit-hooks,
, audiomenu jpassmenu,
, nixvim audiomenu,
, neovim-nightly nixvim,
neovim-nightly,
}: }:
let let
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
# Helpers for producing system-specific outputs # Helpers for producing system-specific outputs
supportedSystems = [ "x86_64-linux" "aarch64-linux" ]; supportedSystems = [
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { "x86_64-linux"
"aarch64-linux"
];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
inherit system; inherit system;
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
}); }
);
overlays = builtins.attrValues self.overlays; overlays = builtins.attrValues self.overlays;
in in
{ {
checks = forEachSupportedSystem ({ pkgs, system }: { checks = forEachSupportedSystem (
{ pkgs, system }:
{
nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule { nvim = nixvim.lib.${system}.check.mkTestDerivationFromNixvimModule {
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs { inherit system overlays; };
module = ./nvim/nixvim.nix; module = ./nvim/nixvim.nix;
}; };
pre-commit-check = pre-commit-hooks.lib.${system}.run { pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = builtins.path { path = ./.; name = "configuration.nix"; }; src = builtins.path {
hooks.typos.enable = true; path = ./.;
hooks.nixpkgs-fmt.enable = true; name = "configuration.nix";
}; };
}); hooks.typos.enable = true;
hooks.nixfmt.enable = true;
hooks.nixfmt.package = pkgs.nixfmt-rfc-style;
};
}
);
packages = forEachSupportedSystem ({ pkgs, system }: { packages = forEachSupportedSystem (
inherit (import ./docs { inherit pkgs lib; }) docs nixos-markdown nvim-markdown home-markdown; { pkgs, system }:
{
inherit (import ./docs { inherit pkgs lib; })
docs
nixos-markdown
nvim-markdown
home-markdown
;
# Nvim standalone module # Nvim standalone module
nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule { nvim = nixvim.legacyPackages.${system}.makeNixvimWithModule {
pkgs = import nixpkgs { inherit system overlays; }; pkgs = import nixpkgs { inherit system overlays; };
module = ./nvim/nixvim.nix; module = ./nvim/nixvim.nix;
}; };
}); }
);
# Provide necessary overlays # Provide necessary overlays
overlays = { overlays = {
@ -86,7 +110,8 @@
jpassmenu = jpassmenu.overlays.default; jpassmenu = jpassmenu.overlays.default;
audiomenu = audiomenu.overlays.default; audiomenu = audiomenu.overlays.default;
"waybar-sway-patch" = final: prev: { "waybar-sway-patch" = final: prev: {
waybar = prev.waybar.overrideAttrs (old: waybar = prev.waybar.overrideAttrs (
old:
let let
# Fixes https://github.com/Alexays/Waybar/issues/3009 # Fixes https://github.com/Alexays/Waybar/issues/3009
patch = final.fetchpatch { patch = final.fetchpatch {
@ -97,7 +122,10 @@
# Deduplicate patch # Deduplicate patch
present = builtins.elem patch prevPatches; present = builtins.elem patch prevPatches;
in in
{ patches = prevPatches ++ final.lib.optional (!present) patch; }); {
patches = prevPatches ++ final.lib.optional (!present) patch;
}
);
}; };
}; };
@ -108,13 +136,10 @@
nixosConfigurations.vm = nixosConfigurations.vm =
let let
system = "x86_64-linux"; system = "x86_64-linux";
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "steam-original" ];
"steam-original"
];
pkgs = import nixpkgs { inherit system overlays config; }; pkgs = import nixpkgs { inherit system overlays config; };
in in
lib.nixosSystem lib.nixosSystem {
{
inherit system pkgs; inherit system pkgs;
modules = [ modules = [
self.nixosModules.vm # import vm module self.nixosModules.vm # import vm module
@ -124,7 +149,11 @@
users.users.jdoe.password = "example"; users.users.jdoe.password = "example";
users.users.jdoe.isNormalUser = true; users.users.jdoe.isNormalUser = true;
users.users.jdoe.extraGroups = [ "wheel" "video" "networkmanager" ]; users.users.jdoe.extraGroups = [
"wheel"
"video"
"networkmanager"
];
home-manager.users.jdoe = { home-manager.users.jdoe = {
home.username = "jdoe"; home.username = "jdoe";
@ -143,7 +172,6 @@
]; ];
}; };
nixosModules = nixosModules =
let let
nvim-config.imports = [ nvim-config.imports = [
@ -167,7 +195,12 @@
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
}; };
machines = [ "capricorn" "gemini" "libra" "vm" ]; machines = [
"capricorn"
"gemini"
"libra"
"vm"
];
mkMachine = hostname: { mkMachine = hostname: {
imports = [ imports = [
nixosModule nixosModule
@ -180,14 +213,21 @@
{ {
default = nixosModule; default = nixosModule;
inherit nixosModule homeManagerModuleNixOS homeManagerModuleSandalone; inherit nixosModule homeManagerModuleNixOS homeManagerModuleSandalone;
} // machineModules; }
// machineModules;
devShells = forEachSupportedSystem ({ pkgs, system }: { devShells = forEachSupportedSystem (
{ pkgs, system }:
{
default = pkgs.mkShell { default = pkgs.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook; inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = with pkgs; [ just self.packages.${system}.nvim ]; 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"; QEMU_OPTS_WL = "-smp 4 -device virtio-gpu-rutabaga,gfxstream-vulkan=on,cross-domain=on,hostmem=2G,wsi=headless";
}; };
}); }
);
}; };
} }

View file

@ -1,17 +1,33 @@
{ overlays, nvim-config, stylix ? null }: { config, pkgs, lib, ... }: {
overlays,
nvim-config,
stylix ? null,
}:
{
config,
pkgs,
lib,
...
}:
let let
cfg = config.jhome; cfg = config.jhome;
devcfg = cfg.dev; devcfg = cfg.dev;
in in
{ {
imports = [ imports =
[
# Apply overlays # Apply overlays
{ nixpkgs = { inherit overlays; }; } {
nixpkgs = {
inherit overlays;
};
}
nvim-config nvim-config
./options.nix ./options.nix
./gui ./gui
./users.nix ./users.nix
] ++ lib.optionals (stylix != null) [ ]
++ lib.optionals (stylix != null) [
stylix.homeManagerModules.stylix stylix.homeManagerModules.stylix
{ {
stylix.image = builtins.fetchurl { stylix.image = builtins.fetchurl {
@ -65,7 +81,8 @@ in
# GPG Agent # GPG Agent
services.gpg-agent.enable = true; services.gpg-agent.enable = true;
services.gpg-agent.maxCacheTtl = 86400; services.gpg-agent.maxCacheTtl = 86400;
services.gpg-agent.pinentryPackage = if config.jhome.gui.enable then pkgs.pinentry-qt else pkgs.pinentry-curses; services.gpg-agent.pinentryPackage =
if config.jhome.gui.enable then pkgs.pinentry-qt else pkgs.pinentry-curses;
services.gpg-agent.extraConfig = "allow-preset-passphrase"; services.gpg-agent.extraConfig = "allow-preset-passphrase";
# Spotifyd # Spotifyd
services.spotifyd.enable = true; services.spotifyd.enable = true;

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, osConfig ? null, ... }: {
config,
lib,
pkgs,
osConfig ? null,
...
}:
let let
inherit (config) jhome; 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;

View file

@ -5,30 +5,60 @@ let
selectAudio = "${pkgs.audiomenu}/bin/audiomenu --menu 'fuzzel --dmenu'"; selectAudio = "${pkgs.audiomenu}/bin/audiomenu --menu 'fuzzel --dmenu'";
swayconf = config.wayland.windowManager.sway.config; swayconf = config.wayland.windowManager.sway.config;
mod = swayconf.modifier; mod = swayconf.modifier;
workspaces = map toString [ 1 2 3 4 5 6 7 8 9 ]; workspaces = map toString [
1
2
3
4
5
6
7
8
9
];
dirs = dirs =
map map
(dir: { (dir: {
key = swayconf.${dir}; key = swayconf.${dir};
arrow = dir; arrow = dir;
direction = dir; direction = dir;
}) [ "up" "down" "left" "right" ]; })
[
"up"
"down"
"left"
"right"
];
joinKeys = builtins.concatStringsSep "+"; joinKeys = builtins.concatStringsSep "+";
# Generate a keybind from a modifier prefix and a key # Generate a keybind from a modifier prefix and a key
keycombo = prefix: key: joinKeys (prefix ++ [ key ]); keycombo = prefix: key: joinKeys (prefix ++ [ key ]);
modKeybind = keycombo [ mod ]; modKeybind = keycombo [ mod ];
modCtrlKeybind = keycombo [ mod "Ctrl" ]; modCtrlKeybind = keycombo [
modShiftKeybind = keycombo [ mod "Shift" ]; mod
modCtrlShiftKeybind = keycombo [ mod "Ctrl" "Shift" ]; "Ctrl"
];
modShiftKeybind = keycombo [
mod
"Shift"
];
modCtrlShiftKeybind = keycombo [
mod
"Ctrl"
"Shift"
];
dir2resize.up = "resize grow height"; dir2resize.up = "resize grow height";
dir2resize.down = "resize shrink height"; dir2resize.down = "resize shrink height";
dir2resize.right = "resize grow width"; dir2resize.right = "resize grow width";
dir2resize.left = "resize shrink width"; dir2resize.left = "resize shrink width";
# Bind a key combo to an action # Bind a key combo to an action
genKeybind = prefix: action: key: { "${prefix key}" = "${action key}"; }; genKeybind = prefix: action: key: { "${prefix key}" = "${action key}"; };
genKey = prefix: action: genKeybind ({ key, ... }: prefix key) ({ direction, ... }: action direction); genKey =
genArrow = prefix: action: genKeybind ({ arrow, ... }: prefix arrow) ({ direction, ... }: action direction); prefix: action: genKeybind ({ key, ... }: prefix key) ({ direction, ... }: action direction);
genArrowAndKey = prefix: action: key: (genKey prefix action key) // (genArrow prefix action key); genArrow =
prefix: action: genKeybind ({ arrow, ... }: prefix arrow) ({ direction, ... }: action direction);
genArrowAndKey =
prefix: action: key:
(genKey prefix action key) // (genArrow prefix action key);
# Move window # Move window
moveWindowKeybinds = map (genArrowAndKey modShiftKeybind (dir: "move ${dir}")) dirs; moveWindowKeybinds = map (genArrowAndKey modShiftKeybind (dir: "move ${dir}")) dirs;
# Focus window # Focus window
@ -36,11 +66,17 @@ let
# Resize window # Resize window
resizeWindowKeybinds = map (genArrowAndKey modCtrlKeybind (dir: dir2resize.${dir})) dirs; resizeWindowKeybinds = map (genArrowAndKey modCtrlKeybind (dir: dir2resize.${dir})) dirs;
# Move container to workspace # 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 # 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 # 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 in
builtins.foldl' (l: r: l // r) builtins.foldl' (l: r: l // r)
{ {
@ -71,9 +107,11 @@ builtins.foldl' (l: r: l // r)
"${mod}+r" = "reload"; "${mod}+r" = "reload";
"${mod}+Shift+m" = "exit"; "${mod}+Shift+m" = "exit";
} }
(focusWindowKeybinds (
focusWindowKeybinds
++ moveWindowKeybinds ++ moveWindowKeybinds
++ resizeWindowKeybinds ++ resizeWindowKeybinds
++ focusWorkspaceKeybindings ++ focusWorkspaceKeybindings
++ moveWorkspaceKeybindings ++ moveWorkspaceKeybindings
++ moveFocusWorkspaceKeybindings) ++ moveFocusWorkspaceKeybindings
)

View file

@ -22,8 +22,7 @@ let
schema = pkgs.gsettings-desktop-schemas; schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}"; datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in in
pkgs.writers.writeDashBin "configure-gtk" pkgs.writers.writeDashBin "configure-gtk" ''
''
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
gnome_schema=org.gnome.desktop.interface gnome_schema=org.gnome.desktop.interface
config="${config.xdg.configHome}/gtk-3.0/settings.ini" config="${config.xdg.configHome}/gtk-3.0/settings.ini"
@ -60,15 +59,23 @@ in
window.border = 2; window.border = 2;
# Make certain windows floating # Make certain windows floating
window.commands = [ window.commands = [
{ command = "floating enable"; criteria.title = "zoom"; } {
{ command = "floating enable"; criteria.class = "floating"; } command = "floating enable";
{ command = "floating enable"; criteria.app_id = "floating"; } criteria.title = "zoom";
}
{
command = "floating enable";
criteria.class = "floating";
}
{
command = "floating enable";
criteria.app_id = "floating";
}
]; ];
# Startup scripts # Startup scripts
startup = startup = [
[ (cmdAlways "${configure-gtk}/bin/configure-gtk") ] (cmdAlways "${configure-gtk}/bin/configure-gtk")
++ (builtins.map cmdAlways cfg.exec.always) ] ++ (builtins.map cmdAlways cfg.exec.always) ++ (builtins.map cmdOnce cfg.exec.once);
++ (builtins.map cmdOnce cfg.exec.once);
# Keyboard configuration # Keyboard configuration
input."type:keyboard" = { input."type:keyboard" = {
repeat_delay = "300"; repeat_delay = "300";

View file

@ -1,5 +1,7 @@
{ config, lib }: { config, lib }:
let cfg = config.jhome.gui; in let
cfg = config.jhome.gui;
in
{ {
mainBar.layer = "top"; mainBar.layer = "top";
mainBar.position = "top"; mainBar.position = "top";
@ -7,9 +9,13 @@ let cfg = config.jhome.gui; in
# Choose the order of the modules # Choose the order of the modules
mainBar.modules-left = [ "sway/workspaces" ]; mainBar.modules-left = [ "sway/workspaces" ];
mainBar.modules-center = [ "clock" ]; mainBar.modules-center = [ "clock" ];
mainBar.modules-right = [ "pulseaudio" "backlight" "battery" "sway/language" "memory" ] mainBar.modules-right = [
++ lib.optional (cfg.tempInfo != null) "temperature" "pulseaudio"
++ [ "tray" ]; "backlight"
"battery"
"sway/language"
"memory"
] ++ lib.optional (cfg.tempInfo != null) "temperature" ++ [ "tray" ];
mainBar."sway/workspaces".disable-scroll = true; mainBar."sway/workspaces".disable-scroll = true;
mainBar."sway/workspaces".persistent-workspaces."1" = [ ]; mainBar."sway/workspaces".persistent-workspaces."1" = [ ];
mainBar."sway/workspaces".persistent-workspaces."2" = [ ]; mainBar."sway/workspaces".persistent-workspaces."2" = [ ];
@ -41,20 +47,37 @@ let cfg = config.jhome.gui; in
mainBar.pulseaudio.format-icons.phone = "󰘂"; mainBar.pulseaudio.format-icons.phone = "󰘂";
mainBar.pulseaudio.format-icons.portable = ""; mainBar.pulseaudio.format-icons.portable = "";
mainBar.pulseaudio.format-icons.car = ""; mainBar.pulseaudio.format-icons.car = "";
mainBar.pulseaudio.format-icons.default = [ "󰕿" "󰖀" "󰕾" ]; mainBar.pulseaudio.format-icons.default = [
"󰕿"
"󰖀"
"󰕾"
];
mainBar.pulseaudio.on-click = "pavucontrol"; mainBar.pulseaudio.on-click = "pavucontrol";
mainBar.pulseaudio.min-length = 13; mainBar.pulseaudio.min-length = 13;
mainBar.temperature = mainBar.temperature = lib.optionalAttrs (cfg.tempInfo != null) {
lib.optionalAttrs (cfg.tempInfo != null) {
inherit (cfg.tempInfo) hwmon-path; inherit (cfg.tempInfo) hwmon-path;
critical-threshold = 80; critical-threshold = 80;
format = "{temperatureC}°C {icon}"; format = "{temperatureC}°C {icon}";
format-icons = [ "" "" "" "" "" ]; format-icons = [
""
""
""
""
""
];
tooltip = false; tooltip = false;
}; };
mainBar.backlight.device = "intel_backlight"; mainBar.backlight.device = "intel_backlight";
mainBar.backlight.format = "{percent}% {icon}"; mainBar.backlight.format = "{percent}% {icon}";
mainBar.backlight.format-icons = [ "󰃚" "󰃛" "󰃜" "󰃝" "󰃞" "󰃟" "󰃠" ]; mainBar.backlight.format-icons = [
"󰃚"
"󰃛"
"󰃜"
"󰃝"
"󰃞"
"󰃟"
"󰃠"
];
mainBar.backlight.min-length = 7; mainBar.backlight.min-length = 7;
mainBar.battery.states.warning = 30; mainBar.battery.states.warning = 30;
mainBar.battery.states.critical = 15; mainBar.battery.states.critical = 15;
@ -62,7 +85,18 @@ let cfg = config.jhome.gui; in
mainBar.battery.format-charging = "{capacity}% 󰂄"; mainBar.battery.format-charging = "{capacity}% 󰂄";
mainBar.battery.format-plugged = "{capacity}% 󰚥"; mainBar.battery.format-plugged = "{capacity}% 󰚥";
mainBar.battery.format-alt = "{time} {icon}"; mainBar.battery.format-alt = "{time} {icon}";
mainBar.battery.format-icons = [ "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ]; mainBar.battery.format-icons = [
"󰁺"
"󰁻"
"󰁼"
"󰁽"
"󰁾"
"󰁿"
"󰂀"
"󰂁"
"󰂂"
"󰁹"
];
mainBar.tray.icon-size = 16; mainBar.tray.icon-size = 16;
mainBar.tray.spacing = 0; mainBar.tray.spacing = 0;
} }

View file

@ -2,9 +2,12 @@
let let
inherit (lib) types; inherit (lib) types;
mkExtraPackagesOption = name: defaultPkgsPath: mkExtraPackagesOption =
name: defaultPkgsPath:
let let
text = lib.strings.concatMapStringsSep " " (pkgPath: "pkgs." + (lib.strings.concatStringsSep "." pkgPath)) defaultPkgsPath; text = lib.strings.concatMapStringsSep " " (
pkgPath: "pkgs." + (lib.strings.concatStringsSep "." pkgPath)
) defaultPkgsPath;
defaultText = lib.literalExpression "[ ${text} ]"; defaultText = lib.literalExpression "[ ${text} ]";
default = builtins.map (pkgPath: lib.attrsets.getAttrFromPath pkgPath pkgs) defaultPkgsPath; default = builtins.map (pkgPath: lib.attrsets.getAttrFromPath pkgPath pkgs) defaultPkgsPath;
in in
@ -126,7 +129,10 @@ let
description = "The terminal emulator to use."; description = "The terminal emulator to use.";
default = "wezterm"; default = "wezterm";
example = "alacritty"; example = "alacritty";
type = types.enum [ "wezterm" "alacritty" ]; type = types.enum [
"wezterm"
"alacritty"
];
}; };
}; };
in in

View file

@ -20,10 +20,12 @@ in
}; };
}) })
(lib.mkIf unlockKey { (lib.mkIf unlockKey {
xdg.configFile.pam-gnupg.text = '' xdg.configFile.pam-gnupg.text =
''
${gpgHome} ${gpgHome}
'' + (lib.strings.concatLines cfg.gpg.unlockKeys); ''
+ (lib.strings.concatLines cfg.gpg.unlockKeys);
}) })
]; ];
} }

View file

@ -1,4 +1,5 @@
{ nixos-hardware }: { { nixos-hardware }:
{
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@ -11,7 +12,10 @@
# Setup extra filesystem options # Setup extra filesystem options
fileSystems."/".options = [ "compress=zstd" ]; fileSystems."/".options = [ "compress=zstd" ];
fileSystems."/home".options = [ "compress=zstd" ]; fileSystems."/home".options = [ "compress=zstd" ];
fileSystems."/nix".options = [ "compress=zstd" "noatime" ]; fileSystems."/nix".options = [
"compress=zstd"
"noatime"
];
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
@ -24,7 +28,12 @@
networking.hostName = "capricorn"; networking.hostName = "capricorn";
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
networking.networkmanager.wifi.backend = "iwd"; networking.networkmanager.wifi.backend = "iwd";
networking.networkmanager.appendNameservers = [ "1.1.1.1" "1.0.0.1" "8.8.8.8" "8.4.4.8" ]; networking.networkmanager.appendNameservers = [
"1.1.1.1"
"1.0.0.1"
"8.8.8.8"
"8.4.4.8"
];
console.useXkbConfig = true; console.useXkbConfig = true;

View file

@ -1,12 +1,21 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, modulesPath, ... }: { {
imports = [ config,
(modulesPath + "/installer/scan/not-detected.nix") lib,
]; modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@ -33,9 +42,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ swapDevices = [ { device = "/dev/disk/by-label/NIXSWAP"; } ];
{ device = "/dev/disk/by-label/NIXSWAP"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # 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 # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -1,7 +1,9 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ nixos-hardware }: { pkgs, ... }: { { nixos-hardware }:
{ pkgs, ... }:
{
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@ -15,7 +17,10 @@
fileSystems."/".options = [ "compress=zstd" ]; fileSystems."/".options = [ "compress=zstd" ];
fileSystems."/steam".options = [ "compress=zstd" ]; fileSystems."/steam".options = [ "compress=zstd" ];
fileSystems."/home".options = [ "compress=zstd" ]; fileSystems."/home".options = [ "compress=zstd" ];
fileSystems."/nix".options = [ "compress=zstd" "noatime" ]; fileSystems."/nix".options = [
"compress=zstd"
"noatime"
];
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;

View file

@ -1,12 +1,23 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, modulesPath, ... }: { {
imports = [ config,
(modulesPath + "/installer/scan/not-detected.nix") lib,
]; modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"ahci"
"usbhid"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@ -40,11 +51,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ swapDevices = [ { device = "/dev/disk/by-label/SWAP"; } ];
{
device = "/dev/disk/by-label/SWAP";
}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # 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 # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -2,7 +2,9 @@
# your system. Help is available in the configuration.nix(5) man page, 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`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ nixos-hardware }: { pkgs, ... }: { { nixos-hardware }:
{ pkgs, ... }:
{
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@ -16,7 +18,10 @@
fileSystems = { fileSystems = {
"/".options = [ "compress=zstd" ]; "/".options = [ "compress=zstd" ];
"/home".options = [ "compress=zstd" ]; "/home".options = [ "compress=zstd" ];
"/nix".options = [ "compress=zstd" "noatime" ]; "/nix".options = [
"compress=zstd"
"noatime"
];
}; };
boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelPackages = pkgs.linuxPackages_latest;
@ -36,7 +41,12 @@
networking.hostName = "libra"; networking.hostName = "libra";
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# networking.networkmanager.wifi.backend = "iwd"; # Seems to cause problems # networking.networkmanager.wifi.backend = "iwd"; # Seems to cause problems
networking.networkmanager.appendNameservers = [ "1.1.1.1" "1.0.0.1" "8.8.8.8" "8.4.4.8" ]; networking.networkmanager.appendNameservers = [
"1.1.1.1"
"1.0.0.1"
"8.8.8.8"
"8.4.4.8"
];
# Select internationalisation properties. # Select internationalisation properties.
console.useXkbConfig = true; # use xkb.options in tty. console.useXkbConfig = true; # use xkb.options in tty.
@ -65,4 +75,3 @@
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?
} }

View file

@ -1,42 +1,46 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [
"nvme"
"xhci_pci"
"usb_storage"
"sd_mod"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e"; device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=root" ]; options = [ "subvol=root" ];
}; };
fileSystems."/home" = fileSystems."/home" = {
{
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e"; device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=home" ]; options = [ "subvol=home" ];
}; };
fileSystems."/nix" = fileSystems."/nix" = {
{
device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e"; device = "/dev/disk/by-uuid/efbda7f0-c286-4fb1-b780-d3128e4d1a3e";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nix" ]; options = [ "subvol=nix" ];
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{
device = "/dev/disk/by-uuid/4E80-8B60"; device = "/dev/disk/by-uuid/4E80-8B60";
fsType = "vfat"; fsType = "vfat";
}; };

View file

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

View file

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

View file

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... } @ args: {
pkgs,
lib,
config,
...
}@args:
let let
cfg = config.jhome.nvim; cfg = config.jhome.nvim;
hmAvailable = args ? hmConfig; hmAvailable = args ? hmConfig;
@ -8,9 +13,7 @@ let
notStandalone = hmAvailable || nixosAvailable || darwinAvailable; notStandalone = hmAvailable || nixosAvailable || darwinAvailable;
in in
{ {
imports = [ imports = [ ./options.nix ];
./options.nix
];
config = lib.mkMerge [ config = lib.mkMerge [
(lib.optionalAttrs canSetAsDefault { defaultEditor = lib.mkDefault true; }) (lib.optionalAttrs canSetAsDefault { defaultEditor = lib.mkDefault true; })
@ -49,9 +52,7 @@ in
plugins = import ./plugins.nix { inherit lib; }; plugins = import ./plugins.nix { inherit lib; };
keymaps = import ./mappings.nix; keymaps = import ./mappings.nix;
inherit (import ./augroups.nix) autoGroups autoCmd; inherit (import ./augroups.nix) autoGroups autoCmd;
extraPlugins = with pkgs.vimPlugins; [ extraPlugins = with pkgs.vimPlugins; [ nvim-web-devicons ];
nvim-web-devicons
];
# Formatting # Formatting
extraPackages = with pkgs; [ extraPackages = with pkgs; [
stylua stylua

View file

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

View file

@ -1,4 +1,5 @@
{ lib }: { { lib }:
{
bacon = { bacon = {
enable = true; enable = true;
settings.quickfix.enabled = true; settings.quickfix.enabled = true;
@ -8,11 +9,17 @@
cmdline = { cmdline = {
"/" = { "/" = {
mapping.__raw = "cmp.mapping.preset.cmdline()"; mapping.__raw = "cmp.mapping.preset.cmdline()";
sources = [{ name = "rg"; } { name = "buffer"; }]; sources = [
{ name = "rg"; }
{ name = "buffer"; }
];
}; };
":" = { ":" = {
mapping.__raw = "cmp.mapping.preset.cmdline()"; mapping.__raw = "cmp.mapping.preset.cmdline()";
sources = [{ name = "path"; } { name = "cmdline"; }]; sources = [
{ name = "path"; }
{ name = "cmdline"; }
];
}; };
}; };
settings = { settings = {
@ -20,18 +27,54 @@
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
# Completion Sources # Completion Sources
sources = [ sources = [
{ name = "buffer"; groupIndex = 3; } {
{ name = "calc"; groupIndex = 2; } name = "buffer";
{ name = "conventionalcommits"; groupIndex = 1; } groupIndex = 3;
{ name = "crates"; groupIndex = 1; } }
{ name = "luasnip"; groupIndex = 1; } {
{ name = "nvim_lsp"; groupIndex = 1; } name = "calc";
{ name = "nvim_lsp_document_symbol"; groupIndex = 1; } groupIndex = 2;
{ name = "nvim_lsp_signature_help"; groupIndex = 1; } }
{ name = "path"; groupIndex = 2; } {
{ name = "spell"; groupIndex = 2; } name = "conventionalcommits";
{ name = "treesitter"; groupIndex = 2; } groupIndex = 1;
{ name = "zsh"; groupIndex = 1; } }
{
name = "crates";
groupIndex = 1;
}
{
name = "luasnip";
groupIndex = 1;
}
{
name = "nvim_lsp";
groupIndex = 1;
}
{
name = "nvim_lsp_document_symbol";
groupIndex = 1;
}
{
name = "nvim_lsp_signature_help";
groupIndex = 1;
}
{
name = "path";
groupIndex = 2;
}
{
name = "spell";
groupIndex = 2;
}
{
name = "treesitter";
groupIndex = 2;
}
{
name = "zsh";
groupIndex = 1;
}
]; ];
mapping.__raw = '' mapping.__raw = ''
cmp.mapping.preset.insert({ cmp.mapping.preset.insert({
@ -116,7 +159,9 @@
}; };
luasnip = { luasnip = {
enable = true; enable = true;
extraConfig = { update_events = "TextChanged,TextChangedI"; }; extraConfig = {
update_events = "TextChanged,TextChangedI";
};
}; };
noice = { noice = {
enable = true; enable = true;
@ -162,7 +207,10 @@
enable = true; enable = true;
lintersByFt = { lintersByFt = {
rust = [ "typos" ]; rust = [ "typos" ];
latex = [ "chktex" "typos" ]; latex = [
"chktex"
"typos"
];
markdown = [ "typos" ]; markdown = [ "typos" ];
}; };
}; };

View file

@ -1,8 +1,13 @@
{ stylix }: { config, pkgs, lib, ... }: { stylix }:
{
config,
pkgs,
lib,
...
}:
let let
cfg = config.jconfig; cfg = config.jconfig;
keysFromGithub = lib.attrsets.mapAttrs' keysFromGithub = lib.attrsets.mapAttrs' (username: sha256: {
(username: sha256: {
name = "pubkeys/${username}"; name = "pubkeys/${username}";
value = { value = {
mode = "0755"; mode = "0755";
@ -11,8 +16,7 @@ let
url = "https://github.com/${username}.keys"; url = "https://github.com/${username}.keys";
}; };
}; };
}) }) cfg.importSSHKeysFromGithub;
cfg.importSSHKeysFromGithub;
in in
{ {
imports = [ imports = [
@ -65,7 +69,9 @@ in
}; };
environment.etc = keysFromGithub; environment.etc = keysFromGithub;
services.openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") (builtins.attrNames keysFromGithub); services.openssh.authorizedKeysFiles = builtins.map (path: "/etc/${path}") (
builtins.attrNames keysFromGithub
);
# Default shell # Default shell
programs.zsh.enable = true; programs.zsh.enable = true;
@ -82,6 +88,9 @@ in
# run between 0 and 45min after boot if run was missed # run between 0 and 45min after boot if run was missed
nix.gc.randomizedDelaySec = "45min"; nix.gc.randomizedDelaySec = "45min";
nix.settings.auto-optimise-store = true; nix.settings.auto-optimise-store = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
}; };
} }

View file

@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
cfg = config.jconfig.gui; cfg = config.jconfig.gui;
enable = config.jconfig.enable && cfg.enable; enable = config.jconfig.enable && cfg.enable;
@ -17,7 +22,10 @@ in
enable = cfg.ydotool.autoStart; enable = cfg.ydotool.autoStart;
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
description = "Generic command-line automation tool"; description = "Generic command-line automation tool";
documentation = [ "man:ydotool(1)" "man:ydotoold(8)" ]; documentation = [
"man:ydotool(1)"
"man:ydotoold(8)"
];
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
Restart = "always"; Restart = "always";

View file

@ -2,8 +2,20 @@
let let
inherit (lib) types; inherit (lib) types;
# Like mkEnableOption but defaults to true # Like mkEnableOption but defaults to true
mkDisableOption = option: (lib.mkEnableOption option) // { default = true; example = false; }; mkDisableOption =
mkImageOption = { description, url, sha256 ? "" }: lib.mkOption { option:
(lib.mkEnableOption option)
// {
default = true;
example = false;
};
mkImageOption =
{
description,
url,
sha256 ? "",
}:
lib.mkOption {
inherit description; inherit description;
type = types.path; type = types.path;
default = builtins.fetchurl { inherit url sha256; }; default = builtins.fetchurl { inherit url sha256; };
@ -48,9 +60,7 @@ let
dev = lib.mkOption { dev = lib.mkOption {
description = lib.mdDoc "Options for setting up a dev environment"; description = lib.mdDoc "Options for setting up a dev environment";
default = { }; default = { };
type = types.submodule { type = types.submodule { options.enable = lib.mkEnableOption "dev configuration"; };
options.enable = lib.mkEnableOption "dev configuration";
};
}; };
gui = lib.mkOption { gui = lib.mkOption {
description = lib.mdDoc "Jalil's default configuration for a NixOS gui."; description = lib.mdDoc "Jalil's default configuration for a NixOS gui.";
@ -77,7 +87,9 @@ let
want to allow ssh logins. want to allow ssh logins.
''; '';
default = { }; default = { };
example = { "jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; }; example = {
"jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
};
type = types.attrsOf types.str; type = types.attrsOf types.str;
}; };
}; };

View file

@ -13,18 +13,30 @@ in
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
polarity = "dark"; polarity = "dark";
fonts.monospace = [ fonts.monospace = [
{ name = "JetBrains Mono"; package = pkgs.jetbrains-mono; } {
name = "JetBrains Mono";
package = pkgs.jetbrains-mono;
}
fallbackSymbols fallbackSymbols
]; ];
fonts.sansSerif = [ fonts.sansSerif = [
{ name = "Noto Sans"; package = pkgs.noto-fonts; } {
name = "Noto Sans";
package = pkgs.noto-fonts;
}
fallbackSymbols fallbackSymbols
]; ];
fonts.serif = [ fonts.serif = [
{ name = "Noto Serif"; package = pkgs.noto-fonts; } {
name = "Noto Serif";
package = pkgs.noto-fonts;
}
fallbackSymbols fallbackSymbols
]; ];
fonts.emoji = { package = pkgs.noto-fonts-emoji; name = "Noto Color Emoji"; }; fonts.emoji = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
fonts.sizes.popups = 12; fonts.sizes.popups = 12;
targets.plymouth.logoAnimated = false; targets.plymouth.logoAnimated = false;
targets.plymouth.logo = cfg.bootLogo; targets.plymouth.logo = cfg.bootLogo;