Commit graph

61 commits

Author SHA1 Message Date
Felix Uhl
389235b63f disko2: Create package
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.
2024-10-30 23:54:41 +01:00
Felix Uhl
bba79f6b5e disk-image: Fix "unexpected argument 'customQemu'" eval error
Previously, an error like

    error: function 'anonymous lambda' called with unexpected argument 'customQemu'

    at /nix/store/lbqj1cndic4121whnx8xm0jgb1c8x4xx-source/pkgs/build-support/vm/default.nix:1:1:

was printed when trying to evaluate `config.system.build.vmWithDisko` or
`config.system.build.diskoImagesScript` with nixpkgs 24.05 (and below).

This argument was added in
65c851cd75,
so technically the minimum version is 24.11.20240708.65c851c. However,
`versionAtLeast` only compares versions alphabetically, so the comparison's
result will be incorrect for other commits made on the same day.

Instead, we compare against 24.11.20240709, which is the next day.
This means this function returns false for some commits that DO support the
customQemu argument, but if it returns true, we can be 100% certain that this
is correct, and we can pass the customQemu argument to vmTools without an
evaluation error.

Fixes #850
2024-10-28 14:38:07 +01:00
qbisi
9938afb435 options: make extraPostVM mergable. 2024-10-14 16:16:13 +00:00
Felix Uhl
72c867c439 Run nix fmt 2024-09-26 15:36:54 +02:00
Jörg Thalheim
51994df8ba imageBuilder: add defaultText
otherwise documentation depends on the hostname to be set
2024-09-20 14:23:16 +00:00
Michael Hoang
c5853dcb32 module: throw if no disks are defined 2024-09-19 07:41:06 +07:00
Michael Hoang
706a1722f6 module: always populate system.build attributes 2024-09-19 06:53:45 +07:00
Michael Hoang
cc4d4a4b91 make-disk-image: convert into NixOS module
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`.
2024-09-14 19:35:44 +10:00
Michael Hoang
0943a50ee7 interactive-vm: convert into NixOS module 2024-09-09 16:06:20 +10:00
Michael Hoang
ba66c22ec1 Add virtualisation.vmVariantWithDisko option 2024-09-09 16:06:20 +10:00
lassulus
74a12fdf53
Merge pull request #742 from dasJ/fix/manual
Fix the manual by fixing string escape
2024-08-21 17:07:16 +02:00
lassulus
6433571556
Merge pull request #713 from nix-community/interactiveVM
add interactive VMs
2024-08-21 16:12:23 +02:00
Janne Heß
5b36e65c7c
Fix the manual by fixing string escape 2024-08-21 12:56:32 +02:00
Maximilian Bosch
ffc718f154
module: fix options.json rendering again 2024-08-20 14:06:57 +02:00
Sandro
1a0a69e2aa
Fix options.json rendering 2024-08-18 17:36:27 +02:00
matthewcroughan
d8a1d5e1f0 make-disk-image: allow vmTools qemu usage to be overriden by disko configuration
This is needed to prevent two layers of emulation when offering a build for a host running binfmt such as an x86 host trying to compile for aarch64 via binfmt
2024-08-14 20:05:56 +01:00
matthewcroughan
de015d2a44 make-disk-image: allow pkgs to be overriden by disko configuration
This is needed when the nixosConfig you're building for modifies nixpkgs options that lead to evaluation failing unnecessarily
2024-08-14 20:05:56 +01:00
matthewcroughan
f5cc4b55e5 make-disk-image: allow kernel to be overriden by disko configuration
This is especially useful when trying to build images for embedded systems such as the pi, which have a vendor kernel that can't be booted as part of the disko image builder process
2024-08-14 20:05:56 +01:00
lassulus
a574d68d37 module: add vmWithDisko output to system 2024-08-01 13:00:08 +02:00
lassulus
dd4d1663cc document extraRootModules better 2024-06-24 13:36:20 +00:00
matthewcroughan
23c63fb093 module: fix typo pkgs -> lib 2024-05-22 16:09:32 +00:00
matthewcroughan
4444751300 make-disk-image: make extraPostVM configurable from module.nix 2024-05-19 14:38:05 +01:00
fricklerhandwerk
2890a8c922 fix broken fallback
fixes an error when using this minimal configuration:

```nix
let
  pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11") { };
  disko = fetchTarball "https://github.com/nix-community/disko/tarball/master";
in
pkgs.nixos {
  imports = [
    "${disko}/module.nix"
    "${disko}/example/hybrid.nix"
  ];
}
```

when running:

```console
$ nix-build
...
error: 'default' at /nix/store/y981rwszq9yi36rvvz2vrr6hb22si0hc-source/lib/default.nix:391:23 called with unexpected argument 'system'
```
2023-12-24 18:44:46 +01:00
matthewcroughan
4c4634bbcb make-disk-image: allow extra dependencies to be passed into image builder 2023-12-14 14:24:37 +00:00
matthewcroughan
bb75ad0b1d make-disk-image: inherit kernel from nixosConfiguration 2023-12-14 14:05:13 +00:00
matthewcroughan
bd8fbc3f27 make-disk-image: make memSize configurable per disk
Sometimes the VM builder can run out of memory and fail to allocate memory when installing the system toplevel
2023-12-13 15:02:45 +00:00
Maximilian Bosch
6ad5c9c17c module: use defaultText to not depend on the configuration when building the manual
I do build my workstation with `documentation.nixos.includeAllModules`
to also have private modules and external stuff in my local options'
reference.

Not sure why exactly this breaks with

    error: attribute 'loader' missing

    at /nix/store/h6qicay9fgggx9nf6apdl6zkdpdp28xx-source/module.nix:46:19:

        45|         type = lib.types.bool;
        46|         default = config.boot.loader.systemd-boot.enable || config.boot.loader.grub.efiSupport;
          |                   ^
        47|       };

but using defaultText is the usual fix that also works here.
2023-10-13 20:57:40 +00:00
lassulus
9f29cedac7 rename makeDiskImage -> makeDiskImages 2023-09-18 12:16:33 +00:00
lassulus
56e6cad143 module: add images to system.build 2023-09-18 12:16:33 +00:00
Jörg Thalheim
9ab96378f8 reformat tree 2023-09-17 04:43:25 +00:00
lassulus
f9907fcf6d module: add extraTestConfig 2023-09-09 13:32:33 +00:00
lassulus
dd5cdd852c module: add tests.extraChecks 2023-09-02 10:14:48 +00:00
lassulus
d53cd437d3 module: fix legacy aliases 2023-08-31 10:00:56 +00:00
Jörg Thalheim
b32f0e2876 apply treefmt 2023-08-11 08:45:46 +00:00
a-kenji
4015740375 fix: typos 2023-07-30 17:43:54 +00:00
lassulus
1ddcff717c module: pass makeTest and eval-config to diskoLib 2023-07-20 21:32:53 +02:00
lassulus
4cad47f3fa module: expose diskoTest via system.build 2023-07-20 18:43:30 +02:00
lassulus
cdaff66b57 lib: refactor outputs into toplevel 2023-07-19 19:07:40 +00:00
lassulus
1e7098ee04 diskoScript: add bash to PATH 2023-06-24 09:19:17 +00:00
lassulus
8e50c6da0d diskoNoDeps -> diskoScriptNoDeps 2023-06-24 09:19:17 +00:00
lassulus
4dd2d14596 module: add better trace warning 2023-05-30 10:42:12 +02:00
lassulus
12662956d1 module: add diskoScript output, deprecated disko output 2023-05-21 15:39:00 +02:00
lassulus
28d4e71950 cli: consume diskoConfigurations or nixosConfigurations disko configs 2023-05-21 14:04:34 +02:00
lassulus
22b33a4fd6 types: refactor into diskoLib 2023-05-20 13:56:42 +02:00
Lily Foster
0accdf4e20 types,module,tests: run shellcheck on scripts before running them in NixOS tests 2023-02-14 09:07:13 +01:00
Chris Scutcher
4ba8181319
style: Disable inherit pattern check in statix
As discussed in [this
comment](https://github.com/nix-community/disko/pull/143#discussion_r1097912402),
as a blanket rule converting everything possible to `inherit` like
statements can hurt readability.

Add config file for statix to disable these checks and fixes, then rerun
the autofix with these options.
2023-02-07 15:37:12 +00:00
Chris Scutcher
08435eec4b
style: Apply nixpkgs-fmt and fix
Apply standard formatting and some statix conventions using;

```sh
nixpkgs-fmt **.nix && statix fix .
```

With the intent of making contribution a bit easier and reducing mental
load in hand formatting (in the same vein as [black]).

[black]: https://github.com/psf/black#the-uncompromising-code-formatter
2023-02-06 14:24:34 +00:00
Jörg Thalheim
48e4c06004 split disko type into multiple files 2023-01-29 08:10:33 +01:00
lassulus
af2da574be add support for another mountpoint than /mnt 2023-01-28 18:08:31 +01:00
phaer
dfd7ee9590 module: dash -> bash 2023-01-19 13:07:31 +01:00