mirror of https://github.com/seL4/microkit.git
Add initial Nix flake for development shell
Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
This commit is contained in:
parent
b8573a5e41
commit
c3ebee6a12
|
@ -5,6 +5,7 @@ Source: http://sel4.systems
|
|||
|
||||
Files:
|
||||
tool/microkit/Cargo.lock
|
||||
flake.lock
|
||||
CHANGES.md
|
||||
VERSION
|
||||
Copyright: 2024, UNSW
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1717179513,
|
||||
"narHash": "sha256-vboIEwIQojofItm2xGCdZCzW96U85l9nDW3ifMuAIdM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "24.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1728538411,
|
||||
"narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"treefmt-nix": "treefmt-nix",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1729736953,
|
||||
"narHash": "sha256-Rb6JUop7NRklg0uzcre+A+Ebrn/ZiQPkm4QdKg6/3pw=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "29b1275740d9283467b8117499ec8cbb35250584",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1729613947,
|
||||
"narHash": "sha256-XGOvuIPW1XRfPgHtGYXd5MAmJzZtOuwlfKDgxX5KT3s=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "aac86347fb5063960eccb19493e0cadcdb4205ca",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1726560853,
|
||||
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
#
|
||||
# Copyright 2024, UNSW
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
{
|
||||
description = "A flake for building microkit";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/24.05";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay, treefmt-nix, ... }@inputs: inputs.utils.lib.eachSystem [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
]
|
||||
(system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
overlays = [ (import rust-overlay) ];
|
||||
};
|
||||
|
||||
treefmtEval = treefmt-nix.lib.evalModule pkgs (
|
||||
{ ... }:
|
||||
{
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixpkgs-fmt.enable = true;
|
||||
}
|
||||
);
|
||||
|
||||
aarch64-toolchain = import nixpkgs {
|
||||
localSystem = "${system}";
|
||||
crossSystem = {
|
||||
config = "aarch64-none-elf";
|
||||
};
|
||||
};
|
||||
|
||||
# pyfdt is not officially supported in Nix so we compile it ourselves
|
||||
pyfdt = with pkgs.python311Packages;
|
||||
buildPythonPackage rec {
|
||||
pname = "pyfdt";
|
||||
version = "0.3";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "superna9999";
|
||||
repo = pname;
|
||||
rev = "${pname}-${version}";
|
||||
hash = "sha256-lt/Mcw3j1aTBVOVhDBSYtriDyzeJHcSli69EXLfsgDM=";
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Python Flattened Device Tree Library";
|
||||
homepage = "https://github.com/superna9999/pyfdt";
|
||||
license = with licenses; [ asl20 ];
|
||||
maintainers = with maintainers; [ wucke13 ];
|
||||
};
|
||||
};
|
||||
|
||||
pythonTool = pkgs.python311.withPackages (ps: [
|
||||
ps.mypy
|
||||
ps.black
|
||||
ps.flake8
|
||||
ps.ply
|
||||
ps.jinja2
|
||||
ps.pyaml
|
||||
ps.lxml
|
||||
pyfdt
|
||||
ps.setuptools
|
||||
]);
|
||||
|
||||
microkiToolToml = nixpkgs.lib.trivial.importTOML ./tool/microkit/Cargo.toml;
|
||||
microkitToolVersion = microkiToolToml.package.rust-version;
|
||||
|
||||
rustTool = pkgs.rust-bin.stable.${microkitToolVersion}.default.override {
|
||||
targets = [ pkgs.pkgsStatic.hostPlatform.rust.rustcTarget ];
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
# for `nix fmt`
|
||||
formatter = treefmtEval.config.build.wrapper;
|
||||
# for `nix flake check`
|
||||
checks.formatting = treefmtEval.config.build.check self;
|
||||
|
||||
devShells.default = pkgs.mkShell rec {
|
||||
name = "microkit-shell";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkgsCross.aarch64-embedded.stdenv.cc.bintools
|
||||
pkgsCross.aarch64-embedded.stdenv.cc.cc
|
||||
pkgsCross.riscv64-embedded.stdenv.cc.bintools
|
||||
pkgsCross.riscv64-embedded.stdenv.cc.cc
|
||||
gnumake
|
||||
dtc
|
||||
expect
|
||||
pythonTool
|
||||
git
|
||||
rustTool
|
||||
pandoc
|
||||
(texlive.combine {
|
||||
inherit (texlive) scheme-medium titlesec enumitem sfmath roboto fontaxes isodate substr tcolorbox environ pdfcol;
|
||||
})
|
||||
cmake
|
||||
ninja
|
||||
libxml2
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue