Closed TheKK closed 3 years ago
Do you think that I should modify github workflow in this PR? Just notice that.
@TheKK I took a quick look and added some comments, thanks for your PR! Yes, CI should be updated.
Note that I think we should probably migrate entirely to flakes, and then use edolstra/flake-compat
to provide a default.nix and shell.nix that uses flake.nix (see here for how I do it). Although it would be good to do that in this PR, it is fine if that happens outside of it - as "stage 2". At minimum, however, we should normalize the nixpkgs pinning in one place, as it is easy to forget updating it in both locations.
Should we create a directory like dep
and put dependencies from inputs of flake.nix
into it?
I found that I have to repeat
let lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${lock.nodes.nixpkgs.locked.rev}.tar.gz";
sha256 = lock.nodes.nixpkgs.locked.narHash;
};
for all
import ./dep/nixpkgs {...}
which appears too many times. Or is there other preferential way to prevent these repetitions?
You should be able to pass the inputs
from flake.nix to project.nix, no?
For default.nix and shell.nix, yes we can. But there are other users of dep/nixpkgs
like ci.nix and static.nix, which can not (easily) derive from flake.nix.
The restriction here is that flake-compat
only exposes defaultPackage and devShell from flake.nix
.
Don't worry about static.nix; that's already broken.
ci.nix should work, but it only requires pkg
(for recurseIntoAttrs
), so you can pass that easily? Don't worry about repetition; if we can get something working first, it can be refactored near the end.
Please let me know if there's anything I can improve :)
Thanks for your advice!
I've merged fixes you mentioned in the comment and rebase this PR onto 602c3de9d61ed9f1277bc2fc0ec01ca912f395df. Please take a look.
This should solve #485.
With this
flake.nix
, we can do...nix build
to buildnix shell
to enter build shellnix run
to runneuron
even without cloning projectnix run "github:TheKK/neuron#neuron" -- open
I also add
result-data
to.gitignore
since it was created after runningnix build
. This make you to runnix-build
to build same derivation afternix build
.If there's anything I can improve, please let me know!