Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nix-community/disko
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.7.0
Choose a base ref
...
head repository: nix-community/disko
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Sep 9, 2024

  1. Copy the full SHA
    ba66c22 View commit details
  2. Copy the full SHA
    0943a50 View commit details
  3. build(deps): bump DeterminateSystems/update-flake-lock from 23 to 24

    Bumps [DeterminateSystems/update-flake-lock](https://github.com/determinatesystems/update-flake-lock) from 23 to 24.
    - [Release notes](https://github.com/determinatesystems/update-flake-lock/releases)
    - [Commits](DeterminateSystems/update-flake-lock@v23...v24)
    
    ---
    updated-dependencies:
    - dependency-name: DeterminateSystems/update-flake-lock
      dependency-type: direct:production
      update-type: version-update:semver-major
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 9, 2024
    Copy the full SHA
    1eb54f6 View commit details

Commits on Sep 12, 2024

  1. Merge pull request #766 from Enzime/disko-vm

    Add `virtualisation.vmVariantWithDisko` option
    Lassulus authored Sep 12, 2024
    Copy the full SHA
    495c2d7 View commit details
  2. make-disk-image: automatically add ZFS to kernel

    Fixes #461
    Enzime authored and mergify[bot] committed Sep 12, 2024
    Copy the full SHA
    59fb64b View commit details

Commits on Sep 13, 2024

  1. ci(Mergify): configuration update

    Signed-off-by: Jörg Thalheim <null>
    Mic92 committed Sep 13, 2024
    Copy the full SHA
    0f0b7f4 View commit details
  2. Merge pull request #768 from nix-community/mergify/Mic92/config-update

    ci(Mergify): configuration update
    Mic92 authored Sep 13, 2024
    Copy the full SHA
    4ef99d8 View commit details

Commits on Sep 14, 2024

  1. 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`.
    Enzime committed Sep 14, 2024
    Copy the full SHA
    cc4d4a4 View commit details
  2. Merge pull request #764 from nix-community/dependabot/github_actions/…

    …DeterminateSystems/update-flake-lock-24
    
    build(deps): bump DeterminateSystems/update-flake-lock from 23 to 24
    Mic92 authored Sep 14, 2024
    Copy the full SHA
    3632080 View commit details

Commits on Sep 15, 2024

  1. Merge pull request #771 from Enzime/refactor/make-disk-image

    make-disk-image: convert into NixOS module
    Lassulus authored Sep 15, 2024
    Copy the full SHA
    51e3a7e View commit details

Commits on Sep 16, 2024

  1. build(deps): bump cachix/install-nix-action from V27 to 28

    Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from V27 to 28. This release includes the previously tagged commit.
    - [Release notes](https://github.com/cachix/install-nix-action/releases)
    - [Commits](cachix/install-nix-action@V27...V28)
    
    ---
    updated-dependencies:
    - dependency-name: cachix/install-nix-action
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Sep 16, 2024
    Copy the full SHA
    521fc3d View commit details
  2. Merge pull request #775 from nix-community/dependabot/github_actions/…

    …cachix/install-nix-action-V28
    
    build(deps): bump cachix/install-nix-action from V27 to 28
    Mic92 authored Sep 16, 2024
    Copy the full SHA
    22ee467 View commit details

Commits on Sep 17, 2024

  1. docs: rename vdb -> main

    Enzime authored and mergify[bot] committed Sep 17, 2024
    Copy the full SHA
    d52ca37 View commit details
  2. Copy the full SHA
    88b015b View commit details
  3. zfs_fs: support updating mountpoint properly

    Use `zfs set -u` to update the `mountpoint` flag without mounting or
    unmounting the filesystem. This flag was added in OpenZFS 2.2.0, which
    was released October 2023.
    
    The previous logic would not update `mountpoint` if `config.options` was
    empty or only contained `mountpoint`.
    Enzime authored and mergify[bot] committed Sep 17, 2024
    Copy the full SHA
    a9eeea3 View commit details
  4. Copy the full SHA
    d32d150 View commit details

Commits on Sep 18, 2024

  1. Copy the full SHA
    706a172 View commit details

Commits on Sep 19, 2024

  1. Copy the full SHA
    c5853dc View commit details
  2. Merge pull request #776 from Enzime/populate

     module: always populate system.build attributes
    Mic92 authored Sep 19, 2024
    Copy the full SHA
    a31fe5e View commit details
  3. update project logo

    fixes #781
    Mic92 committed Sep 19, 2024
    Copy the full SHA
    3646c27 View commit details
  4. Merge pull request #783 from nix-community/joerg-ci

    update project logo
    Mic92 authored Sep 19, 2024
    Copy the full SHA
    624fd86 View commit details

Commits on Sep 20, 2024

  1. filesystem: escape shell args

    Mic92 committed Sep 20, 2024
    Copy the full SHA
    bc7fd72 View commit details
  2. shellcheck: also disable SC2054

    Mic92 committed Sep 20, 2024
    Copy the full SHA
    da8bfaf View commit details
  3. tests/f2fs: add compression

    This is a regression test for shellcheck, where we had to disable SC2054
    Mic92 committed Sep 20, 2024
    Copy the full SHA
    93c1dde View commit details
  4. Copy the full SHA
    9adb48e View commit details
  5. Merge pull request #785 from nix-community/smaller-fixes

    Fix shellcheck for mounoptions with commas + escape filesystem args
    Mic92 authored Sep 20, 2024
    Copy the full SHA
    0fe7799 View commit details
  6. imageBuilder: add defaultText

    otherwise documentation depends on the hostname to be set
    Mic92 authored and mergify[bot] committed Sep 20, 2024
    Copy the full SHA
    51994df View commit details

Commits on Sep 23, 2024

  1. delete old logo

    Lassulus committed Sep 23, 2024
    Copy the full SHA
    49b22d4 View commit details
  2. Copy the full SHA
    e72de07 View commit details
  3. Merge pull request #793 from nix-community/joerg-ci

    add workaround for failing zpool import test
    Mic92 authored Sep 23, 2024
    Copy the full SHA
    430ba34 View commit details
  4. Copy the full SHA
    b1d6bed View commit details
  5. Add binlore for disko and disko-install

    Consider this flake:
    
      {
        description = "Helper for reproducing a disko-related problem";
        inputs = {
          disko.url = "github:nix-community/disko/b1d6bed240abef5f5373e88fc7909f493013e557";
          nixpkgs.follows = "disko/nixpkgs";
        };
    
        outputs =
          {
            self,
            disko,
            nixpkgs,
          }:
          let
            system = "x86_64-linux";
            pkgs = nixpkgs.legacyPackages."${system}";
          in
          {
            packages."${system}".default =
              pkgs.resholve.writeScript "disko-install-binlore-test"
                {
                  inputs = [ disko.packages."${system}".default ];
                  interpreter = "${pkgs.lib.getExe pkgs.bash}";
                }
                ''
                  disko --help
                  disko-install --help
                '';
          };
      }
    
    That flake will fail to build because resholve thinks that disko and
    disko-install might be able to execute their arguments. This commit
    fixes that problem.
    
    Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
    Jayman2000 and Mic92 committed Sep 23, 2024
    Copy the full SHA
    6d2914c View commit details

Commits on Sep 24, 2024

  1. Copy the full SHA
    c61e50b View commit details
  2. lvm: add missing dm-snapshot

    Usually this is added by nixos-generate-config.
    However now that we run nixos-generate-config before disko or we even
    run nixos-facter, we likely not see the LVM block devices anymore.
    Mic92 authored and mergify[bot] committed Sep 24, 2024
    Copy the full SHA
    6d42596 View commit details

Commits on Sep 25, 2024

  1. Always add dm-snapshot when LVM is used

    The lvm_type is only set on RAID and thinly provisioned LVM volumes, but
    regular LVM volumes without a type can also have snapshots.
    r-vdp committed Sep 25, 2024
    Copy the full SHA
    1f8e67e View commit details
  2. Merge pull request #797 from r-vdp/always-add-dm-snapshot

    Always add dm-snapshot when LVM is used
    Mic92 authored Sep 25, 2024
    Copy the full SHA
    c1c472f View commit details

Commits on Sep 26, 2024

  1. Copy the full SHA
    18c5410 View commit details
  2. Merge pull request #801 from danjujan/master

    make-disk-image: use memSize as default build-memory in diskoImagesScript
    iFreilicht authored Sep 26, 2024
    Copy the full SHA
    1879e48 View commit details
  3. flake: add --check option to formatter

    Add an option to check the formatting without modifying files.
    This will be can be used in CI checks.
    beviu authored and iFreilicht committed Sep 26, 2024
    Copy the full SHA
    4c4c869 View commit details
  4. Run nix fmt

    iFreilicht committed Sep 26, 2024
    Copy the full SHA
    72c867c View commit details
  5. Merge pull request #716 from beviu/fmt-check

    Add --check option to formatter in flake
    Mic92 authored Sep 26, 2024
    Copy the full SHA
    67dc29b View commit details

Commits on Sep 28, 2024

  1. interactive-vm: override forceImportRoot

    Some users will have `boot.zfs.forceImportRoot = false;` in their
    configurations which conflicts with `boot.zfs.forceImportAll = true;`,
    so we set it to `true` to match.
    Enzime authored and mergify[bot] committed Sep 28, 2024
    Copy the full SHA
    b709e1c View commit details

Commits on Oct 1, 2024

  1. zpool: fix default value for cache

    we want an empty list instead of null
    Mic92 committed Oct 1, 2024
    Copy the full SHA
    91cd091 View commit details
  2. Copy the full SHA
    fc3ba69 View commit details
  3. zfs-with-vdevs: increase pool import timeout

    Fix fixes a long-standing test failures we have with the zfs-with-vdevs.
    Mic92 committed Oct 1, 2024
    Copy the full SHA
    4e30bc7 View commit details
  4. Merge pull request #805 from nix-community/zfs-fix

    Fix flaky zfs test
    iFreilicht authored Oct 1, 2024
    Copy the full SHA
    037be88 View commit details
  5. Create luks-btrfs-raid.nix

    Sk7Str1p3 authored and iFreilicht committed Oct 1, 2024
    Copy the full SHA
    c312692 View commit details
  6. Copy the full SHA
    ba436ed View commit details
  7. Copy the full SHA
    b9c9948 View commit details
  8. Merge pull request #806 from iFreilicht/luks-btrfs-raid-example

    Luks btrfs raid example
    iFreilicht authored Oct 1, 2024
    Copy the full SHA
    6c5ba9e View commit details
Showing with 5,214 additions and 2,028 deletions.
  1. +1 −0 .envrc
  2. +35 −0 .git-blame-ignore-revs
  3. +2 −2 .github/workflows/update-flake-lock.yml
  4. +5 −0 .gitignore
  5. +2 −5 .mergify.yml
  6. +39 −0 CONTRIBUTING.md
  7. +7 −5 README.md
  8. +92 −39 cli.nix
  9. +91 −27 default.nix
  10. +51 −10 disko
  11. +36 −9 disko-install
  12. +18 −10 doc.nix
  13. +2 −1 docs/HowTo.md
  14. +7 −1 docs/INDEX.md
  15. +38 −13 docs/disko-images.md
  16. +16 −8 docs/disko-install.md
  17. +18 −9 docs/interactive-vm.md
  18. BIN docs/logo.jpeg
  19. BIN docs/logo.png
  20. +3 −3 docs/quickstart.md
  21. +8 −4 docs/reference.md
  22. +4 −2 docs/table-to-gpt.md
  23. +160 −0 docs/testing.md
  24. +1 −0 example/bcachefs.nix
  25. +1 −0 example/boot-raid1.nix
  26. +5 −2 example/btrfs-only-root-subvolume.nix
  27. +5 −2 example/btrfs-subvolumes.nix
  28. +2 −0 example/complex.nix
  29. +8 −1 example/f2fs.nix
  30. +49 −0 example/gpt-name-with-whitespace.nix
  31. +37 −0 example/gpt-unformatted.nix
  32. +1 −0 example/hybrid-mbr.nix
  33. +1 −0 example/hybrid-tmpfs-on-root.nix
  34. +1 −1 example/hybrid.nix
  35. +51 −0 example/legacy-table-with-whitespace.nix
  36. +1 −1 example/legacy-table.nix
  37. +1 −1 example/long-device-name.nix
  38. +78 −0 example/luks-btrfs-raid.nix
  39. +13 −6 example/luks-btrfs-subvolumes.nix
  40. +1 −0 example/luks-interactive-login.nix
  41. +2 −4 example/luks-lvm.nix
  42. +1 −1 example/luks-on-mdadm.nix
  43. +1 −0 example/lvm-raid.nix
  44. +1 −0 example/lvm-sizes-sort.nix
  45. +1 −3 example/lvm-thin.nix
  46. +1 −1 example/non-root-zfs.nix
  47. +1 −1 example/simple-efi.nix
  48. +4 −3 example/stand-alone/configuration.nix
  49. +1 −0 example/swap.nix
  50. +1 −1 example/tmpfs.nix
  51. +6 −1 example/with-lib.nix
  52. +37 −0 example/xfs-with-quota.nix
  53. +63 −0 example/zfs-encrypted-root.nix
  54. +2 −4 example/zfs-over-legacy.nix
  55. +215 −11 example/zfs-with-vdevs.nix
  56. +22 −2 example/zfs.nix
  57. +3 −3 flake.lock
  58. +64 −37 flake.nix
  59. +21 −23 install-cli.nix
  60. +181 −0 lib/binfmt.nix
  61. +819 −273 lib/default.nix
  62. +66 −68 lib/interactive-vm.nix
  63. +158 −91 lib/make-disk-image.nix
  64. +315 −244 lib/tests.nix
  65. +175 −123 lib/types/btrfs.nix
  66. +31 −7 lib/types/disk.nix
  67. +51 −18 lib/types/filesystem.nix
  68. +296 −188 lib/types/gpt.nix
  69. +82 −39 lib/types/luks.nix
  70. +20 −5 lib/types/lvm_pv.nix
  71. +140 −82 lib/types/lvm_vg.nix
  72. +67 −25 lib/types/mdadm.nix
  73. +14 −2 lib/types/mdraid.nix
  74. +19 −2 lib/types/nodev.nix
  75. +54 −27 lib/types/swap.nix
  76. +222 −157 lib/types/table.nix
  77. +14 −2 lib/types/zfs.nix
  78. +105 −63 lib/types/zfs_fs.nix
  79. +56 −17 lib/types/zfs_volume.nix
  80. +281 −102 lib/types/zpool.nix
  81. +206 −86 module.nix
  82. +52 −27 package.nix
  83. +18 −0 scripts/create-release.nix
  84. +67 −0 scripts/create-release.sh
  85. +3 −2 tests/bcachefs.nix
  86. +3 −2 tests/boot-raid1.nix
  87. +3 −2 tests/btrfs-only-root-subvolume.nix
  88. +3 −3 tests/btrfs-subvolumes.nix
  89. +7 −3 tests/cli.nix
  90. +8 −4 tests/complex.nix
  91. +19 −11 tests/default.nix
  92. +23 −6 tests/disko-install/configuration.nix
  93. +11 −2 tests/disko-install/default.nix
  94. +3 −2 tests/f2fs.nix
  95. +3 −2 tests/gpt-bios-compat.nix
  96. +14 −0 tests/gpt-name-with-special-chars.nix
  97. +12 −0 tests/gpt-unformatted.nix
  98. +3 −2 tests/hybrid-mbr.nix
  99. +3 −2 tests/hybrid-tmpfs-on-root.nix
  100. +3 −2 tests/hybrid.nix
  101. +13 −0 tests/legacy-table-with-whitespace.nix
  102. +3 −2 tests/legacy-table.nix
  103. +3 −2 tests/long-device-name.nix
  104. +14 −0 tests/luks-btrfs-raid.nix
  105. +3 −2 tests/luks-btrfs-subvolumes.nix
  106. +6 −4 tests/luks-interactive-login.nix
  107. +3 −2 tests/luks-lvm.nix
  108. +3 −2 tests/luks-on-mdadm.nix
  109. +8 −3 tests/lvm-raid.nix
  110. +3 −2 tests/lvm-sizes-sort.nix
  111. +3 −2 tests/lvm-thin.nix
  112. +14 −12 tests/make-disk-image-impure.nix
  113. +14 −10 tests/make-disk-image.nix
  114. +3 −2 tests/mdadm-raid0.nix
  115. +3 −2 tests/mdadm.nix
  116. +7 −3 tests/module.nix
  117. +3 −2 tests/multi-device-no-deps.nix
  118. +3 −2 tests/negative-size.nix
  119. +3 −2 tests/non-root-zfs.nix
  120. +3 −2 tests/simple-efi.nix
  121. +3 −2 tests/standalone.nix
  122. +18 −5 tests/swap.nix
  123. +3 −2 tests/tmpfs.nix
  124. +3 −2 tests/with-lib.nix
  125. +14 −0 tests/xfs.nix
  126. +17 −0 tests/zfs-encrypted-root.nix
  127. +3 −3 tests/zfs-over-legacy.nix
  128. +47 −2 tests/zfs-with-vdevs.nix
  129. +8 −4 tests/zfs.nix
  130. +11 −0 treefmt.toml
  131. +4 −0 version.nix
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
35 changes: 35 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This file contains a list of commits that are not likely what you
# are looking for in a blame, such as mass reformatting or renaming.
#
# If a commit's line ends with `# !autorebase <command>`,
# where <command> is an idempotent bash command that reapplies the changes from the commit,
# the `https://github.com/NixOS/nixpkgs/blob/master/maintainers/scripts/auto-rebase/run.sh` script can be used to rebase
# across that commit while automatically resolving merge conflicts caused by the commit.
#
# You can set this file as a default ignore file for blame by running
# the following command.
#
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
#
# To temporarily not use this file add
# --ignore-revs-file=""
# to your blame command.
#
# The ignoreRevsFile can't be set globally due to blame failing if the file isn't present.
# To not have to set the option in every repository it is needed in,
# save the following script in your path with the name "git-bblame"
# now you can run
# $ git bblame $FILE
# to use the .git-blame-ignore-revs file if it is present.
#
# #!/usr/bin/env bash
# repo_root=$(git rev-parse --show-toplevel)
# if [[ -e $repo_root/.git-blame-ignore-revs ]]; then
# git blame --ignore-revs-file="$repo_root/.git-blame-ignore-revs" $@
# else
# git blame $@
# fi


# treewide: format all files
bd9da344ab53d297bd3e2baab0805b2e51b31136
4 changes: 2 additions & 2 deletions .github/workflows/update-flake-lock.yml
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@V27
uses: cachix/install-nix-action@v30
- name: Update flake.lock
uses: DeterminateSystems/update-flake-lock@v23
uses: DeterminateSystems/update-flake-lock@v24
with:
pr-labels: |
merge-queue
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
result
result-*
.direnv/

# Created by the NixOS interactive test driver
.nixos-test-history
7 changes: 2 additions & 5 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
queue_rules:
- name: default
merge_conditions:
- check-success=buildbot/nix-eval
defaults:
actions:
queue:
merge_method: rebase
- check-success=buildbot/nix-build
merge_method: rebase
pull_request_rules:
- name: merge using the merge queue
conditions:
39 changes: 39 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Contributing

We welcome contributions of all kinds, be it in terms of bug fixes,
reproductions, features or documentation.

In general, PRs are more likely to be merged quickly if they contain tests which
prove that a feature is working as intended or that a bug was indeed present and
has now been fixed. Creating a draft PR that reproduces a bug is also a great
way to help us fix issues quickly. Check out
[this PR](https://github.com/nix-community/disko/pull/330) as an example.

For more information on how to run and debug tests, check out
[Running and debugging tests](./docs/testing.md).

## How to find issues to work on

If you're looking for a low-hanging fruit, check out
[this list of `good first issue`s](https://github.com/nix-community/disko/labels/good%20first%20issue).
These are issues that we have confirmed to be real and which have a strategy for
a fix already lined out in the comments. All you need to do is implement.

If you're looking for something more challenging, check out
[this list of issues tagged `contributions welcome`](https://github.com/nix-community/disko/labels/contributions%20welcome).
These are issues that we have confirmed to be real and we know we want to be
fixed.

For the real though nuts, we also have
[the `help wanted` label](https://github.com/nix-community/disko/labels/help%20wanted)
for issues that we feel like we need external help with. If you want a real
challenge, take a look there!

If you're looking for bugs that still need to be reproduced, have a look at
[this list of non-`confirmed` bugs](https://github.com/nix-community/disko/issues?q=is%3Aissue+is%3Aopen+label%3Abug+-label%3Aconfirmed+).
These are things that look like bugs but that we haven't reproduced yet.

If you're looking to contribute to the documentation, check out
[the `documentation` tag](https://github.com/nix-community/disko/issues?q=is%3Aissue+is%3Aopen+label%3Adocumentation)
or just read through [our docs](./docs/INDEX.md) and see if you can find any
issues.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# disko - Declarative disk partitioning

<!-- Generated with bing image generator (which uses dall-e-2): edge-gpt-image --prompt "Disco ball shooting a laser beam at one hard drive" -->

<img title="" src="./docs/logo.jpeg" alt="Project logo" width="274">
<img title="" src="./docs/logo.png" alt="Project logo" width="274">

[Documentation Index](./docs/INDEX.md)

@@ -42,7 +40,8 @@ recursive layouts.
Disko doesn't require installation: it can be run directly from nix-community
repository. The [Quickstart Guide](./docs/quickstart.md) documents how to run
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
**disko**, using **disko** without NixOS and downloading the module, see the
@@ -77,6 +76,7 @@ A simple disko configuration may look like this:
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
mountOptions = [ "umask=0077" ];
};
};
root = {
@@ -100,7 +100,7 @@ a disk named /dev/sda, you would run the following command to partition, format
and mount the disk.

```console
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disk-config.nix
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount /tmp/disk-config.nix
```

## Related Tools
@@ -117,6 +117,8 @@ this project.
This software is provided free under the
[MIT Licence](https://opensource.org/licenses/MIT).

If you want to contribute, check out [CONTRIBUTING.md](./CONTRIBUTING.md).

## Get in touch

We have a public matrix channel at
131 changes: 92 additions & 39 deletions cli.nix
Original file line number Diff line number Diff line change
@@ -1,70 +1,123 @@
{ pkgs ? import <nixpkgs> { }
, lib ? pkgs.lib
, mode ? "mount"
, flake ? null
, flakeAttr ? null
, diskoFile ? null
, rootMountPoint ? "/mnt"
, noDeps ? false
, ...
{
pkgs ? import <nixpkgs> { },
lib ? pkgs.lib,
mode ? "mount",
flake ? null,
flakeAttr ? null,
diskoFile ? null,
rootMountPoint ? "/mnt",
noDeps ? false,
...
}@args:
let
disko = import ./. {
inherit rootMountPoint;
inherit lib;
};

hasDiskoFile = diskoFile != null;

diskoAttr =
if noDeps then
{
format = "formatScriptNoDeps";
mount = "mountScriptNoDeps";
disko = "diskoScriptNoDeps";
(
if noDeps then
(
if hasDiskoFile then
{
destroy = "_cliDestroyNoDeps";
format = "_cliFormatNoDeps";
mount = "_cliMountNoDeps";
unmount = "_cliUnmountNoDeps";

# legacy aliases
create = "createScriptNoDeps";
zap_create_mount = "diskoScriptNoDeps";
}.${mode}
else
{
format = "formatScript";
mount = "mountScript";
disko = "diskoScript";
"format,mount" = "_cliFormatMountNoDeps";
"destroy,format,mount" = "_cliDestroyFormatMountNoDeps";
}
else
{
destroy = "destroyNoDeps";
format = "formatNoDeps";
mount = "mountNoDeps";
unmount = "unmountNoDeps";

"format,mount" = "formatMountNoDeps";
"destroy,format,mount" = "destroyFormatMountNoDeps";
}
)
// {
# legacy aliases
disko = "diskoScriptNoDeps";
create = "createScriptNoDeps";
zap_create_mount = "diskoScriptNoDeps";
}
else
(
if hasDiskoFile then
{
destroy = "_cliDestroy";
format = "_cliFormat";
mount = "_cliMount";
unmount = "_cliUnmount";

# legacy aliases
create = "createScript";
zap_create_mount = "diskoScript";
}.${mode};
"format,mount" = "_cliFormatMount";
"destroy,format,mount" = "_cliDestroyFormatMount";
}
else
{
destroy = "destroy";
format = "format";
mount = "mount";
unmount = "unmount";

"format,mount" = "formatMount";
"destroy,format,mount" = "destroyFormatMount";
}
)
// {
# legacy aliases
disko = "diskoScript";
create = "createScript";
zap_create_mount = "diskoScript";
}
).${mode};

hasDiskoConfigFlake =
diskoFile != null || lib.hasAttrByPath [ "diskoConfigurations" flakeAttr ] (builtins.getFlake flake);
hasDiskoFile || lib.hasAttrByPath [ "diskoConfigurations" flakeAttr ] (builtins.getFlake flake);

hasDiskoModuleFlake =
lib.hasAttrByPath [ "nixosConfigurations" flakeAttr "config" "disko" "devices" ] (builtins.getFlake flake);
hasDiskoModuleFlake = lib.hasAttrByPath [
"nixosConfigurations"
flakeAttr
"config"
"disko"
"devices"
] (builtins.getFlake flake);

diskFormat =
let
diskoConfig =
if diskoFile != null then
if hasDiskoFile then
import diskoFile
else
(builtins.getFlake flake).diskoConfigurations.${flakeAttr};
in
if builtins.isFunction diskoConfig then
diskoConfig ({ inherit lib; } // args)
else
diskoConfig;
if builtins.isFunction diskoConfig then diskoConfig ({ inherit lib; } // args) else diskoConfig;

diskoEval =
disko.${diskoAttr} diskFormat pkgs;
diskoEval = disko.${diskoAttr} diskFormat pkgs;

diskoScript =
if hasDiskoConfigFlake then
diskoEval
else if (lib.traceValSeq hasDiskoModuleFlake) then
else if hasDiskoModuleFlake then
(builtins.getFlake flake).nixosConfigurations.${flakeAttr}.config.system.build.${diskoAttr}
or (pkgs.writeShellScriptBin "disko-compat-error" ''
echo 'Error: Attribute `nixosConfigurations.${flakeAttr}.config.system.build.${diskoAttr}` >&2
echo ' not found in flake `${flake}`!' >&2
echo ' This is probably caused by the locked version of disko in the flake' >&2
echo ' being different from the version of disko you executed.' >&2
echo 'EITHER set the `disko` input of your flake to `github:nix-community/disko/latest`,' >&2
echo ' run `nix flake update disko` in the flake directory and then try again,' >&2
echo 'OR run `nix run github:nix-community/disko/v1.9.0 -- --help` and use one of its modes.' >&2
exit 1;'')
else
(builtins.abort "neither diskoConfigurations.${flakeAttr} nor nixosConfigurations.${flakeAttr} found");
(builtins.abort "couldn't find `diskoConfigurations.${flakeAttr}` or `nixosConfigurations.${flakeAttr}.config.disko.devices`");

in
diskoScript
Loading