From 9d2256adddbb830d33119a5e01e3fad6b4b0652b Mon Sep 17 00:00:00 2001 From: brustybee Date: Thu, 19 Mar 2026 23:43:21 +0530 Subject: add flake templates --- common/templates/clang/flake.nix | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 common/templates/clang/flake.nix (limited to 'common/templates/clang/flake.nix') diff --git a/common/templates/clang/flake.nix b/common/templates/clang/flake.nix new file mode 100644 index 0000000..a3dfd01 --- /dev/null +++ b/common/templates/clang/flake.nix @@ -0,0 +1,46 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = + { self, nixpkgs, ... }: + let + inherit (nixpkgs) lib; + forAllSystems = lib.genAttrs lib.systems.flakeExposed; + pname = "hello-c"; + in + { + packages = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + default = pkgs.stdenv.mkDerivation { + inherit pname; + version = "0.1.0"; + src = self; + + # The zig hook handles the build AND the install automatically + nativeBuildInputs = [ pkgs.zig.hook ]; + doCheck = true; + }; + } + ); + + devShells = forAllSystems ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + default = pkgs.mkShellNoCC { + packages = [ + pkgs.zig + pkgs.zls + pkgs.clang-tools + ]; + }; + } + ); + }; +} -- cgit v1.3.1