Handout
This commit is contained in:
64
utils/flake.nix
Normal file
64
utils/flake.nix
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* This file allows you to run `nix develop` to get a shell with all external dependencies (`make` plus the tools it calls) of this repo (and maybe some beyond).
|
||||
* The only thing required is an installation of the "Nix" package manager for Linux (/WSL) or MacOS: https://nixos.org/download/
|
||||
*/
|
||||
{
|
||||
description = ''
|
||||
The educational operating system StuBS.
|
||||
'';
|
||||
inputs = {
|
||||
|
||||
# The rolling-release of the Nix(OS) package definitions. Use `nix flake lock` to update
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
# Some boilerplate:
|
||||
systems.url = "github:nix-systems/x86_64-linux"; # no cross compiling and only x86(_64) for now (darwin (MacOS) might work)
|
||||
};
|
||||
outputs =
|
||||
inputs:
|
||||
let
|
||||
lib = inputs.nixpkgs.lib;
|
||||
eachSystem =
|
||||
f:
|
||||
lib.foldAttrs lib.mergeAttrs { } (
|
||||
map (s: lib.mapAttrs (_: v: { ${s} = v; }) (f s)) (import inputs.systems)
|
||||
);
|
||||
in
|
||||
{ }
|
||||
// (eachSystem (
|
||||
localSystem:
|
||||
let
|
||||
pkgs = import inputs.nixpkgs { system = localSystem; };
|
||||
in
|
||||
{
|
||||
|
||||
# The shell environment definition used by `nix develop`:
|
||||
devShells.default = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } {
|
||||
nativeBuildInputs =
|
||||
with pkgs;
|
||||
[
|
||||
# for all tasks and maintenance
|
||||
gdb
|
||||
qemu_kvm
|
||||
nasm
|
||||
ccache
|
||||
unixtools.xxd
|
||||
git
|
||||
libisoburn # for building iso images
|
||||
grub2
|
||||
python3
|
||||
bear # make compile_commands.json
|
||||
clang-tools # for clangd and clang-format
|
||||
]
|
||||
++ (lib.filter (
|
||||
pkg: lib.isDerivation pkg && pkg.pname or "" != "glibc"
|
||||
) pkgs.stdenv.allowedRequisites); # basic tools + compilers (gcc/g++)
|
||||
env = {
|
||||
# This will tell the iso builder where the grub tools may be found
|
||||
GRUBBIN="${pkgs.grub2}/lib/grub/i386-pc";
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
));
|
||||
}
|
||||
Reference in New Issue
Block a user