-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add nix support Co-authored-by: John-John Tedro <udoprog@tedro.se>
- Loading branch information
1 parent
6df1ba1
commit c11d11a
Showing
9 changed files
with
442 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use genco::fmt; | ||
use genco::prelude::*; | ||
|
||
fn main() -> anyhow::Result<()> { | ||
let nixpkgs = &nix::inherit("inputs", "nixpkgs"); | ||
let pkgs = &nix::variable( | ||
"pkgs", | ||
quote! { | ||
import $nixpkgs { | ||
inherit ($nixpkgs) system; | ||
config.allowUnfree = true; | ||
overlays = []; | ||
} | ||
}, | ||
); | ||
let mk_default = &nix::with("lib", "mkDefault"); | ||
|
||
let tokens = quote! { | ||
{ | ||
imports = []; | ||
environment.systemPackages = with $pkgs; []; | ||
networking.useDHCP = $mk_default true; | ||
} | ||
}; | ||
|
||
let stdout = std::io::stdout(); | ||
let mut w = fmt::IoWriter::new(stdout.lock()); | ||
|
||
let fmt = fmt::Config::from_lang::<Nix>(); | ||
let config = nix::Config::default(); | ||
|
||
tokens.format_file(&mut w.as_formatter(&fmt), &config)?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.