From cac6af6c067060f6ab501ae5ac93f3523b2fa986 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Sun, 9 Feb 2025 02:57:19 -0600 Subject: [PATCH] nintendo switch flake --- flake.lock | 59 ++++++++++++++++++++++++++++++++++- flake.nix | 5 +++ hosts/workstation/toggles.nix | 1 + modules/apps/gaming.nix | 18 ++++++++++- 4 files changed, 81 insertions(+), 2 deletions(-) diff --git a/flake.lock b/flake.lock index fd48fb2..9667c40 100644 --- a/flake.lock +++ b/flake.lock @@ -244,6 +244,23 @@ } }, "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "nur", @@ -757,6 +774,24 @@ "url": "https://github.com/NixOS/nixpkgs/archive/072a6db25e947df2f31aab9eccd0ab75d5b2da11.tar.gz" } }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1711703276, + "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs11": { "locked": { "lastModified": 1738843498, @@ -789,9 +824,30 @@ "type": "github" } }, - "nur": { + "nixtendo-switch": { "inputs": { "flake-parts": "flake-parts_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721329381, + "narHash": "sha256-oj95wOUYXXlpx87Fjmf+Nu+wz1qrFtCf7AKDnxEB8oQ=", + "owner": "nyawox", + "repo": "nixtendo-switch", + "rev": "ba69506f44d4e154cdf11b5ba3d23534f9fb3238", + "type": "github" + }, + "original": { + "owner": "nyawox", + "repo": "nixtendo-switch", + "type": "github" + } + }, + "nur": { + "inputs": { + "flake-parts": "flake-parts_3", "nixpkgs": [ "nixpkgs" ], @@ -843,6 +899,7 @@ "nix-gaming": "nix-gaming", "nixpkgs": "nixpkgs_2", "nixpkgs11": "nixpkgs11", + "nixtendo-switch": "nixtendo-switch", "nur": "nur", "sops-nix": "sops-nix", "stylix": "stylix", diff --git a/flake.nix b/flake.nix index cc08286..9c18996 100644 --- a/flake.nix +++ b/flake.nix @@ -33,6 +33,10 @@ url = "github:danth/stylix"; inputs.nixpkgs.follows = "nixpkgs"; }; + nixtendo-switch = { + url = "github:nyawox/nixtendo-switch"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -65,6 +69,7 @@ inputs.nur.modules.nixos.default inputs.sops-nix.nixosModules.sops inputs.stylix.nixosModules.stylix + inputs.nixtendo-switch.nixosModules.nixtendo-switch ]; }; in diff --git a/hosts/workstation/toggles.nix b/hosts/workstation/toggles.nix index 45ff220..d5be449 100644 --- a/hosts/workstation/toggles.nix +++ b/hosts/workstation/toggles.nix @@ -6,6 +6,7 @@ dictionaries.enable = true; fonts.enable = true; gaming.enable = true; + switch.enable = true; internet.enable = true; multimedia.enable = true; office.enable = true; diff --git a/modules/apps/gaming.nix b/modules/apps/gaming.nix index d9a3797..030d758 100644 --- a/modules/apps/gaming.nix +++ b/modules/apps/gaming.nix @@ -7,8 +7,17 @@ }: { imports = [ inputs.nix-gaming.nixosModules.platformOptimizations ]; - options.my.apps.gaming.enable = lib.mkEnableOption "enable"; + options.my.apps = { + gaming.enable = lib.mkEnableOption "enable"; + switch.enable = lib.mkEnableOption "enable"; + }; config = lib.mkIf config.my.apps.gaming.enable { + sops.secrets.switch-presence = { + sopsFile = ../../secrets/env.yaml; + format = "dotenv"; + owner = config.users.users.jawz.name; + inherit (config.users.users.jawz) group; + }; programs = { gamemode.enable = true; steam = { @@ -19,6 +28,13 @@ platformOptimizations.enable = true; }; }; + services = lib.mkIf config.my.apps.switch.enable { + switch-boot.enable = true; + switch-presence = { + enable = true; + environmentFile = config.sops.secrets.switch-presence.path; + }; + }; users.users.jawz.packages = builtins.attrValues { inherit (pkgs) shipwright # zelda OoT port