Skip to content

Commit

Permalink
Merge pull request nix-community#173 from alan-strohm/master
Browse files Browse the repository at this point in the history
nixosGenerate: allow and suggest leaving pkgs set to null
  • Loading branch information
Mic92 authored Aug 17, 2022
2 parents ecef210 + f561d89 commit adccd19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ An example `flake.nix` demonstrating this approach is below. `vmware` or
outputs = { self, nixpkgs, nixos-generators, ... }: {
packages.x86_64-linux = {
vmware = nixos-generators.nixosGenerate {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
system = "x86_64-linux";
modules = [
# you can include your own nixos configuration here, i.e.
# ./configuration.nix
];
format = "vmware";
};
vbox = nixos-generators.nixosGenerate {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
system = "x86_64-linux";
format = "virtualbox";
};
};
Expand Down
6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
# example usage in flakes:
# outputs = { self, nixpkgs, nixos-generators, ...}: {
# vmware = nixos-generators.nixosGenerate {
# pkgs = nixpkgs.legacyPackages.x86_64-linux;
# system = "x86_64-linux";
# modules = [./configuration.nix];
# format = "vmware";
# };
# }
nixosGenerate = { pkgs, format, specialArgs ? { }, modules ? [ ] }:
nixosGenerate = { pkgs ? null, format, system ? null, specialArgs ? { }, modules ? [ ] }:
let
formatModule = builtins.getAttr format nixosModules;
image = nixpkgs.lib.nixosSystem {
inherit pkgs specialArgs;
system = pkgs.system;
system = if system != null then system else pkgs.system;
modules = [
formatModule
] ++ modules;
Expand Down

0 comments on commit adccd19

Please sign in to comment.