diff --git a/TODO.md b/TODO.md index e10ba29..1f2118b 100755 --- a/TODO.md +++ b/TODO.md @@ -8,7 +8,7 @@ - 🪵 Server: cedar - VMs: [hostname]-vm (fern-vm, oak-vm, cedar-vm) -- [ ] hydenix: some yubikey touch detection for hyprlock and waybar +- [x] hydenix: some yubikey touch detection for hyprlock and waybar - [?] bluemail - [x] scalar - [x] rust @@ -20,4 +20,3 @@ - [ ] Update flake - [ ] Test workflows - [x] Prisma module -- [ ] fix printing diff --git a/flake.lock b/flake.lock index 7ba0bdb..7f76bd7 100755 --- a/flake.lock +++ b/flake.lock @@ -215,6 +215,27 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1750618568, + "narHash": "sha256-w9EG5FOXrjXGfbqCcQg9x1lMnTwzNDW5BMXp8ddy15E=", + "owner": "nix-darwin", + "repo": "nix-darwin", + "rev": "1dd19f19e4b53a1fd2e8e738a08dd5fe635ec7e5", + "type": "github" + }, + "original": { + "owner": "nix-darwin", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "nix-gaming": { "inputs": { "flake-parts": "flake-parts", @@ -377,6 +398,7 @@ "chaotic": "chaotic", "deploy-rs": "deploy-rs", "hydenix": "hydenix", + "nix-darwin": "nix-darwin", "nix-gaming": "nix-gaming", "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs_3", diff --git a/flake.nix b/flake.nix index 9a4820c..5043797 100755 --- a/flake.nix +++ b/flake.nix @@ -11,11 +11,6 @@ # Hydenix and its nixpkgs - kept separate to avoid conflicts hydenix = { - # Available inputs: - # Main: github:richen604/hydenix - # Dev: github:richen604/hydenix/dev - # Commit: github:richen604/hydenix/ - # Version: github:richen604/hydenix/v1.0.0 url = "github:richen604/hydenix"; }; @@ -29,12 +24,14 @@ url = "github:serokell/deploy-rs"; inputs.nixpkgs.follows = "nixpkgs"; }; + + nix-darwin = { + url = "github:nix-darwin/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = - { - ... - }@inputs: + outputs = { self, nix-darwin, ... }@inputs: let vars = { user = "mirage"; @@ -54,6 +51,20 @@ ]; }; + # Create macOS configuration + mkDarwinHost = + hostname: + nix-darwin.lib.darwinSystem { + system = "aarch64-darwin"; # or "x86_64-darwin" for Intel Macs + specialArgs = { + inherit inputs vars; + hostname = hostname; + }; + modules = [ + ./hosts/darwin/${hostname} + ]; + }; + # Create VM variant function mkVm = hostname: @@ -77,7 +88,6 @@ mkDeployNode = hostname: { hostname = hostname; profiles.system = { - # Change from root to your user user = "${vars.user}"; path = inputs.deploy-rs.lib.${system}.activate.nixos inputs.self.nixosConfigurations.${hostname}; sshUser = "${vars.user}"; @@ -95,13 +105,21 @@ nixosConfigurations = { fern = mkHost "fern"; oak = mkHost "oak"; + pine = mkHost "pine"; "fern.local" = mkHost "fern"; "oak.local" = mkHost "oak"; + "pine.local" = mkHost "pine"; + }; + + darwinConfigurations = { + # Replace "macbook" with your actual hostname (run 'scutil --get LocalHostName' to find it) + macbook = mkDarwinHost "macbook"; }; deploy.nodes = { fern = mkDeployNode "fern.local"; oak = mkDeployNode "oak.local"; + pine = mkDeployNode "pine.local"; }; packages.${inputs.hydenix.lib.system} = { @@ -119,16 +137,18 @@ ${pkgs.deploy-rs}/bin/deploy --skip-checks .#oak ;; "fern") ${pkgs.deploy-rs}/bin/deploy --skip-checks .#fern ;; + "pine") + ${pkgs.deploy-rs}/bin/deploy --skip-checks .#pine ;; "all") ${pkgs.deploy-rs}/bin/deploy --skip-checks .#oak ${pkgs.deploy-rs}/bin/deploy --skip-checks .#fern + ${pkgs.deploy-rs}/bin/deploy --skip-checks .#pine ;; - *) echo "Usage: rb [oak|fern|all]" >&2; exit 1 ;; + *) echo "Usage: rb [oak|fern|pine|all]" >&2; exit 1 ;; esac ''; }; - # Only check the specific deployment node checks.${system} = { oak-check = inputs.deploy-rs.lib.${system}.deployChecks { nodes.oak = inputs.self.deploy.nodes.oak; @@ -136,6 +156,9 @@ fern-check = inputs.deploy-rs.lib.${system}.deployChecks { nodes.fern = inputs.self.deploy.nodes.fern; }; + pine-check = inputs.deploy-rs.lib.${system}.deployChecks { + nodes.pine = inputs.self.deploy.nodes.pine; + }; }; }; -} +} \ No newline at end of file diff --git a/hosts/oak/default.nix b/hosts/oak/default.nix index 8e019dc..b9e49d0 100644 --- a/hosts/oak/default.nix +++ b/hosts/oak/default.nix @@ -15,8 +15,10 @@ let (final: prev: { userPkgs = import inputs.nixpkgs { inherit (inputs.hydenix.lib) system; - config.allowUnfree = true; - android_sdk.accept_license = true; + config = { + android_sdk.accept_license = true; + allowUnfree = true; + }; }; }) ]; diff --git a/hosts/pine/default.nix b/hosts/pine/default.nix new file mode 100644 index 0000000..1cdf2ab --- /dev/null +++ b/hosts/pine/default.nix @@ -0,0 +1,88 @@ +{ + inputs, + vars, + ... +}: +let + pkgs = import inputs.hydenix.inputs.hydenix-nixpkgs { + inherit (inputs.hydenix.lib) system; + config = { + allowUnfree = true; + }; + overlays = [ + inputs.hydenix.lib.overlays + (final: prev: { + userPkgs = import inputs.nixpkgs { + inherit (inputs.hydenix.lib) system; + config.allowUnfree = true; + }; + }) + ]; + }; +in +{ + nixpkgs.pkgs = pkgs; + + imports = [ + inputs.hydenix.inputs.home-manager.nixosModules.home-manager + inputs.hydenix.lib.nixOsModules + ./hardware-configuration.nix + ../../modules/system/hosts/pine + + + # === GPU-specific configurations === + + /* + For drivers, we are leveraging nixos-hardware + Most common drivers are below, but you can see more options here: https://github.com/NixOS/nixos-hardware + */ + + #! EDIT THIS SECTION + # === Other common modules === + inputs.hydenix.inputs.nixos-hardware.nixosModules.common-pc + inputs.hydenix.inputs.nixos-hardware.nixosModules.common-pc-ssd + ]; + + boot.kernelParams = [ "video=HDMI-A-1:e" ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit inputs; + }; + users."${vars.user}" = + { ... }: + { + # hm import + imports = [ + ../../modules/hm/hosts/pine + ]; + + desktops.hydenix = { + enable = true; + hostname = "pine"; + }; + }; + }; + + hydenix = { + enable = true; + hostname = "pine"; + timezone = "Europe/Paris"; + locale = "fr_FR.UTF-8"; + }; + + users.users.${vars.user} = { + isNormalUser = true; + #initialPassword = "${vars.user}"; + extraGroups = [ + "wheel" + "networkmanager" + "video" + "lp" + "scanner" + ]; + shell = pkgs.zsh; + }; +} diff --git a/modules/hm/common/browser/default.nix b/modules/hm/common/browser/default.nix index f83c5ac..cb9e85c 100644 --- a/modules/hm/common/browser/default.nix +++ b/modules/hm/common/browser/default.nix @@ -1,12 +1,43 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.browser; + cfg = config.modules.hm.browser; + + # Map browsers to their packages (using pkgs.) + browserToPackage = with pkgs; { + chromium = [ chromium ]; + chrome = [ google-chrome ]; + firefox = [ firefox ]; + brave = [ brave ]; + vivaldi = [ vivaldi ]; + edge = [ microsoft-edge ]; + }; + + # Map browsers to their drivers (using pkgs.) + browserToDriver = with pkgs; { + chromium = chromedriver; + chrome = chromedriver; + vivaldi = chromedriver; + brave = chromedriver; + firefox = geckodriver; + edge = msedgedriver; + }; + + # Get packages for enabled browsers + browserPackages = lib.concatMap (browser: browserToPackage.${browser} or []) cfg.clients; + + # Get drivers for enabled browsers (if driver.enable is true) + drivers = lib.optionals cfg.driver.enable ( + lib.unique (lib.filter (drv: drv != null) ( + map (browser: browserToDriver.${browser} or null) cfg.clients + )) + ); + in { - options.modules.common.browser = { - emulators = lib.mkOption { - type = lib.types.listOf (lib.types.enum ["chromium" "chrome" "firefox" "brave" "vivaldi" "edge"]); + options.modules.hm.browser = { + clients = lib.mkOption { + type = lib.types.listOf (lib.types.enum (lib.attrNames browserToDriver)); default = []; }; @@ -18,21 +49,6 @@ in }; config = { - home.packages = with pkgs; - lib.unique ( - (lib.optionals (lib.elem "chromium" cfg.emulators) [chromium]) ++ - (lib.optionals (lib.elem "chrome" cfg.emulators) [google-chrome]) ++ - (lib.optionals (lib.elem "firefox" cfg.emulators) [firefox]) ++ - (lib.optionals (lib.elem "brave" cfg.emulators) [brave]) ++ - (lib.optionals (lib.elem "vivaldi" cfg.emulators) [vivaldi]) ++ - (lib.optionals (lib.elem "edge" cfg.emulators) [microsoft-edge]) ++ - (lib.optionals - (cfg.driver.enable && - (lib.any (browser: lib.elem browser cfg.emulators) - [ "chromium" "chrome" "vivaldi" "brave" ])) - [chromedriver]) ++ - (lib.optionals (cfg.driver.enable && lib.elem "firefox" cfg.emulators) [geckodriver]) ++ - (lib.optionals (cfg.driver.enable && lib.elem "edge" cfg.emulators) [msedgedriver]) - ); + home.packages = lib.unique (browserPackages ++ drivers); }; } \ No newline at end of file diff --git a/modules/hm/common/communication/discord.nix b/modules/hm/common/communication/discord.nix new file mode 100644 index 0000000..e55134b --- /dev/null +++ b/modules/hm/common/communication/discord.nix @@ -0,0 +1,57 @@ +{ pkgs, lib, config, ... }: + +let + cfg = config.modules.hm.communication.discord; + + # Map Discord clients to their packages + clientsToPackage = with pkgs; { + discord = discord; + discordo = discordo; + discord-sh = discord-sh; + discord-ptb = discord-ptb; + discord-canary = discord-canary; + discord-development = discord-development; + cordless = cordless; + }; + + # Map overlay names to their packages + overlaysToPackage = with pkgs; { + "discover-overlay" = discover-overlay; + overlayed = overlayed; + }; + + # Get packages for enabled clients + clientPackages = map (client: clientsToPackage.${client}) cfg.clients; + + # Get overlay packages + overlayPackages = map (overlay: overlaysToPackage.${overlay}) cfg.overlays; + + # RPC package + rpcPackage = lib.optional cfg.rpc.enable pkgs.discord-rpc; + +in +{ + options.modules.hm.communication.discord = { + clients = lib.mkOption { + type = lib.types.listOf (lib.types.enum (lib.attrNames clientsToPackage)); + default = []; + description = "List of Discord clients to install"; + }; + + overlays = lib.mkOption { + type = lib.types.listOf (lib.types.enum (lib.attrNames overlaysToPackage)); + default = []; + description = "List of Discord overlays to install"; + }; + + rpc.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Whether to enable Discord Rich Presence support"; + }; + }; + + config = lib.mkIf (cfg.clients != [] || cfg.overlays != [] || cfg.rpc.enable) { + home.packages = clientPackages ++ overlayPackages ++ rpcPackage; + }; +} \ No newline at end of file diff --git a/modules/hm/common/communication/mail/bluemail.nix b/modules/hm/common/communication/mail/bluemail.nix index 9919813..c3c11dc 100644 --- a/modules/hm/common/communication/mail/bluemail.nix +++ b/modules/hm/common/communication/mail/bluemail.nix @@ -1,7 +1,5 @@ { pkgs, config, lib, ... }: let - cfg = config.modules.common.communication.mail.bluemail; - bluemail = pkgs.bluemail; bluemailWithGPU = pkgs.symlinkJoin { diff --git a/modules/hm/common/communication/mail/default.nix b/modules/hm/common/communication/mail/default.nix index f0f18b4..876b42d 100644 --- a/modules/hm/common/communication/mail/default.nix +++ b/modules/hm/common/communication/mail/default.nix @@ -1,24 +1,23 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.communication.mail; + cfg = config.modules.hm.communication.mail; serviceList = cfg.services; - # Map service names to their corresponding packages + # Map service names to their corresponding packages or list of packages serviceToPackage = { - thunderbird = pkgs.thunderbird-latest; - bluemail = (import ./bluemail.nix { inherit pkgs lib config; }).bluemailWithGPU; + thunderbird = [ pkgs.thunderbird-latest ]; + bluemail = [ (import ./bluemail.nix { inherit pkgs lib config; }).bluemailWithGPU ]; }; - # Get packages for enabled services, filtering out nulls - packagesToInstall = lib.filter (pkg: pkg != null) - (map (service: serviceToPackage.${service}) serviceList); + # Flatten the list of packages from all enabled services + packagesToInstall = lib.unique (lib.concatMap (s: serviceToPackage.${s}) serviceList); in { - options.modules.common.communication.mail = { + options.modules.hm.communication.mail = { services = lib.mkOption { - type = lib.types.listOf (lib.types.enum ["thunderbird" "bluemail"]); + type = lib.types.listOf (lib.types.enum (lib.attrNames serviceToPackage)); default = []; description = "List of mail services to enable"; }; diff --git a/modules/hm/common/communication/teams.nix b/modules/hm/common/communication/teams.nix index ee85801..e8da2e8 100644 --- a/modules/hm/common/communication/teams.nix +++ b/modules/hm/common/communication/teams.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.communication.teams; + cfg = config.modules.hm.communication.teams; in { - options.modules.common.communication.teams = { + options.modules.hm.communication.teams = { enable = lib.mkEnableOption "Enable Microsoft Teams for Linux"; }; diff --git a/modules/hm/common/default.nix b/modules/hm/common/default.nix index 1e4fd3f..285630d 100644 --- a/modules/hm/common/default.nix +++ b/modules/hm/common/default.nix @@ -6,6 +6,7 @@ ./browser ./communication/mail + ./communication/discord.nix ./communication/teams.nix ./dev/editor/dbeaver.nix @@ -29,14 +30,11 @@ ./engine - #./extra/ignore-file-retriever.nix + ./extra/ignore-file-retriever.nix + ./games/games.nix + ./games/joystick.nix ./games/mangohud.nix - ./games/minecraft.nix - ./games/roblox.nix - ./games/rocket-league.nix - ./games/star-citizen.nix - ./games/northstar.nix ./multimedia/gimp.nix ./multimedia/mpv.nix diff --git a/modules/hm/common/dev/dotnet.nix b/modules/hm/common/dev/dotnet.nix index 57e3e4f..3a2d92f 100644 --- a/modules/hm/common/dev/dotnet.nix +++ b/modules/hm/common/dev/dotnet.nix @@ -1,7 +1,7 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.dotnet; + cfg = config.modules.hm.dev.dotnet; sdkVersions = cfg.sdk-versions; @@ -14,7 +14,7 @@ let in { - options.modules.common.dev.dotnet = { + options.modules.hm.dev.dotnet = { enable = lib.mkEnableOption "Enable .NET development environment"; sdk-versions = lib.mkOption { type = lib.types.listOf lib.types.str; diff --git a/modules/hm/common/dev/editor/android-studio.nix b/modules/hm/common/dev/editor/android-studio.nix index 8fd201f..84af0ba 100644 --- a/modules/hm/common/dev/editor/android-studio.nix +++ b/modules/hm/common/dev/editor/android-studio.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.editor.android-studio; + cfg = config.modules.hm.dev.editor.android-studio; in { - options.modules.common.dev.editor.android-studio = { + options.modules.hm.dev.editor.android-studio = { enable = lib.mkEnableOption "Enable Android Studio development environment"; }; diff --git a/modules/hm/common/dev/editor/dbeaver.nix b/modules/hm/common/dev/editor/dbeaver.nix index dbe0213..ba96f26 100644 --- a/modules/hm/common/dev/editor/dbeaver.nix +++ b/modules/hm/common/dev/editor/dbeaver.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.editor.dbeaver; + cfg = config.modules.hm.dev.editor.dbeaver; in { - options.modules.common.dev.editor.dbeaver = { + options.modules.hm.dev.editor.dbeaver = { enable = lib.mkEnableOption "Enable DBeaver database management tool"; }; diff --git a/modules/hm/common/dev/editor/jetbrains.nix b/modules/hm/common/dev/editor/jetbrains.nix index 990d11b..cee4d15 100644 --- a/modules/hm/common/dev/editor/jetbrains.nix +++ b/modules/hm/common/dev/editor/jetbrains.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.editor.jetbrains; + cfg = config.modules.hm.dev.editor.jetbrains; in { - options.modules.common.dev.editor.jetbrains = { + options.modules.hm.dev.editor.jetbrains = { enable = lib.mkEnableOption "Enable JetBrains IDEs for development"; ides = lib.mkOption { @@ -15,11 +15,12 @@ in }; config = lib.mkIf cfg.enable { - home.packages = lib.optionals (cfg.ides != []) (lib.concatMap (ide: - let - idePackage = builtins.getAttr ide pkgs.jetbrains; - in - [ idePackage ] - ) cfg.ides); + home.packages = lib.optionals (cfg.ides != []) + (lib.concatMap (ide: + let + idePackage = builtins.getAttr ide pkgs.jetbrains; + in + [ idePackage ] + ) (lib.unique cfg.ides)); }; } diff --git a/modules/hm/common/dev/editor/vs-code.nix b/modules/hm/common/dev/editor/vs-code.nix index b150aac..5f2c2e0 100644 --- a/modules/hm/common/dev/editor/vs-code.nix +++ b/modules/hm/common/dev/editor/vs-code.nix @@ -1,11 +1,11 @@ { config, lib, pkgs, vars, ... }: let - cfg = config.modules.common.dev.editor.vs-code; + cfg = config.modules.hm.dev.editor.vs-code; in { # Add options for vs-code - options.modules.common.dev.editor.vs-code = { + options.modules.hm.dev.editor.vs-code = { enable = lib.mkEnableOption "Enable Visual Studio Code for development"; }; diff --git a/modules/hm/common/dev/global-tools/act-github.nix b/modules/hm/common/dev/global-tools/act-github.nix index 6c0d317..61f8c56 100644 --- a/modules/hm/common/dev/global-tools/act-github.nix +++ b/modules/hm/common/dev/global-tools/act-github.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.global-tools.act-github; + cfg = config.modules.hm.dev.global-tools.act-github; in { - options.modules.common.dev.global-tools.act-github = { + options.modules.hm.dev.global-tools.act-github = { enable = lib.mkEnableOption "Enable act for running GitHub Actions locally"; }; diff --git a/modules/hm/common/dev/global-tools/cli.nix b/modules/hm/common/dev/global-tools/cli.nix index 0141a82..ce51bd4 100644 --- a/modules/hm/common/dev/global-tools/cli.nix +++ b/modules/hm/common/dev/global-tools/cli.nix @@ -1,22 +1,29 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.global-tools.cli; + cfg = config.modules.hm.dev.global-tools; + + # Map CLI tools to their packages + cliToPackage = with pkgs; { + vercel = nodePackages.vercel; + graphite = graphite-cli; + }; + + # Get packages for enabled CLI tools + cliPackages = lib.filter (pkg: pkg != null) + (map (tool: cliToPackage.${tool} or null) cfg.cli); + in { - options.modules.common.dev.global-tools.cli = { - - elements = lib.mkOption { - type = lib.types.listOf (lib.types.enum ["vercel" "graphite"]); + options.modules.hm.dev.global-tools = { + cli = lib.mkOption { + type = lib.types.listOf (lib.types.enum (lib.attrNames cliToPackage)); default = []; description = "List of CLI tools to install"; }; }; config = { - home.packages = (with pkgs; - lib.optional (lib.elem "vercel" cfg.elements) nodePackages.vercel ++ - lib.optional (lib.elem "graphite" cfg.elements) graphite-cli - ); + home.packages = lib.unique cliPackages; }; -} +} \ No newline at end of file diff --git a/modules/hm/common/dev/global-tools/nix.nix b/modules/hm/common/dev/global-tools/nix.nix index c82f82d..c5bc2c8 100755 --- a/modules/hm/common/dev/global-tools/nix.nix +++ b/modules/hm/common/dev/global-tools/nix.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.global-tools.nix; + cfg = config.modules.hm.dev.global-tools.nix; in { - options.modules.common.dev.global-tools.nix = { + options.modules.hm.dev.global-tools.nix = { enable = lib.mkEnableOption "Enable Nix development environment"; }; diff --git a/modules/hm/common/dev/node/node.nix b/modules/hm/common/dev/node/node.nix index 72ea43a..d243733 100644 --- a/modules/hm/common/dev/node/node.nix +++ b/modules/hm/common/dev/node/node.nix @@ -1,7 +1,7 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.node; + cfg = config.modules.hm.dev.node; expandPath = path: if lib.hasPrefix "~/" path then "${config.home.homeDirectory}/${lib.removePrefix "~/" path}" @@ -27,7 +27,7 @@ let allNodePackages = lib.flatten (map nodeWithPackageManager cfg.versions) ++ (map (pkgName: pkgs.${pkgName}) cfg.extraPackages); in { - options.modules.common.dev.node = { + options.modules.hm.dev.node = { enable = lib.mkEnableOption "Enable Node.js development environment"; packageManager = lib.mkOption { type = lib.types.enum [ "pnpm" "yarn" "npm" ]; diff --git a/modules/hm/common/dev/node/pm2.nix b/modules/hm/common/dev/node/pm2.nix index b9e83ee..3f8de7e 100644 --- a/modules/hm/common/dev/node/pm2.nix +++ b/modules/hm/common/dev/node/pm2.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.node.pm2; + cfg = config.modules.hm.dev.node.pm2; in { - options.modules.common.dev.node.pm2 = { + options.modules.hm.dev.node.pm2 = { enable = lib.mkEnableOption "Enable PM2 process manager for Node.js applications"; }; diff --git a/modules/hm/common/dev/node/prisma.nix b/modules/hm/common/dev/node/prisma.nix index 1f2219f..5844966 100644 --- a/modules/hm/common/dev/node/prisma.nix +++ b/modules/hm/common/dev/node/prisma.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.node.prisma; + cfg = config.modules.hm.dev.node.prisma; in { - options.modules.common.dev.node.prisma = { + options.modules.hm.dev.node.prisma = { enable = lib.mkEnableOption "Enable Prisma ORM for Node.js applications"; }; @@ -13,5 +13,13 @@ in home.packages = (with pkgs; [ prisma ]); + + home.sessionVariables = { + PRISMA_SCHEMA_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/schema-engine"; + PRISMA_QUERY_ENGINE_BINARY = "${pkgs.prisma-engines}/bin/query-engine"; + PRISMA_QUERY_ENGINE_LIBRARY = "${pkgs.prisma-engines}/lib/libquery_engine.node"; + PRISMA_FMT_BINARY = "${pkgs.prisma-engines}/bin/prisma-fmt"; + PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING = 1; + }; }; } diff --git a/modules/hm/common/dev/python.nix b/modules/hm/common/dev/python.nix index bbb1480..92ad47e 100644 --- a/modules/hm/common/dev/python.nix +++ b/modules/hm/common/dev/python.nix @@ -2,14 +2,7 @@ let # Shorthand for accessing module config - cfg = config.modules.common.dev.python; - - # add home directory to devShell.shellPaths if not already present - homePath = cfg.devShell.defaultPath; # or: builtins.toString config.home.homeDirectory - devShellPaths = lib.unique ( - (lib.optionals (cfg.devShell.shellPaths == []) [ homePath ]) - ++ cfg.devShell.shellPaths - ); + cfg = config.modules.hm.dev.python; # Function to get the required Python version with pipx, pip, and extra packages pythonWithPipx = version: let @@ -32,38 +25,8 @@ let # Flattened list of all selected Python versions with extras allPythonPackages = lib.flatten (map pythonWithPipx cfg.versions); - # Template for shell.nix content - shellNixText = '' - let - pkgs = import {}; - python = pkgs.${"python" + cfg.defaultVersion}; - in - pkgs.mkShell { - buildInputs = [ - python - python.pkgs.pip - python.pkgs.pipx - ${lib.concatMapStringsSep "\n " (pkg: "python.pkgs.${pkg}") cfg.extraPackages} - ]; - - shellHook = ''' - if [ -f "pyproject.toml" ] || [ -f "requirements.txt" ]; then - if [ ! -d ".venv" ]; then - echo "🔧 No .venv found. Creating it..." - python -m venv .venv - fi - - source .venv/bin/activate - echo "🐍 Activated .venv" - else - echo "⚠️ No pyproject.toml or requirements.txt found, skipping .venv auto-activation." - fi - '''; - } - ''; - in { - options.modules.common.dev.python = { + options.modules.hm.dev.python = { # Main toggle enable = lib.mkEnableOption "Enable Python development environment"; @@ -92,62 +55,43 @@ in { poetry.enable = lib.mkEnableOption "Install Poetry"; pdm.enable = lib.mkEnableOption "Install PDM"; tools.enable = lib.mkEnableOption "Install dev tools (pytest, black, flake8)"; - - # Dev shell generation - devShell = { - enable = lib.mkEnableOption "Generate a shell.nix file"; - defaultPath = lib.mkOption { - type = lib.types.str; - default = "./Templates"; - description = "Default path for shell.nix generation"; - }; - - # Additional paths to generate shell.nix in (besides $HOME) - shellPaths = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = []; - description = "Additional relative paths to create shell.nix (besides home)"; - }; - }; }; # Actual config if module is enabled config = lib.mkIf cfg.enable { # Install core packages and optional tools - home.packages = - allPythonPackages - ++ lib.optional cfg.poetry.enable pkgs.poetry - ++ lib.optional cfg.pdm.enable pkgs.pdm - ++ lib.optionals cfg.tools.enable [ - pkgs."python${cfg.defaultVersion}Packages".black - pkgs."python${cfg.defaultVersion}Packages".flake8 - pkgs."python${cfg.defaultVersion}Packages".pytest - ]; - - # Files to write to the home directory - home.file = lib.mkMerge ( - [ - { - ".config/profile.d/python-aliases.sh".text = '' - export PATH=${pkgs."python${cfg.defaultVersion}"}/bin:$PATH - alias py="python" - alias pipx="pipx" - alias pip="pip" - alias pyclean="find . -type f -name '*.py[co]' -delete" - alias pytest="python -m pytest" - ''; - } - ] - ++ - (lib.optionals cfg.devShell.enable ( - map (path: { - "${path}/shell.nix" = { - text = shellNixText; - force = true; - mutable = true; - }; - }) devShellPaths - )) - ); + home = { + packages = + allPythonPackages + ++ lib.optional cfg.poetry.enable pkgs.poetry + ++ lib.optional cfg.pdm.enable pkgs.pdm + ++ lib.optionals cfg.tools.enable [ + pkgs."python${cfg.defaultVersion}Packages".black + pkgs."python${cfg.defaultVersion}Packages".flake8 + pkgs."python${cfg.defaultVersion}Packages".pytest + ]; + + # Files to write to the home directory + file = lib.mkMerge ( + [ + { + ".config/profile.d/python-aliases.sh".text = '' + export PATH=${pkgs."python${cfg.defaultVersion}"}/bin:$PATH + alias py="python" + alias pipx="pipx" + alias pip="pip" + alias pyclean="find . -type f -name '*.py[co]' -delete" + alias pytest="python -m pytest" + ''; + } + ] + ); + # Shell aliases + shellAliases = { + py = "python"; + pyclean = "find . -type f -name '*.py[co]' -delete"; + pytest = "python -m pytest"; + }; + }; }; } diff --git a/modules/hm/common/dev/rust.nix b/modules/hm/common/dev/rust.nix index 8a37b2c..a39a730 100644 --- a/modules/hm/common/dev/rust.nix +++ b/modules/hm/common/dev/rust.nix @@ -1,15 +1,17 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.dev.rust; + cfg = config.modules.hm.dev.rust; rustDefaultPackages = with pkgs; [rustc cargo rust-analyzer clippy rustfmt]; - rustPackages = rustDefaultPackages ++ (map (pkgName: pkgs.${pkgName}) cfg.extraPackages); + rustPackages = rustDefaultPackages + ++ (map (pkgName: pkgs.${pkgName} or (abort "Unknown Rust pkg: ${pkgName}")) + cfg.extraPackages); in { - options.modules.common.dev.rust = { + options.modules.hm.dev.rust = { enable = lib.mkEnableOption "Enable Rust development environment"; extraPackages = lib.mkOption { type = lib.types.listOf lib.types.package; diff --git a/modules/hm/common/documentation/default.nix b/modules/hm/common/documentation/default.nix index d27afca..1e5d901 100644 --- a/modules/hm/common/documentation/default.nix +++ b/modules/hm/common/documentation/default.nix @@ -1,21 +1,29 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.documentation; + cfg = config.modules.hm.documentation; + + # Map document editors to their packages + editorsToPackage = with pkgs; { + onlyoffice = onlyoffice-bin; + okular = okular; + }; + + # Get packages for enabled editors + editorsPackages = lib.unique (lib.filter (pkg: pkg != null) + (map (e: editorsToPackage.${e} or null) cfg.editors)); + in { - options.modules.common.documentation = { - editor = lib.mkOption { - type = lib.types.listOf (lib.types.enum ["onlyoffice" "okular"]); + options.modules.hm.documentation = { + editors = lib.mkOption { + type = lib.types.listOf (lib.types.enum (lib.attrNames editorsToPackage)); default = []; description = "List of document editors to install"; }; }; config = { - home.packages = with pkgs; ( - (lib.optional (lib.elem "onlyoffice" cfg.editor) onlyoffice-bin) ++ - (lib.optional (lib.elem "okular" cfg.editor) okular) - ); + home.packages = editorsPackages; }; -} +} \ No newline at end of file diff --git a/modules/hm/common/documentation/obsidian.nix b/modules/hm/common/documentation/obsidian.nix index 76b8e71..fa30aa6 100644 --- a/modules/hm/common/documentation/obsidian.nix +++ b/modules/hm/common/documentation/obsidian.nix @@ -1,12 +1,12 @@ { config, lib, pkgs, ... }: let - cfg = config.modules.common.documentation.obsidian; + cfg = config.modules.hm.documentation.obsidian; #──────── Canonical default ────────# defaultObsiPath = let dflt = builtins.getEnv "XDG_DOCUMENTS_DIR"; - in if dflt == "" then "$HOME/Documents" else dflt; + in if dflt == "" then "${config.home.homeDirectory}/Documents" else dflt; /*────────────────────────── │ Assets (theme & colors) │ @@ -119,7 +119,7 @@ in /*────────────────────────── │ Module options │ └──────────────────────────*/ - options.modules.common.documentation.obsidian = { + options.modules.hm.documentation.obsidian = { enable = lib.mkEnableOption "Enable the Obsidian module"; backupMethod = lib.mkOption { diff --git a/modules/hm/common/emulator/default.nix b/modules/hm/common/emulator/default.nix index 7d533b9..1b4e41f 100644 --- a/modules/hm/common/emulator/default.nix +++ b/modules/hm/common/emulator/default.nix @@ -1,15 +1,41 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.emulator; -in -{ - options.modules.common.emulator = { - enable = lib.mkEnableOption "Enable emulators for running Windows applications and games on Linux"; + cfg = config.modules.hm.emulator; + # Map emulators to their packages + emulatorToPackage = with pkgs; { + playonlinux = [ playonlinux ]; + bottles = [ bottles ]; + dosbox = [ dosbox ]; + }; + + # Wine packages based on version + winePackages = with pkgs; { + stable = wine; + wayland = wineWayland; + fonts = wine; + }; + + # Proton packages + protonPackages = with pkgs; [ + protonup-qt + protontricks + ]; + + # Get packages for enabled emulators + baseEmulatorPackages = lib.concatMap (emulator: emulatorToPackage.${emulator} or []) cfg.emulators; + + # Additional packages based on configuration + additionalPackages = with pkgs; [] + ++ lib.optionals cfg.wine.enable [ (winePackages.${cfg.wine.version} or pkgs.wine) winetricks ] + ++ lib.optionals cfg.proton.enable protonPackages; + +in { + options.modules.hm.emulator = { emulators = lib.mkOption { type = lib.types.listOf (lib.types.enum ["playonlinux" "proton" "wine" "bottles" "dosbox"]); - default = ["wine"]; + default = []; description = "List of emulators to enable"; }; @@ -20,10 +46,10 @@ in defaultText = "true if 'wine' is in emulators list"; description = "Enable Wine Windows compatibility layer"; }; - + version = lib.mkOption { - type = lib.types.enum ["stable" "staging" "wayland" "fonts"]; - default = "staging"; + type = lib.types.enum ["stable" "wayland" "fonts"]; + default = "stable"; description = "Wine version to install"; }; @@ -44,38 +70,8 @@ in }; }; - config = lib.mkIf cfg.enable { - home.packages = with pkgs; ( - # Wine ecosystem - (lib.optionals (cfg.wine.enable) [ - ({ - stable = wine; - staging = wineStaging; - wayland = wineWayland; - }.${cfg.wine.version} or wine) - winetricks - ]) ++ - - # PlayOnLinux - (lib.optionals (lib.elem "playonlinux" cfg.emulators) [ - playonlinux - ]) ++ - - # Proton - (lib.optionals (cfg.proton.enable) [ - protonup-qt - protontricks - ]) ++ - - (lib.optionals (lib.elem "bottles" cfg.emulators) [ - bottles - ]) ++ - - # DOS emulation - (lib.optionals (lib.elem "dosbox" cfg.emulators) [ - dosbox - ]) - ); + config = { + home.packages = lib.unique (baseEmulatorPackages ++ additionalPackages); # Environment variables for Wine/Proton home.sessionVariables = lib.mkIf (cfg.wine.enable || cfg.proton.enable) { diff --git a/modules/hm/common/engine/default.nix b/modules/hm/common/engine/default.nix index 135a702..e98b14a 100644 --- a/modules/hm/common/engine/default.nix +++ b/modules/hm/common/engine/default.nix @@ -1,20 +1,26 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common; -in -{ - options.modules.common = { + cfg = config.modules.hm; + + # Map game engines to their packages + engineToPackage = with pkgs; { + unity = [ unityhub ]; + }; + + # Get packages for enabled engines + enginePackages = lib.concatMap (engine: engineToPackage.${engine} or []) cfg.engine; + +in { + options.modules.hm = { engine = lib.mkOption { - type = lib.types.listOf (lib.types.enum ["unity"]); + type = lib.types.listOf (lib.types.enum (lib.attrNames engineToPackage)); default = []; description = "List of game engines to install"; }; }; config = { - home.packages = with pkgs; ( - (lib.optionals (lib.elem "unity" cfg.engine) [unityhub]) - ); + home.packages = enginePackages; }; -} +} \ No newline at end of file diff --git a/modules/hm/common/extra/ignore-file-retriever.nix b/modules/hm/common/extra/ignore-file-retriever.nix index 1a222f9..eec0e09 100644 --- a/modules/hm/common/extra/ignore-file-retriever.nix +++ b/modules/hm/common/extra/ignore-file-retriever.nix @@ -1,12 +1,14 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.extra.ignore-file-retriever; + cfg = config.modules.hm.extra.ignore-file-retriever; - expandPath = path: if lib.hasPrefix "~/" path then - lib.removeSuffix "/" (lib.replacePrefix "~/" "${config.home.homeDirectory}/" path) + expandPath = path: let + normalized = lib.removeSuffix "/" path; + in if lib.hasPrefix "~/" normalized then + config.home.homeDirectory + (lib.removePrefix "~/" normalized) else - lib.removeSuffix "/" path; + normalized; templatePath = expandPath cfg.templatePath; outputPath = expandPath cfg.outputPath; @@ -64,15 +66,15 @@ let # Handle directory patterns if [[ "$pattern" =~ /$ ]]; then - echo "${rel_path}${pattern}" >> "$TMP_FILE" + echo "''${rel_path}''${pattern}" >> "$TMP_FILE" else # Handle normal patterns with proper directory prefix if [[ "$pattern" =~ / ]]; then # Pattern contains subdirectories - echo "${rel_path}${pattern}" >> "$TMP_FILE" + echo "''${rel_path}''${pattern}" >> "$TMP_FILE" else # Simple pattern applies to all levels - echo "**/${pattern}" >> "$TMP_FILE" + echo "**/''${pattern}" >> "$TMP_FILE" fi fi done < "$gitignore" @@ -86,7 +88,7 @@ let ''; in { - options.modules.common.extra.ignore-file-retriever = { + options.modules.hm.extra.ignore-file-retriever = { enable = lib.mkEnableOption "Enable ignore file retriever script to create .stignore from .gitignore patterns"; templatePath = lib.mkOption { diff --git a/modules/hm/common/games/games.nix b/modules/hm/common/games/games.nix new file mode 100644 index 0000000..d044a24 --- /dev/null +++ b/modules/hm/common/games/games.nix @@ -0,0 +1,48 @@ +{ config, lib, pkgs, inputs, ... }: + +let + cfg = config.modules.hm.games; + + # Define all available games + availableGames = { + minecraft = { + packages = with pkgs; [ prismlauncher jdk17 gcc glibc ]; + description = "Minecraft Launcher with PrismLauncher"; + }; + northstar = { + packages = with inputs.nix-gaming.packages.${pkgs.system}; [ northstar-proton viper ]; + description = "Northstar (Titanfall 2 mod) with Proton and Viper"; + }; + roblox = { + packages = with inputs.nix-gaming.packages.${pkgs.system}; [ roblox-player ]; + description = "Roblox Player"; + }; + rocket-league = { + packages = with inputs.nix-gaming.packages.${pkgs.system}; [ rocket-league ]; + description = "Rocket League via nix-gaming"; + }; + star-citizen = { + packages = with inputs.nix-gaming.packages.${pkgs.system}; [ star-citizen ]; + description = "Star Citizen Launcher"; + }; + }; + + # Get list of game names for the enum type + gameNames = builtins.attrNames availableGames; + + # Get packages for enabled games + gamePackages = lib.unique (lib.concatMap (game: availableGames.${game}.packages) cfg.enabledGames); + +in { + options.modules.hm.games = { + enabledGames = lib.mkOption { + type = lib.types.listOf (lib.types.enum gameNames); + default = []; + description = "List of games to enable"; + }; + }; + + config = lib.mkIf (cfg.enabledGames != []) { + home.packages = gamePackages; + }; +} \ No newline at end of file diff --git a/modules/hm/common/games/joystick.nix b/modules/hm/common/games/joystick.nix new file mode 100644 index 0000000..de67fcc --- /dev/null +++ b/modules/hm/common/games/joystick.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.modules.hm.games.joystick; +in +{ + options.modules.hm.games.joystick = { + enable = lib.mkEnableOption "Enable Joystick support for games"; + }; + + config = lib.mkIf cfg.enable { + home.packages = (with pkgs; [ + joystickwake + qjoypad + ]); + }; +} diff --git a/modules/hm/common/games/mangohud.nix b/modules/hm/common/games/mangohud.nix index 76de1a0..d11f6fb 100644 --- a/modules/hm/common/games/mangohud.nix +++ b/modules/hm/common/games/mangohud.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.games.mangohud; + cfg = config.modules.hm.games.mangohud; in { - options.modules.common.games.mangohud = { + options.modules.hm.games.mangohud = { enable = lib.mkEnableOption "Enable MangoHud, a Vulkan and OpenGL overlay layer for monitoring performance"; cpu_text = lib.mkOption { type = lib.types.str; diff --git a/modules/hm/common/games/minecraft.nix b/modules/hm/common/games/minecraft.nix deleted file mode 100755 index 180953b..0000000 --- a/modules/hm/common/games/minecraft.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ config, lib, pkgs, ... }: - -let - cfg = config.modules.common.games.minecraft; -in -{ - options.modules.common.games.minecraft = { - enable = lib.mkEnableOption "Enable Minecraft Launcher"; - }; - - config = lib.mkIf cfg.enable { - home.packages = (with pkgs; [ - prismlauncher - jdk17 - gcc - glibc - ]); - }; -} diff --git a/modules/hm/common/games/northstar.nix b/modules/hm/common/games/northstar.nix deleted file mode 100644 index 7908369..0000000 --- a/modules/hm/common/games/northstar.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, lib, pkgs, inputs, ... }: - -let - cfg = config.modules.common.games.northstar; -in -{ - options.modules.common.games.northstar = { - enable = lib.mkEnableOption "Enable Northstar (Titanfall 2 mod) with Proton and Viper"; - }; - - config = lib.mkIf cfg.enable { - home.packages = (with pkgs; [ - inputs.nix-gaming.packages.${pkgs.system}.northstar-proton - inputs.nix-gaming.packages.${pkgs.system}.viper - ]); - }; -} diff --git a/modules/hm/common/games/roblox.nix b/modules/hm/common/games/roblox.nix deleted file mode 100644 index b76d7d5..0000000 --- a/modules/hm/common/games/roblox.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, pkgs, inputs, ... }: - -let - cfg = config.modules.common.games.roblox; -in -{ - options.modules.common.games.roblox = { - enable = lib.mkEnableOption "Enable Roblox Player"; - }; - - config = lib.mkIf cfg.enable { - home.packages = (with pkgs; [ - inputs.nix-gaming.packages.${pkgs.system}.roblox-player - ]); - }; -} diff --git a/modules/hm/common/games/rocket-league.nix b/modules/hm/common/games/rocket-league.nix deleted file mode 100644 index 90c8e44..0000000 --- a/modules/hm/common/games/rocket-league.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, pkgs, inputs, ... }: - -let - cfg = config.modules.common.games.rocket-league; -in -{ - options.modules.common.games.rocket-league = { - enable = lib.mkEnableOption "Enable Rocket League game installation via nix-gaming"; - }; - - config = lib.mkIf cfg.enable { - home.packages = (with pkgs; [ - inputs.nix-gaming.packages.${pkgs.system}.rocket-league - ]); - }; -} diff --git a/modules/hm/common/games/star-citizen.nix b/modules/hm/common/games/star-citizen.nix deleted file mode 100644 index d82d292..0000000 --- a/modules/hm/common/games/star-citizen.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, pkgs, inputs, ... }: - -let - cfg = config.modules.common.games.star-citizen; -in -{ - options.modules.common.games.star-citizen = { - enable = lib.mkEnableOption "Enable Star Citizen Launcher"; - }; - - config = lib.mkIf cfg.enable { - home.packages = (with pkgs; [ - inputs.nix-gaming.packages.${pkgs.system}.star-citizen - ]); - }; -} diff --git a/modules/hm/common/multimedia/gimp.nix b/modules/hm/common/multimedia/gimp.nix index caf246f..95a92e0 100644 --- a/modules/hm/common/multimedia/gimp.nix +++ b/modules/hm/common/multimedia/gimp.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.multimedia.gimp; + cfg = config.modules.hm.multimedia.gimp; in { - options.modules.common.multimedia.gimp = { + options.modules.hm.multimedia.gimp = { enable = lib.mkEnableOption "Enable GIMP image editor"; }; diff --git a/modules/hm/common/multimedia/mpv.nix b/modules/hm/common/multimedia/mpv.nix index f671596..0dc8479 100644 --- a/modules/hm/common/multimedia/mpv.nix +++ b/modules/hm/common/multimedia/mpv.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.multimedia.mpv; + cfg = config.modules.hm.multimedia.mpv; in { - options.modules.common.multimedia.mpv = { + options.modules.hm.multimedia.mpv = { enable = lib.mkEnableOption "Enable mpv media player with custom scripts"; }; diff --git a/modules/hm/common/multimedia/obs.nix b/modules/hm/common/multimedia/obs.nix index 0660555..d972804 100755 --- a/modules/hm/common/multimedia/obs.nix +++ b/modules/hm/common/multimedia/obs.nix @@ -1,10 +1,10 @@ { pkgs, config, lib, ... }: let - cfg = config.modules.common.multimedia.obs; + cfg = config.modules.hm.multimedia.obs; in { - options.modules.common.multimedia.obs = { + options.modules.hm.multimedia.obs = { enable = lib.mkEnableOption "Enable OBS Studio for video recording and streaming"; }; diff --git a/modules/hm/common/multimedia/openshot-qt.nix b/modules/hm/common/multimedia/openshot-qt.nix index d47fee5..695d98b 100644 --- a/modules/hm/common/multimedia/openshot-qt.nix +++ b/modules/hm/common/multimedia/openshot-qt.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.multimedia.openshot-qt; + cfg = config.modules.hm.multimedia.openshot-qt; in { - options.modules.common.multimedia.openshot-qt = { + options.modules.hm.multimedia.openshot-qt = { enable = lib.mkEnableOption "Enable OpenShot video editor"; }; diff --git a/modules/hm/common/multimedia/parsec.nix b/modules/hm/common/multimedia/parsec.nix index 696243d..b9234ba 100644 --- a/modules/hm/common/multimedia/parsec.nix +++ b/modules/hm/common/multimedia/parsec.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.multimedia.parsec; + cfg = config.modules.hm.multimedia.parsec; in { - options.modules.common.multimedia.parsec = { + options.modules.hm.multimedia.parsec = { enable = lib.mkEnableOption "Enable Parsec for remote desktop access"; }; diff --git a/modules/hm/common/multimedia/stremio.nix b/modules/hm/common/multimedia/stremio.nix index 9386488..092328a 100644 --- a/modules/hm/common/multimedia/stremio.nix +++ b/modules/hm/common/multimedia/stremio.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.multimedia.stremio; + cfg = config.modules.hm.multimedia.stremio; in { - options.modules.common.multimedia.stremio = { + options.modules.hm.multimedia.stremio = { enable = lib.mkEnableOption "Enable Stremio media center"; }; diff --git a/modules/hm/common/network/tunnel.nix b/modules/hm/common/network/tunnel.nix index 0a04c91..21fd85d 100644 --- a/modules/hm/common/network/tunnel.nix +++ b/modules/hm/common/network/tunnel.nix @@ -1,8 +1,16 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.network.tunnel; - + cfg = config.modules.hm.network.tunnel; + + # Map services to their packages + servicesToPackage = with pkgs; { + localtunnel = [ nodePackages.localtunnel ]; + cloudflare = [ cloudflared ]; + ngrok = [ ngrok ]; + }; + + # Tunnel command aliases tunnelAliases = { localtunnel = { ltn = "npx localtunnel --port ${toString cfg.localtunnel.port}"; @@ -17,16 +25,34 @@ let }; }; + # Get packages for enabled services + servicesPackages = lib.concatMap (service: servicesToPackage.${service} or []) cfg.services; + + # Get aliases for enabled services enabledAliases = lib.foldl (acc: service: acc // (tunnelAliases.${service} or {}) - ) {} cfg.service; -in -{ - options.modules.common.network.tunnel = { - enable = lib.mkEnableOption "Enable network tunneling for development"; + ) {} cfg.services; + + # Cloudflare token configuration + cloudflareTokenConfig = lib.mkIf (builtins.elem "cloudflare" cfg.services && cfg.cloudflare.tokenPath != null) { + home.sessionVariables.CLOUDFLARE_TOKEN_FILE = cfg.cloudflare.tokenPath; + home.file.".cloudflared/token" = { + source = cfg.cloudflare.tokenPath; + target.recursive = true; + }; + }; - service = lib.mkOption { - type = lib.types.listOf (lib.types.enum ["localtunnel" "cloudflare" "ngrok"]); + ngrokConfig = lib.mkIf (builtins.elem "ngrok" cfg.services && cfg.ngrok.configPath != null) { + home.file.".config/ngrok/ngrok.yml" = { + source = cfg.ngrok.configPath; + target.recursive = true; + }; + }; + +in { + options.modules.hm.network.tunnel = { + services = lib.mkOption { + type = lib.types.listOf (lib.types.enum (lib.attrNames servicesToPackage)); default = ["localtunnel"]; description = "List of tunneling services to enable"; }; @@ -66,26 +92,13 @@ in }; }; - config = lib.mkIf cfg.enable { - home.packages = with pkgs; ( - (lib.optionals (builtins.elem "localtunnel" cfg.service) [ nodePackages.localtunnel ]) ++ - (lib.optionals (builtins.elem "cloudflare" cfg.service) [ cloudflared ]) ++ - (lib.optionals (builtins.elem "ngrok" cfg.service) [ ngrok ]) - ); - - home.shellAliases = enabledAliases; + config = lib.mkMerge [ + { + home.packages = lib.unique servicesPackages; + home.shellAliases = enabledAliases; + } - home.sessionVariables = lib.mkIf (builtins.elem "cloudflare" cfg.service && cfg.cloudflare.tokenPath != null) { - CLOUDFLARE_TOKEN_FILE = cfg.cloudflare.tokenPath; - }; - - home.file = lib.mkMerge [ - (lib.mkIf (builtins.elem "cloudflare" cfg.service && cfg.cloudflare.tokenPath != null) { - ".cloudflared/token".source = cfg.cloudflare.tokenPath; - }) - (lib.mkIf (builtins.elem "ngrok" cfg.service && cfg.ngrok.configPath != null) { - ".config/ngrok/ngrok.yml".source = cfg.ngrok.configPath; - }) - ]; - }; + cloudflareTokenConfig + ngrokConfig + ]; } \ No newline at end of file diff --git a/modules/hm/common/shell/btop.nix b/modules/hm/common/shell/btop.nix index f5712e5..5298165 100644 --- a/modules/hm/common/shell/btop.nix +++ b/modules/hm/common/shell/btop.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.shell.btop; + cfg = config.modules.hm.shell.btop; in { - options.modules.common.shell.btop = { + options.modules.hm.shell.btop = { enable = lib.mkEnableOption "Enable btop system monitor"; }; diff --git a/modules/hm/common/shell/disk-usage.nix b/modules/hm/common/shell/disk-usage.nix index 7718d4c..27d2c18 100644 --- a/modules/hm/common/shell/disk-usage.nix +++ b/modules/hm/common/shell/disk-usage.nix @@ -1,19 +1,32 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.shell.disk-usage; - validTools = [ "ncdu" "diskonaut" "gdu" "dust" "parallel-disk-usage" "squirreldisk" ]; -in -{ - options.modules.common.shell.disk-usage = { + cfg = config.modules.hm.shell.disk-usage; + + # Map disk usage tools to their packages + toolToPackage = with pkgs; { + ncdu = ncdu; + diskonaut = diskonaut; + gdu = gdu; + dust = dust; + parallel-disk-usage = parallel-disk-usage; + squirreldisk = squirreldisk; + }; + + # Get packages for enabled tools + toolPackages = lib.filter (pkg: pkg != null) + (map (tool: toolToPackage.${tool} or null) cfg.tools); + +in { + options.modules.hm.shell.disk-usage = { tools = lib.mkOption { - type = lib.types.listOf (lib.types.enum validTools); + type = lib.types.listOf (lib.types.enum (lib.attrNames toolToPackage)); default = []; - description = "List of disk usage analyzers to install."; + description = "List of disk usage analyzers to install"; }; }; - config = lib.mkIf cfg.enable { - home.packages = builtins.map (tool: pkgs.${tool}) cfg.tools; + config = { + home.packages = toolPackages; }; } \ No newline at end of file diff --git a/modules/hm/common/shell/fzf.nix b/modules/hm/common/shell/fzf.nix index edfcd33..35e1f31 100644 --- a/modules/hm/common/shell/fzf.nix +++ b/modules/hm/common/shell/fzf.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.shell.fzf; + cfg = config.modules.hm.shell.fzf; in { - options.modules.common.shell.fzf = { + options.modules.hm.shell.fzf = { enable = lib.mkEnableOption "Enable FZF (fuzzy finder)"; }; diff --git a/modules/hm/common/shell/navi.nix b/modules/hm/common/shell/navi.nix index 49c089b..4e2ea17 100644 --- a/modules/hm/common/shell/navi.nix +++ b/modules/hm/common/shell/navi.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.shell.navi; + cfg = config.modules.hm.shell.navi; in { - options.modules.common.shell.navi = { + options.modules.hm.shell.navi = { enable = lib.mkEnableOption "Enable Navi (CLI cheat sheet tool)"; }; diff --git a/modules/hm/common/shell/ranger.nix b/modules/hm/common/shell/ranger.nix index 0fe65f4..83e988c 100644 --- a/modules/hm/common/shell/ranger.nix +++ b/modules/hm/common/shell/ranger.nix @@ -1,14 +1,14 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.shell.ranger; + cfg = config.modules.hm.shell.ranger; in { - options.modules.common.shell.ranger = { + options.modules.hm.shell.ranger = { enable = lib.mkEnableOption "Enable Ranger (file manager)"; }; - config = lib.mkIf config.modules.common.shell.ranger.enable { + config = lib.mkIf cfg.enable { home.packages = (with pkgs; [ ranger ]); diff --git a/modules/hm/common/shell/starship.nix b/modules/hm/common/shell/starship.nix index 121143f..3238df9 100644 --- a/modules/hm/common/shell/starship.nix +++ b/modules/hm/common/shell/starship.nix @@ -6,10 +6,10 @@ ... }: let - cfg = config.modules.common.shell.starship; + cfg = config.modules.hm.shell.starship; in { - options.modules.common.shell.starship = { + options.modules.hm.shell.starship = { enable = lib.mkEnableOption "Enable Starship (cross-shell prompt)"; }; diff --git a/modules/hm/common/shell/tools.nix b/modules/hm/common/shell/tools.nix index 7cc25f5..39b1b8a 100644 --- a/modules/hm/common/shell/tools.nix +++ b/modules/hm/common/shell/tools.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.shell.tools; + cfg = config.modules.hm.shell.tools; in { - options.modules.common.shell.tools = { + options.modules.hm.shell.tools = { enable = lib.mkEnableOption "Enable common shell tools"; }; diff --git a/modules/hm/common/utilities/filezilla.nix b/modules/hm/common/utilities/filezilla.nix index 795e2b3..96a9958 100644 --- a/modules/hm/common/utilities/filezilla.nix +++ b/modules/hm/common/utilities/filezilla.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.utilities.filezilla; + cfg = config.modules.hm.utilities.filezilla; in { - options.modules.common.utilities.filezilla = { + options.modules.hm.utilities.filezilla = { enable = lib.mkEnableOption "Enable FileZilla (FTP client)"; }; diff --git a/modules/hm/common/utilities/kde-connect.nix b/modules/hm/common/utilities/kde-connect.nix index 68dd37b..ffa0dd8 100644 --- a/modules/hm/common/utilities/kde-connect.nix +++ b/modules/hm/common/utilities/kde-connect.nix @@ -3,10 +3,10 @@ with lib; let - cfg = config.modules.common.utilities.kde-connect; + cfg = config.modules.hm.utilities.kde-connect; in { - options.modules.common.utilities.kde-connect = { + options.modules.hm.utilities.kde-connect = { enable = mkEnableOption "KDE Connect"; indicator = mkOption { type = types.bool; diff --git a/modules/hm/common/utilities/scalar.nix b/modules/hm/common/utilities/scalar.nix index f8eb9c8..79de38a 100644 --- a/modules/hm/common/utilities/scalar.nix +++ b/modules/hm/common/utilities/scalar.nix @@ -3,7 +3,7 @@ with lib; let - cfg = config.modules.common.utilities.scalar; + cfg = config.modules.hm.utilities.scalar; scalar-deb = pkgs.fetchurl { url = "https://download.scalar.com/linux/deb/x64"; @@ -62,7 +62,7 @@ let }; in { - options.modules.common.utilities.scalar = { + options.modules.hm.utilities.scalar = { enable = mkEnableOption "Scalar desktop application"; }; diff --git a/modules/hm/common/utilities/stacer.nix b/modules/hm/common/utilities/stacer.nix index a0a55e5..215bbc5 100644 --- a/modules/hm/common/utilities/stacer.nix +++ b/modules/hm/common/utilities/stacer.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.common.utilities.stacer; + cfg = config.modules.hm.utilities.stacer; in { - options.modules.common.utilities.stacer = { + options.modules.hm.utilities.stacer = { enable = lib.mkEnableOption "Enable Stacer system optimizer and monitoring tool"; }; diff --git a/modules/hm/desktops/configHydenix.nix b/modules/hm/desktops/configHydenix.nix new file mode 100644 index 0000000..ca82de2 --- /dev/null +++ b/modules/hm/desktops/configHydenix.nix @@ -0,0 +1,56 @@ +{ lib }: + +{ + hyprlandKeybindsConvert = '' + ## █▄▀ █▀▀ █▄█ █▄▄ █ █▄░█ █▀▄ █ █▄░█ █▀▀ █▀ + ## █░█ ██▄ ░█░ █▄█ █ █░▀█ █▄▀ █ █░▀█ █▄█ ▄█ + # $scrPath=$HOME/.local/lib/hyde # set scripts path + + + $l=Launcher + $d=[$l|Rofi menus] + bindd = $mainMod, colon, $d keybindings hint, exec, pkill -x rofi || $scrPath/keybinds_hint.sh c # launch keybinds hint + bindd = $mainMod, semicolon , $d glyph picker , exec, pkill -x rofi || $scrPath/glyph-picker.sh # launch glyph picker + + $ws=Workspaces + $d=[$ws|Navigation] + bindd = $mainMod, ampersand, $d navigate to workspace 1 , workspace, 1 + bindd = $mainMod, eacute, $d navigate to workspace 2 , workspace, 2 + bindd = $mainMod, quotedbl, $d navigate to workspace 3 , workspace, 3 + bindd = $mainMod, apostrophe, $d navigate to workspace 4 , workspace, 4 + bindd = $mainMod, parenleft, $d navigate to workspace 5 , workspace, 5 + bindd = $mainMod, minus, $d navigate to workspace 6 , workspace, 6 + bindd = $mainMod, egrave, $d navigate to workspace 7 , workspace, 7 + bindd = $mainMod, underscore, $d navigate to workspace 8 , workspace, 8 + bindd = $mainMod, ccedilla, $d navigate to workspace 9 , workspace, 9 + bindd = $mainMod, agrave, $d navigate to workspace 10 , workspace, 10 + + # Move focused window to a workspace + $d=[$ws|Move window to workspace] + bindd = $mainMod Shift, ampersand, $d move to workspace 1 , movetoworkspace, 1 + bindd = $mainMod Shift, eacute, $d move to workspace 2 , movetoworkspace, 2 + bindd = $mainMod Shift, quotedbl, $d move to workspace 3 , movetoworkspace, 3 + bindd = $mainMod Shift, apostrophe, $d move to workspace 4 , movetoworkspace, 4 + bindd = $mainMod Shift, parenleft, $d move to workspace 5 , movetoworkspace, 5 + bindd = $mainMod Shift, minus, $d move to workspace 6 , movetoworkspace, 6 + bindd = $mainMod Shift, egrave, $d move to workspace 7 , movetoworkspace, 7 + bindd = $mainMod Shift, underscore, $d move to workspace 8 , movetoworkspace, 8 + bindd = $mainMod Shift, ccedilla, $d move to workspace 9 , movetoworkspace, 9 + bindd = $mainMod Shift, agrave, $d move to workspace 10 , movetoworkspace, 10 + + # Move focused window to a workspace silently + $d=[$ws|Navigation|Move window silently] + bindd = $mainMod Alt, ampersand, $d move to workspace 1 (silent), movetoworkspacesilent, 1 + bindd = $mainMod Alt, eacute, $d move to workspace 2 (silent), movetoworkspacesilent, 2 + bindd = $mainMod Alt, quotedbl, $d move to workspace 3 (silent), movetoworkspacesilent, 3 + bindd = $mainMod Alt, apostrophe, $d move to workspace 4 (silent), movetoworkspacesilent, 4 + bindd = $mainMod Alt, parenleft, $d move to workspace 5 (silent), movetoworkspacesilent, 5 + bindd = $mainMod Alt, minus, $d move to workspace 6 (silent), movetoworkspacesilent, 6 + bindd = $mainMod Alt, egrave, $d move to workspace 7 (silent), movetoworkspacesilent, 7 + bindd = $mainMod Alt, underscore, $d move to workspace 8 (silent), movetoworkspacesilent, 8 + bindd = $mainMod Alt, ccedilla, $d move to workspace 9 (silent), movetoworkspacesilent, 9 + bindd = $mainMod Alt, agrave, $d move to workspace 10 (silent), movetoworkspacesilent, 10 + + $d=#! unset the group name + ''; +} \ No newline at end of file diff --git a/modules/hm/desktops/hydenix.nix b/modules/hm/desktops/hydenix.nix index 0376510..84f5051 100644 --- a/modules/hm/desktops/hydenix.nix +++ b/modules/hm/desktops/hydenix.nix @@ -9,6 +9,8 @@ with lib; let cfg = config.desktops.hydenix; + + configHydenix = import ./configHydenix.nix { inherit lib; }; in { @@ -91,6 +93,8 @@ in kb_layout = fr } + ${configHydenix.hyprlandKeybindsConvert} + # Example monitor configuration # Replace names like HDMI-A-1, DP-1, etc. with the actual names of your monitors (use `hyprctl monitors` to list) # monitor = ,,,,, @@ -113,6 +117,14 @@ in # Disable an unused monitor (example) # monitor=DP-4,disable + + # Alt + Enter to toggle fullscreen + bind = ALT, Return, fullscreen, 0 + # Alt + Tab to cycle between fullscreen windows + bind = ALT, Tab, cyclenext + bind = ALT, Tab, bringactivetotop + + exec-once = sleep 1 && bitwarden ''; force = true; mutable = true; diff --git a/modules/hm/hosts/oak/default.nix b/modules/hm/hosts/oak/default.nix index 9aca276..5bdefa2 100644 --- a/modules/hm/hosts/oak/default.nix +++ b/modules/hm/hosts/oak/default.nix @@ -8,10 +8,9 @@ ../../common ]; - config.modules.common = { + config.modules.hm = { shell = { btop.enable = true; - starship.enable = true; fzf.enable = true; ranger.enable = true; tools.enable = true; @@ -22,18 +21,18 @@ enable = true; cpu_text = "Ryzen 7 7435HS"; }; - minecraft.enable = true; + enabledGames = ["minecraft"]; }; multimedia = { gimp.enable = true; stremio.enable = true; }; browser = { - emulators = ["chrome" "firefox"]; + clients = ["firefox"]; driver.enable = true; }; documentation = { - editor = ["onlyoffice"]; + editors = ["onlyoffice"]; obsidian = { enable = true; backupMethod = "git-push-temp"; @@ -46,43 +45,29 @@ vs-code.enable = true; android-studio.enable = true; }; - dotnet.enable = true; + dotnet = { + enable = true; + extraPackages = [ "dotnet-ef" ]; + }; global-tools = { act-github.enable = true; nix.enable = true; - cli.elements = ["vercel" "graphite"]; }; node = { enable = true; prisma.enable = true; }; - python = { - enable = true; - devShell.enable = true; - }; + python.enable = true; }; communication = { teams.enable = true; mail.services = ["thunderbird"]; + discord.rpc.enable = true; }; network.tunnel = { - enable = true; - service = ["localtunnel" "ngrok"]; + services = ["localtunnel"]; localtunnel.port = 8080; - ngrok = { - port = 3000; - }; - }; - utilities = { - kde-connect.enable = true; - scalar.enable = true; }; - #extra = { - #ignore-file-retriever = { - #enable = true; - #watchMode = true; - #watchPaths = [ "~/Documents" ]; - #}; - #}; + utilities.scalar.enable = true; }; } diff --git a/modules/system/common/backup/syncthing.nix b/modules/system/common/backup/syncthing.nix index f1e351c..6772a43 100644 --- a/modules/system/common/backup/syncthing.nix +++ b/modules/system/common/backup/syncthing.nix @@ -7,10 +7,10 @@ }: let - cfg = config.modules.backup.syncthing; + cfg = config.modules.system.backup.syncthing; in { - options.modules.backup.syncthing = { + options.modules.system.backup.syncthing = { enable = lib.mkEnableOption "Enable Syncthing for file synchronization"; port = lib.mkOption { diff --git a/modules/system/common/default.nix b/modules/system/common/default.nix index b0448df..f32fc5c 100644 --- a/modules/system/common/default.nix +++ b/modules/system/common/default.nix @@ -8,7 +8,6 @@ ./dev/flutter.nix ./dev/php.nix - ./games/gamescope.nix ./games/games.nix ./hardware/autologin.nix @@ -16,7 +15,8 @@ ./hardware/powersave.nix ./networks/print/print.nix - ./networks/vpn/tailscale.nix + ./networks/vpn.nix + ./networks/wol.nix ./nix/linux-cachyos.nix ./nix/nix-garbage.nix @@ -25,6 +25,6 @@ ./security/antivirus.nix ./security/password-manager.nix - ./virtualisation/containers/containers.nix + ./virtualisation/containers.nix ]; } diff --git a/modules/system/common/dev/dev.nix b/modules/system/common/dev/dev.nix index 5d4231f..f8a184d 100755 --- a/modules/system/common/dev/dev.nix +++ b/modules/system/common/dev/dev.nix @@ -6,10 +6,10 @@ }: let - cfg = config.modules.dev.dev-global; + cfg = config.modules.system.dev.dev-global; in { - options.modules.dev.dev-global = { + options.modules.system.dev.dev-global = { enable = lib.mkEnableOption "Enable global development tools and libraries"; }; diff --git a/modules/system/common/dev/flatpak.nix b/modules/system/common/dev/flatpak.nix index 47c690d..55e4a2d 100644 --- a/modules/system/common/dev/flatpak.nix +++ b/modules/system/common/dev/flatpak.nix @@ -6,10 +6,10 @@ }: let - cfg = config.modules.dev.flatpak; + cfg = config.modules.system.dev.flatpak; in { - options.modules.dev.flatpak = { + options.modules.system.dev.flatpak = { enable = lib.mkEnableOption "Enable Flatpak development environment"; flathubRepoUrls = lib.mkOption { diff --git a/modules/system/common/dev/flutter.nix b/modules/system/common/dev/flutter.nix index 9135ce6..303782a 100755 --- a/modules/system/common/dev/flutter.nix +++ b/modules/system/common/dev/flutter.nix @@ -1,7 +1,7 @@ { pkgs, lib, config, vars, ... }: let - cfg = config.modules.dev.flutter; + cfg = config.modules.system.dev.flutter; # Android SDK configuration androidComposition = pkgs.androidenv.composeAndroidPackages { @@ -12,7 +12,7 @@ let androidSdk = androidComposition.androidsdk; in { - options.modules.dev.flutter = { + options.modules.system.dev.flutter = { enable = lib.mkEnableOption "Flutter development environment"; withAndroid = lib.mkEnableOption "Include Android SDK tooling"; @@ -56,7 +56,7 @@ in # Environment variables environment.variables = lib.mkMerge [ { JAVA_HOME = "${cfg.jdkPackage}"; } - { STUDIO_JDK = "${cfg.jdkPackage}"; } + #{ STUDIO_JDK = "${cfg.jdkPackage}"; } (lib.mkIf cfg.withAndroid { ANDROID_HOME = "${androidSdk}/libexec/android-sdk"; }) @@ -69,13 +69,5 @@ in "adbusers" ]; }; - - # Shell profile additions - environment.shellInit = '' - export PATH="$JAVA_HOME/bin:${pkgs.flutter}/bin:${pkgs.flutter}/bin/cache/dart-sdk/bin:$PATH" - ${lib.optionalString cfg.withAndroid '' - export PATH="$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools:$PATH" - ''} - ''; }; } \ No newline at end of file diff --git a/modules/system/common/dev/php.nix b/modules/system/common/dev/php.nix index 0216333..d13e7e6 100644 --- a/modules/system/common/dev/php.nix +++ b/modules/system/common/dev/php.nix @@ -1,10 +1,10 @@ { pkgs, lib, config, ... }: let - cfg = config.modules.dev.php; + cfg = config.modules.system.dev.php; in { - options.modules.dev.php = { + options.modules.system.dev.php = { enable = lib.mkEnableOption "Enable PHP development environment"; }; diff --git a/modules/system/common/games/games.nix b/modules/system/common/games/games.nix index 8dfa9a9..35a97a5 100755 --- a/modules/system/common/games/games.nix +++ b/modules/system/common/games/games.nix @@ -1,23 +1,36 @@ { pkgs, config, lib, ... }: let - cfg = config.modules.games; -in -{ - options.modules.games = { - enable = lib.mkEnableOption "Enable all gaming-related configuration"; + cfg = config.modules.system.games; - steam = { - compatToolsPath = lib.mkOption { - type = lib.types.path; - default = "${builtins.getEnv "HOME"}/.steam/root/compatibilitytools.d"; - description = "Path for Steam compatibility tools"; - }; - enable = lib.mkEnableOption "Enable Steam support"; + # Map gaming clients to their packages + clientToPackage = with pkgs; { + steam = [ steam ]; + lutris = [ lutris ]; + heroic = [ heroic ]; + nexus = [ nexusmods-app-unfree ]; + }; + + # Get packages for enabled clients + clientPackages = lib.concatMap (client: clientToPackage.${client} or []) cfg.clients; + +in { + options.modules.system.games = { + clients = lib.mkOption { + type = lib.types.listOf (lib.types.enum (lib.attrNames clientToPackage)); + default = []; + description = '' + List of gaming clients to enable. Supported options are "steam", "lutris", + "heroic", and "nexus". This allows you to specify which gaming clients should be + configured in your NixOS setup. + ''; }; - lutris.enable = lib.mkEnableOption "Enable Lutris support"; - heroic.enable = lib.mkEnableOption "Enable Heroic support"; + steam.compatToolsPath = lib.mkOption { + type = lib.types.path; + default = "${builtins.getEnv "HOME"}/.steam/root/compatibilitytools.d"; + description = "Path for Steam compatibility tools"; + }; gamemode = { enable = lib.mkEnableOption "Enable GameMode support"; @@ -51,30 +64,28 @@ in }; }; - config = lib.mkIf cfg.enable { - environment.systemPackages = with pkgs; - lib.optional cfg.steam.enable steam - ++ lib.optional cfg.lutris.enable lutris - ++ lib.optional cfg.heroic.enable heroic; - - environment.sessionVariables = lib.mkIf cfg.steam.enable { - STEAM_EXTRA_COMPAT_TOOLS_PATHS = cfg.steam.compatToolsPath; - }; + config = lib.mkMerge [ + { + environment.systemPackages = lib.unique clientPackages; + environment.sessionVariables = lib.mkIf (lib.elem "steam" cfg.clients) { + STEAM_EXTRA_COMPAT_TOOLS_PATHS = cfg.steam.compatToolsPath; + }; + } - programs = lib.mkMerge [ - (lib.mkIf cfg.gamemode.enable { - gamemode = { - enable = true; - enableRenice = cfg.gamemode.enableRenice; - settings = { - general = cfg.gamemode.generalSettings; - gpu = cfg.gamemode.gpuSettings; - custom = cfg.gamemode.notificationCommands; - }; + (lib.mkIf cfg.gamemode.enable { + programs.gamemode = { + enable = true; + enableRenice = cfg.gamemode.enableRenice; + settings = { + general = cfg.gamemode.generalSettings; + gpu = cfg.gamemode.gpuSettings; + custom = cfg.gamemode.notificationCommands; }; - }) + }; + }) - (lib.mkIf cfg.steam.enable { + (lib.mkIf (lib.elem "steam" cfg.clients) { + programs = { gamescope = { enable = true; capSysNice = true; @@ -86,7 +97,7 @@ in localNetworkGameTransfers.openFirewall = true; dedicatedServer.openFirewall = true; }; - }) - ]; - }; + }; + }) + ]; } \ No newline at end of file diff --git a/modules/system/common/games/gamescope.nix b/modules/system/common/games/gamescope.nix deleted file mode 100755 index dd2416f..0000000 --- a/modules/system/common/games/gamescope.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: - -with lib; - -let - cfg = config.modules.games.gamescope; -in -{ - options.modules.games.gamescope = { - enable = mkEnableOption "Enable Gamescope compositor for gaming"; - }; - - config = mkIf cfg.enable { - # Add capability settings for gamescope - security.wrappers.gamescope = { - owner = "root"; - group = "root"; - capabilities = "cap_sys_nice+ep"; - source = "${pkgs.gamescope}/bin/gamescope"; - }; - }; -} diff --git a/modules/system/common/hardware/autologin.nix b/modules/system/common/hardware/autologin.nix index 30c7673..653ab33 100755 --- a/modules/system/common/hardware/autologin.nix +++ b/modules/system/common/hardware/autologin.nix @@ -5,10 +5,10 @@ }: let - cfg = config.modules.hardware.autologin; + cfg = config.modules.system.hardware.autologin; in { - options.modules.hardware.autologin = { + options.modules.system.hardware.autologin = { enable = lib.mkEnableOption "Enable autologin for SDDM"; user = lib.mkOption { diff --git a/modules/system/common/hardware/boot.nix b/modules/system/common/hardware/boot.nix index d598b28..3da1c59 100755 --- a/modules/system/common/hardware/boot.nix +++ b/modules/system/common/hardware/boot.nix @@ -6,11 +6,11 @@ }: let - cfg = config.modules.hardware.boot; + cfg = config.modules.system.hardware.boot; in { - options.modules.hardware.boot = { + options.modules.system.hardware.boot = { enable = lib.mkEnableOption "Enable boot configuration for Hydenix systems"; }; diff --git a/modules/system/common/hardware/powersave.nix b/modules/system/common/hardware/powersave.nix index 61f4673..c49046b 100644 --- a/modules/system/common/hardware/powersave.nix +++ b/modules/system/common/hardware/powersave.nix @@ -1,9 +1,9 @@ { config, lib, pkgs, vars, ... }: let - cfg = config.modules.hardware.powersave; + cfg = config.modules.system.hardware.powersave; in { - options.modules.hardware.powersave = { + options.modules.system.hardware.powersave = { enable = lib.mkEnableOption "Enable power saving configuration"; architecture = lib.mkOption { @@ -104,12 +104,23 @@ in { # Runtime power management RUNTIME_PM_ON_BAT = "auto"; - # Battery charge thresholds (for battery health) - START_CHARGE_THRESH_BAT1 = cfg.batteryHealth.chargeThresholds.start; - STOP_CHARGE_THRESH_BAT1 = cfg.batteryHealth.chargeThresholds.stop; - - # Ensure TLP applies these thresholds - RESTORE_THRESHOLDS_ON_BAT = 1; + # Explicitly set charge thresholds for all batteries + # Set charge thresholds for primary battery (BAT0) + START_CHARGE_THRESH_BAT0 = lib.optionalString cfg.batteryHealth.enable + cfg.batteryHealth.chargeThresholds.start; + STOP_CHARGE_THRESH_BAT0 = lib.optionalString cfg.batteryHealth.enable + cfg.batteryHealth.chargeThresholds.stop; + + # Set charge thresholds for secondary battery (BAT1) if present + START_CHARGE_THRESH_BAT1 = lib.optionalString cfg.batteryHealth.enable + cfg.batteryHealth.chargeThresholds.start; + STOP_CHARGE_THRESH_BAT1 = lib.optionalString cfg.batteryHealth.enable + cfg.batteryHealth.chargeThresholds.stop; + + # Threshold persistence settings + # Ensures thresholds are maintained across power state changes + RESTORE_THRESHOLDS_ON_BAT = lib.optionalString cfg.batteryHealth.enable 1; # Restore when on battery + RESTORE_THRESHOLDS_ON_AC = lib.optionalString cfg.batteryHealth.enable 1; # Restore when on AC power }; }; diff --git a/modules/system/common/networks/portmaster.nix b/modules/system/common/networks/portmaster.nix deleted file mode 100644 index e64bf68..0000000 --- a/modules/system/common/networks/portmaster.nix +++ /dev/null @@ -1,139 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.modules.networks.portmaster; - - portmaster-deb = pkgs.fetchurl { - url = "https://updates.safing.io/latest/linux_amd64/packages/portmaster-installer.deb"; - sha256 = "sha256-2b9Gn9Hzvuiu/YEeAZRTvJU1Iom06tp0bTC5LhbmghM="; - }; - - portmaster-desktop = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/safing/portmaster-packaging/master/linux/portmaster.desktop"; - sha256 = "sha256-ewwD5FUt2Gyu/y1iixM0bP5wpkavEausZVXjSORsKNo="; # Replace with actual hash - }; - - portmaster-app = pkgs.stdenv.mkDerivation { - name = "portmaster-desktop"; - src = portmaster-deb; - - nativeBuildInputs = [ pkgs.autoPatchelfHook pkgs.dpkg pkgs.makeWrapper ]; - buildInputs = with pkgs; [ - alsa-lib - mesa - libdrm - libglvnd - vulkan-loader - libva - gtk3 - libsecret - nss - xorg.libXdamage - xorg.libXtst - xorg.libXcomposite - xorg.libXrandr - systemd - networkmanager - adwaita-icon-theme - ]; - - unpackPhase = "dpkg -x $src ."; - - installPhase = '' - # Main binary - mkdir -p $out/opt/safing/portmaster - cp -r opt/safing/portmaster/* $out/opt/safing/portmaster/ - - # Systemd service - mkdir -p $out/etc/systemd/system - cat > $out/etc/systemd/system/portmaster.service <