From 52756ccf7ac5e49c0bb10dcf67341c3faa87579b Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Thu, 22 May 2025 13:15:07 -0400 Subject: [PATCH 01/15] Nix expr: add flake.nix --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000000..719646ccc44 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1735651292, + "narHash": "sha256-YLbzcBtYo1/FEzFsB3AnM16qFc6fWPMIoOuSoDwvg9g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0da3c44a9460a26d2025ec3ed2ec60a895eb1114", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000000..22e58464b98 --- /dev/null +++ b/flake.nix @@ -0,0 +1,45 @@ +{ + description = "BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores."; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/release-24.05"; + }; + outputs = + inputs@{ self, nixpkgs, ... }: + with builtins; + let + std = nixpkgs.lib; + systems = [ + # TODO :: can we build for aarch64-linux? + "x86_64-linux" + ]; + nixpkgsFor = std.genAttrs systems ( + system: + import nixpkgs { + localSystem = builtins.currentSystem or system; + crossSystem = system; + overlays = [ ]; + } + ); + in + { + formatter = mapAttrs (system: pkgs: pkgs.nixfmt-rfc-style) nixpkgsFor; + packages = mapAttrs ( + system: pkgs: + # ./default.nix outputs some non-derivation attributes, so we have to filter those out + (std.filterAttrs (name: val: std.isDerivation val) (import ./default.nix { inherit system pkgs; })) + // { + default = self.packages.${system}.emuhawk-latest-bin; + } + ) nixpkgsFor; + devShells = mapAttrs ( + system: pkgs: + # ./shell.nix outputs some non-derivation attributes and some extraneous derivations, so we have to filter those out + (std.filterAttrs ( + name: val: std.isDerivation val && name != "stdenv" && name != "out" && name != "inputDerivation" + ) (import ./shell.nix { inherit system pkgs; })) + // { + default = self.devShells.${system}.emuhawk-latest; + } + ) nixpkgsFor; + }; +} From 144e8a79756dec056244aebfdefb0727e0077aae Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Thu, 22 May 2025 13:20:29 -0400 Subject: [PATCH 02/15] Nix expr: add apps output to flake.nix --- flake.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/flake.nix b/flake.nix index 22e58464b98..89a06b680a1 100644 --- a/flake.nix +++ b/flake.nix @@ -41,5 +41,29 @@ default = self.devShells.${system}.emuhawk-latest; } ) nixpkgsFor; + apps = + let + # because for some reason the standard library doesn't include this (i think?) + startsWith = prefix: st: (substring 0 (stringLength prefix) st) == prefix; + toApps = + app: pkgs: + # filter packages to only include ones whose name starts with `app`, then map them to app definitions + mapAttrs (name: pkg: { + type = "app"; + # this seems to be correct, but I'm not entirely sure + program = "${pkg}/bin/${pkg.name}"; + }) (std.filterAttrs (name: val: startsWith app name) pkgs); + in + mapAttrs ( + system: pkgs: + ( + (toApps "emuhawk" pkgs) + // (toApps "discohawk" pkgs) + # TODO :: should `bizhawkAssemblies` be included here? + // { + default = self.apps.${system}.emuhawk-latest-bin; + } + ) + ) self.packages; }; } From 2593753d3108a606c35bec2c11125d984cc6c24b Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Thu, 22 May 2025 13:26:35 -0400 Subject: [PATCH 03/15] Nix expr: update system list --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 89a06b680a1..2fc6519983e 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ let std = nixpkgs.lib; systems = [ - # TODO :: can we build for aarch64-linux? + # this is currently the only supported system, according to https://github.com/TASEmulators/BizHawk/issues/1430#issue-396452488 "x86_64-linux" ]; nixpkgsFor = std.genAttrs systems ( From aed4768cd487cc864d520d28d3749083d82ff472 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Thu, 22 May 2025 13:35:21 -0400 Subject: [PATCH 04/15] Nix expr: remove answered todo comment --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index 2fc6519983e..a8c4eb11b1e 100644 --- a/flake.nix +++ b/flake.nix @@ -59,7 +59,6 @@ ( (toApps "emuhawk" pkgs) // (toApps "discohawk" pkgs) - # TODO :: should `bizhawkAssemblies` be included here? // { default = self.apps.${system}.emuhawk-latest-bin; } From 0a196a5e7a43fbc7b0781030f2f840c0171b0ec6 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Thu, 22 May 2025 14:03:54 -0400 Subject: [PATCH 05/15] Nix expr: add overlay output to `flake.nix` --- flake.nix | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index a8c4eb11b1e..57693195aa9 100644 --- a/flake.nix +++ b/flake.nix @@ -20,13 +20,19 @@ overlays = [ ]; } ); + # because for some reason the standard library doesn't include this (i think?) + startsWith = prefix: st: (substring 0 (stringLength prefix) st) == prefix; + # import the derivations from default.nix for the given system & package set + importDefaultDerivationsWith = + system: pkgs: + # ./default.nix outputs some non-derivation attributes, so we have to filter those out + (std.filterAttrs (name: val: std.isDerivation val) (import ./default.nix { inherit system pkgs; })); in { formatter = mapAttrs (system: pkgs: pkgs.nixfmt-rfc-style) nixpkgsFor; packages = mapAttrs ( system: pkgs: - # ./default.nix outputs some non-derivation attributes, so we have to filter those out - (std.filterAttrs (name: val: std.isDerivation val) (import ./default.nix { inherit system pkgs; })) + (importDefaultDerivationsWith system pkgs) // { default = self.packages.${system}.emuhawk-latest-bin; } @@ -41,10 +47,16 @@ default = self.devShells.${system}.emuhawk-latest; } ) nixpkgsFor; + overlays.default = + final: prev: + # filter derivations to only include `emuhawk` and `discohawk` ones (i.e. excluding `bizhawkAssemblies`) + std.filterAttrs (name: pkg: (startsWith "emuhawk" name) || (startsWith "discohawk" name)) ( + # import `default.nix` with the overlayed package set + # (i don't know the circumstances under which `prev` wouldn't have a `system` attribute, but we may as well account for it) + importDefaultDerivationsWith (prev.system or "") prev + ); apps = let - # because for some reason the standard library doesn't include this (i think?) - startsWith = prefix: st: (substring 0 (stringLength prefix) st) == prefix; toApps = app: pkgs: # filter packages to only include ones whose name starts with `app`, then map them to app definitions From ece2064fecb9c0784368316571e2cdfe4f84c684 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 14:03:45 -0400 Subject: [PATCH 06/15] Nix expr: use `lib.strings.hasPrefix` --- flake.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 57693195aa9..213238dd75a 100644 --- a/flake.nix +++ b/flake.nix @@ -20,8 +20,6 @@ overlays = [ ]; } ); - # because for some reason the standard library doesn't include this (i think?) - startsWith = prefix: st: (substring 0 (stringLength prefix) st) == prefix; # import the derivations from default.nix for the given system & package set importDefaultDerivationsWith = system: pkgs: @@ -50,7 +48,7 @@ overlays.default = final: prev: # filter derivations to only include `emuhawk` and `discohawk` ones (i.e. excluding `bizhawkAssemblies`) - std.filterAttrs (name: pkg: (startsWith "emuhawk" name) || (startsWith "discohawk" name)) ( + std.filterAttrs (name: pkg: (std.hasPrefix "emuhawk" name) || (std.hasPrefix "discohawk" name)) ( # import `default.nix` with the overlayed package set # (i don't know the circumstances under which `prev` wouldn't have a `system` attribute, but we may as well account for it) importDefaultDerivationsWith (prev.system or "") prev @@ -64,7 +62,7 @@ type = "app"; # this seems to be correct, but I'm not entirely sure program = "${pkg}/bin/${pkg.name}"; - }) (std.filterAttrs (name: val: startsWith app name) pkgs); + }) (std.filterAttrs (name: val: std.hasPrefix app name) pkgs); in mapAttrs ( system: pkgs: From f8452a2b7f84a7b814e83cc3eb9f182f05c9b944 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 14:05:11 -0400 Subject: [PATCH 07/15] Nix expr: use description from README.md --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 213238dd75a..b6d9f738a49 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores."; + description = "EmuHawk is a multi-system emulator written in C#. As well as quality-of-life features for casual players, it also has recording/playback and debugging tools, making it the first choice for TASers (Tool-Assisted Speedrunners)."; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/release-24.05"; }; From c47195dbe05bb7b526594f76bb13fa70658ac380 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 14:08:37 -0400 Subject: [PATCH 08/15] Nix expr: remove formatter --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index b6d9f738a49..57794108d4b 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,6 @@ (std.filterAttrs (name: val: std.isDerivation val) (import ./default.nix { inherit system pkgs; })); in { - formatter = mapAttrs (system: pkgs: pkgs.nixfmt-rfc-style) nixpkgsFor; packages = mapAttrs ( system: pkgs: (importDefaultDerivationsWith system pkgs) From 3bd7c86000b06087127619b5cde82a1d8514a185 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 14:13:06 -0400 Subject: [PATCH 09/15] Nix expr: fix derivation import in overlay output --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 57794108d4b..76991067570 100644 --- a/flake.nix +++ b/flake.nix @@ -49,8 +49,8 @@ # filter derivations to only include `emuhawk` and `discohawk` ones (i.e. excluding `bizhawkAssemblies`) std.filterAttrs (name: pkg: (std.hasPrefix "emuhawk" name) || (std.hasPrefix "discohawk" name)) ( # import `default.nix` with the overlayed package set - # (i don't know the circumstances under which `prev` wouldn't have a `system` attribute, but we may as well account for it) - importDefaultDerivationsWith (prev.system or "") prev + # (i don't know the circumstances under which `final` wouldn't have a `system` attribute, but we may as well account for it) + importDefaultDerivationsWith (final.system or "") final ); apps = let From 5f8bd3813081a3b66696640a0f85d3a5d73b990f Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 14:45:55 -0400 Subject: [PATCH 10/15] Nix expr: remove redundant apps output from flake.nix --- flake.nix | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/flake.nix b/flake.nix index 76991067570..fb5582f0cab 100644 --- a/flake.nix +++ b/flake.nix @@ -52,26 +52,5 @@ # (i don't know the circumstances under which `final` wouldn't have a `system` attribute, but we may as well account for it) importDefaultDerivationsWith (final.system or "") final ); - apps = - let - toApps = - app: pkgs: - # filter packages to only include ones whose name starts with `app`, then map them to app definitions - mapAttrs (name: pkg: { - type = "app"; - # this seems to be correct, but I'm not entirely sure - program = "${pkg}/bin/${pkg.name}"; - }) (std.filterAttrs (name: val: std.hasPrefix app name) pkgs); - in - mapAttrs ( - system: pkgs: - ( - (toApps "emuhawk" pkgs) - // (toApps "discohawk" pkgs) - // { - default = self.apps.${system}.emuhawk-latest-bin; - } - ) - ) self.packages; }; } From 226b57182627a37fc786f9afa07a872d80069a22 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 15:11:00 -0400 Subject: [PATCH 11/15] Nix expr: remove overlay output --- flake.nix | 8 -------- 1 file changed, 8 deletions(-) diff --git a/flake.nix b/flake.nix index fb5582f0cab..3f928370257 100644 --- a/flake.nix +++ b/flake.nix @@ -44,13 +44,5 @@ default = self.devShells.${system}.emuhawk-latest; } ) nixpkgsFor; - overlays.default = - final: prev: - # filter derivations to only include `emuhawk` and `discohawk` ones (i.e. excluding `bizhawkAssemblies`) - std.filterAttrs (name: pkg: (std.hasPrefix "emuhawk" name) || (std.hasPrefix "discohawk" name)) ( - # import `default.nix` with the overlayed package set - # (i don't know the circumstances under which `final` wouldn't have a `system` attribute, but we may as well account for it) - importDefaultDerivationsWith (final.system or "") final - ); }; } From ea7855a53f93db0e7e28fbe7154bf07eaffb4f57 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 15:26:50 -0400 Subject: [PATCH 12/15] Nix expr: use `lib` instead of `std` in flake.nix --- flake.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 3f928370257..6cb877b16fa 100644 --- a/flake.nix +++ b/flake.nix @@ -7,12 +7,12 @@ inputs@{ self, nixpkgs, ... }: with builtins; let - std = nixpkgs.lib; + inherit (nixpkgs) lib; systems = [ # this is currently the only supported system, according to https://github.com/TASEmulators/BizHawk/issues/1430#issue-396452488 "x86_64-linux" ]; - nixpkgsFor = std.genAttrs systems ( + nixpkgsFor = lib.genAttrs systems ( system: import nixpkgs { localSystem = builtins.currentSystem or system; @@ -24,7 +24,7 @@ importDefaultDerivationsWith = system: pkgs: # ./default.nix outputs some non-derivation attributes, so we have to filter those out - (std.filterAttrs (name: val: std.isDerivation val) (import ./default.nix { inherit system pkgs; })); + (lib.filterAttrs (name: val: lib.isDerivation val) (import ./default.nix { inherit system pkgs; })); in { packages = mapAttrs ( @@ -37,8 +37,8 @@ devShells = mapAttrs ( system: pkgs: # ./shell.nix outputs some non-derivation attributes and some extraneous derivations, so we have to filter those out - (std.filterAttrs ( - name: val: std.isDerivation val && name != "stdenv" && name != "out" && name != "inputDerivation" + (lib.filterAttrs ( + name: val: lib.isDerivation val && name != "stdenv" && name != "out" && name != "inputDerivation" ) (import ./shell.nix { inherit system pkgs; })) // { default = self.devShells.${system}.emuhawk-latest; From acde1d14c9afe58c30d275a2469f741dac8704b8 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 15:32:26 -0400 Subject: [PATCH 13/15] Nix expr: use `github:NixOS/nixpkgs?ref=24.05` as nixpkgs input in flake.nix --- flake.lock | 8 ++++---- flake.nix | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 719646ccc44..98f71cbeab9 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1735651292, - "narHash": "sha256-YLbzcBtYo1/FEzFsB3AnM16qFc6fWPMIoOuSoDwvg9g=", + "lastModified": 1717179513, + "narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0da3c44a9460a26d2025ec3ed2ec60a895eb1114", + "rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0", "type": "github" }, "original": { "owner": "NixOS", - "ref": "release-24.05", + "ref": "24.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 6cb877b16fa..882bff9cbce 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { description = "EmuHawk is a multi-system emulator written in C#. As well as quality-of-life features for casual players, it also has recording/playback and debugging tools, making it the first choice for TASers (Tool-Assisted Speedrunners)."; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/release-24.05"; + nixpkgs.url = "github:NixOS/nixpkgs?ref=24.05"; }; outputs = inputs@{ self, nixpkgs, ... }: From 6be3da2aeb2694e86280918ed407504221ad174d Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 15:39:29 -0400 Subject: [PATCH 14/15] Nix expr: make `shellHook` an output of `default.nix`, make shells directly within flake.nix --- default.nix | 29 +++++++++++++++++++++++++---- flake.nix | 39 ++++++++++++++++++++++++++++++++------- shell.nix | 21 +-------------------- 3 files changed, 58 insertions(+), 31 deletions(-) diff --git a/default.nix b/default.nix index 77ec34e8272..d8efb1a4387 100644 --- a/default.nix +++ b/default.nix @@ -163,8 +163,10 @@ in { || isVersionAtLeast "2.6" value.hawkSourceInfo.version)) ]; latestVersionFrag = lib.head releaseFrags; - combined = pp // asmsFromReleaseArtifacts // releasesEmuHawkInstallables // { - inherit depsForHistoricalRelease populateHawkSourceInfo releaseTagSourceInfos; + combined = let + launchScriptsForLocalBuild = launchScriptsFor emuhawk-local.assemblies true; + in (pp // asmsFromReleaseArtifacts // releasesEmuHawkInstallables // { + inherit depsForHistoricalRelease populateHawkSourceInfo releaseTagSourceInfos launchScriptsForLocalBuild; bizhawkAssemblies = pp.buildAssembliesFor (fillTargetOSDifferences hawkSourceInfoDevBuild); "bizhawkAssemblies-${latestVersionFrag}" = pp.buildAssembliesFor (fillTargetOSDifferences releaseTagSourceInfos."info-${latestVersionFrag}"); @@ -184,8 +186,27 @@ in { IDEs = { kate = [ kate omnisharp-roslyn ]; }; - launchScriptsForLocalBuild = launchScriptsFor emuhawk-local.assemblies true; - }; + shellHook = drv: '' + export BIZHAWKBUILD_HOME='${builtins.toString ./.}' + export BIZHAWK_HOME="$BIZHAWKBUILD_HOME/output/" + ldLibPath='${lib.makeLibraryPath drv.buildInputs}' # for running tests + if [ -z "$LD_LIBRARY_PATH" ]; then + export LD_LIBRARY_PATH="$ldLibPath" + else + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ldLibPath" + fi + alias discohawk-monort-local='${launchScriptsForLocalBuild.discohawk}' + alias emuhawk-monort-local='${launchScriptsForLocalBuild.emuhawk}' + case "$-" in *i*) + pfx="$(realpath --relative-to="$PWD" "$BIZHAWKBUILD_HOME")/" + if [ "$pfx" = "./" ]; then pfx=""; fi + printf "%s\n%s\n" \ + "Run ''${pfx}Dist/Build{Debug,Release}.sh to build the solution. You may need to clean up with ''${pfx}Dist/CleanupBuildOutputDirs.sh." \ + "Once built, running {discohawk,emuhawk}-monort-local will pull from ''${pfx}output/* and use Mono from Nixpkgs." + ;; + esac + ''; + }); in combined // lib.listToAttrs (lib.concatLists (builtins.map (f: [ { name = f "latest-bin"; value = combined.${f "${latestVersionFrag}-bin"}; } diff --git a/flake.nix b/flake.nix index 882bff9cbce..9906f88a583 100644 --- a/flake.nix +++ b/flake.nix @@ -36,13 +36,38 @@ ) nixpkgsFor; devShells = mapAttrs ( system: pkgs: - # ./shell.nix outputs some non-derivation attributes and some extraneous derivations, so we have to filter those out - (lib.filterAttrs ( - name: val: lib.isDerivation val && name != "stdenv" && name != "out" && name != "inputDerivation" - ) (import ./shell.nix { inherit system pkgs; })) - // { - default = self.devShells.${system}.emuhawk-latest; - } + let + avail = import ./default.nix { inherit system pkgs; }; + mkShellCustom = + drv: + pkgs.mkShell { + packages = with pkgs; [ + git + powershell + ]; + inputsFrom = [ drv ]; + shellHook = avail.shellHook drv; + }; + shells = lib.pipe avail [ + (lib.mapAttrs ( + name: drv: if lib.hasPrefix "bizhawkAssemblies-" name then drv else drv.assemblies or null + )) + (lib.filterAttrs (_: drv: drv != null)) + (lib.mapAttrs ( + _: asms: + lib.traceIf (lib.hasSuffix "-bin" asms.name) + "the attr specified packages BizHawk from release artifacts; some builddeps may be missing from this shell" + mkShellCustom + asms + )) + ]; + in + ( + shells + // { + default = self.devShells.${system}.emuhawk-latest; + } + ) ) nixpkgsFor; }; } diff --git a/shell.nix b/shell.nix index d52f5082a7f..66f980bafb2 100644 --- a/shell.nix +++ b/shell.nix @@ -25,26 +25,7 @@ ++ lib.optionals useVSCode [] #TODO https://devblogs.microsoft.com/dotnet/csharp-dev-kit-now-generally-available/ https://learn.microsoft.com/en-us/training/modules/implement-visual-studio-code-debugging-tools/ ; inputsFrom = [ drv ]; - shellHook = '' - export BIZHAWKBUILD_HOME='${builtins.toString ./.}' - export BIZHAWK_HOME="$BIZHAWKBUILD_HOME/output/" - ldLibPath='${lib.makeLibraryPath drv.buildInputs}' # for running tests - if [ -z "$LD_LIBRARY_PATH" ]; then - export LD_LIBRARY_PATH="$ldLibPath" - else - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$ldLibPath" - fi - alias discohawk-monort-local='${avail.launchScriptsForLocalBuild.discohawk}' - alias emuhawk-monort-local='${avail.launchScriptsForLocalBuild.emuhawk}' - case "$-" in *i*) - pfx="$(realpath --relative-to="$PWD" "$BIZHAWKBUILD_HOME")/" - if [ "$pfx" = "./" ]; then pfx=""; fi - printf "%s\n%s\n" \ - "Run ''${pfx}Dist/Build{Debug,Release}.sh to build the solution. You may need to clean up with ''${pfx}Dist/CleanupBuildOutputDirs.sh." \ - "Once built, running {discohawk,emuhawk}-monort-local will pull from ''${pfx}output/* and use Mono from Nixpkgs." - ;; - esac - ''; + shellHook = avail.shellHook drv; }; shells = lib.pipe avail [ (lib.mapAttrs (name: drv: if lib.hasPrefix "bizhawkAssemblies-" name then drv else drv.assemblies or null)) From dfbd82e3dd4e982c01581615272f8b6bfeb0f051 Mon Sep 17 00:00:00 2001 From: Ash Walker Date: Fri, 23 May 2025 17:19:11 -0400 Subject: [PATCH 15/15] Nix expr: only output default devshell and devshells for latest packages --- flake.nix | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/flake.nix b/flake.nix index 9906f88a583..2e71ffd200e 100644 --- a/flake.nix +++ b/flake.nix @@ -48,26 +48,16 @@ inputsFrom = [ drv ]; shellHook = avail.shellHook drv; }; - shells = lib.pipe avail [ - (lib.mapAttrs ( - name: drv: if lib.hasPrefix "bizhawkAssemblies-" name then drv else drv.assemblies or null - )) - (lib.filterAttrs (_: drv: drv != null)) - (lib.mapAttrs ( - _: asms: - lib.traceIf (lib.hasSuffix "-bin" asms.name) - "the attr specified packages BizHawk from release artifacts; some builddeps may be missing from this shell" - mkShellCustom - asms - )) - ]; in - ( - shells - // { - default = self.devShells.${system}.emuhawk-latest; - } - ) + { + bizhawkAssemblies-latest = mkShellCustom avail.bizhawkAssemblies-latest; + discohawk-latest = self.devShells.${system}.bizhawkAssemblies-latest; + emuhawk-latest = self.devShells.${system}.bizhawkAssemblies-latest; + default = pkgs.mkShell { + packages = [ avail.emuhawk.hawkSourceInfo.dotnet-sdk ]; + inputsFrom = [ self.devShells.${system}.emuhawk-latest ]; + }; + } ) nixpkgsFor; }; }