Belongs to d382a3cccf, but I authored that
on another machine.
Making sure vscode uses mypy from the environment is very important now,
because some of these errors get triggered in different ways depending
on the version.
This makes the tests more readable and easier to browse.
Making sure the tests always run fine, no matter from which directory
they're started is a little detail we should either test for or
document.
Using untyped dicts was not a safe way to pass arguments to error
message rendering. Also, having one giant match statement wouldn't scale
well. Using function pointers and kwargs, mypy can now properly check
whether all required arguments are passed to DiskoMessage().
As a bonus, it's now easy to use the "Go to definition" LSP command for
error codes, which wasn't possible before.
This requires a lot of restructuring. The .nix files have to be bundled
together with the python files, so they need to follow python's module
system structure.
I ran `nix-fast-build --no-link -j 2 --eval-workers 3 --flake .#checks`
and it succeeded, so I'm reasonably confident I changed everything as
required.
Fixes#130
This should fix pretty much all cases where spaces or other special
characters would break disko due to improper quoting. I searched for all
instances of '.label', '.device' and '.name', so I believe I caught
whatever I could.
In some cases I changed single quotes to double quotes for consistency.
I know we don't usually fix bugs in the legacy table type, but it was so
easy I couldn't resist.
Reproduces #130.
For new style table the generated script has a few problems for example;
```sh
sgdisk \
--new=2:0:+100M \
--change-name=2:disk-vdb-name with spaces \
--typecode=2:EF00 \
/dev/vdb
```
and
```sh
mkfs.vfat \
\
/dev/disk/by-partlabel/disk-vdb-name with spaces
```
Legacy table style generates slightly different problems e.g.;
```sh
parted -s /dev/vdb -- mkpart name with spaces 1MiB 100MiB
```
Fixes#745
This adds a script to create a release. Running it will create two
commits that would appear like this in `git log --oneline`:
67b5fff (master) release: reset released flag
0b808f3 (tag: v1.8.1) release: v1.8.1
100d2f3 docs: last change before release
It also re-creates the `version.nix` file, which is used by the flake
to determine the final version the disko CLI will print.
If `disko --version` is run from exactly the commit tagged `v1.8.1`, it
will print `1.8.1`. If it is run from any commit past that (like
master), it will print `1.8.1-67b5fff`, and if it is run from a local
folder with uncommitted changes, it will print `1.8.1-67b5fff-dirty`.
As `makeDiskImages` always requires a NixOS configuration, we can
simplify the code by convering it into a NixOS module. Then we can make
it responsible for populating `system.build.diskoImages` and
`system.build.diskoImagesScript`.
disko-install combines disko and nixos-install into a single command.
Example usage:
sudo ./disko-install --flake /someflake#eva --disk sda /dev/zvol/zroot/test
These options previously existed but had no effect. Now they are
implemented. They only affect mount during disko’s filesystem creation,
not during any later mounts.
Adding test case to existing “complex” example and test mostly because
couldn’t think of any better place to put it.