c++ devshell flake woop woop
This commit is contained in:
commit
bbcb6c3fd6
51
flake.nix
Executable file
51
flake.nix
Executable file
@ -0,0 +1,51 @@
|
||||
{
|
||||
description = "A Nix-flake-based C/C++ development environment";
|
||||
|
||||
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0"; # stable Nixpkgs
|
||||
|
||||
outputs =
|
||||
{ self, ... }@inputs:
|
||||
|
||||
let
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
forEachSupportedSystem =
|
||||
f:
|
||||
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
||||
system:
|
||||
f {
|
||||
pkgs = import inputs.nixpkgs { inherit system; };
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
devShells = forEachSupportedSystem (
|
||||
{ pkgs }:
|
||||
{
|
||||
default =
|
||||
pkgs.mkShell.override
|
||||
{
|
||||
# Override stdenv in order to change compiler:
|
||||
stdenv = pkgs.clangStdenv;
|
||||
}
|
||||
{
|
||||
packages = with pkgs; [
|
||||
clang-tools
|
||||
clang
|
||||
ninja
|
||||
meson
|
||||
pkg-config
|
||||
libcxx
|
||||
];
|
||||
shellHook = ''
|
||||
echo "welcome to c++ devshell nyaaa :3"
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
10
main.cpp
Executable file
10
main.cpp
Executable file
@ -0,0 +1,10 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
string bla = "hello world";
|
||||
cout << bla << std::endl;
|
||||
return 0;
|
||||
}
|
||||
3
meson.build
Executable file
3
meson.build
Executable file
@ -0,0 +1,3 @@
|
||||
project('flake', 'cpp',
|
||||
default_options: ['cpp_std=c++20'])
|
||||
executable('flake', 'main.cpp')
|
||||
Loading…
x
Reference in New Issue
Block a user