Skip to content

Commit

Permalink
✨ go compiler and libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
comavius committed Oct 19, 2024
1 parent 6c64f52 commit f06ad88
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
5 changes: 5 additions & 0 deletions exec-container/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@
inherit pkgs;
inherit filter;
};
golang = import ./golang/golang.nix {
inherit pkgs;
inherit filter;
};
in
{
packages = {
default = pkgs.symlinkJoin {
name = "default-all";
paths = [
python-all
golang
];
};
};
Expand Down
22 changes: 22 additions & 0 deletions exec-container/golang/compiler.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
pkgs, filter, ...
}:
let
golang = pkgs.go;
in
pkgs.stdenv.mkDerivation {
name = "golang";
src = filter {
root = golang;
/*
*/
include = [
"share/go/bin/go"
];
};
phases = "installPhase";
installPhase = ''
mkdir -p $out/bin
ln -s $src/share/go/bin/go $out/bin/go
'';
}
13 changes: 13 additions & 0 deletions exec-container/golang/golang.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
pkgs, filter, ...
}: let
compiler = import ./compiler.nix { inherit pkgs; inherit filter; };
vendor = import ./library.nix { inherit pkgs; };
in
pkgs.symlinkJoin {
name = "python-all";
paths = [
compiler
vendor
];
}
40 changes: 40 additions & 0 deletions exec-container/golang/library.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
pkgs, ...
}:
let
gods = builtins.fetchGit {
url = "https://github.com/emirpasic/gods";
rev = "dbdbadc158ae6b453820b3cfb8c6cb48be4d7ddf"; # v1.18.1
};
gonum = builtins.fetchGit {
url = "https://github.com/gonum/gonum";
rev = "bdcda9a453049449163d160b98285b64ec8093a1"; # v0.15.1
};
gostl = builtins.fetchGit {
url = "https://github.com/liyue201/gostl";
rev = "98dc0eb1ce1063cf860342e7e890760fcb711e3b"; # v1.2.0
};
golang-org-x-exp = builtins.fetchGit {
url = "https://github.com/golang/exp";
rev = "225e2abe05e664228e7afb6bf5b97a25d56ba575"; # v0.0.0-20241009180824-f66d83c29e7c (via GitHub)
};
in
pkgs.stdenv.mkDerivation {
name = "go-library";
description = "Libraries for Go";
phases = "installPhase";
byuidInputs = [
gods
gonum
gostl
golang-org-x-exp
];
src = ./.;
installPhase = ''
mkdir -p $out/cache/go
ln -s ${gods} $out/cache/go/gods
ln -s ${gonum} $out/cache/go/gonum
ln -s ${gostl} $out/cache/go/gostl
ln -s ${golang-org-x-exp} $out/cache/go/exp
'';
}

0 comments on commit f06ad88

Please sign in to comment.