Add flake
This commit is contained in:
94
flake.lock
generated
Normal file
94
flake.lock
generated
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
"nodes": {
|
||||
"devshell": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667210711,
|
||||
"narHash": "sha256-IoErjXZAkzYWHEpQqwu/DeRNJGFdR7X2OGbkhMqMrpw=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "96a9dd12b8a447840cc246e17a47b81a4268bba7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1642700792,
|
||||
"narHash": "sha256-XqHrk7hFb+zBvRg6Ghl+AZDq03ov6OshJLiSWOoX5es=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "846b2ae0fc4cc943637d3d1def4454213e203cba",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1643381941,
|
||||
"narHash": "sha256-pHTwvnN4tTsEKkWlXQ8JMY423epos8wUOhthpwJjtpc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5efc8ca954272c4376ac929f4c5ffefcc20551d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1670267727,
|
||||
"narHash": "sha256-hUFAn5gjNHIBpLQT0CmqpuQjQwgWUm+D6aziGAYsDmw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a5f661b80e4c163510a5013b585a040a5c7ef55e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devshell": "devshell",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
108
flake.nix
Executable file
108
flake.nix
Executable file
@ -0,0 +1,108 @@
|
||||
{
|
||||
description = "BSEos flake for development shell";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
inputs.devshell.url = "github:numtide/devshell";
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, devshell }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true; # For clion
|
||||
overlays = [ devshell.overlay ];
|
||||
};
|
||||
|
||||
# bintools with multilib
|
||||
bintools_multi = pkgs.wrapBintoolsWith {
|
||||
bintools =
|
||||
pkgs.bintools.bintools; # Get the unwrapped bintools from the wrapper
|
||||
libc = pkgs.glibc_multi;
|
||||
};
|
||||
|
||||
# gcc12 with multilib
|
||||
gcc12_multi = pkgs.hiPrio (pkgs.wrapCCWith {
|
||||
cc = pkgs.gcc12.cc; # Get the unwrapped gcc from the wrapper
|
||||
libc = pkgs.glibc_multi;
|
||||
bintools = bintools_multi;
|
||||
});
|
||||
|
||||
# clang14 with multilib for clang-tools
|
||||
clang14_multi = pkgs.wrapCCWith {
|
||||
cc = pkgs.clang_14.cc;
|
||||
libc = pkgs.glibc_multi;
|
||||
bintools = bintools_multi;
|
||||
};
|
||||
in {
|
||||
# devShell = pkgs.devshell.mkShell ...
|
||||
devShell = pkgs.devshell.mkShell {
|
||||
name = "BSEos";
|
||||
|
||||
packages = with pkgs; [
|
||||
gcc12_multi
|
||||
bintools_multi
|
||||
clang14_multi
|
||||
# clang-tools_14 # clangd + clang-format + clang-tidy
|
||||
|
||||
nasm
|
||||
gnumake
|
||||
bear # To generate compilation database
|
||||
gdb
|
||||
qemu # Start os in virtual machine
|
||||
doxygen # Generate docs + graphs
|
||||
|
||||
# glibc_multi # Needed for lsp to find some headers
|
||||
# clang_14 # To view template generation, also alternative error messages, conflicts with gcc
|
||||
|
||||
jetbrains.clion
|
||||
|
||||
# TODO: Figure out what is needed to make cling work
|
||||
# llvmPackages_14.llvm
|
||||
# cling # To try out my bullshit implementations
|
||||
# root
|
||||
];
|
||||
|
||||
# Not for devshell
|
||||
# hardeningDisable = [ "fortify" ]; # FORTIFY_SOURCE needs -O2 but we compile with -O0
|
||||
|
||||
commands = [
|
||||
{
|
||||
name = "ide";
|
||||
help = "Run clion for project";
|
||||
command = "clion &>/dev/null ./ &";
|
||||
}
|
||||
{
|
||||
name = "build";
|
||||
help = "Build the OS";
|
||||
command = "make --jobs 6";
|
||||
}
|
||||
{
|
||||
name = "build-clang";
|
||||
help = "Build the OS using clang";
|
||||
command = "GCCFLAGS='' CC=clang CXX=clang++ make --jobs 6";
|
||||
}
|
||||
{
|
||||
name = "run";
|
||||
help = "Start OS in qemu";
|
||||
command = "make qemu --jobs 6";
|
||||
}
|
||||
{
|
||||
name = "clean";
|
||||
help = "Cleanup build files";
|
||||
command = "make clean";
|
||||
}
|
||||
{
|
||||
name = "generate-compile-commands";
|
||||
help = "Generate the compilation database for clangd";
|
||||
command = "make clean && GCCFLAGS='' bear -- make --jobs 6";
|
||||
}
|
||||
{
|
||||
name = "debug";
|
||||
help = "Start OS for gdb connection and run gdb";
|
||||
command = "(make clean) && (make qemu-gdb --jobs 6 &) && (make gdb)";
|
||||
}
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user