From fc49e86428b965f4d9a445e2efee6b71d97a1a9c Mon Sep 17 00:00:00 2001 From: Elisiei Yehorov Date: Wed, 30 Jul 2025 15:40:27 +0200 Subject: [PATCH] oof --- c/.envrc | 1 + c/.gitignore | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++ c/flake.nix | 43 +++++++++++++++++++++++++++++++++++++++ flake.nix | 4 ++++ 4 files changed, 105 insertions(+) create mode 100644 c/.envrc create mode 100644 c/.gitignore create mode 100644 c/flake.nix diff --git a/c/.envrc b/c/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/c/.envrc @@ -0,0 +1 @@ +use flake diff --git a/c/.gitignore b/c/.gitignore new file mode 100644 index 0000000..ac60bb8 --- /dev/null +++ b/c/.gitignore @@ -0,0 +1,57 @@ +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +# debug information files +*.dwo + +.direnv diff --git a/c/flake.nix b/c/flake.nix new file mode 100644 index 0000000..a3c5fec --- /dev/null +++ b/c/flake.nix @@ -0,0 +1,43 @@ +{ + description = "minimal flake for c dev"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; + + outputs = + 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; [ + gnumake + tinycc + ]; + }; + } + ); + }; +} diff --git a/flake.nix b/flake.nix index 068d8db..8caf91e 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,10 @@ { self }: { templates = { + c = { + path = ./c; + description = "c template"; + }; go = { path = ./go; description = "go template";