Files
bsb2/utils/flake.nix
Niklas Gollenstede 4245798955 fixes for A2
mostly include some things that should and remove some things that shouldn't have been included in the handout (yes this does hint at some places that need to be touched for A2)
2025-11-24 15:04:26 +01:00

68 lines
2.1 KiB
Nix

/*
* 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
gnumake
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
doxygen
graphviz # make doc
]
++ (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";
};
};
}
));
}