Personal Nix flake
nixos home-manager nix
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor: Drop custom mkModule helper

+464 -616
+1 -41
lib/default.nix
··· 1 - { 2 - inputs, 3 - lib, 4 - ... 5 - }: { 1 + {inputs, ...}: { 6 2 nix = inputs.nixpkgs.lib; 7 3 std = inputs.nix-std.lib; 8 - mkModule = { 9 - namespace, 10 - config, 11 - description ? "module", 12 - options ? {}, 13 - configBuilder ? cfg: {}, 14 - namespacedConfigBuilder ? cfg: {}, 15 - imports ? [], 16 - }: let 17 - ns = lib.splitString "." namespace; 18 - cfg = lib.getAttrFromPath ns config; 19 - in { 20 - inherit imports; 21 - options = let 22 - finalOptions = {enable = lib.mkEnableOption description;} // options; 23 - in 24 - lib.setAttrByPath ns finalOptions; 25 - config = let 26 - rootConfig = configBuilder cfg; 27 - namespacedConfig = namespacedConfigBuilder cfg; 28 - in 29 - lib.mkMerge [ 30 - ( 31 - if rootConfig != {} 32 - then rootConfig 33 - else {} 34 - ) 35 - ( 36 - if namespacedConfig != {} 37 - then (lib.setAttrByPath ns namespacedConfig) 38 - else {} 39 - ) 40 - ]; 41 - }; 42 - mkEnableOptionWithDefault = description: default: 43 - (lib.mkEnableOption description) // {inherit default;}; 44 4 }
+26 -31
modules/home/base/default.nix
··· 7 7 inherit (lib) mkDefault; 8 8 inherit (lib.lpchaim) shared; 9 9 inherit (lib.snowfall) fs; 10 - in 11 - lib.lpchaim.mkModule { 12 - inherit config; 13 - description = "root home config"; 14 - namespace = "my.modules"; 15 - imports = [ 16 - (fs.get-file "modules/shared") 17 - ]; 18 - configBuilder = cfg: { 19 - my.modules = { 20 - enable = mkDefault true; 21 - cli.enable = mkDefault true; 22 - de.gnome.enable = mkDefault false; 23 - gui.enable = mkDefault false; 24 - }; 25 - programs.home-manager.enable = mkDefault true; 26 - nix = 27 - { 28 - gc = { 29 - automatic = osConfig == null; 30 - frequency = "daily"; 31 - options = "--delete-older-than 7d"; 32 - }; 33 - settings = shared.nix.settings; 34 - } 35 - // (lib.optionalAttrs (osConfig != null) { 36 - inherit (osConfig.nix) extraOptions; 37 - }); 38 - systemd.user.startServices = "sd-switch"; 39 - }; 40 - } 10 + cfg = config.my.modules; 11 + in { 12 + imports = [ 13 + (fs.get-file "modules/shared") 14 + ]; 15 + 16 + options.my.modules.enable = 17 + lib.mkEnableOption "root home config" 18 + // {enable = true;}; 19 + config = lib.mkIf cfg.enable { 20 + programs.home-manager.enable = mkDefault true; 21 + nix = 22 + { 23 + gc = { 24 + automatic = osConfig == null; 25 + frequency = "daily"; 26 + options = "--delete-older-than 7d"; 27 + }; 28 + settings = shared.nix.settings; 29 + } 30 + // (lib.optionalAttrs (osConfig != null) { 31 + inherit (osConfig.nix) extraOptions; 32 + }); 33 + systemd.user.startServices = "sd-switch"; 34 + }; 35 + }
+5 -6
modules/home/cli/atuin/default.nix
··· 4 4 osConfig ? null, 5 5 pkgs, 6 6 ... 7 - }: 8 - lib.lpchaim.mkModule { 9 - inherit config; 10 - namespace = "my.modules.cli.atuin"; 11 - description = "atuin"; 12 - configBuilder = cfg: { 7 + }: let 8 + cfg = config.my.modules.cli.atuin; 9 + in { 10 + options.my.modules.cli.atuin.enable = lib.mkEnableOption "atuin"; 11 + config = lib.mkIf cfg.enable { 13 12 programs.mcfly.enable = lib.mkForce false; 14 13 programs.atuin = { 15 14 enable = true;
+8 -15
modules/home/cli/default.nix
··· 2 2 config, 3 3 lib, 4 4 ... 5 - }: 6 - with lib; let 7 - namespace = ["my" "modules" "cli"]; 8 - cfg = getAttrFromPath namespace config; 5 + }: let 6 + inherit (lib) mkDefault mkEnableOption mkIf; 7 + cfg = config.my.modules.cli; 9 8 in { 10 - options = setAttrByPath namespace { 11 - enable = mkEnableOption "custom modules"; 12 - }; 9 + options.my.modules.cli.enable = 10 + mkEnableOption "cli modules" 11 + // {default = true;}; 13 12 14 - config = setAttrByPath namespace { 15 - editors = mkIf cfg.enable { 16 - enable = mkDefault true; 17 - helix.enable = mkDefault true; 18 - kakoune.enable = mkDefault true; 19 - neovim.enable = mkDefault true; 20 - vim.enable = mkDefault true; 21 - }; 13 + config.my.modules.cli = mkIf cfg.enable { 14 + editors.enable = mkDefault true; 22 15 essentials.enable = mkDefault true; 23 16 fish.enable = mkDefault true; 24 17 git = {
+5 -7
modules/home/cli/editors/default.nix
··· 3 3 lib, 4 4 ... 5 5 }: let 6 - namespace = ["my" "modules" "cli" "editors"]; 7 - cfg = lib.getAttrFromPath namespace config; 6 + cfg = config.my.modules.cli.editors; 7 + inherit (cfg) enable; 8 8 in { 9 - options = lib.setAttrByPath namespace { 9 + options.my.modules.cli.editors = { 10 10 enable = lib.mkEnableOption "editors"; 11 - helix.enable = lib.mkEnableOption "helix"; 12 - kakoune.enable = lib.mkEnableOption "kakoune"; 13 - neovim.enable = lib.mkEnableOption "neovim"; 14 - vim.enable = lib.mkEnableOption "vim"; 11 + kakoune.enable = lib.mkEnableOption "kakoune" // {inherit enable;}; 12 + vim.enable = lib.mkEnableOption "vim" // {inherit enable;}; 15 13 }; 16 14 17 15 config = lib.mkIf cfg.enable {
+4 -2
modules/home/cli/editors/helix/default.nix
··· 3 3 lib, 4 4 ... 5 5 }: let 6 - namespace = ["my" "modules" "cli" "editors" "helix"]; 7 - cfg = lib.getAttrFromPath namespace config; 6 + cfg = config.my.modules.cli.editors.helix; 8 7 in { 8 + options.my.modules.cli.editors.helix.enable = 9 + lib.mkEnableOption "helix" 10 + // {inherit (config.my.modules.cli.editors) enable;}; 9 11 config = lib.mkIf cfg.enable { 10 12 programs.helix = { 11 13 enable = true;
+4 -2
modules/home/cli/editors/neovim/default.nix
··· 3 3 lib, 4 4 ... 5 5 }: let 6 - namespace = ["my" "modules" "cli" "editors" "neovim"]; 7 - cfg = lib.getAttrFromPath namespace config; 6 + cfg = config.my.modules.cli.editors.neovim; 8 7 in { 8 + options.my.modules.cli.editors.neovim.enable = 9 + lib.mkEnableOption "neovim" 10 + // {inherit (config.my.modules.cli.editors) enable;}; 9 11 config = lib.mkIf cfg.enable { 10 12 programs.nixvim = { 11 13 enable = true;
+2 -5
modules/home/cli/essentials/default.nix
··· 6 6 }: 7 7 with lib; let 8 8 inherit (lib.lpchaim.shared) defaults; 9 - namespace = ["my" "modules" "cli" "essentials"]; 10 - cfg = lib.getAttrFromPath namespace config; 9 + cfg = config.my.modules.cli.essentials; 11 10 in { 12 - options = lib.setAttrByPath namespace { 13 - enable = lib.mkEnableOption "essentials"; 14 - }; 11 + options.my.modules.cli.essentials.enable = lib.mkEnableOption "essentials"; 15 12 16 13 config = lib.mkIf cfg.enable { 17 14 home = {
+5 -6
modules/home/cli/fish/default.nix
··· 3 3 lib, 4 4 pkgs, 5 5 ... 6 - }: 7 - lib.lpchaim.mkModule { 8 - inherit config; 9 - namespace = "my.modules.cli.fish"; 10 - description = "fish shell"; 11 - configBuilder = cfg: { 6 + }: let 7 + cfg = config.my.modules.cli.fish; 8 + in { 9 + options.my.modules.cli.fish.enable = lib.mkEnableOption "fish shell"; 10 + config = lib.mkIf cfg.enable { 12 11 programs.fish = { 13 12 inherit (config.home) shellAliases; 14 13 enable = true;
+4 -5
modules/home/cli/git/default.nix
··· 3 3 lib, 4 4 ... 5 5 }: let 6 - namespace = ["my" "modules" "cli" "git"]; 7 - cfg = lib.getAttrFromPath namespace config; 8 6 inherit (lib.lpchaim.shared) defaults; 7 + cfg = config.my.modules.cli.git; 9 8 in { 10 - options = lib.setAttrByPath namespace { 9 + options.my.modules.cli.git = { 11 10 enable = lib.mkEnableOption "git"; 12 - lazygit.enable = lib.mkEnableOption "lazygit"; 11 + lazygit.enable = lib.mkEnableOption "lazygit" // {inherit (cfg) enable;}; 13 12 }; 14 13 15 14 config = lib.mkIf cfg.enable { ··· 25 24 userEmail = defaults.email.main; 26 25 userName = defaults.name.full; 27 26 }; 28 - lazygit.enable = lib.mkIf cfg.lazygit.enable true; 27 + lazygit.enable = cfg.lazygit.enable; 29 28 }; 30 29 }; 31 30 }
+4 -7
modules/home/cli/hishtory/default.nix
··· 3 3 lib, 4 4 pkgs, 5 5 ... 6 - }: 7 - with lib; let 8 - namespace = ["my" "modules" "cli" "hishtory"]; 9 - cfg = getAttrFromPath namespace config; 6 + }: let 7 + inherit (lib) mkEnableOption mkIf; 8 + cfg = config.my.modules.cli.hishtory; 10 9 in { 11 - options = setAttrByPath namespace { 12 - enable = mkEnableOption "hishtory"; 13 - }; 10 + options.my.modules.cli.hishtory.enable = mkEnableOption "hishtory"; 14 11 15 12 config = mkIf cfg.enable { 16 13 home = {
+6 -7
modules/home/cli/just/default.nix
··· 3 3 lib, 4 4 pkgs, 5 5 ... 6 - }: 7 - lib.lpchaim.mkModule { 8 - inherit config; 9 - namespace = "my.modules.cli.just"; 10 - description = "just task runner"; 11 - options = { 6 + }: let 7 + cfg = config.my.modules.cli.just; 8 + in { 9 + options.my.modules.cli.just = { 10 + enable = lib.mkEnableOption "just task runner"; 12 11 extraConfig = lib.mkOption { 13 12 description = "extra text to append to justfile"; 14 13 type = lib.types.lines; 15 14 default = ""; 16 15 }; 17 16 }; 18 - configBuilder = cfg: { 17 + config = lib.mkIf cfg.enable { 19 18 home = { 20 19 packages = [pkgs.just]; 21 20 file.".justfile".text = lib.trim ''
+2 -6
modules/home/cli/nushell/default.nix
··· 1 1 { 2 2 config, 3 - inputs, 4 3 lib, 5 4 pkgs, 6 5 ... 7 6 }: let 8 - namespace = ["my" "modules" "cli" "nushell"]; 9 - cfg = lib.getAttrFromPath namespace config; 7 + cfg = config.my.modules.cli.nushell; 10 8 in { 11 - options = lib.setAttrByPath namespace { 12 - enable = lib.mkEnableOption "nushell"; 13 - }; 9 + options.my.modules.cli.nushell.enable = lib.mkEnableOption "nushell"; 14 10 15 11 config = lib.mkIf cfg.enable { 16 12 programs.nushell = {
+2 -5
modules/home/cli/starship/default.nix
··· 4 4 pkgs, 5 5 ... 6 6 }: let 7 - namespace = ["my" "modules" "cli" "starship"]; 8 - cfg = lib.getAttrFromPath namespace config; 7 + cfg = config.my.modules.cli.starship; 9 8 settings = import ./settings.nix; 10 9 util = import ./util.nix args; 11 10 in { 12 - options = lib.setAttrByPath namespace { 13 - enable = lib.mkEnableOption "starship"; 14 - }; 11 + options.my.modules.cli.starship.enable = lib.mkEnableOption "starship"; 15 12 16 13 config = lib.mkIf cfg.enable { 17 14 programs.starship = {
+2 -5
modules/home/cli/tealdeer/default.nix
··· 4 4 pkgs, 5 5 ... 6 6 }: let 7 - namespace = ["my" "modules" "cli" "tealdeer"]; 8 - cfg = lib.getAttrFromPath namespace config; 7 + cfg = config.my.modules.cli.tealdeer; 9 8 in { 10 - options = lib.setAttrByPath namespace { 11 - enable = lib.mkEnableOption "nushell"; 12 - }; 9 + options.my.modules.cli.tealdeer.enable = lib.mkEnableOption "nushell"; 13 10 14 11 config = lib.mkIf cfg.enable { 15 12 home.packages = [pkgs.tealdeer];
+2 -3
modules/home/cli/tmux/catppuccin/default.nix
··· 7 7 }: 8 8 with builtins; 9 9 with lib; let 10 - namespace = ["my" "modules" "cli" "tmux" "catppuccin"]; 11 - cfg = lib.getAttrFromPath namespace config; 10 + cfg = config.my.modules.cli.tmux.catppuccin; 12 11 in { 13 - options = lib.setAttrByPath namespace { 12 + options.my.modules.cli.tmux.catppuccin = { 14 13 enable = mkOption { 15 14 description = "Whether to enable catppuccin."; 16 15 type = types.bool;
+13 -12
modules/home/cli/tmux/default.nix
··· 3 3 pkgs, 4 4 lib, 5 5 ... 6 - }: 7 - with builtins; 8 - with lib; let 9 - namespace = ["my" "modules" "cli" "tmux"]; 10 - cfg = lib.getAttrFromPath namespace config; 6 + }: let 7 + cfg = config.my.modules.cli.tmux; 11 8 defaultClipboard = "clipboard"; # clipboard, primary, secondary 12 9 termBasic = "screen-256color"; 13 10 termFull = "xterm-256color"; 14 11 in { 15 - options = lib.setAttrByPath namespace { 12 + options.my.modules.cli.tmux = { 16 13 enable = lib.mkEnableOption "tmux"; 17 14 theme = lib.mkOption { 18 15 description = "Which theme to use."; 19 - type = types.enum ["catppuccin" "tmux-powerline"]; 16 + type = lib.types.enum ["catppuccin" "tmux-powerline"]; 20 17 default = "catppuccin"; 21 18 }; 22 19 }; 23 20 24 - config = lib.mkIf cfg.enable ({ 21 + config = lib.mkIf cfg.enable (lib.mkMerge [ 22 + { 23 + my.modules.cli.tmux = { 24 + catppuccin.enable = cfg.theme == "catppuccin"; 25 + tmux-powerline.enable = cfg.theme == "tmux-powerline"; 26 + }; 27 + } 28 + { 25 29 home.sessionVariables.TERM = termFull; 26 30 27 31 home.packages = with pkgs; [ ··· 155 159 }; 156 160 }; 157 161 } 158 - // lib.setAttrByPath namespace { 159 - catppuccin.enable = cfg.theme == "catppuccin"; 160 - tmux-powerline.enable = cfg.theme == "tmux-powerline"; 161 - }); 162 + ]); 162 163 }
+4 -13
modules/home/cli/tmux/tmux-powerline/default.nix
··· 3 3 pkgs, 4 4 lib, 5 5 ... 6 - }: 7 - with builtins; 8 - with lib; let 9 - namespace = ["my" "modules" "cli" "tmux" "tmux-powerline"]; 10 - cfg = lib.getAttrFromPath namespace config; 6 + }: let 7 + cfg = config.my.modules.cli.tmux.tmux-powerline; 11 8 in { 12 - options = lib.setAttrByPath namespace { 13 - enable = mkOption { 14 - description = "Whether to enable tmux-powerline."; 15 - type = types.bool; 16 - default = false; 17 - }; 18 - }; 9 + options.my.modules.cli.tmux.tmux-powerline.enable = lib.mkEnableOption "tmux-powerline."; 19 10 20 - config = mkIf cfg.enable { 11 + config = lib.mkIf cfg.enable { 21 12 programs.tmux.plugins = with pkgs.tmuxPlugins; [ 22 13 (mkTmuxPlugin { 23 14 pluginName = "tmux-powerline";
+3 -12
modules/home/cli/zellij/default.nix
··· 4 4 lib, 5 5 ... 6 6 }: let 7 - inherit 8 - (lib) 9 - getAttrFromPath 10 - mkEnableOption 11 - mkForce 12 - setAttrByPath 13 - ; 7 + inherit (lib) mkEnableOption mkForce; 14 8 inherit (inputs.home-manager.lib.hm.generators) toKDL; 15 - namespace = ["my" "modules" "cli" "zellij"]; 16 - cfg = getAttrFromPath namespace config; 9 + cfg = config.my.modules.cli.zellij; 17 10 in { 18 - options = setAttrByPath namespace { 19 - enable = mkEnableOption "zellij"; 20 - }; 11 + options.my.modules.cli.zellij.enable = mkEnableOption "zellij"; 21 12 22 13 config = lib.mkIf cfg.enable { 23 14 programs = {
+2 -5
modules/home/cli/zsh/default.nix
··· 4 4 pkgs, 5 5 ... 6 6 }: let 7 - namespace = ["my" "modules" "cli" "zsh"]; 8 - cfg = lib.getAttrFromPath namespace config; 7 + cfg = config.my.modules.cli.zsh; 9 8 in { 10 - options = lib.setAttrByPath namespace { 11 - enable = lib.mkEnableOption "zsh"; 12 - }; 9 + options.my.modules.cli.zsh.enable = lib.mkEnableOption "zsh"; 13 10 14 11 config = lib.mkIf cfg.enable { 15 12 programs.zsh = {
+19 -19
modules/home/de/gnome/default.nix
··· 4 4 ... 5 5 }: 6 6 with lib; let 7 - namespace = ["my" "modules" "de" "gnome"]; 8 - cfg = getAttrFromPath namespace config; 7 + cfg = config.my.modules.de.gnome; 9 8 in { 10 - options = setAttrByPath namespace { 11 - enable = mkEnableOption "GTK/GNOME Shell customizations"; 12 - }; 9 + options.my.modules.de.gnome.enable = mkEnableOption "GTK/GNOME Shell customizations"; 13 10 14 - config = lib.mkIf cfg.enable (setAttrByPath namespace 11 + config = lib.mkIf cfg.enable (lib.mkMerge [ 15 12 { 16 - extensions = { 17 - enable = mkDefault true; 18 - dash-to-panel.enable = mkDefault true; 19 - }; 20 - theming = { 21 - enable = mkDefault true; 22 - enableGtkTheme = mkDefault cfg.theming.enable; 23 - enableGnomeShellTheme = mkDefault cfg.theming.enable; 24 - enableIconTheme = mkDefault cfg.theming.enable; 25 - enableCursorTheme = mkDefault cfg.theming.enable; 26 - preferDarkTheme = mkDefault cfg.theming.enable; 13 + my.modules.de.gnome = { 14 + extensions = { 15 + enable = mkDefault true; 16 + dash-to-panel.enable = mkDefault true; 17 + }; 18 + theming = { 19 + enable = mkDefault true; 20 + enableGtkTheme = mkDefault cfg.theming.enable; 21 + enableGnomeShellTheme = mkDefault cfg.theming.enable; 22 + enableIconTheme = mkDefault cfg.theming.enable; 23 + enableCursorTheme = mkDefault cfg.theming.enable; 24 + preferDarkTheme = mkDefault cfg.theming.enable; 25 + }; 27 26 }; 28 27 } 29 - // { 28 + { 30 29 gtk.enable = true; 31 30 dconf.settings = { 32 31 "org/gnome/desktop/interface" = { ··· 49 48 ]; 50 49 }; 51 50 }; 52 - }); 51 + } 52 + ]); 53 53 }
+2 -5
modules/home/de/gnome/extensions/dash-to-panel.nix
··· 5 5 ... 6 6 }: 7 7 with lib; let 8 - namespace = ["my" "modules" "de" "gnome" "extensions" "dash-to-panel"]; 9 - cfg = getAttrFromPath namespace config; 8 + cfg = config.my.modules.de.gnome.extensions.dash-to-panel; 10 9 in { 11 - options = setAttrByPath namespace { 12 - enable = mkEnableOption "Dash to Panel."; 13 - }; 10 + options.my.modules.de.gnome.extensions.dash-to-panel.enable = mkEnableOption "Dash to Panel."; 14 11 15 12 config = lib.mkIf cfg.enable { 16 13 home.packages = with pkgs.gnomeExtensions; [
+2 -5
modules/home/de/gnome/extensions/default.nix
··· 5 5 ... 6 6 }: 7 7 with lib; let 8 - namespace = ["my" "modules" "de" "gnome" "extensions"]; 9 - cfg = getAttrFromPath namespace config; 8 + cfg = config.my.modules.de.gnome.extensions; 10 9 pre43 = versionOlder pkgs.gnome-shell.version "43"; 11 10 in { 12 - options = setAttrByPath namespace { 13 - enable = mkEnableOption "GNOME Shell extensions"; 14 - }; 11 + options.my.modules.de.gnome.extensions.enable = mkEnableOption "GNOME Shell extensions"; 15 12 16 13 config = mkIf cfg.enable { 17 14 home.packages = with pkgs;
+2 -5
modules/home/de/gnome/theming/default.nix
··· 1 1 { 2 2 config, 3 - inputs, 4 3 lib, 5 4 pkgs, 6 5 ... 7 6 }: 8 7 with lib; let 9 - namespace = ["my" "modules" "de" "gnome" "theming"]; 10 - cfg = getAttrFromPath namespace config; 11 - toTitle = str: "${lib.toUpper (lib.substring 0 1 str)}${lib.substring 1 (lib.stringLength str) str}"; 8 + cfg = config.my.modules.de.gnome.theming; 12 9 in { 13 - options = setAttrByPath namespace { 10 + options.my.modules.de.gnome.theming = { 14 11 enable = mkEnableOption "theming tweaks"; 15 12 enableGtkTheme = mkEnableOption "custom GTK theme"; 16 13 enableGnomeShellTheme = mkEnableOption "custom GNOME Shell theme";
+34 -36
modules/home/de/hyprland/bars/ags/default.nix
··· 3 3 lib, 4 4 pkgs, 5 5 ... 6 - }: 7 - lib.lpchaim.mkModule { 8 - inherit config; 9 - description = "ags"; 10 - namespace = "my.modules.de.hyprland.bars.ags"; 11 - configBuilder = cfg: 12 - lib.mkIf cfg.enable { 13 - programs.ags.enable = true; 14 - home.sessionVariables = { 15 - GTK_THEME = "Adwaita-dark"; 16 - XCURSOR_THEME = "Adwaita"; 6 + }: let 7 + cfg = config.my.modules.de.hyprland.bars.ags; 8 + in { 9 + options.my.modules.de.hyprland.bars.ags.enable = lib.mkEnableOption "ags"; 10 + config = lib.mkIf cfg.enable { 11 + programs.ags.enable = true; 12 + home.sessionVariables = { 13 + GTK_THEME = "Adwaita-dark"; 14 + XCURSOR_THEME = "Adwaita"; 15 + }; 16 + systemd.user.services.ags = let 17 + ags = config.programs.ags.finalPackage; 18 + options = import ./options.nix {inherit config;}; 19 + optionsFile = pkgs.writeText "ags-config-json" (builtins.toJSON options); 20 + in { 21 + Install = { 22 + WantedBy = ["graphical-session.target"]; 17 23 }; 18 - systemd.user.services.ags = let 19 - ags = config.programs.ags.finalPackage; 20 - options = import ./options.nix {inherit config;}; 21 - optionsFile = pkgs.writeText "ags-config-json" (builtins.toJSON options); 22 - in { 23 - Install = { 24 - WantedBy = ["graphical-session.target"]; 25 - }; 26 - Service = { 27 - ExecStartPre = pkgs.writeShellScript "config-ags" '' 28 - mkdir -p ~/.cache/ags 29 - cp ${optionsFile} ~/.cache/ags/options.json 30 - chmod +w ~/.cache/ags/options.json 31 - ''; 32 - ExecStart = "${lib.getExe' ags (ags.pname or ags.name)}"; 33 - Restart = "always"; 34 - RestartSec = "5"; 35 - }; 36 - Unit = { 37 - After = ["graphical-session-pre.target"]; 38 - ConditionEnvironment = "WAYLAND_DISPLAY"; 39 - Description = "ags"; 40 - PartOf = ["graphical-session.target"]; 41 - X-Restart-Triggers = [ags optionsFile]; 42 - }; 24 + Service = { 25 + ExecStartPre = pkgs.writeShellScript "config-ags" '' 26 + mkdir -p ~/.cache/ags 27 + cp ${optionsFile} ~/.cache/ags/options.json 28 + chmod +w ~/.cache/ags/options.json 29 + ''; 30 + ExecStart = "${lib.getExe' ags (ags.pname or ags.name)}"; 31 + Restart = "always"; 32 + RestartSec = "5"; 33 + }; 34 + Unit = { 35 + After = ["graphical-session-pre.target"]; 36 + ConditionEnvironment = "WAYLAND_DISPLAY"; 37 + Description = "ags"; 38 + PartOf = ["graphical-session.target"]; 39 + X-Restart-Triggers = [ags optionsFile]; 43 40 }; 44 41 }; 42 + }; 45 43 }
+8 -10
modules/home/de/hyprland/bars/ags/dotfiles/aylur/default.nix
··· 4 4 lib, 5 5 pkgs, 6 6 ... 7 - }: 8 - lib.lpchaim.mkModule { 9 - inherit config; 10 - description = "aylur's ags dotfiles"; 11 - namespace = "my.modules.de.hyprland.bars.ags.dotfiles.aylur"; 12 - configBuilder = cfg: 13 - lib.mkIf cfg.enable { 14 - programs.ags.package = pkgs.callPackage ./ags.nix {inherit inputs;}; 15 - home.file.".config/background".source = config.stylix.image; 16 - }; 7 + }: let 8 + cfg = config.my.modules.de.hyprland.bars.ags.dotfiles.aylur; 9 + in { 10 + options.my.modules.de.hyprland.bars.ags.dotfiles.aylur.enable = lib.mkEnableOption "aylur's ags dotfiles"; 11 + config = lib.mkIf cfg.enable { 12 + programs.ags.package = pkgs.callPackage ./ags.nix {inherit inputs;}; 13 + home.file.".config/background".source = config.stylix.image; 14 + }; 17 15 }
+51 -54
modules/home/de/hyprland/bars/ags/dotfiles/end-4/default.nix
··· 35 35 pkgs.gnome-bluetooth 36 36 pkgs.gnome.gnome-control-center 37 37 ]; 38 - in 39 - lib.lpchaim.mkModule { 40 - inherit config; 41 - description = "end-4's ags dotfiles"; 42 - namespace = "my.modules.de.hyprland.bars.ags.dotfiles.end-4"; 43 - options = { 44 - enableFnKeys = lib.mkEnableOption "function key bindings"; 45 - }; 46 - configBuilder = cfg: 47 - lib.mkIf cfg.enable (lib.mkMerge [ 48 - { 49 - programs.ags = { 50 - package = inputs.ags.packages.${pkgs.system}.ags.overrideAttrs (prev: { 51 - nativeBuildInputs = 52 - prev.nativeBuildInputs 53 - ++ dependencies 54 - ++ (with pkgs; [ 55 - gjs 56 - wrapGAppsHook3 57 - ]); 58 - buildInputs = 59 - prev.buildInputs 60 - ++ dependencies 61 - ++ (with pkgs; [ 62 - linux-pam 63 - ]); 64 - }); 65 - configDir = pkgs.stdenvNoCC.mkDerivation { 66 - name = "ags-config"; 67 - src = inputs.dotfiles-end-4; 68 - buildPhase = '' 69 - mkdir -p $out 70 - cp -r $src/.config/ags/. $out/ 71 - chmod -R +w $out 72 - cp $out/scss/fallback/_material.scss \ 73 - $out/scss/_material.scss # TODO Workaround until I manage to generate this through a derivation 74 - ''; 75 - }; 76 - }; 77 - home.packages = dependencies; 78 - } 79 - (lib.mkIf cfg.enableFnKeys { 80 - wayland.windowManager.hyprland.settings = { 81 - binde = lib.mkAfter [ 82 - ", XF86AudioRaiseVolume, exec, ags run-js 'indicator.popup(1)'" 83 - ", XF86AudioLowerVolume, exec, ags run-js 'indicator.popup(1)'" 84 - ", XF86AudioMute, exec, ags run-js 'indicator.popup(1)'" 85 - ", XF86MonBrightnessDown, exec, ags run-js 'indicator.popup(1)'" 86 - ", XF86MonBrightnessUp, exec, ags run-js 'indicator.popup(1)'" 87 - ]; 88 - }; 89 - }) 90 - ]); 91 - } 38 + cfg = config.my.modules.de.hyprland.bars.ags.dotfiles.end-4; 39 + in { 40 + options.my.modules.de.hyprland.bars.ags.dotfiles.end-4 = { 41 + enable = lib.mkEnableOption "end-4's ags dotfiles"; 42 + enableFnKeys = lib.mkEnableOption "function key bindings"; 43 + }; 44 + config = lib.mkIf cfg.enable (lib.mkMerge [ 45 + { 46 + programs.ags = { 47 + package = inputs.ags.packages.${pkgs.system}.ags.overrideAttrs (prev: { 48 + nativeBuildInputs = 49 + prev.nativeBuildInputs 50 + ++ dependencies 51 + ++ (with pkgs; [ 52 + gjs 53 + wrapGAppsHook3 54 + ]); 55 + buildInputs = 56 + prev.buildInputs 57 + ++ dependencies 58 + ++ (with pkgs; [ 59 + linux-pam 60 + ]); 61 + }); 62 + configDir = pkgs.stdenvNoCC.mkDerivation { 63 + name = "ags-config"; 64 + src = inputs.dotfiles-end-4; 65 + buildPhase = '' 66 + mkdir -p $out 67 + cp -r $src/.config/ags/. $out/ 68 + chmod -R +w $out 69 + cp $out/scss/fallback/_material.scss \ 70 + $out/scss/_material.scss # TODO Workaround until I manage to generate this through a derivation 71 + ''; 72 + }; 73 + }; 74 + home.packages = dependencies; 75 + } 76 + (lib.mkIf cfg.enableFnKeys { 77 + wayland.windowManager.hyprland.settings = { 78 + binde = lib.mkAfter [ 79 + ", XF86AudioRaiseVolume, exec, ags run-js 'indicator.popup(1)'" 80 + ", XF86AudioLowerVolume, exec, ags run-js 'indicator.popup(1)'" 81 + ", XF86AudioMute, exec, ags run-js 'indicator.popup(1)'" 82 + ", XF86MonBrightnessDown, exec, ags run-js 'indicator.popup(1)'" 83 + ", XF86MonBrightnessUp, exec, ags run-js 'indicator.popup(1)'" 84 + ]; 85 + }; 86 + }) 87 + ]); 88 + }
+2 -5
modules/home/de/hyprland/bars/waybar/default.nix
··· 5 5 ... 6 6 }: 7 7 with lib; let 8 - namespace = ["my" "modules" "de" "hyprland" "bars" "waybar"]; 9 - cfg = getAttrFromPath namespace config; 8 + cfg = config.my.modules.de.hyprland.bars.waybar; 10 9 in { 11 - options = setAttrByPath namespace { 12 - enable = mkEnableOption "Waybar"; 13 - }; 10 + options.my.modules.de.hyprland.bars.waybar.enable = mkEnableOption "Waybar"; 14 11 15 12 config = mkIf cfg.enable { 16 13 programs.waybar = {
+2 -4
modules/home/de/hyprland/binds/default.nix
··· 9 9 concatStringsSep 10 10 elemAt 11 11 genList 12 - getAttrFromPath 13 12 mkEnableOption 14 13 mkIf 15 14 mkMerge ··· 17 16 setAttrByPath 18 17 ; 19 18 20 - namespace = ["my" "modules" "de" "hyprland" "binds"]; 21 - cfg = getAttrFromPath namespace config; 19 + cfg = config.my.modules.de.hyprland.binds; 22 20 23 21 makeDirectional = { 24 22 cmd, ··· 49 47 in "${trigger}, ${getKey i}, ${cmd}, ${getWorkspace i}") 50 48 (range 1 10); 51 49 in { 52 - options = setAttrByPath namespace { 50 + options.my.modules.de.hyprland.binds = { 53 51 enable = mkEnableOption "bindings"; 54 52 enableFnKeys = lib.mkEnableOption "function key bindings"; 55 53 };
+14 -15
modules/home/de/hyprland/default.nix
··· 6 6 }: 7 7 with lib; let 8 8 inherit (lib.lpchaim) shared; 9 - namespace = ["my" "modules" "de" "hyprland"]; 10 - cfg = getAttrFromPath namespace config; 9 + cfg = config.my.modules.de.hyprland; 11 10 in { 12 - options = setAttrByPath namespace { 13 - enable = mkEnableOption "Hyprland customizations"; 14 - }; 11 + options.my.modules.de.hyprland.enable = lib.mkEnableOption "Hyprland customizations"; 15 12 16 13 config = mkIf cfg.enable (mkMerge [ 17 - (setAttrByPath namespace { 18 - bars.ags.enable = mkDefault cfg.enable; 19 - bars.ags.dotfiles.aylur.enable = mkDefault cfg.bars.ags.enable; 20 - binds.enableFnKeys = mkDefault cfg.bars.ags.enable; 21 - bars.waybar.enable = mkDefault false; 22 - binds.enable = mkDefault cfg.enable; 23 - launchers.rofi.enable = mkDefault cfg.enable; 24 - osd.swayosd.enable = mkDefault false; 25 - plugins.enable = mkDefault false; 26 - }) 14 + { 15 + my.modules.de.hyprland = { 16 + bars.ags.enable = mkDefault cfg.enable; 17 + bars.ags.dotfiles.aylur.enable = mkDefault cfg.bars.ags.enable; 18 + binds.enableFnKeys = mkDefault cfg.bars.ags.enable; 19 + bars.waybar.enable = mkDefault false; 20 + binds.enable = mkDefault cfg.enable; 21 + launchers.rofi.enable = mkDefault cfg.enable; 22 + osd.swayosd.enable = mkDefault false; 23 + plugins.enable = mkDefault false; 24 + }; 25 + } 27 26 { 28 27 wayland.windowManager.hyprland = { 29 28 enable = true;
+1 -2
modules/home/de/hyprland/hypridle/default.nix
··· 5 5 ... 6 6 }: 7 7 with lib; let 8 - namespace = ["my" "modules" "de" "hyprland"]; 9 - cfg = getAttrFromPath namespace config; 8 + cfg = config.my.modules.de.hyprland; 10 9 in 11 10 mkIf cfg.enable { 12 11 services.hypridle = {
+2 -3
modules/home/de/hyprland/hyprlock/default.nix
··· 4 4 osConfig ? null, 5 5 ... 6 6 }: let 7 - inherit (lib) getAttrFromPath mkIf; 8 - namespace = ["my" "modules" "de" "hyprland"]; 9 - cfg = getAttrFromPath namespace config; 7 + inherit (lib) mkIf; 8 + cfg = config.my.modules.de.hyprland; 10 9 in 11 10 mkIf cfg.enable { 12 11 stylix.targets.hyprlock.enable = false;
+2 -5
modules/home/de/hyprland/launchers/rofi/default.nix
··· 4 4 pkgs, 5 5 ... 6 6 }: let 7 - namespace = ["my" "modules" "de" "hyprland" "launchers" "rofi"]; 8 - cfg = lib.getAttrFromPath namespace config; 7 + cfg = config.my.modules.de.hyprland.launchers.rofi; 9 8 in { 10 - options = lib.setAttrByPath namespace { 11 - enable = lib.mkEnableOption "rofi"; 12 - }; 9 + options.my.modules.de.hyprland.launchers.rofi.enable = lib.mkEnableOption "rofi"; 13 10 14 11 config = lib.mkIf cfg.enable { 15 12 wayland.windowManager.hyprland.settings.bindr = [
+2 -5
modules/home/de/hyprland/osd/swayosd/default.nix
··· 4 4 pkgs, 5 5 ... 6 6 }: let 7 - namespace = ["my" "modules" "de" "hyprland" "osd" "swayosd"]; 8 - cfg = lib.getAttrFromPath namespace config; 7 + cfg = config.my.modules.de.hyprland.osd.swayosd; 9 8 in { 10 - options = lib.setAttrByPath namespace { 11 - enable = lib.mkEnableOption "sway-osd"; 12 - }; 9 + options.my.modules.de.hyprland.osd.swayosd.enable = lib.mkEnableOption "sway-osd"; 13 10 14 11 config = lib.mkIf cfg.enable { 15 12 my.modules.de.hyprland.binds.enableFnKeys = lib.mkForce false;
+2 -5
modules/home/de/hyprland/plugins/default.nix
··· 6 6 ... 7 7 }: 8 8 with lib; let 9 - namespace = ["my" "modules" "de" "hyprland" "plugins"]; 10 - cfg = getAttrFromPath namespace config; 9 + cfg = config.my.modules.de.hyprland.plugins; 11 10 in { 12 - options = setAttrByPath namespace { 13 - enable = mkEnableOption "Hyprland plugins"; 14 - }; 11 + options.my.modules.de.hyprland.plugins.enable = mkEnableOption "Hyprland plugins"; 15 12 16 13 config = mkIf cfg.enable { 17 14 wayland.windowManager.hyprland.settings = {
+12 -17
modules/home/gaming/default.nix
··· 6 6 ... 7 7 }: let 8 8 inherit (lib) mkIf mkMerge; 9 - in 10 - lib.lpchaim.mkModule { 11 - inherit config; 12 - description = "gaming config"; 13 - namespace = "my.modules.gaming"; 14 - configBuilder = cfg: 15 - mkMerge [ 16 - (mkIf (osConfig.programs.steam.enable or false) { 17 - home.file = 18 - lib.concatMapAttrs 19 - (_: package: { 20 - ".local/share/Steam/compatibilitytools.d/${package.version}".source = "${package.steamcompattool}"; 21 - }) 22 - pkgs.proton-ge-bin-versions; 23 - }) 24 - ]; 25 - } 9 + cfg = config.my.modules.gaming; 10 + in { 11 + options.my.modules.gaming.enable = lib.mkEnableOption "gaming tweaks"; 12 + config = mkIf (cfg.enable && osConfig != null && osConfig.programs.steam.enable) { 13 + home.file = 14 + lib.concatMapAttrs 15 + (_: package: { 16 + ".local/share/Steam/compatibilitytools.d/${package.version}".source = "${package.steamcompattool}"; 17 + }) 18 + pkgs.proton-ge-bin-versions; 19 + }; 20 + }
+3 -8
modules/home/gui/default.nix
··· 6 6 ... 7 7 }: 8 8 with lib; let 9 - namespace = ["my" "modules" "gui"]; 10 - cfg = getAttrFromPath namespace config; 9 + cfg = config.my.modules.gui; 11 10 in { 12 11 imports = [ 13 12 ./chromium.nix ··· 15 14 ./mangohud.nix 16 15 ]; 17 16 18 - options = setAttrByPath namespace { 19 - enable = mkEnableOption "gui apps"; 20 - }; 17 + options.my.modules.gui.enable = mkEnableOption "gui apps"; 21 18 22 19 config = mkIf cfg.enable (mkMerge [ 23 - (setAttrByPath namespace { 24 - firefox.enable = mkDefault true; 25 - }) 20 + {my.modules.gui.firefox.enable = mkDefault true;} 26 21 { 27 22 home.packages = with pkgs; [ 28 23 logseq
+2 -5
modules/home/gui/firefox.nix
··· 4 4 pkgs, 5 5 ... 6 6 }: let 7 - namespace = ["my" "modules" "gui" "firefox"]; 8 - cfg = lib.getAttrFromPath namespace config; 7 + cfg = config.my.modules.gui.firefox; 9 8 in { 10 - options = lib.setAttrByPath namespace { 11 - enable = lib.mkEnableOption "Mozilla Firefox"; 12 - }; 9 + options.my.modules.gui.firefox.enable = lib.mkEnableOption "Mozilla Firefox"; 13 10 14 11 config = lib.mkIf cfg.enable { 15 12 programs.firefox = {
+2 -3
modules/home/misc/llm/default.nix
··· 8 8 inherit (inputs.home-manager.lib) hm; 9 9 inherit (inputs.nix-std.lib) serde; 10 10 inherit (lib) mkIf mkEnableOption mkOption; 11 - namespace = ["my" "modules" "misc" "llm"]; 12 - cfg = lib.getAttrFromPath namespace config; 11 + cfg = config.my.modules.misc.llm; 13 12 defaultEnable = {default = cfg.enable;}; 14 13 in { 15 - options = lib.setAttrByPath namespace { 14 + options.my.modules.misc.llm = { 16 15 enable = mkEnableOption "LLM tools"; 17 16 defaultModel = mkOption { 18 17 description = "Which model to use by default";
+2 -5
modules/nixos/desktop/swayosd.nix
··· 4 4 pkgs, 5 5 ... 6 6 }: let 7 - namespace = ["my" "services" "swayosd"]; 8 - cfg = lib.getAttrFromPath namespace config; 7 + cfg = config.my.services.swayosd; 9 8 in { 10 - options = lib.setAttrByPath namespace { 11 - enable = lib.mkEnableOption "swayosd libinput backend"; 12 - }; 9 + options.my.services.swayosd.enable = lib.mkEnableOption "swayosd libinput backend"; 13 10 14 11 config = lib.mkIf cfg.enable { 15 12 systemd.packages = [pkgs.swayosd];
+12 -14
modules/nixos/secureboot/default.nix
··· 3 3 lib, 4 4 pkgs, 5 5 ... 6 - }: 7 - lib.lpchaim.mkModule { 8 - inherit config; 9 - namespace = "my.security.secureboot"; 10 - description = "secure boot"; 11 - configBuilder = cfg: 12 - lib.mkIf cfg.enable { 13 - environment.systemPackages = [pkgs.sbctl]; 14 - boot = { 15 - loader.systemd-boot.enable = lib.mkForce false; 16 - lanzaboote = { 17 - enable = true; 18 - pkiBundle = "/etc/secureboot"; 19 - }; 6 + }: let 7 + cfg = config.my.security.secureboot; 8 + in { 9 + options.my.security.secureboot.enable = lib.mkEnableOption "secure boot"; 10 + config = lib.mkIf cfg.enable { 11 + environment.systemPackages = [pkgs.sbctl]; 12 + boot = { 13 + loader.systemd-boot.enable = lib.mkForce false; 14 + lanzaboote = { 15 + enable = true; 16 + pkiBundle = "/etc/secureboot"; 20 17 }; 21 18 }; 19 + }; 22 20 }
+61 -63
modules/nixos/security/default.nix
··· 4 4 options, 5 5 pkgs, 6 6 ... 7 - }: 8 - lib.lpchaim.mkModule { 9 - inherit config; 10 - namespace = "my.security"; 11 - options = { 7 + }: let 8 + cfg = config.my.security; 9 + in { 10 + options.my.security = { 12 11 enable = lib.mkEnableOption "security settings" // {default = true;}; 13 12 u2f = { 14 13 control = lib.mkOption { ··· 27 26 }; 28 27 }; 29 28 }; 30 - configBuilder = cfg: 31 - lib.mkIf cfg.enable { 32 - environment.etc = let 33 - patch = svc: 34 - lib.replaceStrings 35 - ["auth ${cfg.u2f.control} ${pkgs.pam_u2f}"] 36 - ["auth sufficient ${pkgs.pam_u2f}"] 37 - config.security.pam.services.${svc}.text; 38 - needsPatch = cfg.u2f.control != "sufficient"; 39 - patchIfNeeded = svc: 40 - lib.mkIf (cfg.u2f.relaxed && needsPatch) (lib.mkForce (patch svc)); 41 - in { 42 - "pam.d/login".text = patchIfNeeded "login"; 43 - "pam.d/sudo".text = patchIfNeeded "sudo"; 44 - }; 45 - security.pam = { 46 - services = { 47 - login.u2fAuth = false; 48 - sshd.u2fAuth = true; 49 - sudo.u2fAuth = true; 50 - }; 51 - sshAgentAuth.enable = true; 52 - u2f = { 53 - inherit (cfg.u2f) control; 54 - enable = true; 55 - settings.authfile = "${config.sops.secrets."u2f-mappings".path}"; 56 - settings = { 57 - cue = true; 58 - appid = "pam://auth"; 59 - origin = "pam://localhost"; 60 - }; 61 - }; 29 + config = lib.mkIf cfg.enable { 30 + environment.etc = let 31 + patch = svc: 32 + lib.replaceStrings 33 + ["auth ${cfg.u2f.control} ${pkgs.pam_u2f}"] 34 + ["auth sufficient ${pkgs.pam_u2f}"] 35 + config.security.pam.services.${svc}.text; 36 + needsPatch = cfg.u2f.control != "sufficient"; 37 + patchIfNeeded = svc: 38 + lib.mkIf (cfg.u2f.relaxed && needsPatch) (lib.mkForce (patch svc)); 39 + in { 40 + "pam.d/login".text = patchIfNeeded "login"; 41 + "pam.d/sudo".text = patchIfNeeded "sudo"; 42 + }; 43 + security.pam = { 44 + services = { 45 + login.u2fAuth = false; 46 + sshd.u2fAuth = true; 47 + sudo.u2fAuth = true; 62 48 }; 63 - programs = { 64 - gnupg.agent = { 65 - enable = true; 66 - enableSSHSupport = true; 49 + sshAgentAuth.enable = true; 50 + u2f = { 51 + inherit (cfg.u2f) control; 52 + enable = true; 53 + settings.authfile = "${config.sops.secrets."u2f-mappings".path}"; 54 + settings = { 55 + cue = true; 56 + appid = "pam://auth"; 57 + origin = "pam://localhost"; 67 58 }; 68 59 }; 69 - services = { 70 - udev = { 71 - extraRules = lib.mkIf cfg.u2f.screenOffOnUnplug '' 72 - ACTION=="remove", \ 73 - ENV{ID_BUS}=="usb", \ 74 - ENV{ID_MODEL_ID}=="0407", \ 75 - ENV{ID_VENDOR_ID}=="1050", \ 76 - ENV{ID_VENDOR}=="Yubico", \ 77 - RUN+="${pkgs.systemd}/bin/loginctl lock-sessions" 78 - ''; 79 - packages = [pkgs.yubikey-personalization]; 80 - }; 60 + }; 61 + programs = { 62 + gnupg.agent = { 63 + enable = true; 64 + enableSSHSupport = true; 81 65 }; 82 - environment.systemPackages = with pkgs; [ 83 - gnupg 84 - pam_u2f 85 - pamtester 86 - yubikey-personalization 87 - yubioath-flutter 88 - ]; 89 - sops.secrets.u2f-mappings = { 90 - group = "wheel"; 91 - mode = "0440"; 66 + }; 67 + services = { 68 + udev = { 69 + extraRules = lib.mkIf cfg.u2f.screenOffOnUnplug '' 70 + ACTION=="remove", \ 71 + ENV{ID_BUS}=="usb", \ 72 + ENV{ID_MODEL_ID}=="0407", \ 73 + ENV{ID_VENDOR_ID}=="1050", \ 74 + ENV{ID_VENDOR}=="Yubico", \ 75 + RUN+="${pkgs.systemd}/bin/loginctl lock-sessions" 76 + ''; 77 + packages = [pkgs.yubikey-personalization]; 92 78 }; 93 79 }; 80 + environment.systemPackages = with pkgs; [ 81 + gnupg 82 + pam_u2f 83 + pamtester 84 + yubikey-personalization 85 + yubioath-flutter 86 + ]; 87 + sops.secrets.u2f-mappings = { 88 + group = "wheel"; 89 + mode = "0440"; 90 + }; 91 + }; 94 92 }
+54 -57
modules/nixos/tailscale/default.nix
··· 5 5 ... 6 6 }: let 7 7 inherit (lib.lpchaim) shared; 8 - in 9 - lib.lpchaim.mkModule { 10 - inherit config; 11 - namespace = "my.networking.tailscale"; 12 - options = { 13 - enable = lib.mkEnableOption "tailscale" // {default = true;}; 14 - authKeyParameters = 15 - options.services.tailscale.authKeyParameters 16 - // { 17 - default.ephemeral = false; 18 - default.preauthorized = true; 19 - }; 20 - trusted = lib.mkOption { 21 - description = "Whether to tag this device as trusted"; 22 - type = lib.types.bool; 23 - default = false; 8 + cfg = config.my.networking.tailscale; 9 + in { 10 + options.my.networking.tailscale = { 11 + enable = lib.mkEnableOption "tailscale" // {default = true;}; 12 + authKeyParameters = 13 + options.services.tailscale.authKeyParameters 14 + // { 15 + default.ephemeral = false; 16 + default.preauthorized = true; 24 17 }; 25 - advertise.exitNode = lib.mkOption { 26 - description = "Whether to advertise an exit node"; 27 - default = false; 28 - type = lib.types.bool; 29 - }; 30 - advertise.tags = lib.mkOption { 31 - description = "ACL tags to advertise"; 32 - default = ["nixos"]; 33 - type = with lib.types; listOf str; 34 - }; 18 + trusted = lib.mkOption { 19 + description = "Whether to tag this device as trusted"; 20 + type = lib.types.bool; 21 + default = false; 22 + }; 23 + advertise.exitNode = lib.mkOption { 24 + description = "Whether to advertise an exit node"; 25 + default = false; 26 + type = lib.types.bool; 27 + }; 28 + advertise.tags = lib.mkOption { 29 + description = "ACL tags to advertise"; 30 + default = ["nixos"]; 31 + type = with lib.types; listOf str; 32 + }; 33 + }; 34 + config = lib.mkIf cfg.enable { 35 + services.tailscale = let 36 + tags = 37 + cfg.advertise.tags 38 + ++ lib.optionals cfg.trusted ["trusted"]; 39 + formattedTags = lib.pipe tags [ 40 + (map (it: "tag:${it}")) 41 + (builtins.concatStringsSep ",") 42 + ]; 43 + in { 44 + inherit (cfg) authKeyParameters; 45 + enable = true; 46 + authKeyFile = config.sops.secrets."tailscale/oauth/secret".path; 47 + extraUpFlags = 48 + [ 49 + "--accept-dns" 50 + "--accept-routes" 51 + "--advertise-tags=${formattedTags}" 52 + "--operator=${shared.defaults.name.user}" 53 + "--reset" # Forces unspecified arguments to default values 54 + "--ssh" 55 + ] 56 + ++ lib.optionals cfg.advertise.exitNode [ 57 + "--advertise-exit-node" 58 + ]; 59 + openFirewall = true; 60 + useRoutingFeatures = "both"; 35 61 }; 36 - configBuilder = cfg: 37 - lib.mkIf cfg.enable { 38 - services.tailscale = let 39 - tags = 40 - cfg.advertise.tags 41 - ++ lib.optionals cfg.trusted ["trusted"]; 42 - formattedTags = lib.pipe tags [ 43 - (map (it: "tag:${it}")) 44 - (builtins.concatStringsSep ",") 45 - ]; 46 - in { 47 - inherit (cfg) authKeyParameters; 48 - enable = true; 49 - authKeyFile = config.sops.secrets."tailscale/oauth/secret".path; 50 - extraUpFlags = 51 - [ 52 - "--accept-dns" 53 - "--accept-routes" 54 - "--advertise-tags=${formattedTags}" 55 - "--operator=${shared.defaults.name.user}" 56 - "--reset" # Forces unspecified arguments to default values 57 - "--ssh" 58 - ] 59 - ++ lib.optionals cfg.advertise.exitNode [ 60 - "--advertise-exit-node" 61 - ]; 62 - openFirewall = true; 63 - useRoutingFeatures = "both"; 64 - }; 65 - }; 66 - } 62 + }; 63 + }
+67 -71
modules/nixos/traits/gaming.nix
··· 4 4 pkgs, 5 5 ... 6 6 }: let 7 - inherit (lib.lpchaim) mkModule; 8 7 inherit (lib.lpchaim.shared) defaults; 9 - in 10 - mkModule { 11 - inherit config; 12 - namespace = "my.gaming"; 13 - options = { 14 - enable = lib.mkEnableOption "gaming tweaks"; 15 - steam.enable = lib.mkEnableOption "steam tweaks" // {default = config.my.gaming.enable;}; 16 - }; 17 - configBuilder = cfg: 18 - lib.mkMerge [ 19 - (lib.mkIf cfg.enable { 20 - environment.systemPackages = with pkgs; [ 21 - # osu-stable # @TODO Reenable when I figure out why nix-gaming's cachix doesn't ever seem to work 22 - parsec-bin 23 - lutris 24 - # wine-discord-ipc-bridge 25 - (pkgs.wrapOBS { 26 - plugins = ( 27 - (with pkgs.obs-studio-plugins; [ 28 - input-overlay 29 - obs-pipewire-audio-capture 30 - obs-scale-to-sound 31 - obs-vaapi 32 - obs-vkcapture 33 - wlrobs 34 - ]) 35 - ++ (lib.optionals (lib.elem "nvidia" config.services.xserver.videoDrivers) [ 36 - pkgs.obs-studio-plugins.obs-nvfbc 37 - ]) 38 - ); 39 - }) 40 - ]; 8 + cfg = config.my.gaming; 9 + in { 10 + options.my.gaming = { 11 + enable = lib.mkEnableOption "gaming tweaks"; 12 + steam.enable = lib.mkEnableOption "steam tweaks" // {default = config.my.gaming.enable;}; 13 + }; 14 + config = lib.mkMerge [ 15 + (lib.mkIf cfg.enable { 16 + environment.systemPackages = with pkgs; [ 17 + # osu-stable # @TODO Reenable when I figure out why nix-gaming's cachix doesn't ever seem to work 18 + parsec-bin 19 + lutris 20 + # wine-discord-ipc-bridge 21 + (pkgs.wrapOBS { 22 + plugins = ( 23 + (with pkgs.obs-studio-plugins; [ 24 + input-overlay 25 + obs-pipewire-audio-capture 26 + obs-scale-to-sound 27 + obs-vaapi 28 + obs-vkcapture 29 + wlrobs 30 + ]) 31 + ++ (lib.optionals (lib.elem "nvidia" config.services.xserver.videoDrivers) [ 32 + pkgs.obs-studio-plugins.obs-nvfbc 33 + ]) 34 + ); 35 + }) 36 + ]; 41 37 42 - services.pipewire.lowLatency.enable = true; 43 - security.rtkit.enable = true; # make pipewire realtime-capable 38 + services.pipewire.lowLatency.enable = true; 39 + security.rtkit.enable = true; # make pipewire realtime-capable 44 40 45 - programs.gamemode = { 46 - enable = true; 47 - enableRenice = true; 48 - }; 49 - programs.gamescope = { 50 - enable = true; 51 - capSysNice = true; 52 - }; 53 - security.wrappers.gamescope.source = lib.mkForce (lib.getBin pkgs.gamescope); 41 + programs.gamemode = { 42 + enable = true; 43 + enableRenice = true; 44 + }; 45 + programs.gamescope = { 46 + enable = true; 47 + capSysNice = true; 48 + }; 49 + security.wrappers.gamescope.source = lib.mkForce (lib.getBin pkgs.gamescope); 54 50 55 - users.extraUsers.${defaults.name.user}.extraGroups = ["gamemode"]; 56 - }) 57 - (lib.mkIf cfg.steam.enable { 58 - hardware.steam-hardware.enable = true; 59 - programs.steam = { 60 - enable = true; 61 - extest.enable = true; 62 - extraPackages = with pkgs; [ 63 - gamescope 64 - mangohud 65 - ]; 66 - package = pkgs.steam.override { 67 - extraEnv = { 68 - MANGOHUD = true; 69 - OBS_VKCAPTURE = true; 70 - }; 71 - }; 72 - extraCompatPackages = builtins.attrValues pkgs.proton-ge-bin-versions; 73 - gamescopeSession.enable = true; 74 - remotePlay.openFirewall = true; 75 - dedicatedServer.openFirewall = true; 76 - localNetworkGameTransfers.openFirewall = true; 77 - platformOptimizations.enable = true; 78 - protontricks.enable = true; 51 + users.extraUsers.${defaults.name.user}.extraGroups = ["gamemode"]; 52 + }) 53 + (lib.mkIf cfg.steam.enable { 54 + hardware.steam-hardware.enable = true; 55 + programs.steam = { 56 + enable = true; 57 + extest.enable = true; 58 + extraPackages = with pkgs; [ 59 + gamescope 60 + mangohud 61 + ]; 62 + package = pkgs.steam.override { 63 + extraEnv = { 64 + MANGOHUD = true; 65 + OBS_VKCAPTURE = true; 79 66 }; 80 - }) 81 - ]; 82 - } 67 + }; 68 + extraCompatPackages = builtins.attrValues pkgs.proton-ge-bin-versions; 69 + gamescopeSession.enable = true; 70 + remotePlay.openFirewall = true; 71 + dedicatedServer.openFirewall = true; 72 + localNetworkGameTransfers.openFirewall = true; 73 + platformOptimizations.enable = true; 74 + protontricks.enable = true; 75 + }; 76 + }) 77 + ]; 78 + }