[fix] fmt: change formatter to nixfmt-rfc-style

Alejandra has ads and splits files into too many new lines.
This commit is contained in:
Jalil David Salamé Messina 2024-07-03 23:58:26 +02:00
parent 711c1aa81d
commit 91284a73ca
Signed by: jalil
GPG key ID: F016B9E770737A0B
28 changed files with 800 additions and 742 deletions

View file

@ -1,36 +1,30 @@
{
lib,
pkgs,
...
} @ attrs: let
{ lib, pkgs, ... }@attrs:
let
osConfig = attrs.osConfig or null;
inherit (lib) types;
fromOs = let
get = path: set:
if path == []
then set
else get (builtins.tail path) (builtins.getAttr (builtins.head path) set);
in
path: default:
if osConfig == null
then default
else get path osConfig;
fromConfig = path: default: fromOs (["jconfig"] ++ path) default;
fromOs =
let
get =
path: set:
if path == [ ] then set else get (builtins.tail path) (builtins.getAttr (builtins.head path) set);
in
path: default: if osConfig == null then default else get path osConfig;
fromConfig = path: default: fromOs ([ "jconfig" ] ++ path) default;
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 = {
@ -62,12 +56,12 @@
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;
};
};
@ -85,14 +79,27 @@
};
sway.options = {
enable = lib.mkEnableOption "sway" // {default = fromConfig ["gui" "sway"] true;};
enable = lib.mkEnableOption "sway" // {
default = fromConfig [
"gui"
"sway"
] true;
};
background = lib.mkOption {
description = "The wallpaper to use.";
type = types.path;
default = fromConfig ["styling" "wallpaper"] (builtins.fetchurl {
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
});
default =
fromConfig
[
"styling"
"wallpaper"
]
(
builtins.fetchurl {
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
}
);
};
autostart = lib.mkOption {
description = ''
@ -109,20 +116,20 @@
};
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" ];
};
};
};
@ -130,7 +137,12 @@
};
gui.options = {
enable = lib.mkEnableOption "GUI applications" // {default = fromConfig ["gui" "enable"] false;};
enable = lib.mkEnableOption "GUI applications" // {
default = fromConfig [
"gui"
"enable"
] false;
};
tempInfo = lib.mkOption {
description = "Temperature info to display in the statusbar.";
default = null;
@ -138,7 +150,7 @@
};
sway = lib.mkOption {
description = "Sway window manager configuration.";
default = {};
default = { };
type = types.submodule sway;
};
terminal = lib.mkOption {
@ -151,48 +163,57 @@
];
};
};
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";
hostName = lib.mkOption {
description = "The hostname of this system.";
type = types.str;
default = fromOs ["networking" "hostName"] "nixos";
default = fromOs [
"networking"
"hostName"
] "nixos";
example = "my pc";
};
dev = lib.mkOption {
description = "Setup development environment for programming languages.";
default = {};
default = { };
type = types.submodule {
options = {
enable = lib.mkEnableOption "development settings" // {default = fromConfig ["dev" "enable"] false;};
enable = lib.mkEnableOption "development settings" // {
default = fromConfig [
"dev"
"enable"
] false;
};
neovimAsManPager = lib.mkEnableOption "neovim as the man pager";
extraPackages = mkExtraPackagesOption "dev" [
["jq"] # json parser
["just"] # just a command runner
["typos"] # low false positive rate typo checker
["gcc"] # GNU Compiler Collection
["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
[ "gcc" ] # GNU Compiler Collection
[ "git-absorb" ] # fixup! but automatic
[ "man-pages" ] # gimme the man pages
[ "man-pages-posix" ] # I said gimme the man pages!!!
];
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-insta"] # snapshot testing
["cargo-llvm-cov"] # code coverage
["cargo-msrv"] # minimum supported version
["cargo-nextest"] # better testing harness
["cargo-sort"] # sort deps and imports
["cargo-udeps"] # check for unused dependencies (requires nightly)
["cargo-watch"] # watch for file changes and run commands
[ "cargo-insta" ] # snapshot testing
[ "cargo-llvm-cov" ] # code coverage
[ "cargo-msrv" ] # minimum supported version
[ "cargo-nextest" ] # better testing harness
[ "cargo-sort" ] # sort deps and imports
[ "cargo-udeps" ] # check for unused dependencies (requires nightly)
[ "cargo-watch" ] # watch for file changes and run commands
];
};
};
@ -206,15 +227,20 @@ in {
};
gui = lib.mkOption {
description = "Jalil's default GUI configuration.";
default = {};
default = { };
type = types.submodule gui;
};
styling = lib.mkOption {
description = "My custom styling (uses stylix)";
default = {};
default = { };
type = types.submodule {
options = {
enable = lib.mkEnableOption "styling" // {default = fromConfig ["styling" "enable"] true;};
enable = lib.mkEnableOption "styling" // {
default = fromConfig [
"styling"
"enable"
] true;
};
};
};
};