-
Notifications
You must be signed in to change notification settings - Fork 414
Add flake.nix #4328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SignalWalker
wants to merge
15
commits into
TASEmulators:master
Choose a base branch
from
SignalWalker:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add flake.nix #4328
Changes from 5 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
52756cc
Nix expr: add flake.nix
SignalWalker 144e8a7
Nix expr: add apps output to flake.nix
SignalWalker 2593753
Nix expr: update system list
SignalWalker aed4768
Nix expr: remove answered todo comment
SignalWalker 0a196a5
Nix expr: add overlay output to `flake.nix`
SignalWalker ece2064
Nix expr: use `lib.strings.hasPrefix`
SignalWalker f8452a2
Nix expr: use description from README.md
SignalWalker c47195d
Nix expr: remove formatter
SignalWalker 3bd7c86
Nix expr: fix derivation import in overlay output
SignalWalker 5f8bd38
Nix expr: remove redundant apps output from flake.nix
SignalWalker 226b571
Nix expr: remove overlay output
SignalWalker ea7855a
Nix expr: use `lib` instead of `std` in flake.nix
SignalWalker acde1d1
Nix expr: use `github:NixOS/nixpkgs?ref=24.05` as nixpkgs input in fl…
SignalWalker 6be3da2
Nix expr: make `shellHook` an output of `default.nix`, make shells di…
SignalWalker dfbd82e
Nix expr: only output default devshell and devshells for latest packages
SignalWalker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
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"; | ||
SignalWalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
outputs = | ||
inputs@{ self, nixpkgs, ... }: | ||
with builtins; | ||
let | ||
std = nixpkgs.lib; | ||
SignalWalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
systems = [ | ||
# this is currently the only supported system, according to https://github.com/TASEmulators/BizHawk/issues/1430#issue-396452488 | ||
"x86_64-linux" | ||
]; | ||
YoshiRulz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
nixpkgsFor = std.genAttrs systems ( | ||
system: | ||
import nixpkgs { | ||
localSystem = builtins.currentSystem or system; | ||
crossSystem = system; | ||
overlays = [ ]; | ||
} | ||
); | ||
# because for some reason the standard library doesn't include this (i think?) | ||
startsWith = prefix: st: (substring 0 (stringLength prefix) st) == prefix; | ||
SignalWalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# 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; | ||
YoshiRulz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
packages = mapAttrs ( | ||
system: pkgs: | ||
(importDefaultDerivationsWith 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; })) | ||
SignalWalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// { | ||
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)) ( | ||
SignalWalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# 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 | ||
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); | ||
SignalWalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
in | ||
mapAttrs ( | ||
system: pkgs: | ||
( | ||
(toApps "emuhawk" pkgs) | ||
// (toApps "discohawk" pkgs) | ||
// { | ||
default = self.apps.${system}.emuhawk-latest-bin; | ||
} | ||
) | ||
) self.packages; | ||
}; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.