[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,38 +1,41 @@
{ pkgs, lib }: {
let pkgs,
lib,
}: let
# can be removed once https://github.com/rust-lang/mdBook/pull/2262 lands # can be removed once https://github.com/rust-lang/mdBook/pull/2262 lands
highlight = pkgs.fetchurl { highlight = pkgs.fetchurl {
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 = filterVisible = toplevelOption: option:
toplevelOption: option: option // {visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption;};
option // { visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption; };
home-eval = lib.evalModules { home-eval = lib.evalModules {
modules = [ ../home/options.nix ]; modules = [../home/options.nix];
specialArgs = { specialArgs = {
inherit pkgs; 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 = home-markdown =
(pkgs.nixosOptionsDoc { (pkgs.nixosOptionsDoc {
inherit (home-eval) options; inherit (home-eval) options;
transformOptions = filterVisible "jhome"; transformOptions = filterVisible "jhome";
}).optionsCommonMark; })
.optionsCommonMark;
nvim-markdown = nvim-markdown =
(pkgs.nixosOptionsDoc { (pkgs.nixosOptionsDoc {
inherit (nvim-eval) options; inherit (nvim-eval) options;
transformOptions = filterVisible "jhome"; transformOptions = filterVisible "jhome";
}).optionsCommonMark; })
.optionsCommonMark;
nixos-markdown = nixos-markdown =
(pkgs.nixosOptionsDoc { (pkgs.nixosOptionsDoc {
inherit (nixos-eval) options; inherit (nixos-eval) options;
transformOptions = filterVisible "jconfig"; transformOptions = filterVisible "jconfig";
}).optionsCommonMark; })
in .optionsCommonMark;
{ in {
inherit nixos-markdown nvim-markdown home-markdown; inherit nixos-markdown nvim-markdown home-markdown;
docs = pkgs.stdenvNoCC.mkDerivation { docs = pkgs.stdenvNoCC.mkDerivation {
name = "nixos-configuration-book"; name = "nixos-configuration-book";
@ -54,7 +57,7 @@ in
sed -f sed-cmds <${nixos-markdown} >> ./src/nixos-options.md 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"; buildPhase = "${pkgs.mdbook}/bin/mdbook build --dest-dir $out";
}; };
} }

View file

@ -33,8 +33,7 @@
inputs.neovim-flake.inputs.nixpkgs.follows = "nixpkgs"; inputs.neovim-flake.inputs.nixpkgs.follows = "nixpkgs";
# Flake outputs that other flakes can use # Flake outputs that other flakes can use
outputs = outputs = {
{
self, self,
nixpkgs, nixpkgs,
stylix, stylix,
@ -44,31 +43,30 @@
audiomenu, audiomenu,
nixvim, nixvim,
neovim-flake, neovim-flake,
}: }: let
let
inherit (nixpkgs) lib; inherit (nixpkgs) lib;
# Helpers for producing system-specific outputs # Helpers for producing system-specific outputs
supportedSystems = [ supportedSystems = [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
]; ];
forEachSupportedSystem = forEachSupportedSystem = f:
f:
nixpkgs.lib.genAttrs supportedSystems ( nixpkgs.lib.genAttrs supportedSystems (
system: system:
f { 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 ( checks = forEachSupportedSystem (
{ pkgs, system }:
{ {
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;
}; };
# alejandra = {}; # alejandra = {};
@ -77,9 +75,12 @@
); );
packages = forEachSupportedSystem ( packages = forEachSupportedSystem (
{ pkgs, system }:
{ {
inherit (import ./docs { inherit pkgs lib; }) pkgs,
system,
}: {
inherit
(import ./docs {inherit pkgs lib;})
docs docs
nixos-markdown nixos-markdown
nvim-markdown nvim-markdown
@ -87,7 +88,7 @@
; ;
# 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;
}; };
} }
@ -102,14 +103,13 @@
}; };
# Nix files formatter (run `nix fmt`) # Nix files formatter (run `nix fmt`)
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt-rfc-style); formatter = forEachSupportedSystem ({pkgs, ...}: pkgs.alejandra);
# Example vm configuration # Example vm configuration
nixosConfigurations.vm = nixosConfigurations.vm = let
let
system = "x86_64-linux"; system = "x86_64-linux";
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "steam-original" ]; config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) ["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;
@ -144,24 +144,23 @@
]; ];
}; };
nixosModules = nixosModules = let
let
nvim-config.imports = [ nvim-config.imports = [
nixvim.homeManagerModules.nixvim nixvim.homeManagerModules.nixvim
./nvim ./nvim
]; ];
overlays = builtins.attrValues self.overlays; overlays = builtins.attrValues self.overlays;
homeManagerModuleSandalone = import ./home { inherit overlays nvim-config stylix; }; homeManagerModuleSandalone = import ./home {inherit overlays nvim-config stylix;};
homeManagerModuleNixOS = import ./home { inherit overlays nvim-config; }; homeManagerModuleNixOS = import ./home {inherit overlays nvim-config;};
nixosModule = { nixosModule = {
imports = [ imports = [
(import ./system { inherit stylix; }) (import ./system {inherit stylix;})
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
]; ];
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.sharedModules = [ homeManagerModuleNixOS ]; home-manager.sharedModules = [homeManagerModuleNixOS];
# Pin nixpkgs # Pin nixpkgs
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
@ -176,9 +175,9 @@
mkMachine = hostname: { mkMachine = hostname: {
imports = [ imports = [
nixosModule nixosModule
(import (./machines + "/${hostname}") { inherit nixos-hardware; }) (import (./machines + "/${hostname}") {inherit nixos-hardware;})
]; ];
home-manager.sharedModules = [ { jhome.hostName = hostname; } ]; home-manager.sharedModules = [{jhome.hostName = hostname;}];
}; };
machineModules = lib.genAttrs machines mkMachine; machineModules = lib.genAttrs machines mkMachine;
in in
@ -189,8 +188,10 @@
// machineModules; // machineModules;
devShells = forEachSupportedSystem ( devShells = forEachSupportedSystem (
{ pkgs, system }:
{ {
pkgs,
system,
}: {
default = pkgs.mkShell { default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
just just

View file

@ -2,18 +2,15 @@
overlays, overlays,
nvim-config, nvim-config,
stylix ? null, stylix ? null,
}: }: {
{
config, config,
pkgs, pkgs,
lib, lib,
... ...
}: }: let
let
cfg = config.jhome; cfg = config.jhome;
devcfg = cfg.dev; devcfg = cfg.dev;
in in {
{
imports = imports =
[ [
# Apply overlays # Apply overlays
@ -82,7 +79,9 @@ in
services.gpg-agent.enable = true; services.gpg-agent.enable = true;
services.gpg-agent.maxCacheTtl = 86400; services.gpg-agent.maxCacheTtl = 86400;
services.gpg-agent.pinentryPackage = 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"; services.gpg-agent.extraConfig = "allow-preset-passphrase";
# Spotifyd # Spotifyd
services.spotifyd.enable = true; services.spotifyd.enable = true;
@ -173,7 +172,7 @@ in
}; };
}) })
(lib.mkIf (cfg.enable && devcfg.enable && devcfg.rust.enable) { (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) # Background code checker (for Rust)
programs.bacon = { programs.bacon = {
enable = true; enable = true;

View file

@ -4,22 +4,25 @@
pkgs, pkgs,
osConfig ? null, 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;
osSway = osConfig == null && !osConfig.programs.sway.enable; 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; cfg = jhome.gui;
cursor.package = pkgs.nordzy-cursor-theme; cursor.package = pkgs.nordzy-cursor-theme;
cursor.name = "Nordzy-cursors"; cursor.name = "Nordzy-cursors";
iconTheme.name = "Papirus-Dark"; iconTheme.name = "Papirus-Dark";
iconTheme.package = pkgs.papirus-icon-theme; iconTheme.package = pkgs.papirus-icon-theme;
in in {
{
config = lib.mkIf (jhome.enable && cfg.enable) { config = lib.mkIf (jhome.enable && cfg.enable) {
home.packages = home.packages = with pkgs;
with pkgs;
[ [
webcord webcord
ferdium ferdium
@ -48,13 +51,13 @@ in
# Video player # Video player
programs.mpv = { programs.mpv = {
enable = true; enable = true;
scripts = builtins.attrValues { inherit (pkgs.mpvScripts) uosc thumbfast; }; scripts = builtins.attrValues {inherit (pkgs.mpvScripts) uosc thumbfast;};
}; };
# Status bar # Status bar
programs.waybar = { programs.waybar = {
enable = true; enable = true;
systemd.enable = true; systemd.enable = true;
settings = import ./waybar-settings.nix { inherit config lib; }; settings = import ./waybar-settings.nix {inherit config lib;};
}; };
# Terminal # Terminal
programs.wezterm = { programs.wezterm = {
@ -103,7 +106,7 @@ in
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
package = swayPkg; # no sway package if it comes from the OS 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 # Set cursor style

View file

@ -1,5 +1,7 @@
{ pkgs, config }: {
let pkgs,
config,
}: let
cfg = config.jhome.gui.sway; cfg = config.jhome.gui.sway;
passmenu = "${pkgs.jpassmenu}/bin/jpassmenu"; passmenu = "${pkgs.jpassmenu}/bin/jpassmenu";
selectAudio = "${pkgs.audiomenu}/bin/audiomenu --menu 'fuzzel --dmenu'"; selectAudio = "${pkgs.audiomenu}/bin/audiomenu --menu 'fuzzel --dmenu'";
@ -31,8 +33,8 @@ let
]; ];
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 [ modCtrlKeybind = keycombo [
mod mod
"Ctrl" "Ctrl"
@ -51,13 +53,10 @@ let
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 = genKey = prefix: action: genKeybind ({key, ...}: prefix key) ({direction, ...}: action direction);
prefix: action: genKeybind ({ key, ... }: prefix key) ({ direction, ... }: action direction); genArrow = prefix: action: genKeybind ({arrow, ...}: prefix arrow) ({direction, ...}: action direction);
genArrow = genArrowAndKey = prefix: action: key:
prefix: action: genKeybind ({ arrow, ... }: prefix arrow) ({ direction, ... }: action direction);
genArrowAndKey =
prefix: action: key:
(genKey prefix action key) // (genArrow 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;
@ -66,19 +65,25 @@ 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 ( moveWorkspaceKeybindings =
map (genKeybind modShiftKeybind (
number: "move container to workspace number ${number}" number: "move container to workspace number ${number}"
)) workspaces; ))
workspaces;
# Focus workspace # Focus workspace
focusWorkspaceKeybindings = map (genKeybind modKeybind ( focusWorkspaceKeybindings =
map (genKeybind modKeybind (
number: "workspace number ${number}" number: "workspace number ${number}"
)) workspaces; ))
workspaces;
# Move container to Workspace and focus on it # 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}" number: "move container to workspace number ${number}; workspace number ${number}"
)) workspaces; ))
workspaces;
in in
builtins.foldl' (l: r: l // r) builtins.foldl' (l: r: l // r)
{ {
"${mod}+Return" = "exec ${swayconf.terminal}"; "${mod}+Return" = "exec ${swayconf.terminal}";
"${mod}+D" = "exec ${swayconf.menu}"; "${mod}+D" = "exec ${swayconf.menu}";

View file

@ -1,15 +1,16 @@
{ config, pkgs }: {
let config,
pkgs,
}: let
cfg = config.jhome.gui.sway; cfg = config.jhome.gui.sway;
modifier = "Mod4"; modifier = "Mod4";
terminal = config.jhome.gui.terminal; terminal = config.jhome.gui.terminal;
termCmd = termCmd =
if terminal == "wezterm" then if terminal == "wezterm"
"wezterm start" then "wezterm start"
else if terminal == "alacritty" then else if terminal == "alacritty"
"alacritty -e" then "alacritty -e"
else else builtins.abort "no command configured for ${terminal}";
builtins.abort "no command configured for ${terminal}";
menu = "${pkgs.fuzzel}/bin/fuzzel --terminal '${termCmd}'"; menu = "${pkgs.fuzzel}/bin/fuzzel --terminal '${termCmd}'";
# currently, there is some friction between sway and gtk: # currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland # 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 # for gsettings to work, we need to tell it where the schemas are
# using the XDG_DATA_DIR environment variable # using the XDG_DATA_DIR environment variable
# run at the end of sway config # run at the end of sway config
configure-gtk = configure-gtk = let
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
@ -38,17 +38,16 @@ let
${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name" ${pkgs.glib}/bin/gsettings set "$gnome_schema" font-name "$font_name"
${pkgs.glib}/bin/gsettings set "$gnome_schema" color-scheme prefer-dark ${pkgs.glib}/bin/gsettings set "$gnome_schema" color-scheme prefer-dark
''; '';
cmdOnce = command: { inherit command; }; cmdOnce = command: {inherit command;};
cmdAlways = command: { cmdAlways = command: {
inherit command; inherit command;
always = true; always = true;
}; };
in in {
{
inherit modifier terminal menu; inherit modifier terminal menu;
keybindings = import ./keybindings.nix { inherit config pkgs; }; keybindings = import ./keybindings.nix {inherit config pkgs;};
# Appearance # Appearance
bars = [ ]; # Waybar is started as a systemd service bars = []; # Waybar is started as a systemd service
gaps = { gaps = {
smartGaps = true; smartGaps = true;
smartBorders = "on"; smartBorders = "on";
@ -73,9 +72,12 @@ in
} }
]; ];
# 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 cmdOnce cfg.exec.once); ]
++ (builtins.map cmdAlways cfg.exec.always)
++ (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,31 +1,35 @@
{ config, lib }:
let
cfg = config.jhome.gui;
in
{ {
config,
lib,
}: let
cfg = config.jhome.gui;
in {
mainBar.layer = "top"; mainBar.layer = "top";
mainBar.position = "top"; mainBar.position = "top";
mainBar.margin = "2 2 2 2"; mainBar.margin = "2 2 2 2";
# 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 = [ mainBar.modules-right =
[
"pulseaudio" "pulseaudio"
"backlight" "backlight"
"battery" "battery"
"sway/language" "sway/language"
"memory" "memory"
] ++ lib.optional (cfg.tempInfo != null) "temperature" ++ [ "tray" ]; ]
++ 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" = [];
mainBar."sway/workspaces".persistent-workspaces."3" = [ ]; mainBar."sway/workspaces".persistent-workspaces."3" = [];
mainBar."sway/workspaces".persistent-workspaces."4" = [ ]; mainBar."sway/workspaces".persistent-workspaces."4" = [];
mainBar."sway/workspaces".persistent-workspaces."5" = [ ]; mainBar."sway/workspaces".persistent-workspaces."5" = [];
mainBar."sway/workspaces".persistent-workspaces."6" = [ ]; mainBar."sway/workspaces".persistent-workspaces."6" = [];
mainBar."sway/workspaces".persistent-workspaces."7" = [ ]; mainBar."sway/workspaces".persistent-workspaces."7" = [];
mainBar."sway/workspaces".persistent-workspaces."8" = [ ]; mainBar."sway/workspaces".persistent-workspaces."8" = [];
mainBar."sway/workspaces".persistent-workspaces."9" = [ ]; mainBar."sway/workspaces".persistent-workspaces."9" = [];
mainBar."sway/language".format = "{} "; mainBar."sway/language".format = "{} ";
mainBar."sway/language".min-length = 5; mainBar."sway/language".min-length = 5;
mainBar."sway/language".tooltip = false; mainBar."sway/language".tooltip = false;

View file

@ -1,13 +1,16 @@
{ lib, pkgs, ... }: {
let lib,
pkgs,
...
}: let
inherit (lib) types; inherit (lib) types;
mkExtraPackagesOption = mkExtraPackagesOption = name: defaultPkgsPath: let
name: defaultPkgsPath: text =
let lib.strings.concatMapStringsSep " " (
text = lib.strings.concatMapStringsSep " " (
pkgPath: "pkgs." + (lib.strings.concatStringsSep "." pkgPath) pkgPath: "pkgs." + (lib.strings.concatStringsSep "." pkgPath)
) defaultPkgsPath; )
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
@ -15,7 +18,7 @@ let
description = "Extra ${name} Packages."; description = "Extra ${name} Packages.";
type = types.listOf types.package; type = types.listOf types.package;
inherit default defaultText; inherit default defaultText;
example = [ ]; example = [];
}; };
identity.options = { identity.options = {
@ -47,12 +50,12 @@ let
enable = lib.mkEnableOption "Jalil's default user configuration"; enable = lib.mkEnableOption "Jalil's default user configuration";
gpg = lib.mkOption { gpg = lib.mkOption {
description = "GnuPG Configuration."; description = "GnuPG Configuration.";
default = { }; default = {};
type = types.submodule { type = types.submodule {
options.unlockKeys = lib.mkOption { options.unlockKeys = lib.mkOption {
description = "Keygrips of keys to unlock through `pam-gnupg` when logging in."; description = "Keygrips of keys to unlock through `pam-gnupg` when logging in.";
default = [ ]; default = [];
example = [ "6F4ABB77A88E922406BCE6627AFEEE2363914B76" ]; example = ["6F4ABB77A88E922406BCE6627AFEEE2363914B76"];
type = types.listOf types.str; type = types.listOf types.str;
}; };
}; };
@ -93,20 +96,20 @@ let
}; };
exec = lib.mkOption { exec = lib.mkOption {
description = "Run commands when starting sway."; description = "Run commands when starting sway.";
default = { }; default = {};
type = types.submodule { type = types.submodule {
options = { options = {
once = lib.mkOption { once = lib.mkOption {
description = "Programs to start only once (`exec`)."; description = "Programs to start only once (`exec`).";
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
example = [ "signal-desktop --start-in-tray" ]; example = ["signal-desktop --start-in-tray"];
}; };
always = lib.mkOption { always = lib.mkOption {
description = "Programs to start whenever the config is sourced (`exec_always`)."; description = "Programs to start whenever the config is sourced (`exec_always`).";
type = types.listOf types.str; type = types.listOf types.str;
default = [ ]; default = [];
example = [ "signal-desktop --start-in-tray" ]; example = ["signal-desktop --start-in-tray"];
}; };
}; };
}; };
@ -114,7 +117,7 @@ let
}; };
gui.options = { gui.options = {
enable = lib.mkEnableOption ("GUI applications"); enable = lib.mkEnableOption "GUI applications";
tempInfo = lib.mkOption { tempInfo = lib.mkOption {
description = "Temperature info to display in the statusbar."; description = "Temperature info to display in the statusbar.";
default = null; default = null;
@ -122,7 +125,7 @@ let
}; };
sway = lib.mkOption { sway = lib.mkOption {
description = "Sway window manager configuration."; description = "Sway window manager configuration.";
default = { }; default = {};
type = types.submodule sway; type = types.submodule sway;
}; };
terminal = lib.mkOption { terminal = lib.mkOption {
@ -135,11 +138,10 @@ let
]; ];
}; };
}; };
in in {
{
options.jhome = lib.mkOption { options.jhome = lib.mkOption {
description = "Jalil's default home-manager configuration."; description = "Jalil's default home-manager configuration.";
default = { }; default = {};
type = types.submodule { type = types.submodule {
options = { options = {
enable = lib.mkEnableOption "jalil's home defaults"; enable = lib.mkEnableOption "jalil's home defaults";
@ -151,29 +153,29 @@ in
}; };
dev = lib.mkOption { dev = lib.mkOption {
description = "Setup development environment for programming languages."; description = "Setup development environment for programming languages.";
default = { }; default = {};
type = types.submodule { type = types.submodule {
options.enable = lib.mkEnableOption "development settings"; options.enable = lib.mkEnableOption "development settings";
options.neovimAsManPager = lib.mkEnableOption "neovim as the man pager"; options.neovimAsManPager = lib.mkEnableOption "neovim as the man pager";
options.extraPackages = mkExtraPackagesOption "dev" [ options.extraPackages = mkExtraPackagesOption "dev" [
[ "jq" ] # json parser ["jq"] # json parser
[ "just" ] # just a command runner ["just"] # just a command runner
[ "typos" ] # low false positive rate typo checker ["typos"] # low false positive rate typo checker
[ "git-absorb" ] # fixup! but automatic ["git-absorb"] # fixup! but automatic
[ "man-pages" ] # gimme the man pages ["man-pages"] # gimme the man pages
[ "man-pages-posix" ] # I said gimme the man pages!!! ["man-pages-posix"] # I said gimme the man pages!!!
]; ];
options.rust = lib.mkOption { options.rust = lib.mkOption {
description = "Jalil's default rust configuration."; description = "Jalil's default rust configuration.";
default = { }; default = {};
type = types.submodule { type = types.submodule {
options.enable = lib.mkEnableOption "rust development settings"; options.enable = lib.mkEnableOption "rust development settings";
options.extraPackages = mkExtraPackagesOption "Rust" [ options.extraPackages = mkExtraPackagesOption "Rust" [
[ "cargo-kcov" ] # code coverage ["cargo-kcov"] # code coverage
[ "cargo-msrv" ] # minimum supported version ["cargo-msrv"] # minimum supported version
[ "cargo-nextest" ] # better testing harness ["cargo-nextest"] # better testing harness
[ "cargo-sort" ] # sort deps and imports ["cargo-sort"] # sort deps and imports
[ "cargo-watch" ] # watch for file changes and run commands ["cargo-watch"] # watch for file changes and run commands
]; ];
}; };
}; };
@ -186,7 +188,7 @@ in
}; };
gui = lib.mkOption { gui = lib.mkOption {
description = "Jalil's default GUI configuration."; description = "Jalil's default GUI configuration.";
default = { }; default = {};
type = types.submodule gui; type = types.submodule gui;
}; };
}; };

View file

@ -1,5 +1,8 @@
{ config, lib, ... }: {
let config,
lib,
...
}: let
inherit (config) jhome; inherit (config) jhome;
inherit (cfg.defaultIdentity) signingKey; inherit (cfg.defaultIdentity) signingKey;
@ -7,9 +10,8 @@ let
hasConfig = jhome.enable && cfg != null; hasConfig = jhome.enable && cfg != null;
hasKey = signingKey != null; hasKey = signingKey != null;
gpgHome = config.programs.gpg.homedir; gpgHome = config.programs.gpg.homedir;
unlockKey = hasConfig && cfg.gpg.unlockKeys != [ ]; unlockKey = hasConfig && cfg.gpg.unlockKeys != [];
in in {
{
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf hasConfig { (lib.mkIf hasConfig {
programs.git = { programs.git = {
@ -21,7 +23,7 @@ in
}; };
}; };
programs.jujutsu.settings = { 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 { signing = lib.mkIf hasKey {
sign-all = true; sign-all = true;
backend = "gpg"; backend = "gpg";

View file

@ -1,5 +1,4 @@
{ 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
@ -10,8 +9,8 @@
]; ];
# 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 = [ fileSystems."/nix".options = [
"compress=zstd" "compress=zstd"
"noatime" "noatime"

View file

@ -6,9 +6,8 @@
lib, lib,
modulesPath, modulesPath,
... ...
}: }: {
{ imports = [(modulesPath + "/installer/scan/not-detected.nix")];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
"xhci_pci" "xhci_pci"
@ -16,20 +15,20 @@
"usb_storage" "usb_storage"
"sd_mod" "sd_mod"
]; ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-label/NIXROOT"; device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=root" ]; options = ["subvol=root"];
}; };
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/dev/disk/by-label/NIXROOT"; device = "/dev/disk/by-label/NIXROOT";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nix" ]; options = ["subvol=nix"];
}; };
fileSystems."/home" = { fileSystems."/home" = {
@ -42,7 +41,7 @@
fsType = "vfat"; 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 # 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,9 +1,7 @@
# 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 }: {nixos-hardware}: {pkgs, ...}: {
{ pkgs, ... }:
{
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@ -14,9 +12,9 @@
nixos-hardware.nixosModules.common-gpu-amd nixos-hardware.nixosModules.common-gpu-amd
]; ];
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 = [ fileSystems."/nix".options = [
"compress=zstd" "compress=zstd"
"noatime" "noatime"
@ -46,7 +44,7 @@
# }; # };
services.openssh.enable = true; services.openssh.enable = true;
services.openssh.startWhenNeeded = true; services.openssh.startWhenNeeded = true;
services.openssh.settings.AllowUsers = [ "jalil" ]; services.openssh.settings.AllowUsers = ["jalil"];
# Enable CUPS to print documents. # Enable CUPS to print documents.
services.printing.enable = true; services.printing.enable = true;

View file

@ -6,9 +6,8 @@
lib, lib,
modulesPath, modulesPath,
... ...
}: }: {
{ imports = [(modulesPath + "/installer/scan/not-detected.nix")];
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
"nvme" "nvme"
@ -18,15 +17,15 @@
"usb_storage" "usb_storage"
"sd_mod" "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-label/NIXOSROOT"; # device = "/dev/disk/by-label/NIXOSROOT";
device = "/dev/disk/by-label/NIXOSHOME"; device = "/dev/disk/by-label/NIXOSHOME";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=root" ]; options = ["subvol=root"];
}; };
fileSystems."/steam" = { fileSystems."/steam" = {
@ -37,13 +36,13 @@
fileSystems."/home" = { fileSystems."/home" = {
device = "/dev/disk/by-label/NIXOSHOME"; device = "/dev/disk/by-label/NIXOSHOME";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=home" ]; options = ["subvol=home"];
}; };
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/dev/disk/by-label/NIXOSROOT"; device = "/dev/disk/by-label/NIXOSROOT";
fsType = "btrfs"; fsType = "btrfs";
options = [ "subvol=nix" ]; options = ["subvol=nix"];
}; };
fileSystems."/boot" = { fileSystems."/boot" = {
@ -51,7 +50,7 @@
fsType = "vfat"; 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 # 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,10 +1,7 @@
# 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, 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,8 +13,8 @@
]; ];
fileSystems = { fileSystems = {
"/".options = [ "compress=zstd" ]; "/".options = ["compress=zstd"];
"/home".options = [ "compress=zstd" ]; "/home".options = ["compress=zstd"];
"/nix".options = [ "/nix".options = [
"compress=zstd" "compress=zstd"
"noatime" "noatime"
@ -25,7 +22,7 @@
}; };
boot.kernelPackages = pkgs.linuxPackages_latest; 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.opengl.enable = true;
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;

View file

@ -7,10 +7,8 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: }: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [
"nvme" "nvme"
@ -18,26 +16,26 @@
"usb_storage" "usb_storage"
"sd_mod" "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" = {
@ -45,7 +43,7 @@
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = [ ]; swapDevices = [];
# 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,5 +1,4 @@
{ ... }: {...}: {
{
services.qemuGuest.enable = true; services.qemuGuest.enable = true;
boot.initrd.availableKernelModules = [ boot.initrd.availableKernelModules = [

View file

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

View file

@ -1,6 +1,5 @@
{ 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

@ -3,21 +3,19 @@
lib, lib,
config, config,
... ...
}@args: } @ args: let
let
cfg = config.jhome.nvim; cfg = config.jhome.nvim;
hmAvailable = args ? hmConfig; hmAvailable = args ? hmConfig;
nixosAvailable = args ? nixosConfig; nixosAvailable = args ? nixosConfig;
darwinAvailable = args ? darwinConfig; darwinAvailable = args ? darwinConfig;
canSetAsDefault = hmAvailable || nixosAvailable; canSetAsDefault = hmAvailable || nixosAvailable;
notStandalone = hmAvailable || nixosAvailable || darwinAvailable; notStandalone = hmAvailable || nixosAvailable || darwinAvailable;
in in {
{ imports = [./options.nix];
imports = [ ./options.nix ];
config = lib.mkMerge [ config = lib.mkMerge [
(lib.optionalAttrs canSetAsDefault { defaultEditor = lib.mkDefault true; }) (lib.optionalAttrs canSetAsDefault {defaultEditor = lib.mkDefault true;})
(lib.optionalAttrs notStandalone { enable = lib.mkDefault true; }) (lib.optionalAttrs notStandalone {enable = lib.mkDefault true;})
(lib.mkIf cfg.enable { (lib.mkIf cfg.enable {
# package = pkgs.neovim-nightly; # package = pkgs.neovim-nightly;
globals.mapleader = " "; globals.mapleader = " ";
@ -49,15 +47,13 @@ in
# Enable local configuration :h 'exrc' # Enable local configuration :h 'exrc'
exrc = true; # safe since nvim 0.9 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; keymaps = import ./mappings.nix;
inherit (import ./augroups.nix) autoGroups autoCmd; inherit (import ./augroups.nix) autoGroups autoCmd;
extraPlugins = extraPlugins = let
let jjdescription = pkgs.callPackage ./vim-jjdescription.nix {};
jjdescription = pkgs.callPackage ./vim-jjdescription.nix { };
in in
with pkgs.vimPlugins; with pkgs.vimPlugins; [
[
nvim-web-devicons nvim-web-devicons
jjdescription jjdescription
]; ];

View file

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

View file

@ -1,5 +1,7 @@
{ lib, pkgs }:
{ {
lib,
pkgs,
}: {
bacon = { bacon = {
enable = true; enable = true;
settings.quickfix.enabled = true; settings.quickfix.enabled = true;
@ -10,15 +12,15 @@
"/" = { "/" = {
mapping.__raw = "cmp.mapping.preset.cmdline()"; mapping.__raw = "cmp.mapping.preset.cmdline()";
sources = [ sources = [
{ name = "rg"; } {name = "rg";}
{ name = "buffer"; } {name = "buffer";}
]; ];
}; };
":" = { ":" = {
mapping.__raw = "cmp.mapping.preset.cmdline()"; mapping.__raw = "cmp.mapping.preset.cmdline()";
sources = [ sources = [
{ name = "path"; } {name = "path";}
{ name = "cmdline"; } {name = "cmdline";}
]; ];
}; };
}; };
@ -118,16 +120,16 @@
conform-nvim = { conform-nvim = {
enable = true; enable = true;
formattersByFt = { formattersByFt = {
"_" = [ "trim_whitespace" ]; "_" = ["trim_whitespace"];
c = [ "clang_format" ]; c = ["clang_format"];
cpp = [ "clang_format" ]; cpp = ["clang_format"];
lua = [ "stylua" ]; lua = ["stylua"];
nix = [ "nixpkgs_fmt" ]; nix = ["nixpkgs_fmt"];
rust = [ "rustfmt" ]; rust = ["rustfmt"];
sh = [ "shfmt" ]; sh = ["shfmt"];
toml = [ "taplo" ]; toml = ["taplo"];
yaml = [ "yamlfmt" ]; yaml = ["yamlfmt"];
zig = [ "zigfmt" ]; zig = ["zigfmt"];
}; };
}; };
gitsigns.enable = true; gitsigns.enable = true;
@ -196,11 +198,9 @@
enable = true; enable = true;
indent = true; indent = true;
incrementalSelection.enable = true; incrementalSelection.enable = true;
grammarPackages = grammarPackages = let
let
parsers = pkgs.vimPlugins.nvim-treesitter-parsers; parsers = pkgs.vimPlugins.nvim-treesitter-parsers;
in in [
[
parsers.asm parsers.asm
parsers.bash parsers.bash
# parsers.bibtex # parsers.bibtex
@ -264,12 +264,12 @@
lint = { lint = {
enable = true; enable = true;
lintersByFt = { lintersByFt = {
rust = [ "typos" ]; rust = ["typos"];
latex = [ latex = [
"chktex" "chktex"
"typos" "typos"
]; ];
markdown = [ "typos" ]; markdown = ["typos"];
}; };
}; };
} }

View file

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

View file

@ -1,13 +1,12 @@
{ stylix }: {stylix}: {
{
config, config,
pkgs, pkgs,
lib, lib,
... ...
}: }: let
let
cfg = config.jconfig; cfg = config.jconfig;
keysFromGithub = lib.attrsets.mapAttrs' (username: sha256: { keysFromGithub =
lib.attrsets.mapAttrs' (username: sha256: {
name = "pubkeys/${username}"; name = "pubkeys/${username}";
value = { value = {
mode = "0755"; mode = "0755";
@ -16,15 +15,15 @@ let
url = "https://github.com/${username}.keys"; url = "https://github.com/${username}.keys";
}; };
}; };
}) cfg.importSSHKeysFromGithub; })
in cfg.importSSHKeysFromGithub;
{ in {
imports = [ imports = [
./options.nix ./options.nix
./gui ./gui
stylix.nixosModules.stylix stylix.nixosModules.stylix
# FIXME(https://github.com/danth/stylix/issues/216): Must configure 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 { config = lib.mkIf cfg.enable {
@ -85,8 +84,8 @@ in
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
# Open ports for spotifyd # Open ports for spotifyd
networking.firewall.allowedUDPPorts = [ 5353 ]; networking.firewall.allowedUDPPorts = [5353];
networking.firewall.allowedTCPPorts = [ 2020 ]; networking.firewall.allowedTCPPorts = [2020];
# Nix Settings # Nix Settings
nix.gc.automatic = true; nix.gc.automatic = true;

View file

@ -3,24 +3,24 @@
lib, lib,
pkgs, pkgs,
... ...
}: }: let
let
cfg = config.jconfig.gui; cfg = config.jconfig.gui;
enable = config.jconfig.enable && cfg.enable; enable = config.jconfig.enable && cfg.enable;
in in {
{
config = lib.mkMerge [ config = lib.mkMerge [
(lib.mkIf enable { (lib.mkIf enable {
environment.systemPackages = [ environment.systemPackages =
[
pkgs.gnome.adwaita-icon-theme pkgs.gnome.adwaita-icon-theme
pkgs.adwaita-qt pkgs.adwaita-qt
pkgs.nordzy-cursor-theme pkgs.nordzy-cursor-theme
pkgs.pinentry-qt 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 { systemd.user.services.ydotool = lib.mkIf cfg.ydotool.enable {
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 = [ documentation = [
"man:ydotool(1)" "man:ydotool(1)"
@ -45,7 +45,7 @@ in
programs.dconf.enable = true; programs.dconf.enable = true;
programs.sway.enable = cfg.sway; 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.base = true;
programs.sway.wrapperFeatures.gtk = true; programs.sway.wrapperFeatures.gtk = true;
@ -65,7 +65,7 @@ in
# XDG portals # XDG portals
xdg.portal.enable = true; xdg.portal.enable = true;
xdg.portal.wlr.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 # Default to the gtk portal
xdg.portal.config.preferred.default = "gtk"; xdg.portal.config.preferred.default = "gtk";
# Use wlr for screenshots and screen recording # Use wlr for screenshots and screen recording

View file

@ -1,16 +1,13 @@
{ lib, ... }: {lib, ...}: let
let
inherit (lib) types; inherit (lib) types;
# Like mkEnableOption but defaults to true # Like mkEnableOption but defaults to true
mkDisableOption = mkDisableOption = option:
option:
(lib.mkEnableOption option) (lib.mkEnableOption option)
// { // {
default = true; default = true;
example = false; example = false;
}; };
mkImageOption = mkImageOption = {
{
description, description,
url, url,
sha256 ? "", sha256 ? "",
@ -18,7 +15,7 @@ let
lib.mkOption { lib.mkOption {
inherit description; inherit description;
type = types.path; type = types.path;
default = builtins.fetchurl { inherit url sha256; }; default = builtins.fetchurl {inherit url sha256;};
defaultText = lib.literalMD "![${description}](${url})"; defaultText = lib.literalMD "![${description}](${url})";
}; };
@ -31,7 +28,7 @@ let
steamHardwareSupport = mkDisableOption "steam hardware support"; steamHardwareSupport = mkDisableOption "steam hardware support";
ydotool = lib.mkOption { ydotool = lib.mkOption {
description = "Jalil's default ydotool configuration."; description = "Jalil's default ydotool configuration.";
default = { }; default = {};
type = types.submodule { type = types.submodule {
options.enable = mkDisableOption "ydotool"; options.enable = mkDisableOption "ydotool";
options.autoStart = mkDisableOption "autostarting ydotool at login"; options.autoStart = mkDisableOption "autostarting ydotool at login";
@ -59,17 +56,17 @@ let
enable = lib.mkEnableOption "jalil's default configuration."; enable = lib.mkEnableOption "jalil's default configuration.";
dev = lib.mkOption { dev = lib.mkOption {
description = "Options for setting up a dev environment"; description = "Options for setting up a dev environment";
default = { }; default = {};
type = types.submodule { options.enable = lib.mkEnableOption "dev configuration"; }; type = types.submodule {options.enable = lib.mkEnableOption "dev configuration";};
}; };
gui = lib.mkOption { gui = lib.mkOption {
description = "Jalil's default configuration for a NixOS gui."; description = "Jalil's default configuration for a NixOS gui.";
default = { }; default = {};
type = types.submodule gui; type = types.submodule gui;
}; };
styling = lib.mkOption { styling = lib.mkOption {
description = "Jalil's styling options"; description = "Jalil's styling options";
default = { }; default = {};
type = types.submodule styling; type = types.submodule styling;
}; };
importSSHKeysFromGithub = lib.mkOption { importSSHKeysFromGithub = lib.mkOption {
@ -86,18 +83,17 @@ let
`users.users.<name>.openssh.authorizedKeys.keyFiles` on the users you `users.users.<name>.openssh.authorizedKeys.keyFiles` on the users you
want to allow ssh logins. want to allow ssh logins.
''; '';
default = { }; default = {};
example = { example = {
"jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; "jalil-salame" = "sha256:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
}; };
type = types.attrsOf types.str; type = types.attrsOf types.str;
}; };
}; };
in in {
{
options.jconfig = lib.mkOption { options.jconfig = lib.mkOption {
description = "Jalil's default NixOS configuration."; description = "Jalil's default NixOS configuration.";
default = { }; default = {};
type = types.submodule config; type = types.submodule config;
}; };
} }

View file

@ -1,13 +1,14 @@
{ config, pkgs }: {
let config,
pkgs,
}: let
cfg = config.jconfig.styling; cfg = config.jconfig.styling;
nerdFontSymbols = pkgs.nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }; nerdFontSymbols = pkgs.nerdfonts.override {fonts = ["NerdFontsSymbolsOnly"];};
fallbackSymbols = { fallbackSymbols = {
name = "Symbols Nerd Font"; name = "Symbols Nerd Font";
package = nerdFontSymbols; package = nerdFontSymbols;
}; };
in in {
{
autoEnable = cfg.enable; autoEnable = cfg.enable;
image = cfg.wallpaper; image = cfg.wallpaper;
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";