Skip to content

Commit

Permalink
Add nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
9ary committed Dec 31, 2023
1 parent 99d1b15 commit e6f2088
Show file tree
Hide file tree
Showing 6 changed files with 171 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8="
fi
use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ ipl.rom

!res/qoob_pro_none_upgrade.elf
!res/qoob_sx_13c_upgrade.elf

.direnv
7 changes: 7 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(import (let
lockFile = builtins.fromJSON (builtins.readFile ./flake.lock);
info = lockFile.nodes.flake-compat.locked;
in builtins.fetchTarball {
url = "https://api.${info.host or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}";
${if info ? narHash then "sha256" else null} = info.narHash;
}) { src = ./.; }).defaultNix
81 changes: 81 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

70 changes: 70 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
description = "A utilitarian bootloader for the GameCube";

inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
nixpkgs.url = "github:9ary/nixpkgs/devkitPPC";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
systems.flake = false;
};

outputs = { ... } @ inputs: inputs.flake-parts.lib.mkFlake {
inherit inputs;
} ({ config, flake-parts-lib, getSystem, inputs, lib, options, ... }:
let
rootConfig = config;
rootOptions = options;
in
{
_file = ./flake.nix;
imports = [ ];
config.perSystem = { config, inputs', nixpkgs, options, pkgs, system, ... }:
let
systemConfig = config;
systemOptions = options;
in
{
_file = ./flake.nix;
config = {
devShells.default = pkgs.callPackage
({ mkShell
, devkitPPC
, gamecube-tools
, meson
, ninja
, p7zip
, python3
}: mkShell {
name = "iplboot";
nativeBuildInputs = [
# The cross toolchain
devkitPPC
gamecube-tools

# The build system
meson ninja

# Compressing binaries and the release archive
p7zip

# For build scripts
python3
];

env = {
# For the libogc2 Makefile
DEVKITPPC = devkitPPC;
};
})
{ };
};
};
config.systems = import inputs.systems;
});
}
7 changes: 7 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(import (let
lockFile = builtins.fromJSON (builtins.readFile ./flake.lock);
info = lockFile.nodes.flake-compat.locked;
in builtins.fetchTarball {
url = "https://api.${info.host or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}";
${if info ? narHash then "sha256" else null} = info.narHash;
}) { src = ./.; }).shellNix

0 comments on commit e6f2088

Please sign in to comment.