feat: C template #27
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
Compat
Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: auxolotl/templates#27
Loading…
Reference in a new issue
No description provided.
Delete branch "c"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A small flake template for a C project using Makefile as build system.
The boilerplate code is a simple hello program.
Based of #26
x86-64_linux
nix flake check --all-systems
I would prefer to not have rec, also i believe it is pname, not name
@ -0,0 +17,4 @@
default = pkgs.mkShell { inputsFrom = [ packages.${pkgs.system}.hello ]; };
});
packages = forAllSystems (pkgs: rec {
Can we move the package defection to a file called default.nix
@ -0,0 +21,4 @@
default = hello;
hello = pkgs.callPackage ./hello.nix { };
});
Please change the description to something more related to C
for
mkDerivation
it's name: otherwise it would throwerror: attribute 'name' missing
@ -0,0 +17,4 @@
default = pkgs.mkShell { inputsFrom = [ packages.${pkgs.system}.hello ]; };
});
packages = forAllSystems (pkgs: rec {
Is there a need to split the flake? it is quite small
@ -0,0 +21,4 @@
default = hello;
hello = pkgs.callPackage ./hello.nix { };
});
What does this do?
@ -0,0 +17,4 @@
default = pkgs.mkShell { inputsFrom = [ packages.${pkgs.system}.hello ]; };
});
packages = forAllSystems (pkgs: rec {
It allows it to have old nix compatibility. that’s the main thing for me. Also prevents redeclaring the package a few times.
@ -0,0 +21,4 @@
default = hello;
hello = pkgs.callPackage ./hello.nix { };
});
this allows the user to consume the overlay and it will be added the nixpkgs list. so i could use
enviroment.systemPackages = [ pkgs.hello ];
instead.@ -0,0 +21,4 @@
default = hello;
hello = pkgs.callPackage ./hello.nix { };
});
doesn't this cause conflict with the nixpkgs's hello pkgs?
this can be commited, as long as it doesn't assume nix is installed. this can work for example
these are all unused
when using cmake or meson with github's template, these are not necessary as we have a standard build directory and file extensions are already matched
why assume this?
there's no reason to use these by default. it will only be confusing if anyone shares a locally built binary
make
is in stdenv, so i'm not sure we need this? also if you were to switch to meson/cmake, this would need to be replaced with one of these insteadthis is also another reason to use cmake or meson: this phase wouldn't be required
im not really sure why this is set?
we really only need to use
final
when passing arguments to callPackagethis isn't what the app output is really meant for, and doesn't actually introduce anything new. users can still use
nix run
andnix run .#hello
without this@ -0,0 +1,27 @@
{
description = "Aux template for C project";
inputs.nixpkgs.url = "github:auxolotl/nixpkgs/nixos-unstable";
we aren't actually updating branches besides master currently
we really don't need to overcomplicate this
Only the
.pre-commit-config.yaml
is unused so I'll remove it.I'm not sure why do you want to include entries unrelated to this template in the gitignore but also removing important ignore like
.cache
orcompile_commands.json
that are useful, it seems like a contradiction?Committing a
.envrc
doesn't seems like a good practice to me.I can remove that entry tho, so it's up to the user to decide was to do i they use direnv
I cant find any public gitignore using
repl-result-*
, so it sound like something we may not needI think that C99 is a very good standard to based a template on
@ -0,0 +1,27 @@
{
description = "Aux template for C project";
inputs.nixpkgs.url = "github:auxolotl/nixpkgs/nixos-unstable";
master template use it too.
write
is lighter thanprintf
. I think it is better to use it, and i am not sure by what means it is overcomplicated?To me it would make more sense for this to be dynamic, because i cant think of a scenario where you wouldn't add the build inputs of a package within the dev shell
I went through your suggestion and made what i think is a good tradeoff between our two positions
I agree with getchoo.
I think defining macros when it's arguably not needed is overcomplicating it. Also, I think we really don't care about the performance of printf vs write here. Getchoo's suggestion is the canonical hello world C program, it doesn't bring in any header other than stdlib, it doesn't define any item besides main (which you probably need), and it's recognizable so people know they should scrap it anyway.
I feel like the template should focus on nix code, and completely disregard C code (unless it demonstrates something on the nix side). I'd even be fine with an empty source file if that compiled.
yeah this would be better removed
if you use
:bl
in a repl, you do. this is a known nix artifact, same asresult*
most people also aren't using c99 anymore. i feel this is just your personal taste here
slightly different builds of the same package. this is done in prismlauncher for example
this also duplicates inputs due to the
default
package (which only really slows eval time a bit, but still) and currently doesn't work at alllib.attrValues packages
evaluates to[ { default = { ... }; hello = { ... }; } { default = { ... }; hello = { ... }; } { ... } ]
i don't think we're really going to get anywhere with this question being asked, so i would rather not continue with this
@ -0,0 +1,27 @@
{
description = "Aux template for C project";
inputs.nixpkgs.url = "github:auxolotl/nixpkgs/nixos-unstable";
this should changed as well
the only reason they are important is because of the specific way you have this set up. other projects are very unlikely to use these, and i would say they shouldn't be used here either
i genuinely don't get it, but i changed the implementation to use a regular
printf
This is the same scenario with the other GitHub ignore you wanted me to include, I think either both should be put or none, because it doesn't seem logic to add one and not the other
@ -0,0 +1,27 @@
{
description = "Aux template for C project";
inputs.nixpkgs.url = "github:auxolotl/nixpkgs/nixos-unstable";
This might need it's own dedicated issue