Re: Add custom flags to nimble install
That's what I ended up doing, thanks.
Re: Add custom flags to nimble install
what is the point of customTask that is not even defined locally, if you can just add -p:-d:danger?
Re: Add custom flags to nimble install
this doesnt work
Re: Add custom flags to nimble install
Unfortunately, your approach doesn't work because most of the flags that `-d:danger` activates/deactivates are set in `nim.cfg`. In fact, if you look at the binary size of your `hi.nim` file compiled with your method and with the standard `nim c -d:danger hi.nim`, you'll see that the latter one will be smaller in size, because it will have all the `-d:danger` flags properly activated, getting rid of debug stuff, dead code, etc...
Re: Add custom flags to nimble install
$ cat hi.nim echo 42 $ cat hi.nims --define:danger $ nim c hi.nim Hint: used config file '/home/juan/.choosenim/toolchains/nim-1.0.2/config/nim.cfg' [Conf] Hint: used config file '/home/juan/code/temp/hi.nims' [Conf] Hint: [Link] Hint: operation successful (2180 lines compiled; 0.6 sec total; 19.9MiB peakmem; Dangerous Release Build) Run
Re: Add custom flags to nimble install
The only problem I'm finding now is that, considering that the general `nim.cfg` gets executed before `config.nims`, if I add the `-d:danger` flag to `config.nims`, it doesn't actually get applied to the resulting binary, as the behaviour for `-d:danger` is defined in `nim.cfg`. Is there a way to execute `config.nims` before `nim.cfg`?
Re: Add custom flags to nimble install
Use a `config.nims`.
Re: Add custom flags to nimble install
Because I'd simply want the user to run `nimble install` without having to provide additional flags when installing my package. This comes from the fact that the user can't use the custom flags that I provide in my nimble package before cloning the repository first. So, it's not possible to do `nimble customInstall /path/to/git/repo` (where the `customInstall` task is defined), while it's possible to do `nimble install /path/to/git/repo`
Re: Add custom flags to nimble install
why? if you need to apply configuration you should use nim.cfg or config.nims, not override default actions.
Add custom flags to nimble install
Hello everyone, Is there a way to add custom compiler flags (e.g. `-d:danger`) to the `nimble install` task? I know that I can use the `--passNim` flag on the nimble call, but I was wondering if this could be directly abstracted from the user in the nimble file of my package. I tried creating my own task with a different name than `install`, and it works, but the only caveat is that the user can't just run `nimble install /url/to/git` and have the nimble package installed with my flags, as the `install` task has its own. I have also tried to add the additional flags to the `before install:`, without success. Alternatively, is there a way to overwrite the `install` task completely?