diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..0d3a05d --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,16 @@ +name: Build docs with nix and Material for mkDocs +on: + push: + +jobs: + build-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Nix action dependencies + run: | + apt update -y + apt install sudo -y + - uses: cachix/install-nix-action@v27 + - name: Build package from flake + run: nix build .#docs \ No newline at end of file diff --git a/dotfiles/takamaki/equibop/equicord-settings.json b/dotfiles/takamaki/equibop/equicord-settings.json index 6d05336..128709c 100755 --- a/dotfiles/takamaki/equibop/equicord-settings.json +++ b/dotfiles/takamaki/equibop/equicord-settings.json @@ -4,7 +4,7 @@ "authenticated": false, "settingsSync": false, "url": "https://cloud.equicord.org/", - "settingsSyncVersion": 1788144154760 + "settingsSyncVersion": 1788177702981 }, "enableOnlineThemes": true, "enabledThemeLinks": [], diff --git a/dotfiles/takamaki/equibop/quickCss.css b/dotfiles/takamaki/equibop/quickCss.css index 17e3fa1..4c1821b 100755 --- a/dotfiles/takamaki/equibop/quickCss.css +++ b/dotfiles/takamaki/equibop/quickCss.css @@ -18,9 +18,9 @@ body { /* text colors */ --text-0: hsl(220, 16%, 95%); /* text on colored elements */ --text-2: hsl(217.5, 20%, 90%); /* headings and important text */ - --text-3: hsl(219, 30%, 85%); /* normal text */ - --text-4: hsl(220.5, 14%, 75%); /* icon buttons and channels */ - --text-5: hsl(221, 13.5%, 70%); /* muted channels/chats and timestamps */ + --text-3: hsl(219, 30%, 90%); /* normal text */ + --text-4: hsl(220.5, 14%, 85%); /* icon buttons and channels */ + --text-5: hsl(221, 13.5%, 80%); /* muted channels/chats and timestamps */ /* background and dark colors */ --bg-1: #303643; /* dark buttons when clicked */ @@ -34,7 +34,7 @@ body { /* accent colors */ --accent-1: #8fbcbb; /* links and other accent text */ - --accent-2: hsl(179, 25%, 45%); /* small accent elements */ + --accent-2: hsl(179, 30%, 45%); /* small accent elements */ --accent-3: hsl(193, 25%, 45%); /* accent buttons */ --accent-4: hsl(193, 25%, 55%); /* accent buttons when hovered */ --accent-5: hsl(193, 25%, 60%); /* accent buttons when clicked */ diff --git a/modules/capabilities/audio.nix b/modules/capabilities/audio.nix new file mode 100644 index 0000000..da93561 --- /dev/null +++ b/modules/capabilities/audio.nix @@ -0,0 +1,5 @@ +{ inputs, self, ... }: { + flake.homeModules.audio = { ... }: { + imports = [ self.homeModules.audioOptions ]; + }; +} \ No newline at end of file diff --git a/modules/capabilities/gaming.nix b/modules/capabilities/gaming.nix index dcd6360..0b3108d 100644 --- a/modules/capabilities/gaming.nix +++ b/modules/capabilities/gaming.nix @@ -1,5 +1,11 @@ { inputs, self, ... }: { - flake.nixosModules.gaming = { pkgs, config, lib, ... }: { + flake.nixosModules.gaming = { ... }: { + imports = [ self.nixosModules.gamingOptions ]; + hardware.steam-hardware.enable = true; }; + + flake.homeModules.gaming = { ... }: { + imports = [ self.homeModules.gamingOptions ]; + }; } diff --git a/modules/capabilities/graphics.nix b/modules/capabilities/graphics.nix index 7660ba9..0981305 100644 --- a/modules/capabilities/graphics.nix +++ b/modules/capabilities/graphics.nix @@ -1,85 +1,52 @@ -{ inputs, self, ... }: let - wm-option-type = inputs.helpers.mkOptionalListOfType (inputs.helpers.mkEnumFromDirContents "${self}/modules/components/window-managers"); - shell-option-type = inputs.helpers.mkOptionalListOfType (inputs.helpers.mkEnumFromDirContents "${self}/modules/components/shells"); -in { - flake.nixosModules.graphics = { config, pkgs, lib, ... }: { - options.components = { - displayManager = lib.mkOption { - # enum that dynamically populates itself with the contents of the display-managers directory - type = inputs.helpers.mkEnumFromDirContents "${self}/modules/components/display-managers"; - default = "lightdm"; - }; +{ inputs, self, ... }: { + flake.nixosModules.graphics = { pkgs, ... }: { + imports = [ self.nixosModules.graphicsOptions ]; - windowManagers = lib.mkOption { - type = wm-option-type; - default = []; - }; + environment.systemPackages = with pkgs; [ + wayland-utils + mesa-demos + vulkan-tools + ]; - shells = lib.mkOption { - type = shell-option-type; - default = []; - }; - }; - - config = { - environment.systemPackages = with pkgs; [ - wayland-utils - mesa-demos - vulkan-tools - ]; - - fonts.packages = with pkgs; [ - iosevka-comfy.comfy - nerd-fonts.jetbrains-mono - ]; - }; + fonts.packages = with pkgs; [ + iosevka-comfy.comfy + nerd-fonts.jetbrains-mono + ]; }; - flake.homeModules.graphics = { config, pkgs, lib, ... }: { - options.components = { - windowManagers = lib.mkOption { - type = wm-option-type; - default = []; - }; + flake.homeModules.graphics = { config, pkgs, ... }: { + imports = [ self.homeModules.graphicsOptions ]; - shells = lib.mkOption { - type = shell-option-type; - default = []; + home.packages = with pkgs; [ + bibata-cursors + x264 + gparted + vlc + iosevka-comfy.comfy + nerd-fonts.jetbrains-mono + ]; + + dconf.settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; }; }; - config = { - home.packages = with pkgs; [ - bibata-cursors - x264 - gparted - vlc - iosevka-comfy.comfy - nerd-fonts.jetbrains-mono - ]; + home.pointerCursor = { + enable = true; + package = pkgs.bibata-cursors; + name = "Bibata-Modern-Ice"; + size = 22; + gtk.enable = true; + x11.enable = true; + }; - dconf.settings = { - "org/gnome/desktop/interface" = { - color-scheme = "prefer-dark"; - }; - }; + gtk = { + enable = true; + colorScheme = "dark"; - home.pointerCursor = { - enable = true; - package = pkgs.bibata-cursors; - name = "Bibata-Modern-Ice"; - size = 22; - gtk.enable = true; - x11.enable = true; - }; - - gtk = { - enable = true; - colorScheme = "dark"; - - gtk2.configLocation = "${config.xdg.configHome}/.gtkrc-2.0"; # prevents file conflicts between this and other parts of the nix config - gtk2.force = true; - }; + gtk2.configLocation = "${config.xdg.configHome}/.gtkrc-2.0"; # prevents file conflicts between this and other parts of the nix config + gtk2.force = true; }; }; } \ No newline at end of file diff --git a/modules/docs.nix b/modules/docs.nix new file mode 100644 index 0000000..7ba46ac --- /dev/null +++ b/modules/docs.nix @@ -0,0 +1,79 @@ +{ inputs, self, ... }: let + mkDocsDerivation = { pkgs, doBuild ? true }: let + inherit (pkgs) lib stdenv mkdocs python314Packages; + + mkOptionsDocFromModule = commandName: module: let + eval = lib.evalModules { + modules = [ module ]; + args = { inherit pkgs; }; + }; + + optionsDoc = pkgs.nixosOptionsDoc { + inherit (eval) options; + }; + in pkgs.runCommand commandName {} '' + cat ${optionsDoc.optionsCommonMark} >> $out + ''; + + indexMd = let + rawText = '' + ## Hello world + Welcome to the site! + ''; + in pkgs.runCommand "index.md" {} '' + echo "${rawText}" >> $out + ''; + + nixosOptionsMd = mkOptionsDocFromModule "nixos-options.md" self.nixosModules.options; + homeOptionsMd = mkOptionsDocFromModule "home-options.md" self.homeModules.options; + + mkDocsConfig = '' + site_name: greyweather's nix flake options + nav: + - Home: 'index.md' + - Options: + - NixOS: 'nixos-options.md' + - Home Manager: 'home-options.md' + theme: material + ''; + + mkDocsYml = pkgs.runCommand "mkdocs.yml" {} '' + echo "${mkDocsConfig}" >> $out + ''; + in stdenv.mkDerivation { + src = self; + name = if doBuild then "docs" else "docs-md"; + buildInput = [ + mkDocsYml + indexMd + nixosOptionsMd + homeOptionsMd + ]; + nativeBuildInputs = [ + mkdocs + python314Packages.mkdocs-material + python314Packages.pygments + ]; + buildPhase = '' + mkdir docs-build + cd docs-build + ln -s ${mkDocsYml} "./mkdocs.yml" + mkdir docs + ln -s ${indexMd} "./docs/index.md" + ln -s ${nixosOptionsMd} "./docs/nixos-options.md" + ln -s ${homeOptionsMd} "./docs/home-options.md" + # generate the site + ${if doBuild then "mkdocs build" else ""} + ''; + installPhase = if doBuild then '' + mv site $out + '' else '' + cp -r . $out + ''; + }; +in { + perSystem = { pkgs, ... }: { + packages.docs = mkDocsDerivation { inherit pkgs; }; + packages.docs-md = mkDocsDerivation { inherit pkgs; doBuild = false; }; + }; +} \ No newline at end of file diff --git a/modules/features/applications/cli/color-converter.nix b/modules/features/applications/cli/color-converter.nix index f7d5745..aeb1c54 100644 --- a/modules/features/applications/cli/color-converter.nix +++ b/modules/features/applications/cli/color-converter.nix @@ -30,8 +30,6 @@ }; in { flake.nixosModules.global = { pkgs, lib, config, ... }: { - options.features.applications.cli.color-converter.enable = lib.mkEnableOption "color-converter"; - config = lib.mkIf (config.features.applications.cli.color-converter.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { home-manager.users.grey.features.applications.cli.color-converter.enable = lib.mkDefault true; } { @@ -40,8 +38,6 @@ in { }; flake.homeModules.global = { pkgs, config, lib, ... }: { - options.features.applications.cli.color-converter.enable = lib.mkEnableOption "color-converter"; - config = lib.mkIf (config.features.applications.cli.color-converter.enable) { home.packages = [ (pkgs.callPackage color-converter-package {}) ]; }; diff --git a/modules/features/applications/cli/fastfetch.nix b/modules/features/applications/cli/fastfetch.nix index 556fbe0..a28350e 100644 --- a/modules/features/applications/cli/fastfetch.nix +++ b/modules/features/applications/cli/fastfetch.nix @@ -1,7 +1,5 @@ { inputs, self, ... }: { flake.nixosModules.global = { pkgs, lib, config, ... }: { - options.features.applications.cli.fastfetch.enable = lib.mkEnableOption "fastfetch"; - config = lib.mkIf (config.features.applications.cli.fastfetch.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { home-manager.users.grey.features.applications.cli.fastfetch.enable = lib.mkDefault true; } { @@ -10,8 +8,6 @@ }; flake.homeModules.global = { pkgs, lib, config, ... }: { - options.features.applications.cli.fastfetch.enable = lib.mkEnableOption "fastfetch"; - config = lib.mkIf (config.features.applications.cli.fastfetch.enable) ({ programs.zsh.initContent = lib.mkOrder 1500 "fastfetch"; programs.fastfetch.enable = true; diff --git a/modules/features/applications/cli/nh.nix b/modules/features/applications/cli/nh.nix index a9afae5..fbbdf84 100644 --- a/modules/features/applications/cli/nh.nix +++ b/modules/features/applications/cli/nh.nix @@ -10,8 +10,6 @@ }; in { flake.nixosModules.global = { pkgs, config, lib, ... }: { - options.features.applications.cli.nh.enable = lib.mkEnableOption "nh"; - config = lib.mkIf (config.features.applications.cli.nh.enable) { programs.nh = mkNhAttrs config.info.rootPath; @@ -22,8 +20,6 @@ in { }; flake.homeModules.global = { pkgs, config, lib, ... }: { - options.features.applications.cli.nh.enable = lib.mkEnableOption "nh"; - config = lib.mkIf (config.features.applications.cli.nh.enable && config.info.isStandalone) { programs.nh = mkNhAttrs config.info.rootPath; }; diff --git a/modules/features/applications/gui/equibop.nix b/modules/features/applications/gui/equibop.nix index 9679b37..c39a752 100644 --- a/modules/features/applications/gui/equibop.nix +++ b/modules/features/applications/gui/equibop.nix @@ -1,13 +1,5 @@ { inputs, self, ... }: { flake.nixosModules.graphics = { pkgs, lib, config, ...}: { - options.features.applications.gui.equibop = { - enable = lib.mkEnableOption "equibop"; - autostart = lib.mkOption { - type = lib.types.bool; - default = false; - }; - }; - config = inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { home-manager.users.grey.features.applications.gui.equibop = lib.mkDefault config.features.applications.gui.equibop; } { @@ -16,14 +8,6 @@ }; flake.homeModules.graphics = { pkgs, lib, config, ... }: { - options.features.applications.gui.equibop = { - enable = lib.mkEnableOption "equibop"; - autostart = lib.mkOption { - type = lib.types.bool; - default = false; - }; - }; - config = lib.mkIf (config.features.applications.gui.equibop.enable) { programs.equibop.enable = true; diff --git a/modules/features/applications/gui/floorp.nix b/modules/features/applications/gui/floorp.nix index c4e2fdf..6a56589 100644 --- a/modules/features/applications/gui/floorp.nix +++ b/modules/features/applications/gui/floorp.nix @@ -1,7 +1,5 @@ { inputs, self, ... }: { flake.nixosModules.graphics = { pkgs, lib, config, ... }: { - options.features.applications.gui.floorp.enable = lib.mkEnableOption "floorp"; - config = lib.mkIf (config.features.applications.gui.floorp.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { home-manager.users.grey.features.applications.gui.floorp.enable = lib.mkDefault true; } { @@ -10,8 +8,6 @@ }; flake.homeModules.graphics = { pkgs, lib, config, ... }: { - options.features.applications.gui.floorp.enable = lib.mkEnableOption "floorp"; - config = lib.mkIf (config.features.applications.gui.floorp.enable) ( let firefox-addons = with pkgs; inputs.firefox-addons.packages.${pkgs.stdenv.hostPlatform.system}; diff --git a/modules/features/applications/gui/fluxer.nix b/modules/features/applications/gui/fluxer.nix index 5cb1e4b..20ed205 100644 --- a/modules/features/applications/gui/fluxer.nix +++ b/modules/features/applications/gui/fluxer.nix @@ -65,11 +65,6 @@ }; in { flake.nixosModules.graphics = { pkgs, config, lib, ... }: { - options.features.applications.gui = { - fluxer.enable = lib.mkEnableOption "fluxer"; - fluxer-canary.enable = lib.mkEnableOption "fluxer-canary"; - }; - config = lib.mkIf (config.features.applications.gui.fluxer.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { home-manager.users.grey.features.applications.gui.fluxer.enable = lib.mkDefault true; } { @@ -86,11 +81,6 @@ in { }; flake.homeModules.graphics = { pkgs, config, lib, ... }: { - options.features.applications.gui = { - fluxer.enable = lib.mkEnableOption "fluxer"; - fluxer-canary.enable = lib.mkEnableOption "fluxer-canary"; - }; - config = lib.mkIf (config.features.applications.gui.fluxer.enable) { home.packages = [ (pkgs.callPackage (fluxer-package) {}) diff --git a/modules/features/applications/gui/kitty.nix b/modules/features/applications/gui/kitty.nix index bc12c5f..edb800a 100644 --- a/modules/features/applications/gui/kitty.nix +++ b/modules/features/applications/gui/kitty.nix @@ -1,7 +1,5 @@ { inputs, self, ... }: { flake.nixosModules.graphics = { pkgs, config, lib, ... }: { - options.features.applications.gui.kitty.enable = lib.mkEnableOption "kitty"; - config = let in lib.mkIf (config.features.applications.gui.kitty.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { home-manager.users.grey.features.applications.gui.kitty.enable = lib.mkDefault true; @@ -11,8 +9,6 @@ }; flake.homeModules.graphics = { pkgs, config, lib, ... }: { - options.features.applications.gui.kitty.enable = lib.mkEnableOption "kitty"; - config = lib.mkIf (config.features.applications.gui.kitty.enable) { programs.kitty = { enable = true; diff --git a/modules/features/applications/gui/nautilus.nix b/modules/features/applications/gui/nautilus.nix index 2e2bb1a..03c040a 100644 --- a/modules/features/applications/gui/nautilus.nix +++ b/modules/features/applications/gui/nautilus.nix @@ -1,7 +1,5 @@ { inputs, self, ... }: { flake.nixosModules.graphics = { pkgs, config, lib, ... }: { - options.features.applications.gui.nautilus.enable = lib.mkEnableOption "nautilus"; - config = lib.mkIf (config.features.applications.gui.nautilus.enable) { environment.systemPackages = with pkgs; [ nautilus @@ -24,8 +22,6 @@ }; flake.homeModules.graphics = { pkgs, config, lib, ... }: { - options.features.applications.gui.nautilus.enable = lib.mkEnableOption "nautilus"; - config = lib.mkIf (config.features.applications.gui.nautilus.enable) { home.packages = lib.mkIf (config.info.isStandalone) [ pkgs.nautilus ]; diff --git a/modules/features/applications/gui/remmina.nix b/modules/features/applications/gui/remmina.nix index f10d06a..cf8bb24 100644 --- a/modules/features/applications/gui/remmina.nix +++ b/modules/features/applications/gui/remmina.nix @@ -1,7 +1,5 @@ { inputs, self, ... }: { - flake.nixosModules.graphics = { pkgs, config, lib, ... }: { - options.features.applications.gui.remmina.enable = lib.mkEnableOption "remmina"; - + flake.nixosModules.graphics = { pkgs, config, lib, ... }: { config = lib.mkIf (config.features.applications.gui.remmina.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { home-manager.users.grey.features.applications.gui.remmina.enable = lib.mkDefault true; } { @@ -13,8 +11,6 @@ }; flake.homeModules.graphics = { pkgs, config, lib, ... }: { - options.features.applications.gui.remmina.enable = lib.mkEnableOption "remmina"; - config = lib.mkIf (config.features.applications.gui.remmina.enable) { home.packages = with pkgs; [ remmina diff --git a/modules/features/applications/gui/spotify.nix b/modules/features/applications/gui/spotify.nix index 447a82e..4f299b9 100644 --- a/modules/features/applications/gui/spotify.nix +++ b/modules/features/applications/gui/spotify.nix @@ -1,19 +1,7 @@ { inputs, self, ... }: { flake.nixosModules.graphics = { pkgs, config, lib, ... }: let spicePkgs = inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system}; - theme-option-type = with inputs.nixpkgs; lib.types.enum (builtins.attrNames spicePkgs.themes); in { - options.features.applications.gui.spotify = { - enable = lib.mkEnableOption "spotify"; - spicetify = { - enable = lib.mkEnableOption "spicetify"; - theme = lib.mkOption { - type = lib.types.nullOr (theme-option-type); - default = null; - }; - }; - }; - config = lib.mkIf (config.features.applications.gui.spotify.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { home-manager.users.grey.features.applications.gui.spotify = { enable = lib.mkDefault true; @@ -26,19 +14,7 @@ flake.homeModules.graphics = { pkgs, config, lib, ... }: let spicePkgs = inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system}; - theme-option-type = with inputs.nixpkgs; lib.types.enum (builtins.attrNames spicePkgs.themes); in { - options.features.applications.gui.spotify = { - enable = lib.mkEnableOption "spotify"; - spicetify = { - enable = lib.mkEnableOption "spicetify"; - theme = lib.mkOption { - type = lib.types.nullOr (theme-option-type); - default = null; - }; - }; - }; - imports = [ inputs.spicetify.homeManagerModules.default ]; diff --git a/modules/features/applications/gui/vscode.nix b/modules/features/applications/gui/vscode.nix index d16fbba..1f7f452 100644 --- a/modules/features/applications/gui/vscode.nix +++ b/modules/features/applications/gui/vscode.nix @@ -1,7 +1,5 @@ { inputs, self, ... }: { flake.nixosModules.graphics = { config, pkgs, lib, ... }: { - options.features.applications.gui.vscode.enable = lib.mkEnableOption "vscode"; - config = lib.mkIf (config.features.applications.gui.vscode.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { home-manager.users.grey.features.applications.gui.vscode.enable = lib.mkDefault true; } { @@ -10,8 +8,6 @@ }; flake.homeModules.graphics = { config, pkgs, lib, ... }: { - options.features.applications.gui.vscode.enable = lib.mkEnableOption "vscode"; - config = lib.mkIf (config.features.applications.gui.vscode.enable) { home.packages = [ pkgs.vscode ]; diff --git a/modules/features/hardware/steam-controller.nix b/modules/features/hardware/steam-controller.nix index 0bc5062..21e1be7 100644 --- a/modules/features/hardware/steam-controller.nix +++ b/modules/features/hardware/steam-controller.nix @@ -1,11 +1,5 @@ { inputs, self, ... }: { flake.nixosModules.gaming = { pkgs, config, lib, ... }: { - options.features.hardware.steam-controller.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Enable tweaks and configurations that assist when using Valve's Steam Controller"; - }; - config = lib.mkIf (config.features.hardware.steam-controller.enable) { home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) { features.hardware.steam-controller.enable = lib.mkDefault true; @@ -14,12 +8,6 @@ }; flake.homeModules.gaming = { pkgs, config, lib, inputs, ... }: { - options.features.hardware.steam-controller.enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = "Enable tweaks and configurations that assist when using Valve's Steam Controller"; - }; - config = let pkgsCross = import inputs.nixpkgs { localSystem = "x86_64-linux"; diff --git a/modules/features/nixos/home-manager.nix b/modules/features/nixos/home-manager.nix index aac9128..e03b835 100644 --- a/modules/features/nixos/home-manager.nix +++ b/modules/features/nixos/home-manager.nix @@ -8,8 +8,6 @@ inputs.home-manager.nixosModules.default ]; - options.features.nixos.home-manager.enable = lib.mkEnableOption "home-manager"; - config.home-manager = lib.mkIf (config.features.nixos.home-manager.enable) { useGlobalPkgs = true; useUserPackages = true; diff --git a/modules/features/nixos/stylix.nix b/modules/features/nixos/stylix.nix index b8d36ba..f9d7db0 100644 --- a/modules/features/nixos/stylix.nix +++ b/modules/features/nixos/stylix.nix @@ -4,8 +4,6 @@ inputs.stylix.nixosModules.stylix ]; - options.features.nixos.stylix.enable = lib.mkEnableOption "stylix"; - config = lib.mkIf (config.features.nixos.stylix.enable) { stylix.enable = true; stylix.image = builtins.path { path = "${self}/modules/hosts/${config.info.hostName}/wallpaper.jpg"; }; @@ -18,8 +16,6 @@ }; flake.homeModules.graphics = { pkgs, lib, config, ... }: { - options.features.nixos.stylix.enable = lib.mkEnableOption "stylix"; - config = lib.mkIf (config.features.nixos.stylix.enable) { stylix.targets = lib.mkIf (config.features.applications.gui.floorp.enable) { floorp.profileNames = [ "default" ]; diff --git a/modules/features/services/easyeffects.nix b/modules/features/services/easyeffects.nix index 844fedd..0536e07 100644 --- a/modules/features/services/easyeffects.nix +++ b/modules/features/services/easyeffects.nix @@ -1,7 +1,5 @@ { inputs, self, ... }: { flake.homeModules.audio = { pkgs, config, lib, ...}: { - options.features.services.easyeffects.enable = lib.mkEnableOption "easyeffects"; - config = lib.mkIf (config.features.services.easyeffects.enable) { services.easyeffects.enable = true; diff --git a/modules/features/shells.nix b/modules/features/shells.nix index 7f45e6a..5ba6103 100644 --- a/modules/features/shells.nix +++ b/modules/features/shells.nix @@ -1,15 +1,10 @@ { inputs, self, ... }: { flake.nixosModules.global = { config, pkgs, lib, ... }: { - options.features.shells.defaultShell = lib.mkOption { - type = inputs.helpers.mkEnumFromDirContents "${self}/modules/features/shells"; - default = "zsh"; - }; + programs.${config.features.shells.defaultShell}.enable = true; - config = { - programs.${config.features.shells.defaultShell}.enable = true; + users.defaultUserShell = pkgs.${config.features.shells.defaultShell}; + users.users."grey".shell = pkgs.${config.features.shells.defaultShell}; - users.defaultUserShell = pkgs.${config.features.shells.defaultShell}; - users.users."grey".shell = pkgs.${config.features.shells.defaultShell}; - }; + features.shells.${config.features.shells.defaultShell}.enable = true; }; } \ No newline at end of file diff --git a/modules/features/shells/zsh.nix b/modules/features/shells/zsh.nix index 1fd8db0..bc4aecb 100644 --- a/modules/features/shells/zsh.nix +++ b/modules/features/shells/zsh.nix @@ -1,10 +1,5 @@ { inputs, self, ... }: { flake.nixosModules.global = { config, pkgs, lib, ... }: { - options.features.shells.zsh = { - enable = lib.mkEnableOption "zsh"; - antidote.enable = lib.mkEnableOption "antidote"; - }; - config = lib.mkIf (config.features.shells.zsh.enable) { programs.zsh.enable = true; @@ -16,11 +11,6 @@ }; flake.homeModules.global = { pkgs, config, lib, ... }: { - options.features.shells.zsh = { - enable = lib.mkEnableOption "zsh"; - antidote.enable = lib.mkEnableOption "antidote"; - }; - config = lib.mkIf (config.features.shells.zsh.enable) { home.shell.enableZshIntegration = true; diff --git a/modules/flake-parts.nix b/modules/flake-parts.nix index 9377a9b..27e11e8 100644 --- a/modules/flake-parts.nix +++ b/modules/flake-parts.nix @@ -1,9 +1,5 @@ -{ inputs, self, ...}: { +{ inputs, self, ... }: { systems = [ "x86_64-linux" ]; - - flake.flakeModules = { - docs-entry-point = inputs.import-tree "${self}/modules"; - }; -} \ No newline at end of file +} diff --git a/modules/global/home.nix b/modules/global/home.nix index a7210c4..9da0af5 100644 --- a/modules/global/home.nix +++ b/modules/global/home.nix @@ -1,5 +1,7 @@ { inputs, self, ... }: { flake.homeModules.global = { lib, config, pkgs, ... }: { + imports = [ self.homeModules.globalOptions ]; + nix.gc = lib.mkIf (!config.features.applications.cli.nh.enable) { automatic = true; persistent = true; diff --git a/modules/global/nixos.nix b/modules/global/nixos.nix index 6824c4c..d16984c 100644 --- a/modules/global/nixos.nix +++ b/modules/global/nixos.nix @@ -1,5 +1,7 @@ { inputs, self, ... }: { flake.nixosModules.global = { pkgs, config, lib, ... }: { + imports = [ self.nixosModules.globalOptions ]; + system.stateVersion = config.info.stateVersion; nix = { diff --git a/modules/global/options.nix b/modules/global/options.nix deleted file mode 100644 index b0c38cc..0000000 --- a/modules/global/options.nix +++ /dev/null @@ -1,70 +0,0 @@ -{ inputs, self, ... }: { - flake.nixosModules.global = { pkgs, config, lib, ... }: { - options = { - info = { - rootPath = lib.mkOption { - type = lib.types.str; - default = "/home/grey/nixos"; - }; - - hostName = lib.mkOption { - type = lib.types.str; - default = ""; - }; - - stateVersion = lib.mkOption { - type = lib.types.str; - default = ""; - }; - }; - - components.bootLoader = lib.mkOption { - type = inputs.helpers.mkEnumFromDirContents "${self}/modules/components/boot-loaders"; - default = "grub"; - }; - - features.applications.extraPackages = lib.mkOption { - type = lib.types.listOf (lib.types.package); - default = []; - }; - }; - }; - - flake.homeModules.global = { pkgs, config, lib, ... }: { - options = { - info = { - rootPath = lib.mkOption { - type = lib.types.str; - default = "/home/grey/nixos"; - }; - - hostName = lib.mkOption { - type = lib.types.str; - default = ""; - }; - - stateVersion = lib.mkOption { - type = lib.types.str; - default = ""; - }; - - isStandalone = lib.mkOption { - type = lib.types.bool; - default = true; - }; - }; - - features.applications = { - shellScripts = lib.mkOption { - type = lib.types.attrsOf (lib.types.str); - default = {}; - }; - - extraPackages = lib.mkOption { - type = lib.types.listOf (lib.types.package); - default = []; - }; - }; - }; - }; -} \ No newline at end of file diff --git a/modules/options/audio.nix b/modules/options/audio.nix new file mode 100644 index 0000000..210e800 --- /dev/null +++ b/modules/options/audio.nix @@ -0,0 +1,5 @@ +{ inputs, self, ... }: { + flake.homeModules.audioOptions = { lib, ...}: { + options.features.services.easyeffects.enable = lib.mkEnableOption "easyeffects"; + }; +} \ No newline at end of file diff --git a/modules/options/gaming.nix b/modules/options/gaming.nix new file mode 100644 index 0000000..b9f7e97 --- /dev/null +++ b/modules/options/gaming.nix @@ -0,0 +1,17 @@ +{ inputs, self, ... }: { + flake.nixosModules.gamingOptions = { lib, ... }: { + options.features.hardware.steam-controller.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Enable tweaks and configurations that assist when using Valve's Steam Controller"; + }; + }; + + flake.homeModules.gamingOptions = { lib, ... }: { + options.features.hardware.steam-controller.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Enable tweaks and configurations that assist when using Valve's Steam Controller"; + }; + }; +} \ No newline at end of file diff --git a/modules/options/global.nix b/modules/options/global.nix new file mode 100644 index 0000000..da91efe --- /dev/null +++ b/modules/options/global.nix @@ -0,0 +1,101 @@ +{ inputs, self, ... }: let + mkSharedGlobalOptions = { lib }: { + info = { + rootPath = lib.mkOption { + type = lib.types.str; + description = "This option is used to tell the config the global path to the flake's root directory, in order to perform impure actions (in a Nix sense, not morally impure, I promise)."; + default = "/home/grey/nixos"; + }; + + hostName = lib.mkOption { + type = lib.types.str; + description = "This option is used to tell the config the hostname of the current machine, mostly for symlinking the right dotfiles."; + default = ""; + }; + + stateVersion = lib.mkOption { + type = lib.types.str; + description = "This option is used to set the stateVersion value."; + example = "26.11"; + default = ""; + }; + }; + + features = { + applications = { + cli = { + color-converter.enable = lib.mkEnableOption "color-converter"; + fastfetch.enable = lib.mkEnableOption "fastfetch"; + nh.enable = lib.mkEnableOption "nh"; + }; + + extraPackages = lib.mkOption { + type = lib.types.listOf (lib.types.package); + default = []; + }; + }; + + shells = { + zsh = { + enable = lib.mkEnableOption "zsh"; + antidote.enable = lib.mkEnableOption "antidote"; + }; + }; + }; + }; + + mkExtraPackagesDescription = optionName: "This options is equivalent to `${optionName}`, and exists purely for convenience."; +in { + flake.nixosModules.globalOptions = { lib, ... }: { + options = (mkSharedGlobalOptions { inherit lib; }) // { + components = { + bootLoader = lib.mkOption { + type = inputs.helpers.mkEnumFromDirContents "${self}/modules/components/boot-loaders"; + description = "This option defines the bootloader that should be used, enabling any config associated with it in the process."; + default = "grub"; + }; + }; + + features = (mkSharedGlobalOptions { inherit lib; }).features // { + shells = { + defaultShell = lib.mkOption { + type = inputs.helpers.mkEnumFromDirContents "${self}/modules/features/shells"; + description = "This option controls the shell that should be used as the default, enabling that shell in the process."; + default = "zsh"; + }; + } // (mkSharedGlobalOptions { inherit lib; }).features.shells; + + nixos.home-manager.enable = lib.mkEnableOption "home-manager"; + + applications = (mkSharedGlobalOptions { inherit lib; }).features.applications // { + extraPackages = (mkSharedGlobalOptions { inherit lib; }).features.applications.extraPackages // { description = mkExtraPackagesDescription "environment.systemPackages"; }; + }; + }; + }; + }; + + flake.homeModules.globalOptions = { lib, ... }: { + options = (mkSharedGlobalOptions { inherit lib; }) // { + info = { + isStandalone = lib.mkOption { + type = lib.types.bool; + description = "This option tells the config whether this home-manager config is part of a larger NixOS config or not, and is read-only."; + default = true; + readOnly = true; + }; + } // (mkSharedGlobalOptions { inherit lib; }).info; + + features = (mkSharedGlobalOptions { inherit lib; }).features // { + applications = (mkSharedGlobalOptions { inherit lib; }).features.applications // { + shellScripts = lib.mkOption { + type = lib.types.attrsOf (lib.types.str); + description = "This option is a set of multiline strings, which are processed into executable bash scripts in `$XDG_BIN_HOME`. The shebang (`#!/bin/bash`) is added afterwards, and shouldn't be included in definitions."; + default = {}; + }; + + extraPackages = (mkSharedGlobalOptions { inherit lib; }).features.applications.extraPackages // { description = mkExtraPackagesDescription "home.packages"; }; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/options/graphics.nix b/modules/options/graphics.nix new file mode 100644 index 0000000..d5e7b37 --- /dev/null +++ b/modules/options/graphics.nix @@ -0,0 +1,82 @@ +{ inputs, self, ... }: let + mkSharedGraphicsOptions = { pkgs, lib }: { + components = { + windowManagers = lib.mkOption { + type = inputs.helpers.mkOptionalListOfType (inputs.helpers.mkEnumFromDirContents "${self}/modules/components/window-managers"); + description = "This option defines the window manager(s) that should be installed, enabling any config associated with it in the process. It can be either a list or just one value."; + default = []; + }; + + shells = lib.mkOption { + type = inputs.helpers.mkOptionalListOfType (inputs.helpers.mkEnumFromDirContents "${self}/modules/components/shells"); + description = "This option defines the graphical shell(s) that should be installed (e.g. Noctalia, DMS), enabling any config associated with it in the process. It can be either a list or just one value."; + default = []; + }; + }; + + features = { + applications.gui = { + equibop = { + enable = lib.mkEnableOption "equibop"; + autostart = lib.mkOption { + type = lib.types.bool; + description = "This option controls whether an `equibop.desktop` file is generated and placed into `$XDG_CONFIG_HOME/autostart`."; + default = false; + }; + }; + + floorp.enable = lib.mkEnableOption "floorp"; + + fluxer.enable = lib.mkEnableOption "fluxer"; + fluxer-canary.enable = lib.mkEnableOption "fluxer-canary"; + + kitty.enable = lib.mkEnableOption "kitty"; + + nautilus.enable = lib.mkEnableOption "nautilus"; + + remmina.enable = lib.mkEnableOption "remmina"; + + spotify = { + enable = lib.mkEnableOption "spotify"; + spicetify = { + enable = lib.mkEnableOption "spicetify"; + theme = lib.mkOption { + type = lib.types.nullOr (lib.types.enum (builtins.attrNames inputs.spicetify.legacyPackages.${pkgs.stdenv.hostPlatform.system}.themes)); + description = "This option is used to select a theme for Spicetify to use, from the list of available packages themes."; + default = null; + }; + }; + }; + + vscode.enable = lib.mkEnableOption "vscode"; + }; + + nixos.stylix.enable = lib.mkEnableOption "stylix"; + }; + }; + + redundantOptionWarn = name: value: "The functionality of this option completely depends on `${name}` being `${value}`, and will not be evaluated otherwise."; +in { + flake.nixosModules.graphicsOptions = { pkgs, lib, ... }: { + options = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }) // { + components = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).components // { + displayManager = lib.mkOption { + type = inputs.helpers.mkEnumFromDirContents "${self}/modules/components/display-managers"; + description = "This option defines the bootloader that should be used, enabling any config associated with it in the process."; + default = "lightdm"; + }; + }; + + features = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).features // { + applications.gui = { + equibop.enable.description = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).features.applications.gui.equibop.enable.description + "\n" + (redundantOptionWarn "features.nixos.home-manager.enable" "true"); + spotify.spicetify.theme.description = (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).features.applications.gui.spotify.spicetify.theme.description + "\n" + (redundantOptionWarn "features.nixos.home-manager.enable" "true"); + } // (mkSharedGraphicsOptions { inherit pkgs; inherit lib; }).features.applications.gui; + }; + }; + }; + + flake.homeModules.graphicsOptions = { pkgs, lib, ... }: { + options = mkSharedGraphicsOptions { inherit pkgs; inherit lib; }; + }; +} \ No newline at end of file diff --git a/modules/options/options.nix b/modules/options/options.nix new file mode 100644 index 0000000..80084d5 --- /dev/null +++ b/modules/options/options.nix @@ -0,0 +1,18 @@ +{ inputs, self, ... }: { + flake.nixosModules.options = { ... }: { + imports = with self.nixosModules; [ + globalOptions + graphicsOptions + gamingOptions + ]; + }; + + flake.homeModules.options = { ... }: { + imports = with self.homeModules; [ + globalOptions + audioOptions + graphicsOptions + gamingOptions + ]; + }; +} \ No newline at end of file