mirror of
https://github.com/nix-community/nixos-generators.git
synced 2024-11-22 10:05:06 +03:00
nix fmt
This commit is contained in:
parent
7c60ba4bc8
commit
409f3e6e38
@ -30,13 +30,15 @@
|
|||||||
allConfigs = lib.mapAttrs (formatName: evalFormat) config.formatConfigs;
|
allConfigs = lib.mapAttrs (formatName: evalFormat) config.formatConfigs;
|
||||||
|
|
||||||
# adds an evaluated `config` to the derivation attributes of a format for introspection
|
# adds an evaluated `config` to the derivation attributes of a format for introspection
|
||||||
exposeConfig = conf: output: output.overrideAttrs (old: {
|
exposeConfig = conf: output:
|
||||||
|
output.overrideAttrs (old: {
|
||||||
passthru.config = conf.config;
|
passthru.config = conf.config;
|
||||||
});
|
});
|
||||||
|
|
||||||
# attrset of formats to be exposed under config.system.formats
|
# attrset of formats to be exposed under config.system.formats
|
||||||
formats = lib.flip lib.mapAttrs allConfigs (
|
formats = lib.flip lib.mapAttrs allConfigs (
|
||||||
formatName: conf: exposeConfig conf (
|
formatName: conf:
|
||||||
|
exposeConfig conf (
|
||||||
pkgs.runCommand "${conf.config.system.build.${conf.config.formatAttr}.name}" {} ''
|
pkgs.runCommand "${conf.config.system.build.${conf.config.formatAttr}.name}" {} ''
|
||||||
set -efu
|
set -efu
|
||||||
target=$(find '${conf.config.system.build.${conf.config.formatAttr}}' -name '*${conf.config.fileExtension}' -xtype f -print -quit)
|
target=$(find '${conf.config.system.build.${conf.config.formatAttr}}' -name '*${conf.config.fileExtension}' -xtype f -print -quit)
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
{
|
{lib, ...}: {
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
services.sshd.enable = true;
|
services.sshd.enable = true;
|
||||||
services.nginx.enable = true;
|
services.nginx.enable = true;
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@ in {
|
|||||||
];
|
];
|
||||||
|
|
||||||
hyperv.baseImageSize =
|
hyperv.baseImageSize =
|
||||||
if diskSize == "auto" then "auto"
|
if diskSize == "auto"
|
||||||
|
then "auto"
|
||||||
else lib.strings.toIntBase10 diskSize;
|
else lib.strings.toIntBase10 diskSize;
|
||||||
|
|
||||||
formatAttr = "hypervImage";
|
formatAttr = "hypervImage";
|
||||||
|
@ -13,7 +13,7 @@ in {
|
|||||||
];
|
];
|
||||||
|
|
||||||
system.build = rec {
|
system.build = rec {
|
||||||
image = pkgs.runCommand "image" { buildInputs = [ pkgs.nukeReferences ]; } ''
|
image = pkgs.runCommand "image" {buildInputs = [pkgs.nukeReferences];} ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
cp ${config.system.build.kernel}/${config.system.boot.loader.kernelFile} $out/kernel
|
cp ${config.system.build.kernel}/${config.system.boot.loader.kernelFile} $out/kernel
|
||||||
cp ${config.system.build.netbootRamdisk}/initrd $out/initrd
|
cp ${config.system.build.netbootRamdisk}/initrd $out/initrd
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
{lib, modulesPath, ...}: {
|
{
|
||||||
|
lib,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
"${toString modulesPath}/virtualisation/proxmox-lxc.nix"
|
"${toString modulesPath}/virtualisation/proxmox-lxc.nix"
|
||||||
];
|
];
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
# for virtio kernel drivers
|
# for virtio kernel drivers
|
||||||
imports = [
|
imports = [
|
||||||
"${toString modulesPath}/profiles/qemu-guest.nix"
|
"${toString modulesPath}/profiles/qemu-guest.nix"
|
||||||
@ -8,17 +13,18 @@
|
|||||||
options = {
|
options = {
|
||||||
boot = {
|
boot = {
|
||||||
consoles = lib.mkOption {
|
consoles = lib.mkOption {
|
||||||
default = [ "ttyS0" ] ++
|
default =
|
||||||
(lib.optional (pkgs.stdenv.hostPlatform.isAarch) "ttyAMA0,115200") ++
|
["ttyS0"]
|
||||||
(lib.optional (pkgs.stdenv.hostPlatform.isRiscV64) "ttySIF0,115200");
|
++ (lib.optional (pkgs.stdenv.hostPlatform.isAarch) "ttyAMA0,115200")
|
||||||
|
++ (lib.optional (pkgs.stdenv.hostPlatform.isRiscV64) "ttySIF0,115200");
|
||||||
description = "Kernel console boot flags to pass to boot.kernelParams";
|
description = "Kernel console boot flags to pass to boot.kernelParams";
|
||||||
example = [ "ttyS2,115200" ];
|
example = ["ttyS2,115200"];
|
||||||
};
|
};
|
||||||
|
|
||||||
diskSize = lib.mkOption {
|
diskSize = lib.mkOption {
|
||||||
default = "auto";
|
default = "auto";
|
||||||
description = "The disk size in megabytes of the system disk image.";
|
description = "The disk size in megabytes of the system disk image.";
|
||||||
type = with lib.types; oneOf [ ints.positive (enum [ "auto" ])];
|
type = with lib.types; oneOf [ints.positive (enum ["auto"])];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -54,4 +60,3 @@
|
|||||||
fileExtension = ".qcow2";
|
fileExtension = ".qcow2";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@ in {
|
|||||||
];
|
];
|
||||||
|
|
||||||
vmware.baseImageSize =
|
vmware.baseImageSize =
|
||||||
if diskSize == "auto" then "auto"
|
if diskSize == "auto"
|
||||||
|
then "auto"
|
||||||
else lib.strings.toIntBase10 diskSize;
|
else lib.strings.toIntBase10 diskSize;
|
||||||
|
|
||||||
formatAttr = "vmwareImage";
|
formatAttr = "vmwareImage";
|
||||||
|
Loading…
Reference in New Issue
Block a user