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, ... }: { pkgs, lib, ... }:
let let
eval = lib.evalModules { modules = [ ../options.nix ]; }; eval = lib.evalModules { modules = [ ../nixos/options.nix ]; };
doc = (pkgs.nixosOptionsDoc { inherit (eval) options; }).optionsCommonMark; doc = (pkgs.nixosOptionsDoc { inherit (eval) options; }).optionsCommonMark;
in in
pkgs.stdenvNoCC.mkDerivation { 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.url = "https://flakehub.com/f/danth/stylix/0.1.282.tar.gz";
inputs.stylix.inputs.nixpkgs.follows = "nixpkgs"; inputs.stylix.inputs.nixpkgs.follows = "nixpkgs";
inputs.stylix.inputs.home-manager.follows = "home-manager"; inputs.stylix.inputs.home-manager.follows = "home-manager";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; 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.url = "https://flakehub.com/f/nix-community/home-manager/0.1.*.tar.gz";
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs"; inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz"; inputs.flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
# Flake outputs that other flakes can use # Flake outputs that other flakes can use
@ -33,7 +36,7 @@
nixosModules = rec { nixosModules = rec {
default = nixosModule; default = nixosModule;
nixosModule = import ./module { inherit stylix; }; nixosModule = import ./nixos { inherit stylix; };
}; };
}; };
} }

View file

@ -3,13 +3,15 @@ let
cfg = config.jconfig; cfg = config.jconfig;
in 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.mkIf cfg.enable {
config = lib.optionalAttrs cfg.enable {
boot.plymouth.enable = cfg.styling.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) # Enable unlocking the gpg-agent at boot (configured through home.nix)
security.pam.services.login.gnupg.enable = true; security.pam.services.login.gnupg.enable = true;
@ -32,7 +34,7 @@ in
# Shell prompt # Shell prompt
programs.starship.enable = true; programs.starship.enable = true;
programs.starship.settings = lib.optionalAttrs cfg.styling.enable { programs.starship.settings = lib.mkIf cfg.styling.enable {
format = "$time$all"; format = "$time$all";
add_newline = false; add_newline = false;
cmd_duration.min_time = 500; cmd_duration.min_time = 500;

View file

@ -3,7 +3,7 @@ let
cfg = config.jconfig.gui; cfg = config.jconfig.gui;
in in
{ {
config = lib.optionalAttrs (config.jconfig.enable && cfg.enable) config = lib.mkIf (config.jconfig.enable && cfg.enable)
{ {
environment.systemPackages = [ environment.systemPackages = [
pkgs.gnome.adwaita-icon-theme pkgs.gnome.adwaita-icon-theme
@ -12,7 +12,7 @@ in
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.optionalAttrs 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";
@ -56,7 +56,7 @@ in
hardware.opengl.enable = true; hardware.opengl.enable = true;
hardware.uinput.enable = true; hardware.uinput.enable = true;
hardware.steam-hardware.enable = cfg.steamHardwareSupport; 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 # Udev rules to start or stop systemd service when controller is connected or disconnected
services.udev.extraRules = '' services.udev.extraRules = ''
# May vary depending on your controller model, find product id using 'lsusb' # 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 let
cfg = config.jconfig.gui.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;
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";
polarity = "dark"; polarity = "dark";
@ -17,9 +18,9 @@ in
fonts.sansSerif.package = pkgs.noto-fonts; fonts.sansSerif.package = pkgs.noto-fonts;
fonts.serif.name = "Noto Serif"; fonts.serif.name = "Noto Serif";
fonts.serif.package = pkgs.noto-fonts; fonts.serif.package = pkgs.noto-fonts;
fonts.fallbackFonts.monospace = [ fallbackSymbols ]; # fonts.fallbackFonts.monospace = [ fallbackSymbols ];
fonts.fallbackFonts.sansSerif = [ fallbackSymbols ]; # fonts.fallbackFonts.sansSerif = [ fallbackSymbols ];
fonts.fallbackFonts.serif = [ fallbackSymbols ]; # fonts.fallbackFonts.serif = [ fallbackSymbols ];
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;

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=";
};
};
};
};
};
};
};
}