Skip to content
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

Nix package for goa #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{ pkgs,
lib ? pkgs.lib,
stdenv ? pkgs.stdenv,
toolchain-bin ## provided by nixpkgs-genode
}:

stdenv.mkDerivation rec {
name = "goa";
version = "2024-11-04";

src = ./.;

buildInputs = with pkgs; [
expect

## dependencies documented at https://github.com/genodelabs/goa/blob/master/bin/goa#L42
git gnumake wget findutils gnused diffutils gnutar libxml2.bin

## dependencies for `goa help`
man less

## https://github.com/genodelabs/goa/blob/master/share/goa/lib/actions/build.tcl#L152
toolchain-bin
];

nativeBuildInputs = with pkgs; [
makeWrapper
gnused
autoPatchelfHook
];

installPhase = ''
mkdir -p $out
cp -r ./* $out

wrapProgram $out/bin/goa --set PATH "${lib.makeBinPath buildInputs}:$PATH"

## substitute hardcoded paths of genode-toolchain
sed -e 's@^set genode_tools_dir.*$@set genode_tools_dir "${toolchain-bin}/bin/"@' -i $out/share/goa/lib/backtrace
sed -e 's@set qt_tool_dir.*$@set qt_tool_dir "${toolchain-bin}/"@' -i $out/share/goa/lib/build/qmake.tcl ## TODO test
sed -e 's@arm_v8a { set cross_dev_prefix.*$@arm_v8a { set cross_dev_prefix "${toolchain-bin}/bin/genode-aarch64-" }@' -i $out/share/goa/lib/command_line.tcl
sed -e 's@x86_64 *{ set cross_dev_prefix.*$@x86_64 { set cross_dev_prefix "${toolchain-bin}/bin/genode-x86-" }@' -i $out/share/goa/lib/command_line.tcl
'';
}
64 changes: 64 additions & 0 deletions flake.lock

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

53 changes: 53 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
description = ''
This flake provides `goa` with the required dependencies from [nixpkgs](https://nixos.org/).

The `goa`-executable can be used without installation:
```sh
nix run github:johannesloetzsch/goa -- help
```

The `defaultShell` opens an environment with `goa`, its dependencies and the `genode-toolchain`.
Usage:
```sh
nix shell github:johannesloetzsch/goa
goa help
```
'';

inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";

flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};

genode-utils = {
url = "github:zgzollers/nixpkgs-genode";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, flake-compat, genode-utils }:
let
inherit (genode-utils.packages.${system}) toolchain-bin;

system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
in rec {
packages.${system} = rec {

## The [Genode tool chain](https://genode.org/download/tool-chain)
## provided by [nixpkgs-genode](https://github.com/zgzollers/nixpkgs-genode/blob/main/pkgs/toolchain-bin.nix)
inherit toolchain-bin;

goa = import ./default.nix { inherit pkgs toolchain-bin; };
default = goa;
};

defaultShell = pkgs.mkShell {
buildInputs = with packages.${system}; [ goa goa.buildInputs toolchain-bin ];
};
};
}