add in default nix at repo root that calls flake for build

This commit is contained in:
John Murray 2023-11-14 22:09:02 -05:00
parent f64766f625
commit 81cd92f3fe
No known key found for this signature in database
6 changed files with 49 additions and 17 deletions

10
default.nix Normal file
View File

@ -0,0 +1,10 @@
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = lock.nodes.flake-compat.locked.url or "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix

View File

@ -1,5 +1,19 @@
{
"nodes": {
"flake-compat": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"revCount": 57,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@ -59,6 +73,7 @@
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixgl": "nixgl",
"nixpkgs": "nixpkgs",

View File

@ -18,9 +18,12 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
# for non flake backwards compatibility
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, nixgl }:
outputs = { self, nixpkgs, rust-overlay, flake-utils, nixgl, ... }@inputs:
let supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
in flake-utils.lib.eachSystem supportedSystems (system:
let
@ -31,7 +34,8 @@
rocBuild = import ./nix { inherit pkgs; };
compile-deps = rocBuild.compile-deps;
inherit (compile-deps) zigPkg llvmPkgs llvmVersion llvmMajorMinorStr glibcPath libGccSPath;
inherit (compile-deps) zigPkg llvmPkgs llvmVersion
llvmMajorMinorStr glibcPath libGccSPath darwinInputs;
# DevInputs are not necessary to build roc as a user
linuxDevInputs = with pkgs;
@ -48,16 +52,6 @@
xorg.libxcb
];
darwinInputs = with pkgs;
lib.optionals stdenv.isDarwin
(with pkgs.darwin.apple_sdk.frameworks; [
AppKit
CoreFoundation
CoreServices
Foundation
Security
]);
# DevInputs are not necessary to build roc as a user
darwinDevInputs = with pkgs;
lib.optionals stdenv.isDarwin

View File

@ -12,4 +12,14 @@ let
in
{
inherit zigPkg llvmPkgs llvmVersion llvmMajorMinorStr glibcPath libGccSPath;
darwinInputs = with pkgs;
lib.optionals stdenv.isDarwin
(with pkgs.darwin.apple_sdk.frameworks; [
AppKit
CoreFoundation
CoreServices
Foundation
Security
]);
}

View File

@ -5,11 +5,12 @@ let
cargo = rustVersion;
rustc = rustVersion;
};
compile-deps = pkgs.callPackage ./compile-deps.nix {};
compile-deps = pkgs.callPackage ./compile-deps.nix { };
in
{
inherit rustPlatform compile-deps;
rust-shell =
(rustVersion.override { extensions = [ "rust-src" "rust-analyzer" ]; });
roc-cli = pkgs.callPackage ./roc-cli.nix { inherit compile-deps rustPlatform; };
roc-lang-server = {};
}

View File

@ -1,4 +1,4 @@
{ pkgs, rustPlatform, compile-deps }:
{ pkgs, rustPlatform, compile-deps, subPackage ? null }:
let
inherit (compile-deps) zigPkg llvmPkgs llvmVersion llvmMajorMinorStr glibcPath libGccSPath;
in
@ -6,10 +6,12 @@ rustPlatform.buildRustPackage {
pname = "roc";
version = "0.0.1";
src = pkgs.nix-gitignore.gitignoreSource [ ] ./.;
buildAndTestSubdir = subPackage;
src = pkgs.nix-gitignore.gitignoreSource [ ] ../.;
cargoLock = {
lockFile = ./Cargo.lock;
lockFile = ../Cargo.lock;
outputHashes = {
"criterion-0.3.5" = "sha256-+FibPQGiR45g28xCHcM0pMN+C+Q8gO8206Wb5fiTy+k=";
"inkwell-0.2.0" = "sha256-VhTapYGonoSQ4hnDoLl4AAgj0BppAhPNA+UPuAJSuAU=";