Basic C project template.
1{
2 description = "Declarations for the environment that this project will use.";
3
4 # Flake inputs
5 inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1";
6
7 # Flake outputs
8 outputs = inputs:
9 let
10 # The systems supported for this flake
11 supportedSystems = [
12 "x86_64-linux" # 64-bit Intel/AMD Linux
13 "aarch64-linux" # 64-bit ARM Linux
14 "x86_64-darwin" # 64-bit Intel macOS
15 "aarch64-darwin" # 64-bit ARM macOS
16 ];
17
18 # Helper to provide system-specific attributes
19 forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems (system: f {
20 pkgs = import inputs.nixpkgs { inherit system; };
21 });
22 in
23 {
24 devShells = forEachSupportedSystem ({ pkgs }: {
25 default = pkgs.mkShell {
26 # The Nix packages provided in the environment
27 # Add any you need here
28 packages = with pkgs; [
29 gcc
30 gnumake
31 ];
32
33 # Set any environment variables for your dev shell
34 env = { };
35
36 # Add any shell logic you want executed any time the environment is activated
37 shellHook = ''
38 '';
39 };
40 });
41 };
42}