update earthfile, flake.nix and shell.nix

This commit is contained in:
Anton-4 2022-05-02 20:02:46 +02:00
parent c745c08071
commit 3b7ef7b3ca
No known key found for this signature in database
GPG Key ID: C954D6E0F9C0ABFD
4 changed files with 190 additions and 63 deletions

View File

@ -1,4 +1,4 @@
FROM rust:1.58.0-slim-bullseye # make sure to update rust-toolchain.toml and nixpkgs-unstable in sources.json too so that it uses the same rust version > search for cargo on unstable here: https://search.nixos.org/packages
FROM rust:1.60.0-slim-bullseye # make sure to update rust-toolchain.toml and nixpkgs-unstable in sources.json too so that it uses the same rust version > search for cargo on unstable here: https://search.nixos.org/packages
WORKDIR /earthbuild
prep-debian:

View File

@ -1,5 +1,50 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1637014545,
"narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1629481132,
"narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "997f7efcb746a9c140ce1f13c72263189225f482",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1647282937,
@ -18,11 +63,43 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1647350163,
"narHash": "sha256-OcMI+PFEHTONthXuEQNddt16Ml7qGvanL3x8QOl2Aao=",
"lastModified": 1651369430,
"narHash": "sha256-d86uUm0s11exU9zLo2K1AwtJQJDKubFpoF0Iw767uT4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3eb07eeafb52bcbf02ce800f032f18d666a9498d",
"rev": "b283b64580d1872333a99af2b4cef91bb84580cf",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1637453606,
"narHash": "sha256-Gy6cwUswft9xqsjWxFYEnx/63/qzaFUwatcbV5GF/GQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8afc4e543663ca0a6a4f496262cd05233737e732",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1631288242,
"narHash": "sha256-sXm4KiKs7qSIf5oTAmrlsEvBW193sFj+tKYVirBaXz0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0e24c87754430cb6ad2f8c8c8021b29834a8845e",
"type": "github"
},
"original": {
@ -34,8 +111,49 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
"nixpkgs-unstable": "nixpkgs-unstable",
"rust-overlay": "rust-overlay",
"zig": "zig"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1651459928,
"narHash": "sha256-V/4b3OG7W6WgkTZXlaYXIg1lYqXy+VgRQReWE4apjgU=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "979ae5a43bdb7662c9dfd2f57826afde0ad438bb",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"zig": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1651452199,
"narHash": "sha256-lq6mTsoPeOCsji/oMFf6953/uOtOhZZ7HSdtjNVDh6I=",
"owner": "roarkanize",
"repo": "zig-overlay",
"rev": "c3bd59086dbc731c240c924fd2bc3581720d0035",
"type": "github"
},
"original": {
"owner": "roarkanize",
"repo": "zig-overlay",
"type": "github"
}
}
},

119
flake.nix
View File

@ -3,68 +3,77 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
# zig = { url = "github:roarkanize/zig-overlay"; };
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
zig.url = "github:roarkanize/zig-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, nixpkgs-unstable }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
unstable-pkgs = nixpkgs-unstable.legacyPackages.x86_64-linux;
llvmPkgs = pkgs.llvmPackages_12;
outputs = { self, nixpkgs, nixpkgs-unstable, rust-overlay, zig, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
unstable-pkgs = nixpkgs-unstable.legacyPackages.${system};
llvmPkgs = pkgs.llvmPackages_12;
linuxInputs = with pkgs; [
valgrind # used in cli tests, see cli/tests/cli_run.rs
vulkan-headers
vulkan-loader
vulkan-tools
vulkan-validation-layers
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
xorg.libxcb
alsa-lib
];
# get current working directory
cwd = builtins.toString ./.;
rust = pkgs.rust-bin.fromRustupToolchainFile "${cwd}/rust-toolchain.toml";
sharedInputs = (with pkgs; [
# build libraries
cmake
git
python3
llvmPkgs.llvm.dev
llvmPkgs.clang
libxkbcommon
pkg-config
zig # roc builtins are implemented in zig, see compiler/builtins/bitcode/
linuxInputs = with pkgs; [
valgrind # used in cli tests, see cli/tests/cli_run.rs
vulkan-headers
vulkan-loader
vulkan-tools
vulkan-validation-layers
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXi
xorg.libxcb
alsa-lib
];
# lib deps
libffi
libxml2
ncurses
zlib
libiconv
# zig 0.8.1 from pkgs is broken on aarch64-darwin, hence the workaround
zig-toolchain = zig.packages.${system}."0.8.1";
# faster builds - see https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md#use-lld-for-the-linker
llvmPkgs.lld
# debugir
]) ++ (with unstable-pkgs; [
rustc
cargo
clippy
rustfmt
]);
in {
sharedInputs = (with pkgs; [
# build libraries
cmake
git
python3
llvmPkgs.llvm.dev
llvmPkgs.clang
libxkbcommon
pkg-config
zig-toolchain # roc builtins are implemented in zig, see compiler/builtins/bitcode/
devShell.x86_64-linux = pkgs.mkShell {
buildInputs = sharedInputs ++ linuxInputs;
# lib deps
libffi
libxml2
ncurses
zlib
libiconv
LLVM_SYS_120_PREFIX = "${llvmPkgs.llvm.dev}";
NIX_GLIBC_PATH = if pkgs.stdenv.isLinux then "${pkgs.glibc_multi.out}/lib" else "";
LD_LIBRARY_PATH = with pkgs;
lib.makeLibraryPath
([ pkg-config stdenv.cc.cc.lib libffi ncurses zlib ] ++ linuxInputs);
};
# faster builds - see https://github.com/rtfeldman/roc/blob/trunk/BUILDING_FROM_SOURCE.md#use-lld-for-the-linker
llvmPkgs.lld
# debugir
};
rust
]);
in {
devShell = pkgs.mkShell {
buildInputs = sharedInputs ++ linuxInputs;
LLVM_SYS_120_PREFIX = "${llvmPkgs.llvm.dev}";
NIX_GLIBC_PATH = if pkgs.stdenv.isLinux then "${pkgs.glibc_multi.out}/lib" else "";
LD_LIBRARY_PATH = with pkgs;
lib.makeLibraryPath
([ pkg-config stdenv.cc.cc.lib libffi ncurses zlib ] ++ linuxInputs);
};
}
);
}

View File

@ -29,10 +29,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "684c73c9e6ac8f4d0c6dea3251292e758ac375b5",
"sha256": "0hl2nzizn4pwd3sn9gxkngzn88k9in01xm14afpj7716j8y0j2qa",
"rev": "b283b64580d1872333a99af2b4cef91bb84580cf",
"sha256": "0gmrpfzc622xl1lv3ffaj104j2q3nmia7jywafqmgmrcdm9axkkp",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/684c73c9e6ac8f4d0c6dea3251292e758ac375b5.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/b283b64580d1872333a99af2b4cef91bb84580cf.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}