From 6338112a9d25364012ffaca07b728689e23569b2 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sun, 8 Oct 2023 02:46:37 -0500 Subject: [PATCH] Meleee --- flake.lock | 104 ++++++++++++++++++++++++- flake.nix | 2 +- modules/home-manager/default.nix | 1 + modules/home-manager/dragon.nix | 8 ++ modules/home-manager/melee.nix | 24 ++++++ modules/nixos/common.nix | 12 +++ modules/nixos/default.nix | 1 + modules/nixos/melee.nix | 9 +-- modules/nixos/pipewire-low-latency.nix | 16 ++++ nixos/dragon/default.nix | 3 +- 10 files changed, 169 insertions(+), 11 deletions(-) create mode 100644 modules/home-manager/melee.nix create mode 100644 modules/nixos/pipewire-low-latency.nix diff --git a/flake.lock b/flake.lock index d307931..fddc66a 100644 --- a/flake.lock +++ b/flake.lock @@ -223,6 +223,40 @@ "type": "github" } }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1598695561, + "narHash": "sha256-gyH/5j+h/nWw0W8AcR2WKvNBUsiQ7QuxqSJNXAwV+8E=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "1705b4a26fbf065d9574dce47a94e8c7c79e052f", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs_7" + }, + "locked": { + "lastModified": 1609520816, + "narHash": "sha256-IGO7tfJXsv9u2wpW76VCzOsHYapRZqH9pHGVsoffPrI=", + "owner": "NixOS", + "repo": "nix", + "rev": "8a2ce0f455da32bc20978e68c0aad9efb4560abc", + "type": "github" + }, + "original": { + "id": "nix", + "type": "indirect" + } + }, "nixpkgs": { "locked": { "lastModified": 1690026219, @@ -367,6 +401,37 @@ "type": "github" } }, + "nixpkgs_7": { + "locked": { + "lastModified": 1602702596, + "narHash": "sha256-fqJ4UgOb4ZUnCDIapDb4gCrtAah5Rnr2/At3IzMitig=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ad0d20345219790533ebe06571f82ed6b034db31", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-20.09-small", + "type": "indirect" + } + }, + "nixpkgs_8": { + "locked": { + "lastModified": 1692447944, + "narHash": "sha256-fkJGNjEmTPvqBs215EQU4r9ivecV5Qge5cF/QDLVn3U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d680ded26da5cf104dd2735a51e88d2d8f487b4d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "api-lyte-dev": "api-lyte-dev", @@ -377,7 +442,8 @@ "hyprland": "hyprland", "nixpkgs-stable": "nixpkgs-stable", "nixpkgs-unstable": "nixpkgs-unstable", - "sops-nix": "sops-nix" + "sops-nix": "sops-nix", + "ssbm": "ssbm" } }, "rust-overlay": { @@ -405,6 +471,22 @@ "type": "github" } }, + "slippi-desktop": { + "flake": false, + "locked": { + "lastModified": 1607036060, + "narHash": "sha256-TUYsiVvKAws3N3roZYDwkLB0obyl6zwvh8CAk2RwHrY=", + "owner": "project-slippi", + "repo": "slippi-desktop-app", + "rev": "3ca39ba6bbd02157515b12a79aa01e5d669ad1b1", + "type": "github" + }, + "original": { + "owner": "project-slippi", + "repo": "slippi-desktop-app", + "type": "github" + } + }, "sops-nix": { "inputs": { "nixpkgs": "nixpkgs_6", @@ -424,6 +506,26 @@ "type": "github" } }, + "ssbm": { + "inputs": { + "nix": "nix", + "nixpkgs": "nixpkgs_8", + "slippi-desktop": "slippi-desktop" + }, + "locked": { + "lastModified": 1696638790, + "narHash": "sha256-fmpFkchuAyQfaSOWqEMnw4wRxWFkD7LqBwjKcVog8xQ=", + "owner": "djanatyn", + "repo": "ssbm-nix", + "rev": "cfeb1874b437e5883272c522234d1d15cb3d3ebd", + "type": "github" + }, + "original": { + "owner": "djanatyn", + "repo": "ssbm-nix", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 68da6a8..637f8b5 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ api-lyte-dev.url = "git+ssh://gitea@git.lyte.dev/lytedev/api.lyte.dev.git"; - # TODO: ssbm.url = "github:djanatyn/ssbm-nix"; + ssbm.url = "github:djanatyn/ssbm-nix"; # need to bump ishiiruka upstream I think # slippi-desktop.url = "github:project-slippi/slippi-desktop-app"; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 972e0b4..eab13e2 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -4,6 +4,7 @@ # List your module files here # my-module = import ./my-module.nix; common = import ./common.nix; + melee = import ./melee.nix; linux = import ./linux.nix; macos = import ./macos.nix; iex = import ./iex.nix; diff --git a/modules/home-manager/dragon.nix b/modules/home-manager/dragon.nix index e518a9a..c5bbdac 100644 --- a/modules/home-manager/dragon.nix +++ b/modules/home-manager/dragon.nix @@ -1,9 +1,11 @@ { + config, lib, outputs, ... }: { imports = with outputs.homeManagerModules; [ + melee sway ]; @@ -41,4 +43,10 @@ ); }; }; + + ssbm = { + slippi-launcher = { + isoPath = "${config.home.homeDirectory}/../games/roms/dolphin/melee.iso"; + }; + }; } diff --git a/modules/home-manager/melee.nix b/modules/home-manager/melee.nix new file mode 100644 index 0000000..5778b87 --- /dev/null +++ b/modules/home-manager/melee.nix @@ -0,0 +1,24 @@ +{ + # flake, + inputs, + # outputs, + # lib, + # config, + # pkgs, + # system, + # modulesPath, + ... +}: { + imports = [ + { + nixpkgs.overlays = [inputs.ssbm.overlay]; + } + inputs.ssbm.homeManagerModule + ]; + + ssbm = { + slippi-launcher = { + enable = true; + }; + }; +} diff --git a/modules/nixos/common.nix b/modules/nixos/common.nix index 7134854..57b14be 100644 --- a/modules/nixos/common.nix +++ b/modules/nixos/common.nix @@ -180,6 +180,18 @@ "h.lyte.dev:HeVWtne31ZG8iMf+c15VY3/Mky/4ufXlfTpT8+4Xbs0=" ]; }; + + registry = { + self.flake = inputs.self; + + nixpkgs = { + from = { + id = "nixpkgs"; + type = "indirect"; + }; + flake = inputs.nixpkgs-unstable; + }; + }; }; nixpkgs = { diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 49b2661..68514f5 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -6,6 +6,7 @@ desktop-usage = import ./desktop-usage.nix; intel = import ./intel.nix; pipewire = import ./pipewire.nix; + pipewire-low-latency = import ./pipewire-low-latency.nix; podman = import ./podman.nix; postgres = import ./postgres.nix; sway = import ./sway.nix; diff --git a/modules/nixos/melee.nix b/modules/nixos/melee.nix index 5664236..71d9c7e 100644 --- a/modules/nixos/melee.nix +++ b/modules/nixos/melee.nix @@ -5,19 +5,12 @@ # lib, # config, # pkgs, - system, + # system, # modulesPath, ... }: { imports = [inputs.ssbm.nixosModule]; - environment = { - systemPackages = with inputs.ssbm.packages.${system}; [ - slippi-netplay - slippi-playback - ]; - }; - ssbm = { cache.enable = true; diff --git a/modules/nixos/pipewire-low-latency.nix b/modules/nixos/pipewire-low-latency.nix new file mode 100644 index 0000000..e10ab5e --- /dev/null +++ b/modules/nixos/pipewire-low-latency.nix @@ -0,0 +1,16 @@ +{...}: { + environment.etc = { + "pipewire/pipewire.conf.d/92-low-latency.conf".text = '' + context.properties = { + default.clock.rate = 48000 + default.clock.quantum = 128 + default.clock.min-quantum = 128 + default.clock.max-quantum = 128 + } + + jack.properties = { + node.latency = 128/48000 + } + ''; + }; +} diff --git a/nixos/dragon/default.nix b/nixos/dragon/default.nix index ac54b74..0d7f0ca 100644 --- a/nixos/dragon/default.nix +++ b/nixos/dragon/default.nix @@ -17,10 +17,11 @@ flake.diskoConfigurations.standard inputs.hardware.nixosModules.common-cpu-amd inputs.hardware.nixosModules.common-pc-ssd + outputs.nixosModules.pipewire-low-latency ] ++ (with outputs.nixosModules; [ # If you want to use modules your own flake exports (from modules/nixos): - # melee + melee desktop-usage podman postgres