diff --git a/all-formats.nix b/all-formats.nix index dafa705..b96e4c8 100644 --- a/all-formats.nix +++ b/all-formats.nix @@ -30,25 +30,27 @@ allConfigs = lib.mapAttrs (formatName: evalFormat) config.formatConfigs; # adds an evaluated `config` to the derivation attributes of a format for introspection - exposeConfig = conf: output: output.overrideAttrs (old: { - passthru.config = conf.config; - }); + exposeConfig = conf: output: + output.overrideAttrs (old: { + passthru.config = conf.config; + }); # attrset of formats to be exposed under config.system.formats formats = lib.flip lib.mapAttrs allConfigs ( - formatName: conf: exposeConfig conf ( - pkgs.runCommand "${conf.config.system.build.${conf.config.formatAttr}.name}" {} '' - set -efu - target=$(find '${conf.config.system.build.${conf.config.formatAttr}}' -name '*${conf.config.fileExtension}' -xtype f -print -quit) - if [ -z "$target" ]; then - echo "No target file found for ${conf.config.formatAttr} format" - echo "Check the content of this build path: ${conf.config.system.build.${conf.config.formatAttr}}" - exit 1 - fi - mkdir $out - ln -s "$target" "$out/$(basename "$target")" - '' - ) + formatName: conf: + exposeConfig conf ( + pkgs.runCommand "${conf.config.system.build.${conf.config.formatAttr}.name}" {} '' + set -efu + target=$(find '${conf.config.system.build.${conf.config.formatAttr}}' -name '*${conf.config.fileExtension}' -xtype f -print -quit) + if [ -z "$target" ]; then + echo "No target file found for ${conf.config.formatAttr} format" + echo "Check the content of this build path: ${conf.config.system.build.${conf.config.formatAttr}}" + exit 1 + fi + mkdir $out + ln -s "$target" "$out/$(basename "$target")" + '' + ) ); in { _file = ./all-formats.nix; diff --git a/configuration.nix b/configuration.nix index 58364da..0c4633a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,7 +1,4 @@ -{ - lib, - ... -}: { +{lib, ...}: { services.sshd.enable = true; services.nginx.enable = true; diff --git a/formats/hyperv.nix b/formats/hyperv.nix index cb2c9f5..bed93ad 100644 --- a/formats/hyperv.nix +++ b/formats/hyperv.nix @@ -11,7 +11,8 @@ in { ]; hyperv.baseImageSize = - if diskSize == "auto" then "auto" + if diskSize == "auto" + then "auto" else lib.strings.toIntBase10 diskSize; formatAttr = "hypervImage"; diff --git a/formats/kexec.nix b/formats/kexec.nix index 65ad4fb..e7a0713 100644 --- a/formats/kexec.nix +++ b/formats/kexec.nix @@ -13,14 +13,14 @@ in { ]; system.build = rec { - image = pkgs.runCommand "image" { buildInputs = [ pkgs.nukeReferences ]; } '' + image = pkgs.runCommand "image" {buildInputs = [pkgs.nukeReferences];} '' mkdir $out cp ${config.system.build.kernel}/${config.system.boot.loader.kernelFile} $out/kernel cp ${config.system.build.netbootRamdisk}/initrd $out/initrd echo "init=${builtins.unsafeDiscardStringContext config.system.build.toplevel}/init ${toString config.boot.kernelParams}" > $out/cmdline nuke-refs $out/kernel ''; - + kexec_script = pkgs.writeTextFile { executable = true; name = "kexec-nixos"; @@ -44,7 +44,7 @@ in { sync echo "executing kernel, filesystems will be improperly umounted" kexec -e - ''; + ''; }; kexec_tarball = maybe.mkForce (pkgs.callPackage "${toString modulesPath}/../lib/make-system-tarball.nix" { diff --git a/formats/proxmox-lxc.nix b/formats/proxmox-lxc.nix index 7ff7024..b3389bb 100644 --- a/formats/proxmox-lxc.nix +++ b/formats/proxmox-lxc.nix @@ -1,4 +1,8 @@ -{lib, modulesPath, ...}: { +{ + lib, + modulesPath, + ... +}: { imports = [ "${toString modulesPath}/virtualisation/proxmox-lxc.nix" ]; diff --git a/formats/qcow-efi.nix b/formats/qcow-efi.nix index 74e67da..e71224a 100644 --- a/formats/qcow-efi.nix +++ b/formats/qcow-efi.nix @@ -1,5 +1,10 @@ -{ config, lib, pkgs, modulesPath, ... }: { + config, + lib, + pkgs, + modulesPath, + ... +}: { # for virtio kernel drivers imports = [ "${toString modulesPath}/profiles/qemu-guest.nix" @@ -8,17 +13,18 @@ options = { boot = { consoles = lib.mkOption { - default = [ "ttyS0" ] ++ - (lib.optional (pkgs.stdenv.hostPlatform.isAarch) "ttyAMA0,115200") ++ - (lib.optional (pkgs.stdenv.hostPlatform.isRiscV64) "ttySIF0,115200"); + default = + ["ttyS0"] + ++ (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"; - example = [ "ttyS2,115200" ]; + example = ["ttyS2,115200"]; }; diskSize = lib.mkOption { default = "auto"; 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"; }; } - diff --git a/formats/vmware.nix b/formats/vmware.nix index 58ef621..781c8fb 100644 --- a/formats/vmware.nix +++ b/formats/vmware.nix @@ -11,7 +11,8 @@ in { ]; vmware.baseImageSize = - if diskSize == "auto" then "auto" + if diskSize == "auto" + then "auto" else lib.strings.toIntBase10 diskSize; formatAttr = "vmwareImage";