fix: Many many infinite recursion errors

This commit is contained in:
Jalil David Salamé Messina 2024-01-15 12:42:01 +01:00
parent 042b10abb8
commit c96bd537d5
Signed by: jalil
GPG key ID: F016B9E770737A0B
7 changed files with 93 additions and 83 deletions

View file

@ -1,6 +1,6 @@
{ pkgs, lib, ... }:
let
eval = lib.evalModules { modules = [ ../options.nix ]; };
eval = lib.evalModules { modules = [ ../nixos/options.nix ]; };
doc = (pkgs.nixosOptionsDoc { inherit (eval) options; }).optionsCommonMark;
in
pkgs.stdenvNoCC.mkDerivation {

View file

@ -7,9 +7,12 @@
inputs.stylix.url = "https://flakehub.com/f/danth/stylix/0.1.282.tar.gz";
inputs.stylix.inputs.nixpkgs.follows = "nixpkgs";
inputs.stylix.inputs.home-manager.follows = "home-manager";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
inputs.home-manager.url = "https://flakehub.com/f/nix-community/home-manager/0.1.*.tar.gz";
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
# Flake outputs that other flakes can use
@ -33,7 +36,7 @@
nixosModules = rec {
default = nixosModule;
nixosModule = import ./module { inherit stylix; };
nixosModule = import ./nixos { inherit stylix; };
};
};
}

View file

@ -3,13 +3,15 @@ let
cfg = config.jconfig;
in
{
imports = [ ./gui ] ++ lib.optional (cfg.enable && cfg.styling.enable) stylix.nixosModules.stylix;
imports = [
./options.nix
./gui
stylix.nixosModules.stylix
];
options = import ../options.nix;
config = lib.optionalAttrs cfg.enable {
config = lib.mkIf cfg.enable {
boot.plymouth.enable = cfg.styling.enable;
stylix = lib.optionalAttrs cfg.styling.enable (import ./stylix-config.nix);
stylix = lib.mkIf cfg.styling.enable (import ./stylix-config.nix { inherit config pkgs; });
# Enable unlocking the gpg-agent at boot (configured through home.nix)
security.pam.services.login.gnupg.enable = true;
@ -32,7 +34,7 @@ in
# Shell prompt
programs.starship.enable = true;
programs.starship.settings = lib.optionalAttrs cfg.styling.enable {
programs.starship.settings = lib.mkIf cfg.styling.enable {
format = "$time$all";
add_newline = false;
cmd_duration.min_time = 500;

View file

@ -3,7 +3,7 @@ let
cfg = config.jconfig.gui;
in
{
config = lib.optionalAttrs (config.jconfig.enable && cfg.enable)
config = lib.mkIf (config.jconfig.enable && cfg.enable)
{
environment.systemPackages = [
pkgs.gnome.adwaita-icon-theme
@ -12,7 +12,7 @@ in
pkgs.pinentry-qt
] ++ lib.optional cfg.ydotool.enable pkgs.ydotool;
systemd.user.services.ydotool = lib.optionalAttrs cfg.ydotool.enable {
systemd.user.services.ydotool = lib.mkIf cfg.ydotool.enable {
enable = cfg.ydotool.autoStart;
wantedBy = [ "default.target" ];
description = "Generic command-line automation tool";
@ -56,7 +56,7 @@ in
hardware.opengl.enable = true;
hardware.uinput.enable = true;
hardware.steam-hardware.enable = cfg.steamHardwareSupport;
} // lib.optionalAttrs cfg."8bitdoFix" {
} // lib.mkIf cfg."8bitdoFix" {
# Udev rules to start or stop systemd service when controller is connected or disconnected
services.udev.extraRules = ''
# May vary depending on your controller model, find product id using 'lsusb'

66
nixos/options.nix Normal file
View file

@ -0,0 +1,66 @@
{ lib, ... }:
let
inherit (lib) types;
# Like mkEnableOption but defaults to true
mkDisableOption = option: lib.mkOption {
description = lib.mdDoc "Whether to enable ${option}.";
type = types.bool;
default = true;
example = false;
};
gui.options = {
enable = lib.mkEnableOption "jalil's default gui configuration.";
# Fix for using Xinput mode on 8bitdo Ultimate C controller
# Inspired by https://aur.archlinux.org/packages/8bitdo-ultimate-controller-udev
# Adapted from: https://gist.github.com/interdependence/28452fbfbe692986934fbe1e54c920d4
"8bitdoFix" = mkDisableOption "a fix for 8bitdo controllers";
steamHardwareSupport = mkDisableOption "steam hardware support";
ydotool = lib.mkOption {
description = lib.mdDoc "Jalil's default ydotool configuration.";
type = types.submodule {
options.enable = mkDisableOption "ydotool";
options.autoStart = mkDisableOption "autostarting ydotool at login";
};
};
};
styling.options = {
enable = mkDisableOption "jalil's default styling";
wallpaper = lib.mkOption {
description = "The wallpaper to use.";
type = types.str;
default = builtins.fetchurl {
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
};
};
bootLogo = lib.mkOption {
description = "The logo used by plymouth at boot.";
type = types.str;
# http://xenia-linux-site.glitch.me/images/cathodegaytube-splash.png
default = builtins.fetchurl {
url = "https://efimero.github.io/xenia-images/cathodegaytube-splash.png";
sha256 = "qKugUfdRNvMwSNah+YmMepY3Nj6mWlKFh7jlGlAQDo8=";
};
};
};
config.options = {
enable = lib.mkEnableOption "jalil's default configuration.";
gui = lib.mkOption {
description = lib.mdDoc "Jalil's default configuration for a NixOS gui.";
type = types.submodule gui;
};
styling = lib.mkOption {
description = "Jalil's styling options";
type = types.submodule styling;
};
};
in
{
options.jconfig = lib.mkOption {
description = lib.mdDoc "Jalil's default NixOS configuration.";
type = types.submodule config;
};
}

View file

@ -1,13 +1,14 @@
{ config, pkgs, ... }:
{ config, pkgs }:
let
cfg = config.jconfig.gui.styling;
nerdFontSymbols = pkgs.nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; };
fallbackSymbols = {
name = "Symbols Nerd Font";
package = nerdFontSymbols;
};
cfg = config.jconfig.styling;
# nerdFontSymbols = pkgs.nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; };
# fallbackSymbols = {
# name = "Symbols Nerd Font";
# package = nerdFontSymbols;
# };
in
{
autoEnable = cfg.enable;
image = cfg.wallpaper;
base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
polarity = "dark";
@ -17,9 +18,9 @@ in
fonts.sansSerif.package = pkgs.noto-fonts;
fonts.serif.name = "Noto Serif";
fonts.serif.package = pkgs.noto-fonts;
fonts.fallbackFonts.monospace = [ fallbackSymbols ];
fonts.fallbackFonts.sansSerif = [ fallbackSymbols ];
fonts.fallbackFonts.serif = [ fallbackSymbols ];
# fonts.fallbackFonts.monospace = [ fallbackSymbols ];
# fonts.fallbackFonts.sansSerif = [ fallbackSymbols ];
# fonts.fallbackFonts.serif = [ fallbackSymbols ];
fonts.sizes.popups = 12;
targets.plymouth.logoAnimated = false;
targets.plymouth.logo = cfg.bootLogo;

View file

@ -1,62 +0,0 @@
{ lib, ... }:
let
inherit (lib) types;
# Like mkEnableOption but defaults to true
mkDisableOption = option: lib.mkOption {
description = lib.mdDoc "Whether to enable ${option}.";
type = types.bool;
default = true;
example = false;
};
in
{
options.jconfig = lib.mkOption {
description = lib.mdDoc "Jalil's default NixOS configuration.";
type = types.submodule {
options = {
enable = lib.mkEnableOption "jalil's default configuration.";
gui = lib.mkOption {
description = lib.mdDoc "Jalil's default configuration for a NixOS gui.";
type = types.submodule {
options.enable = lib.mkEnableOption "jalil's default gui configuration.";
# Fix for using Xinput mode on 8bitdo Ultimate C controller
# Inspired by https://aur.archlinux.org/packages/8bitdo-ultimate-controller-udev
# Adapted from: https://gist.github.com/interdependence/28452fbfbe692986934fbe1e54c920d4
options."8bitdoFix" = mkDisableOption "a fix for 8bitdo controllers";
options.steamHardwareSupport = mkDisableOption "steam hardware support";
options.ydotool = lib.mkOption {
description = lib.mdDoc "Jalil's default ydotool configuration.";
type = types.submodule {
options.enable = mkDisableOption "ydotool";
options.autoStart = mkDisableOption "autostarting ydotool at login";
};
};
};
};
styling = lib.mkOption {
description = "Jalil's styling options";
type = types.submodule {
options.enable = mkDisableOption "jalil's default styling";
options.wallpaper = lib.mkOption {
description = "The wallpaper to use.";
type = types.str;
default = builtins.fetchurl {
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
};
};
options.bootLogo = lib.mkOption {
description = "The logo used by plymouth at boot.";
type = types.str;
# http://xenia-linux-site.glitch.me/images/cathodegaytube-splash.png
default = builtins.fetchurl {
url = "https://efimero.github.io/xenia-images/cathodegaytube-splash.png";
sha256 = "qKugUfdRNvMwSNah+YmMepY3Nj6mWlKFh7jlGlAQDo8=";
};
};
};
};
};
};
};
}