c template using meson
This commit is contained in:
parent
a27820eb99
commit
042af47d5f
58
c/flake.lock
Normal file
58
c/flake.lock
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1707091808,
|
||||
"narHash": "sha256-LahKBAfGbY836gtpVNnWwBTIzN7yf/uYM/S0g393r0Y=",
|
||||
"path": "/nix/store/ws5098bfhd2kzvg3yxwb2ggvl05h7gfd-source",
|
||||
"rev": "9f2ee8c91ac42da3ae6c6a1d21555f283458247e",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"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
|
||||
}
|
29
c/flake.nix
Normal file
29
c/flake.nix
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
description = "A bare minimum c flake";
|
||||
|
||||
inputs = {
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (sys:
|
||||
let pkgs = import nixpkgs { system = sys; };
|
||||
devTools = [
|
||||
pkgs.meson
|
||||
pkgs.ninja
|
||||
pkgs.pkg-config
|
||||
];
|
||||
in rec {
|
||||
packages.default = packages.mypkg;
|
||||
packages.mypkg = pkgs.stdenv.mkDerivation {
|
||||
name = "mypkg";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
nativeBuildInputs = devTools;
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = devTools;
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
12
c/meson.build
Normal file
12
c/meson.build
Normal file
|
@ -0,0 +1,12 @@
|
|||
project('mypkg', 'c',
|
||||
default_options: ['c_std=c23'])
|
||||
|
||||
srcs = ['src/main.c']
|
||||
incs = []
|
||||
deps = []
|
||||
|
||||
executable('mypkg',
|
||||
sources: srcs,
|
||||
dependencies: deps,
|
||||
include_directories: incs,
|
||||
install: true)
|
5
c/src/main.c
Normal file
5
c/src/main.c
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
puts("Hello World!");
|
||||
}
|
Loading…
Reference in New Issue
Block a user