Open viluon opened 3 months ago
nixos-generators, something like the following
{ inputs = { nixpkgs.url = "nixpkgs/nixos-23.11"; nixos-generators = { url = "github:nix-community/nixos-generators"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, nixos-generators, ... }: { packages.x86_64-linux = { qemu = nixos-generators.nixosGenerate { system = "x86_64-linux"; modules = [ ./configuration.nix ]; # qcow2 for qemu format = "qcow"; # optional arguments: # explicit nixpkgs and lib: # pkgs = nixpkgs.legacyPackages.x86_64-linux; # lib = nixpkgs.legacyPackages.x86_64-linux.lib; # additional arguments to pass to modules: # specialArgs = { myExtraArg = "foobar"; }; # you can also define your own custom formats # customFormats = { "myFormat" = <myFormatModule>; ... }; # format = "myFormat"; }; # vbox = nixos-generators.nixosGenerate { # system = "x86_64-linux"; # format = "virtualbox"; # }; }; }; }
See also live USBs with flakes.
nixos-generators, something like the following