mirror of
https://github.com/nix-community/disko.git
synced 2026-12-03 14:33:28 +01:00
Merge pull request #716 from beviu/fmt-check
Add --check option to formatter in flake
This commit is contained in:
7 files changed
+69
-19
No files matched your search
@@ -40,7 +40,8 @@ recursive layouts.
|
|||||||
Disko doesn't require installation: it can be run directly from nix-community
|
Disko doesn't require installation: it can be run directly from nix-community
|
||||||
repository. The [Quickstart Guide](./docs/quickstart.md) documents how to run
|
repository. The [Quickstart Guide](./docs/quickstart.md) documents how to run
|
||||||
Disko in its simplest form when installing NixOS. Alternatively, you can also
|
Disko in its simplest form when installing NixOS. Alternatively, you can also
|
||||||
use the new [disko-install](./docs/disko-install.md) tool, which combines `disko` and `nixos-install` into one step.
|
use the new [disko-install](./docs/disko-install.md) tool, which combines
|
||||||
|
`disko` and `nixos-install` into one step.
|
||||||
|
|
||||||
For information on other use cases, including upgrading from an older version of
|
For information on other use cases, including upgrading from an older version of
|
||||||
**disko**, using **disko** without NixOS and downloading the module, see the
|
**disko**, using **disko** without NixOS and downloading the module, see the
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
# Running Interactive VMs with disko
|
# Running Interactive VMs with disko
|
||||||
|
|
||||||
disko now exports its own flavor of interactive VMs (similiar to config.system.build.vm).
|
disko now exports its own flavor of interactive VMs (similiar to
|
||||||
Simply import the disko module and build the vm runner with:
|
config.system.build.vm). Simply import the disko module and build the vm runner
|
||||||
|
with:
|
||||||
|
|
||||||
```
|
```
|
||||||
nix build -L '.#nixosConfigurations.mymachine.config.system.build.vmWithDisko'
|
nix build -L '.#nixosConfigurations.mymachine.config.system.build.vmWithDisko'
|
||||||
```
|
```
|
||||||
@@ -12,7 +14,8 @@ afterwards you can run the interactive VM with:
|
|||||||
result/bin/disko-vm
|
result/bin/disko-vm
|
||||||
```
|
```
|
||||||
|
|
||||||
You can configure the VM using the `virtualisation.vmVariantWithDisko` NixOS option:
|
You can configure the VM using the `virtualisation.vmVariantWithDisko` NixOS
|
||||||
|
option:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
@@ -24,6 +27,6 @@ You can configure the VM using the `virtualisation.vmVariantWithDisko` NixOS opt
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
extraConfig that is set in disko.tests.extraConfig is also applied to the interactive VMs.
|
extraConfig that is set in disko.tests.extraConfig is also applied to the
|
||||||
imageSize of the VMs will be determined by the imageSize in the disk type in your disko config.
|
interactive VMs. imageSize of the VMs will be determined by the imageSize in the
|
||||||
memorySize is set by disko.memSize
|
disk type in your disko config. memorySize is set by disko.memSize
|
||||||
@@ -85,10 +85,58 @@
|
|||||||
deadnix
|
deadnix
|
||||||
];
|
];
|
||||||
text = ''
|
text = ''
|
||||||
set -o xtrace
|
showUsage() {
|
||||||
nixpkgs-fmt "$@"
|
cat <<EOF
|
||||||
deno fmt "$@"
|
Usage: $0 [OPTIONS] FILES...
|
||||||
deadnix --edit "$@"
|
-c, --check Only check formatting, do not modify files.
|
||||||
|
-h, --help Show this help message.
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
check=
|
||||||
|
files=()
|
||||||
|
|
||||||
|
parseArgs() {
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
-h | --help)
|
||||||
|
showUsage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-c | --check)
|
||||||
|
check=1
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
files+=("$1")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ ''${#files[@]} -eq 0 ]]; then
|
||||||
|
files=(.)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
parseArgs "$@"
|
||||||
|
|
||||||
|
if [[ -z "$check" ]]; then
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
nixpkgs-fmt -- "''${files[@]}"
|
||||||
|
deno fmt -- "''${files[@]}"
|
||||||
|
deadnix --edit -- "''${files[@]}"
|
||||||
|
else
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
nixpkgs-fmt --check -- "''${files[@]}"
|
||||||
|
deno fmt --check -- "''${files[@]}"
|
||||||
|
deadnix -- "''${files[@]}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-3
@@ -31,7 +31,7 @@ in
|
|||||||
types = {
|
types = {
|
||||||
topology =
|
topology =
|
||||||
let
|
let
|
||||||
vdev = lib.types.submodule ({ name, ... }: {
|
vdev = lib.types.submodule ({ ... }: {
|
||||||
options = {
|
options = {
|
||||||
mode = lib.mkOption {
|
mode = lib.mkOption {
|
||||||
type = lib.types.enum modeOptions;
|
type = lib.types.enum modeOptions;
|
||||||
@@ -44,10 +44,9 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
parent = config;
|
|
||||||
in
|
in
|
||||||
lib.types.submodule
|
lib.types.submodule
|
||||||
({ config, name, ... }: {
|
({ ... }: {
|
||||||
options = {
|
options = {
|
||||||
type = lib.mkOption {
|
type = lib.mkOption {
|
||||||
type = lib.types.enum [ "topology" ];
|
type = lib.types.enum [ "topology" ];
|
||||||
|
|||||||
+1
-1
@@ -189,7 +189,7 @@ in
|
|||||||
Machine configuration to be added for the vm script available at `.system.build.vmWithDisko`.
|
Machine configuration to be added for the vm script available at `.system.build.vmWithDisko`.
|
||||||
'';
|
'';
|
||||||
inherit (vmVariantWithDisko) type;
|
inherit (vmVariantWithDisko) type;
|
||||||
default = {};
|
default = { };
|
||||||
visible = "shallow";
|
visible = "shallow";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -33,4 +33,5 @@ let
|
|||||||
mainProgram = finalAttrs.name;
|
mainProgram = finalAttrs.name;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
in self
|
in
|
||||||
|
self
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
{ pkgs ? import <nixpkgs> { }
|
{ pkgs ? import <nixpkgs> { }, ... }:
|
||||||
, diskoLib ? pkgs.callPackage ../lib { }
|
|
||||||
}:
|
|
||||||
(pkgs.nixos [
|
(pkgs.nixos [
|
||||||
../example/stand-alone/configuration.nix
|
../example/stand-alone/configuration.nix
|
||||||
{ documentation.enable = false; }
|
{ documentation.enable = false; }
|
||||||
|
|||||||
Reference in new issue
Block a user