Closed avdv closed 1 year ago
Also, should we also use nix_path: nixpkgs=./nix/nixpkgs.nix action argument for the Test workflow, too?
I don't think so, I'd like my CI to fail if it depends on $NIX_PATH.
And, I've found it useful to trigger the update-niv action manually sometimes (I am only running the job weekly). What do you think about that?
Yeah that sounds like a good idea, any ideas how to do that?
Also, should we also use nix_path: nixpkgs=./nix/nixpkgs.nix action argument for the Test workflow, too?
I don't think so, I'd like my CI to fail if it depends on $NIX_PATH.
Could you elaborate on that? Or, what's the alternative?
I was just put off about the warning: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I), at (string):1:9; will use bash from your environment
message you get, e.g. when running nix-shell --run 'niv update'
.
Would nix-shell -I nixpkgs=./nix/nixpkgs.nix ...
work for you? (I guess not)
If not, how can I only "load" niv inside the shell just be using a nix expression. I tried something like nix-shell -A niv nix/nixpkgs.nix
but that would pull all build dependencies for niv instead of niv itself, right? I probably need to put niv into a buildInputs
attribute... ? Is that the way to go?
And, I've found it useful to trigger the update-niv action manually sometimes (I am only running the job weekly). What do you think about that?
Yeah that sounds like a good idea, any ideas how to do that?
You can use the workflow_dispatch
trigger. See https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
edit: I'll prepare a PR.
Would nix-shell -I nixpkgs=./nix/nixpkgs.nix ... work for you? (I guess not)
Yeah, that's fine.
Could you elaborate on that? Or, what's the alternative?
It's because it's not reproducible between local and CI setups then (it will work on CI). More at https://nix.dev/tutorials/towards-reproducibility-pinning-nixpkgs.html
You can use the workflow_dispatch trigger. See https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
TIL :)
Would nix-shell -I nixpkgs=./nix/nixpkgs.nix ... work for you? (I guess not)
Yeah, that's fine.
Could you elaborate on that? Or, what's the alternative?
It's because it's not reproducible between local and CI setups then (it will work on CI). More at nix.dev/tutorials/towards-reproducibility-pinning-nixpkgs.html
Sorry, I don't fully get it. Since it's still pinned, in the same way it is locally, as it refers to the same nixpkgs definition.
But of course, it's referring to the NIX_PATH which is implicitly given inside the CI env. Is this what you mean? And if you explicitly specify the -I nixpkgs=./nix/nixpkgs.nix
argument it is not..?!
But then, running without NIX_PATH, it will use the same nixpkgs... no?! I have to give this some thought.
PS: PR created: #36
But of course, it's referring to the NIX_PATH which is implicitly given inside the CI env. Is this what you mean?
Yes, it will work on CI, but not locally since NIX_PATH is not defined. You could export it in shell.nix, but I really don't think that's a good idea.
This template now uses https://devenv.sh so no more niv.
This avoids fetching all dev dependencies running the "Update niv" workflow, which is a bit wasteful and time consuming.
The time needed for the workflow went down from ~3 min to ~1 min for my project: https://github.com/avdv/replay/actions/workflows/update-niv.yml
Also, should we also use
nix_path: nixpkgs=./nix/nixpkgs.nix
action argument for the Test workflow, too?And, I've found it useful to trigger the update-niv action manually sometimes (I am only running the job weekly). What do you think about that?