Skip to content

Commit

Permalink
🎨 change all default.nix to flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
comavius committed Nov 11, 2024
1 parent 3529ce4 commit 4ffaaa0
Show file tree
Hide file tree
Showing 24 changed files with 349 additions and 170 deletions.
4 changes: 3 additions & 1 deletion exec-container/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
result
result
**/flake.lock
!/flake.lock
5 changes: 0 additions & 5 deletions exec-container/compilers/brainfuck/default.nix

This file was deleted.

11 changes: 11 additions & 0 deletions exec-container/compilers/brainfuck/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
inputs = {};

outputs = {...}: {
drv = {pkgs, ...}: let
myBrainfuck = pkgs.bfc;
myClang = pkgs.clang;
in
pkgs.writeShellScriptBin "bfc" "PATH=${myClang}/bin:$PATH exec ${myBrainfuck}/bin/bfc $@";
};
}
9 changes: 0 additions & 9 deletions exec-container/compilers/default.nix

This file was deleted.

21 changes: 21 additions & 0 deletions exec-container/compilers/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
inputs = {
myBrainfuck = {
url = "./brainfuck";
};
myGolang = {
url = "./golang";
};
};

outputs = {
myGolang,
myBrainfuck,
...
}: {
all = {pkgs, ...}: [
(myGolang.drv {inherit pkgs;})
(myBrainfuck.drv {inherit pkgs;})
];
};
}
4 changes: 0 additions & 4 deletions exec-container/compilers/golang/compiler.nix

This file was deleted.

8 changes: 0 additions & 8 deletions exec-container/compilers/golang/default.nix

This file was deleted.

68 changes: 68 additions & 0 deletions exec-container/compilers/golang/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
inputs = {
gods = {
url = "github:emirpasic/gods/v1.18.1";
flake = false;
};
gonum = {
url = "github:gonum/gonum/v0.15.1";
flake = false;
};
gostl = {
url = "github:liyue201/gostl/v1.2.0";
flake = false;
};
golang-org-exp = {
# No version tag available in the repository. (v0.0.0-20241009180824-f66d83c29e7c)
url = "github:golang/exp/225e2abe05e664228e7afb6bf5b97a25d56ba575";
flake = false;
};
};

outputs = {
self,
gods,
gonum,
gostl,
golang-org-exp,
...
}: {
drv = {pkgs, ...}: let
compiler-drv = let
goCompiler = pkgs.go;
in
pkgs.writeShellScriptBin "go" "exec ${goCompiler}/share/go/bin/go $@";
mod-drv = pkgs.stdenv.mkDerivation {
name = "go.mod template";
src = ./.;
phases = "installPhase";
installPhase = ''
mkdir -p $out/misc/go
touch $out/misc/go/go.mod
echo 'module gomod-template
go 1.23.2
require (
github.com/emirpasic/gods v1.18.1
github.com/gonum/gonum v0.15.1
github.com/liyue201/gostl v1.2.0
golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c
)
replace (
github.com/emirpasic/gods => ${gods}
github.com/gonum/gonum => ${gonum}
github.com/liyue201/gostl => ${gostl}
golang.org/x/exp => ${golang-org-exp}
)
' > $out/misc/go/go.mod
'';
};
in
pkgs.symlinkJoin {
name = "golang";
paths = [compiler-drv mod-drv];
};
};
}
28 changes: 0 additions & 28 deletions exec-container/compilers/golang/go-mod.nix

This file was deleted.

131 changes: 127 additions & 4 deletions exec-container/flake.lock

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

60 changes: 16 additions & 44 deletions exec-container/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,32 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
gods = {
url = "github:emirpasic/gods/v1.18.1";
flake = false;
};
gonum = {
url = "github:gonum/gonum/v0.15.1";
flake = false;
};
gostl = {
url = "github:liyue201/gostl/v1.2.0";
flake = false;
};
golang-org-exp = {
# No version tag available in the repository. (v0.0.0-20241009180824-f66d83c29e7c)
url = "github:golang/exp/225e2abe05e664228e7afb6bf5b97a25d56ba575";
flake = false;
};
myCompilers.url = "./compilers";
myInterpreters.url = "./interpreters";
myTools.url = "./tools";
};

outputs = {
self,
nixpkgs,
flake-utils,
gods,
gonum,
gostl,
golang-org-exp,
myCompilers,
myInterpreters,
myTools,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
myGoLibraries = {
inherit gods gonum gostl golang-org-exp;
};
})
];
};
pkgs = import nixpkgs {inherit system;};
in {
packages = {
environment = let
interpreters = import ./interpreters {inherit pkgs;};
compilers = import ./compilers {inherit pkgs;};
tools = import ./tools {inherit pkgs;};
in
pkgs.symlinkJoin {
name = "exec-container-enviroment";
paths = [
interpreters.all
compilers.all
tools.all
];
};
environment = pkgs.symlinkJoin {
name = "exec-container-enviroment";
paths = [
(myCompilers.all {inherit pkgs;})
(myInterpreters.all {inherit pkgs;})
(myTools.all {inherit pkgs;})
];
};
default = pkgs.dockerTools.buildImage {
name = "exec-container";
copyToRoot = [
Expand Down
4 changes: 0 additions & 4 deletions exec-container/interpreters/bash/default.nix

This file was deleted.

Loading

0 comments on commit 4ffaaa0

Please sign in to comment.