Usage with Nix Flakes
See original GitHub issueHello!
I was just wondering how I would go about using this with Nix Flakes, as in what module I would have to import in nixpkgs.lib.nixosSystem.modules
? Would mach-nix.nixosModules.mach-nix
work?
Thank you kindly for the help!
Issue Analytics
- State:
- Created 3 years ago
- Comments:34 (31 by maintainers)
Top Results From Across the Web
Flakes - NixOS Wiki
Using flakes project from a legacy Nix ... There is a flake-compat library you can use to shim legacy default.nix and shell.nix files....
Read more >Nix Flakes, Part 1: An introduction and tutorial - Tweag
Flakes are a solution to these problems. A flake is simply a source tree (such as a Git repository) containing a file named...
Read more >Practical Nix Flakes - Serokell
nix flake set of subcommands is used to observe and manipulate flakes themselves rather than their outputs. nix flake show. This command takes...
Read more >nix flake - NixOS
Flakes are the unit for packaging Nix code in a reproducible and discoverable way. They can have dependencies on other flakes, making it...
Read more >nix-flakes.md - gists · GitHub
A flake is (usually) a Git repository that contains a file named flake. · Flakes provide an attribute set of values, such as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Flake inputs actually have some special handling that causes
toString flake-input-name
to return a Nix store path; as a result, you can import Nix files from flake inputs directly. I’ve been using that strategy in my own flake-based projects; a working (but very simple) example flake that does this withmach-nix
is shown below:mkPython
works just fine, which you can see for yourself by initializing a repo with the above flake and runningHowever, functions like
buildPythonApplication
that rely onextractor
don’t run correctly for some arguments (e. g. URLs) due to a<nixpkgs>
import that can’t be evaluated in pure-mode by the flake. ~I’ve got a local patch to replace that import with thepkgs
value used to initializemach-nix
; it hasn’t caused me any issues yet, so I’ll see if I can put a PR up for it tomorrow.~ This can be worked around by providingpname
,version
, andrequirements
manually in the argument attrset, which causes the logic that depends on the extractor to be skipped. My local patch doesn’t actually resolve this issue, and it looks like doing so would require digging deeper into the code than I have time for right now.I merged some commits of @nat543207 and @newkozlukov and added the library functions to flakes.nix.