Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Sanft <[email protected]>
  • Loading branch information
msanft committed Sep 14, 2023
0 parents commit 4ee7631
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 0 deletions.
3 changes: 3 additions & 0 deletions example/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/msanft/keystone-go-enclaves

go 1.20
23 changes: 23 additions & 0 deletions example/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package main

/*
#include <stdio.h>
#include <stdlib.h>
void myprint() {
printf("Hello world (c)\n)");
}
*/
import "C"
import "fmt"

func main() {
C.myprint()
fmt.Println("Hello world (go)")
}

// import "fmt"

// func main() {
// fmt.Println("Hello world")
// }
25 changes: 25 additions & 0 deletions flake.lock

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

39 changes: 39 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
description = "A very basic flake";

outputs = { self, nixpkgs }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
musl = pkgs.pkgsCross.riscv64.musl; # pkgs.musl;
in
{
packages.x86_64-linux.default = pkgs.pkgsCross.riscv64.pkgsStatic.buildGoModule {
pname = "keystone-go-enclaves";
version = "0.0.0";

src = ./example;

vendorHash = null;

nativeBuildInputs = [ musl ];

CGO_ENABLED = 1;

ldflags = [
"-s"
"-w"
"-linkmode external"
"-extldflags '-static -L${musl}/lib'"
];

};

devShells.x86_64-linux.default = pkgs.mkShell
{
packages = [
pkgs.qemu
musl
];
};
};
}
1 change: 1 addition & 0 deletions result

0 comments on commit 4ee7631

Please sign in to comment.