mirror of
https://github.com/nix-community/nixos-generators.git
synced 2024-10-03 23:17:50 +03:00
reformat all files
This commit is contained in:
parent
121b5a7b38
commit
fb30cf1cbe
@ -1,10 +1,14 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
services.sshd.enable = true;
|
||||
services.nginx.enable = true;
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
|
||||
networking.firewall.allowedTCPPorts = [80];
|
||||
|
||||
users.users.root.password = "nixos";
|
||||
services.openssh.permitRootLogin = lib.mkDefault "yes";
|
||||
services.getty.autologinUser = lib.mkDefault "root";
|
||||
|
@ -1,3 +1,5 @@
|
||||
(import (builtins.fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
|
||||
src = ./.;
|
||||
}).defaultNix.default
|
||||
})
|
||||
.defaultNix
|
||||
.default
|
||||
|
223
flake.nix
223
flake.nix
@ -7,110 +7,131 @@
|
||||
# Bin dependency
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
outputs = { self, nixpkgs, nixlib }:
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
nixlib,
|
||||
}:
|
||||
# Library modules (depend on nixlib)
|
||||
{
|
||||
# export all generator formats in ./formats
|
||||
nixosModules = nixlib.lib.mapAttrs' (file: _: {
|
||||
name = nixlib.lib.removeSuffix ".nix" file;
|
||||
# The exported module should include the internal format* options
|
||||
value.imports = [ (./formats + "/${file}") ./format-module.nix ];
|
||||
}) (builtins.readDir ./formats);
|
||||
{
|
||||
# export all generator formats in ./formats
|
||||
nixosModules = nixlib.lib.mapAttrs' (file: _: {
|
||||
name = nixlib.lib.removeSuffix ".nix" file;
|
||||
# The exported module should include the internal format* options
|
||||
value.imports = [(./formats + "/${file}") ./format-module.nix];
|
||||
}) (builtins.readDir ./formats);
|
||||
|
||||
# example usage in flakes:
|
||||
# outputs = { self, nixpkgs, nixos-generators, ...}: {
|
||||
# vmware = nixos-generators.nixosGenerate {
|
||||
# system = "x86_64-linux";
|
||||
# modules = [./configuration.nix];
|
||||
# format = "vmware";
|
||||
# };
|
||||
# }
|
||||
# example usage in flakes:
|
||||
# outputs = { self, nixpkgs, nixos-generators, ...}: {
|
||||
# vmware = nixos-generators.nixosGenerate {
|
||||
# system = "x86_64-linux";
|
||||
# modules = [./configuration.nix];
|
||||
# format = "vmware";
|
||||
# };
|
||||
# }
|
||||
|
||||
nixosGenerate = { pkgs ? null, lib ? nixpkgs.lib, format, system ? null, specialArgs ? { }, modules ? [ ], customFormats ? {} }:
|
||||
let
|
||||
extraFormats = lib.mapAttrs' (name: value: lib.nameValuePair
|
||||
(name)
|
||||
(value // {
|
||||
imports = ( value.imports or [] ++ [ ./format-module.nix ] );
|
||||
} )
|
||||
) customFormats;
|
||||
formatModule = builtins.getAttr format (self.nixosModules // extraFormats);
|
||||
image = nixpkgs.lib.nixosSystem {
|
||||
inherit pkgs specialArgs;
|
||||
system = if system != null then system else pkgs.system;
|
||||
lib = if lib != null then lib else pkgs.lib;
|
||||
modules = [
|
||||
formatModule
|
||||
] ++ modules;
|
||||
};
|
||||
in
|
||||
image.config.system.build.${image.config.formatAttr};
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
|
||||
# Binary and Devshell outputs (depend on nixpkgs)
|
||||
(
|
||||
let
|
||||
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "x86_64-darwin" "i686-linux" "aarch64-linux" "aarch64-darwin" ];
|
||||
in {
|
||||
|
||||
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
|
||||
|
||||
packages = forAllSystems (system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
in rec {
|
||||
nixos-generators = nixpkgs.lib.warn ''
|
||||
|
||||
Deprecation note from: github:nix-community/nixos-generators
|
||||
|
||||
Was renamed:
|
||||
|
||||
Was: nixos-generators.packages.${system}.nixos-generators
|
||||
Now: nixos-generators.packages.${system}.nixos-generate
|
||||
|
||||
Plase adapt your references
|
||||
'' nixos-generate;
|
||||
nixos-generate = pkgs.stdenv.mkDerivation {
|
||||
name = "nixos-generate";
|
||||
src = ./.;
|
||||
meta.description = "Collection of image builders";
|
||||
nativeBuildInputs = with pkgs; [ makeWrapper ];
|
||||
installFlags = [ "PREFIX=$(out)" ];
|
||||
postFixup = ''
|
||||
wrapProgram $out/bin/nixos-generate \
|
||||
--prefix PATH : ${pkgs.lib.makeBinPath (with pkgs; [ jq coreutils findutils ])}
|
||||
'';
|
||||
nixosGenerate = {
|
||||
pkgs ? null,
|
||||
lib ? nixpkgs.lib,
|
||||
format,
|
||||
system ? null,
|
||||
specialArgs ? {},
|
||||
modules ? [],
|
||||
customFormats ? {},
|
||||
}: let
|
||||
extraFormats =
|
||||
lib.mapAttrs' (
|
||||
name: value:
|
||||
lib.nameValuePair
|
||||
name
|
||||
(value
|
||||
// {
|
||||
imports = (value.imports or [] ++ [./format-module.nix]);
|
||||
})
|
||||
)
|
||||
customFormats;
|
||||
formatModule = builtins.getAttr format (self.nixosModules // extraFormats);
|
||||
image = nixpkgs.lib.nixosSystem {
|
||||
inherit pkgs specialArgs;
|
||||
system =
|
||||
if system != null
|
||||
then system
|
||||
else pkgs.system;
|
||||
lib =
|
||||
if lib != null
|
||||
then lib
|
||||
else pkgs.lib;
|
||||
modules =
|
||||
[
|
||||
formatModule
|
||||
]
|
||||
++ modules;
|
||||
};
|
||||
});
|
||||
|
||||
defaultPackage = forAllSystems (system: self.packages."${system}".nixos-generate);
|
||||
|
||||
devShell = forAllSystems (system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
in pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ jq coreutils findutils ];
|
||||
});
|
||||
|
||||
# Make it runnable with `nix run`
|
||||
apps = forAllSystems (system: let
|
||||
nixos-generate = {
|
||||
type = "app";
|
||||
program = "${self.packages."${system}".nixos-generate}/bin/nixos-generate";
|
||||
};
|
||||
in {
|
||||
inherit nixos-generate;
|
||||
|
||||
# Nix >= 2.7 flake output schema uses `apps.<system>.default` instead
|
||||
# of `defaultApp.<system>` to signify the default app (the thing that
|
||||
# gets run with `nix run . -- <args>`)
|
||||
default = nixos-generate;
|
||||
});
|
||||
|
||||
defaultApp = forAllSystems (system: self.apps."${system}".nixos-generate);
|
||||
in
|
||||
image.config.system.build.${image.config.formatAttr};
|
||||
}
|
||||
);
|
||||
//
|
||||
# Binary and Devshell outputs (depend on nixpkgs)
|
||||
(
|
||||
let
|
||||
forAllSystems = nixpkgs.lib.genAttrs ["x86_64-linux" "x86_64-darwin" "i686-linux" "aarch64-linux" "aarch64-darwin"];
|
||||
in {
|
||||
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
|
||||
|
||||
packages = forAllSystems (system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
in rec {
|
||||
nixos-generators =
|
||||
nixpkgs.lib.warn ''
|
||||
|
||||
Deprecation note from: github:nix-community/nixos-generators
|
||||
|
||||
Was renamed:
|
||||
|
||||
Was: nixos-generators.packages.${system}.nixos-generators
|
||||
Now: nixos-generators.packages.${system}.nixos-generate
|
||||
|
||||
Plase adapt your references
|
||||
''
|
||||
nixos-generate;
|
||||
nixos-generate = pkgs.stdenv.mkDerivation {
|
||||
name = "nixos-generate";
|
||||
src = ./.;
|
||||
meta.description = "Collection of image builders";
|
||||
nativeBuildInputs = with pkgs; [makeWrapper];
|
||||
installFlags = ["PREFIX=$(out)"];
|
||||
postFixup = ''
|
||||
wrapProgram $out/bin/nixos-generate \
|
||||
--prefix PATH : ${pkgs.lib.makeBinPath (with pkgs; [jq coreutils findutils])}
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
defaultPackage = forAllSystems (system: self.packages."${system}".nixos-generate);
|
||||
|
||||
devShell = forAllSystems (system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [jq coreutils findutils];
|
||||
});
|
||||
|
||||
# Make it runnable with `nix run`
|
||||
apps = forAllSystems (system: let
|
||||
nixos-generate = {
|
||||
type = "app";
|
||||
program = "${self.packages."${system}".nixos-generate}/bin/nixos-generate";
|
||||
};
|
||||
in {
|
||||
inherit nixos-generate;
|
||||
|
||||
# Nix >= 2.7 flake output schema uses `apps.<system>.default` instead
|
||||
# of `defaultApp.<system>` to signify the default app (the thing that
|
||||
# gets run with `nix run . -- <args>`)
|
||||
default = nixos-generate;
|
||||
});
|
||||
|
||||
defaultApp = forAllSystems (system: self.apps."${system}".nixos-generate);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ lib, ... }: rec {
|
||||
{lib, ...}: rec {
|
||||
_file = ./format-module.nix;
|
||||
# This deliberate key makes sure this module will be deduplicated
|
||||
# regardless of the accessor path: either via flake's nixosModule
|
||||
@ -18,4 +18,3 @@
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/../maintainers/scripts/ec2/amazon-image.nix"
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/azure-image.nix"
|
||||
];
|
||||
|
@ -1,14 +1,20 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/cloudstack-config.nix"
|
||||
];
|
||||
|
||||
system.build.cloudstackImage = import "${toString modulesPath}/../lib/make-disk-image.nix" {
|
||||
system.build.cloudstackImage = import "${toString modulesPath}/../lib/make-disk-image.nix" {
|
||||
inherit lib config pkgs;
|
||||
diskSize = 8192;
|
||||
format = "qcow2";
|
||||
configFile = pkgs.writeText "configuration.nix"
|
||||
configFile =
|
||||
pkgs.writeText "configuration.nix"
|
||||
''
|
||||
{
|
||||
imports = [ "${toString modulesPath}/virtualisation/cloudstack-config.nix" ];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/digital-ocean-image.nix"
|
||||
];
|
||||
|
@ -1,5 +1,8 @@
|
||||
{ modulesPath, lib, ... }:
|
||||
{
|
||||
modulesPath,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/docker-image.nix"
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/google-compute-image.nix"
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/hyperv-image.nix"
|
||||
];
|
||||
|
@ -1,11 +1,15 @@
|
||||
{ config, lib, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix"
|
||||
];
|
||||
|
||||
# override installation-cd-base and enable wpa and sshd start at boot
|
||||
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
|
||||
systemd.services.sshd.wantedBy = lib.mkForce ["multi-user.target"];
|
||||
virtualisation.hypervGuest.enable = true;
|
||||
|
||||
formatAttr = "isoImage";
|
||||
|
@ -1,12 +1,16 @@
|
||||
{ config, lib, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/installer/cd-dvd/installation-cd-base.nix"
|
||||
];
|
||||
|
||||
# override installation-cd-base and enable wpa and sshd start at boot
|
||||
systemd.services.wpa_supplicant.wantedBy = lib.mkForce [ "multi-user.target" ];
|
||||
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
|
||||
systemd.services.wpa_supplicant.wantedBy = lib.mkForce ["multi-user.target"];
|
||||
systemd.services.sshd.wantedBy = lib.mkForce ["multi-user.target"];
|
||||
|
||||
formatAttr = "isoImage";
|
||||
filename = "*.iso";
|
||||
|
@ -1,5 +1,8 @@
|
||||
{ config, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/installer/cd-dvd/iso-image.nix"
|
||||
];
|
||||
|
@ -1,6 +1,5 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
imports = [ ./kexec.nix ];
|
||||
{lib, ...}: {
|
||||
imports = [./kexec.nix];
|
||||
|
||||
formatAttr = lib.mkForce "kexec_bundle";
|
||||
filename = lib.mkForce "*-kexec_bundle";
|
||||
|
@ -1,11 +1,17 @@
|
||||
{ config, pkgs, lib, modulesPath, options, ... }: let
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
modulesPath,
|
||||
options,
|
||||
...
|
||||
}: let
|
||||
clever-tests = builtins.fetchGit {
|
||||
url = "https://github.com/cleverca22/nix-tests";
|
||||
rev = "a9a316ad89bfd791df4953c1a8b4e8ed77995a18"; # master on 2021-06-13
|
||||
};
|
||||
|
||||
inherit (import ../lib.nix { inherit lib options; }) maybe;
|
||||
inherit (import ../lib.nix {inherit lib options;}) maybe;
|
||||
in {
|
||||
imports = [
|
||||
"${toString modulesPath}/installer/netboot/netboot-minimal.nix"
|
||||
@ -17,7 +23,10 @@ in {
|
||||
system.build = rec {
|
||||
kexec_tarball = maybe.mkForce (pkgs.callPackage "${toString modulesPath}/../lib/make-system-tarball.nix" {
|
||||
storeContents = [
|
||||
{ object = config.system.build.kexec_script; symlink = "/kexec_nixos"; }
|
||||
{
|
||||
object = config.system.build.kexec_script;
|
||||
symlink = "/kexec_nixos";
|
||||
}
|
||||
];
|
||||
contents = [];
|
||||
});
|
||||
@ -50,10 +59,11 @@ in {
|
||||
|
||||
boot.loader.grub.enable = false;
|
||||
boot.kernelParams = [
|
||||
"console=ttyS0,115200" # allows certain forms of remote access, if the hardware is setup right
|
||||
"panic=30" "boot.panic_on_fail" # reboot the machine upon fatal boot issues
|
||||
"console=ttyS0,115200" # allows certain forms of remote access, if the hardware is setup right
|
||||
"panic=30"
|
||||
"boot.panic_on_fail" # reboot the machine upon fatal boot issues
|
||||
];
|
||||
systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ];
|
||||
systemd.services.sshd.wantedBy = lib.mkForce ["multi-user.target"];
|
||||
networking.hostName = lib.mkDefault "kexec";
|
||||
|
||||
formatAttr = "kexec_tarball";
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/kubevirt.nix"
|
||||
];
|
||||
|
@ -1,5 +1,10 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/profiles/qemu-guest.nix"
|
||||
];
|
||||
@ -23,7 +28,7 @@
|
||||
autoResize = true;
|
||||
};
|
||||
|
||||
swapDevices = [{ device = "/dev/sdb"; }];
|
||||
swapDevices = [{device = "/dev/sdb";}];
|
||||
|
||||
# Enable LISH and Linode booting w/ GRUB
|
||||
boot = {
|
||||
@ -38,7 +43,7 @@
|
||||
growPartition = true;
|
||||
|
||||
# Set up LISH serial connection:
|
||||
kernelParams = [ "console=ttyS0,19200n8" ];
|
||||
kernelParams = ["console=ttyS0,19200n8"];
|
||||
|
||||
loader = {
|
||||
# Increase timeout to allow LISH connection:
|
||||
|
@ -1,6 +1,9 @@
|
||||
{ config, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/lxc-container.nix"
|
||||
];
|
||||
@ -8,4 +11,3 @@
|
||||
formatAttr = "metadata";
|
||||
filename = "*/tarball/*.tar.xz";
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
{ config, pkgs, lib, modulesPath, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/lxc-container.nix"
|
||||
];
|
||||
|
@ -1,11 +1,17 @@
|
||||
{ modulesPath, lib, ... }:
|
||||
if lib.pathExists "${toString modulesPath}/../maintainers/scripts/openstack/nova-image.nix" then {
|
||||
{
|
||||
modulesPath,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
if lib.pathExists "${toString modulesPath}/../maintainers/scripts/openstack/nova-image.nix"
|
||||
then {
|
||||
imports = [
|
||||
"${toString modulesPath}/../maintainers/scripts/openstack/nova-image.nix"
|
||||
];
|
||||
|
||||
formatAttr = "novaImage";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
imports = [
|
||||
"${toString modulesPath}/../maintainers/scripts/openstack/openstack-image.nix"
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/proxmox-lxc.nix"
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/proxmox-image.nix"
|
||||
];
|
||||
|
@ -1,5 +1,10 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
# for virtio kernel drivers
|
||||
imports = [
|
||||
"${toString modulesPath}/profiles/qemu-guest.nix"
|
||||
@ -12,17 +17,16 @@
|
||||
};
|
||||
|
||||
boot.growPartition = true;
|
||||
boot.kernelParams = [ "console=ttyS0" ];
|
||||
boot.loader.grub.device = if (pkgs.stdenv.system == "x86_64-linux") then
|
||||
(lib.mkDefault "/dev/vda")
|
||||
else
|
||||
(lib.mkDefault "nodev");
|
||||
boot.kernelParams = ["console=ttyS0"];
|
||||
boot.loader.grub.device =
|
||||
if (pkgs.stdenv.system == "x86_64-linux")
|
||||
then (lib.mkDefault "/dev/vda")
|
||||
else (lib.mkDefault "nodev");
|
||||
|
||||
boot.loader.grub.efiSupport = lib.mkIf (pkgs.stdenv.system != "x86_64-linux") (lib.mkDefault true);
|
||||
boot.loader.grub.efiInstallAsRemovable = lib.mkIf (pkgs.stdenv.system != "x86_64-linux") (lib.mkDefault true);
|
||||
boot.loader.timeout = 0;
|
||||
|
||||
|
||||
system.build.qcow = import "${toString modulesPath}/../lib/make-disk-image.nix" {
|
||||
inherit lib config pkgs;
|
||||
diskSize = 8192;
|
||||
|
@ -1,9 +1,14 @@
|
||||
{ config, lib, options, pkgs, modulesPath, ... }:
|
||||
|
||||
let
|
||||
inherit (import ../lib.nix { inherit lib options; }) maybe;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
options,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: let
|
||||
inherit (import ../lib.nix {inherit lib options;}) maybe;
|
||||
in {
|
||||
imports = [ ./raw.nix ];
|
||||
imports = [./raw.nix];
|
||||
|
||||
boot.loader.grub = {
|
||||
device = "nodev";
|
||||
|
@ -1,5 +1,10 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-label/nixos";
|
||||
autoResize = true;
|
||||
@ -8,13 +13,12 @@
|
||||
|
||||
boot = {
|
||||
growPartition = true;
|
||||
kernelParams = [ "console=ttyS0" ];
|
||||
kernelParams = ["console=ttyS0"];
|
||||
loader.grub.device = lib.mkDefault "/dev/vda";
|
||||
loader.timeout = lib.mkDefault 0;
|
||||
initrd.availableKernelModules = [ "uas" ];
|
||||
initrd.availableKernelModules = ["uas"];
|
||||
};
|
||||
|
||||
|
||||
system.build.raw = import "${toString modulesPath}/../lib/make-disk-image.nix" {
|
||||
inherit lib config pkgs;
|
||||
diskSize = "auto";
|
||||
|
@ -1,5 +1,8 @@
|
||||
{ config, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/installer/sd-card/sd-image-aarch64-installer.nix"
|
||||
];
|
||||
|
@ -1,5 +1,10 @@
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/installer/sd-card/sd-image-aarch64.nix"
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/vagrant-virtualbox-image.nix"
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/virtualbox-image.nix"
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
./vm.nix
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
{pkgs, ...}: let
|
||||
resize = pkgs.writeScriptBin "resize" ''
|
||||
if [ -e /dev/tty ]; then
|
||||
old=$(stty -g)
|
||||
@ -15,8 +14,8 @@ in {
|
||||
./vm.nix
|
||||
];
|
||||
virtualisation.graphics = false;
|
||||
virtualisation.qemu.options = [ "-serial mon:stdio" ];
|
||||
virtualisation.qemu.options = ["-serial mon:stdio"];
|
||||
|
||||
environment.systemPackages = [ resize ];
|
||||
environment.systemPackages = [resize];
|
||||
environment.loginShellInit = "${resize}/bin/resize";
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/qemu-vm.nix"
|
||||
];
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ modulesPath, ... }:
|
||||
{
|
||||
{modulesPath, ...}: {
|
||||
imports = [
|
||||
"${toString modulesPath}/virtualisation/vmware-image.nix"
|
||||
];
|
||||
|
@ -1,22 +1,21 @@
|
||||
{ nixpkgs ? <nixpkgs>
|
||||
, configuration ? <nixos-config>
|
||||
, system ? builtins.currentSystem
|
||||
|
||||
, formatConfig
|
||||
|
||||
, flakeUri ? null
|
||||
, flakeAttr ? null
|
||||
}:
|
||||
let
|
||||
{
|
||||
nixpkgs ? <nixpkgs>,
|
||||
configuration ? <nixos-config>,
|
||||
system ? builtins.currentSystem,
|
||||
formatConfig,
|
||||
flakeUri ? null,
|
||||
flakeAttr ? null,
|
||||
}: let
|
||||
module = import ./format-module.nix;
|
||||
|
||||
# Will only get evaluated when used, so no worries
|
||||
flake = builtins.getFlake flakeUri;
|
||||
flakeSystem = flake.outputs.packages."${system}".nixosConfigurations."${flakeAttr}" or flake.outputs.nixosConfigurations."${flakeAttr}";
|
||||
in
|
||||
if flakeUri != null then
|
||||
if flakeUri != null
|
||||
then
|
||||
flakeSystem.extendModules {
|
||||
modules = [ module formatConfig ];
|
||||
modules = [module formatConfig];
|
||||
}
|
||||
else
|
||||
import "${toString nixpkgs}/nixos/lib/eval-config.nix" {
|
||||
|
Loading…
Reference in New Issue
Block a user