Skip to content

Commit

Permalink
refactor: change (mostly) everything
Browse files Browse the repository at this point in the history
- Add nixpkgs/nixos-23.11 as explicit input
- Add overlay for python and build system dependencies
- Add camkes-deps pkg, and missing concurrencytests pkg for it
- Move seL4 package to seL4 moritz-fork package and outputs
- Refine checks and hydraJobs
  • Loading branch information
wucke13 committed Feb 11, 2024
1 parent 72600d1 commit c62e9f4
Show file tree
Hide file tree
Showing 8 changed files with 292 additions and 172 deletions.
12 changes: 7 additions & 5 deletions flake.lock

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

329 changes: 166 additions & 163 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,177 +1,180 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils, ... } @ inputs: flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
inherit (self.packages.${system}) python-seL4-deps repoToolFetcher;
})
];
};
in
rec {
packages = rec {
# python dependencies

guardonce = pkgs.python3Packages.callPackage pkgs/guardonce.nix { };
pyfdt = pkgs.python3Packages.callPackage pkgs/pyfdt.nix { };

python-seL4-deps = pkgs.python3Packages.callPackage pkgs/python-seL4-deps.nix {
inherit (self.packages.${system}) guardonce pyfdt;
outputs = { self, nixpkgs, flake-utils, ... } @ inputs: flake-utils.lib.eachSystem [ "x86_64-linux" ]
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};

#
### seL4 Kernel Flavours
#
seL4-kernel-arm-hyp = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "ARM_HYP_verified";
};

seL4-kernel-arm-mcs = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "ARM_MCS_verified";
};

seL4-kernel-arm = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "ARM_verified";
};

seL4-kernel-riscv64-mcs = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "RISCV64_MCS_verified";
};

seL4-kernel-riscv64 = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "RISCV64_verified";
};

seL4-kernel-x64 = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "X64_verified";
in
{
packages = {
# python dependencies for seL4
# these are not actually part of the nixpkgs, but provided over the default overlay of
# this flake
guardonce = pkgs.python3Packages.guardonce;
pyfdt = pkgs.python3Packages.pyfdt;
concurrencytest = pkgs.python3Packages.concurrencytest;
seL4-deps = pkgs.python3Packages.seL4-deps;
camkes-deps = pkgs.python3Packages.camkes-deps;

#
### seL4 Kernel Flavours
#
seL4-kernel-arm-hyp = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "ARM_HYP_verified";
};

seL4-kernel-arm-mcs = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "ARM_MCS_verified";
};

seL4-kernel-arm = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "ARM_verified";
};

seL4-kernel-riscv64-mcs = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "RISCV64_MCS_verified";
};

seL4-kernel-riscv64 = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "RISCV64_verified";
};

seL4-kernel-x64 = pkgs.callPackage pkgs/seL4-kernel.nix {
config = "X64_verified";
};

#
### seL4 kernel + userspace flavours
#
seL4-moritz-fork-arm-hyp = pkgs.callPackage pkgs/seL4-moritz-fork.nix {
config = "ARM_HYP_verified";
extraCmakeFlags = [
"-DPLATFORM=zynq7000"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
];
};

seL4-moritz-fork-arm-mcs = pkgs.callPackage pkgs/seL4-moritz-fork.nix {
config = "ARM_MCS_verified";
extraCmakeFlags = [
"-DPLATFORM=zynq7000"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
];
};

seL4-moritz-fork-arm = pkgs.callPackage pkgs/seL4-moritz-fork.nix {
config = "ARM_verified";
extraCmakeFlags = [
"-DPLATFORM=zynq7000"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
];
};

seL4-moritz-fork-riscv64-mcs = pkgs.callPackage pkgs/seL4-moritz-fork.nix {
config = "RISCV64_MCS_verified";
extraCmakeFlags = [
"-DPLATFORM=hifive"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
];
};

seL4-moritz-fork-riscv64 = pkgs.callPackage pkgs/seL4-moritz-fork.nix {
config = "RISCV64_verified";
extraCmakeFlags = [
"-DPLATFORM=hifive"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
];
};

seL4-moritz-fork-x64 = (pkgs.callPackage pkgs/seL4-moritz-fork.nix {
config = "X64_verified";
extraCmakeFlags = [
"-DPLATFORM=pc99"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
];
}).overrideAttrs (_: { src = self.packages.${system}.seL4-test-source; });


seL4-test-source = pkgs.repoToolFetcher {
url = "https://github.com/seL4/sel4test-manifest.git";
tag = "12.1.0";
hash = "sha256-VOkoGM+E0D3OzkvOqGo9nSRp7aUx3YTiqHsDNQAOXo8=";
};
};

#
### seL4 kernel + userspace flavours
#
seL4-arm-hyp = pkgs.callPackage pkgs/seL4.nix {
config = "ARM_HYP_verified";
extraCmakeFlags = [
"-DPLATFORM=zynq7000"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
# seL4
ccache
cmake
cmakeCurses
curl
doxygen
dtc
git
gitRepo
libxml2
ncurses
ninja
protobuf
qemu_full
ubootTools
gcc-arm-embedded-8

# CAmkES
stack
haskell.compiler.ghc902

# both
python3Packages.camkes-deps # includes seL4-deps
];
shellHook = ''
export NIX_PATH=nixpkgs=${inputs.nixpkgs}:$NIX_PATH
cat << EOF
repo init -u https://github.com/seL4/sel4-tutorials-manifest
repo sync
rm -rf tutorial*
mkdir tutorial
cd tutorial
../init --tut hello-world
cd ../tutorial_build
ninja
./check
EOF
'';
};

seL4-arm-mcs = pkgs.callPackage pkgs/seL4.nix {
config = "ARM_MCS_verified";
extraCmakeFlags = [
"-DPLATFORM=zynq7000"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
];
};

seL4-arm = pkgs.callPackage pkgs/seL4.nix {
config = "ARM_verified";
extraCmakeFlags = [
"-DPLATFORM=zynq7000"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
];
};

# These two fail to link

# seL4-riscv64-mcs = pkgs.callPackage pkgs/seL4.nix {
# inherit python-seL4-deps;
# config = "RISCV64_MCS_verified";
# extraCmakeFlags = [
# "-DPLATFORM=hifive"
# "-DRELEASE=FALSE"
# "-DVERIFICATION=FALSE"
# ];
# };
# seL4-riscv64 = pkgs.callPackage pkgs/seL4.nix {
# inherit python-seL4-deps;
# config = "RISCV64_verified";
# extraCmakeFlags = [
# "-DPLATFORM=hifive"
# "-DRELEASE=FALSE"
# "-DVERIFICATION=FALSE"
# ];
# };

seL4-x64 = pkgs.callPackage pkgs/seL4.nix {
config = "X64_verified";
extraCmakeFlags = [
"-DPLATFORM=pc99"
"-DRELEASE=FALSE"
"-DVERIFICATION=FALSE"
];
# always check these
checks = {
nixpkgs-fmt = pkgs.runCommand "nixpkgs-fmt"
{
nativeBuildInputs = [ pkgs.nixpkgs-fmt ];
} "nixpkgs-fmt --check ${./.}; touch $out";
};

repoToolFetcher = pkgs.callPackage pkgs/repo-tool-fetcher.nix { };

seL4-test-source = repoToolFetcher {
url = "https://github.com/seL4/sel4test-manifest.git";
tag = "12.1.0";
hash = "sha256-VOkoGM+E0D3OzkvOqGo9nSRp7aUx3YTiqHsDNQAOXo8=";
};
};

devShells.default = (pkgs.mkShell.override { stdenv = pkgs.gcc8Stdenv; }) {
nativeBuildInputs = with pkgs; [
# seL4
ccache
cmake
cmakeCurses
curl
doxygen
dtc
git
gitRepo
libxml2
ncurses
ninja
protobuf
qemu_full
ubootTools
gcc-arm-embedded-8

# CAmkES
stack
haskell.compiler.ghc902

# both
packages.python-seL4-deps
];
shellHook = ''
export NIX_PATH=nixpkgs=${inputs.nixpkgs}:$NIX_PATH
cat << EOF
repo init -u https://github.com/seL4/sel4-tutorials-manifest
repo sync
rm -rf tutorial*
mkdir tutorial
cd tutorial
../init --tut hello-world
cd ../tutorial_build
ninja
./check
EOF
'';
};

# always check these
checks = {
nixpkgs-fmt = pkgs.runCommand "nixpkgs-fmt"
{
nativeBuildInputs = [ pkgs.nixpkgs-fmt ];
} "nixpkgs-fmt --check ${./.}; touch $out";
};

# instructions for the CI server
hydraJobs = (nixpkgs.lib.filterAttrs (n: _: n != "default") packages) // checks;
});
# instructions for the CI server
hydraJobs =
let
inherit (nixpkgs.lib.attrsets) filterAttrs;
checks = self.checks.${system};
packages = self.packages.${system};
in
(filterAttrs (n: v: n != "default") packages) // checks;
}) // {
# declare overlay with added deps, i. e. the python packages not available in official nixpkgs
overlays.default = import ./overlay.nix;
};
}
Loading

0 comments on commit c62e9f4

Please sign in to comment.