Added a CPP flake and changed some Python options

This commit is contained in:
Alexandre 2026-02-10 19:11:56 +01:00
parent 280062063c
commit f4bdc0fc57
6 changed files with 131 additions and 35 deletions

View File

@ -0,0 +1,23 @@
# Make sure to change some parameter to fit your project
cmake_minimum_required(VERSION 3.22)
project(MyApp LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(myapp
src/main.cpp
src/utils.cpp
)
# This is the install rule - it tells CMake where to put the binary
# when 'make install' or 'ninja install' is run
install(TARGETS myapp
RUNTIME DESTINATION bin
)
# If you have data files, you can install them too:
# install(FILES assets/config.json
# DESTINATION share/myapp
# )

61
dev-flakes/cpp/flake.lock generated Normal file
View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1770562336,
"narHash": "sha256-ub1gpAONMFsT/GU2hV6ZWJjur8rJ6kKxdm9IlCT0j84=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d6c71932130818840fc8fe9509cf50be8c64634f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View File

@ -3,6 +3,47 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url =
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "myapp";
version = "0.1.0";
src = self;
nativeBuildInputs = with pkgs; [ cmake ninja ];
buildInputs = with pkgs; [ ];
};
devShells.default = pkgs.mkShell {
name = "cpp-dev";
# In the dev shell, you get more tools than just what's needed to build
packages = with pkgs; [
gcc
clang
cmake
ninja
gdb
valgrind
clang-tools
ccache
];
shellHook = ''
echo "C++ loaded"
export CC="ccache gcc"
export CXX="ccache g++"
'';
};
});
}

View File

@ -14,15 +14,15 @@
config.allowUnfree = true;
};
python = pkgs.python311;
python = pkgs.python314;
in
{
devShells.default = pkgs.mkShell {
name = "python-ml";
name = "python";
packages = with pkgs; [
python314
python314.pkgs.pygame
python
python.pkgs.pygame
#python.pkgs.pip
#python.pkgs.virtualenv

View File

@ -1,30 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
FILES=$(rg "modules/.+\.nix" -l hosts)
for file in $FILES; do
echo "Migrating $file"
# Skip files that already import registry
if rg "import .*modules" "$file" >/dev/null; then
continue
fi
# Insert let modules = import …
sed -i '' '
1s|^|let\n modules = import ../../modules;\nin\n|
' "$file"
# Replace common patterns
sed -i '' \
-e 's|../../modules/common/\([^/]*\)\.nix|modules.common.\1|g' \
-e 's|../../modules/home-manager/Hyprland/\([^/]*\)\.nix|modules.hm.\1|g' \
-e 's|../../modules/home-manager/\([^/]*\)\.nix|modules.hm.\1|g' \
-e 's|../../modules/nixos/\([^/]*\)\.nix|modules.nixos.\1|g' \
"$file"
done
echo "✓ Migration pass complete"
echo "⚠️ Please review files manually and fix edge cases."

View File

@ -125,6 +125,7 @@ in
firefox
cava
inputs.awww.packages.${pkgs.stdenv.hostPlatform.system}.awww
quickshell
# File manager
kdePackages.dolphin
kdePackages.gwenview