disko/flake.nix
Maximilian Bosch 007625baaa
Fix manual build
The option `disko.devices.lvm_vg.<name>.lvs.<name>.priority` depends on
a different option that's unset by default breaking the manual build
like this:

    … while evaluating the attribute 'optionalValue.value'

     at /nix/store/lwyjz70qh12nq6cb7fixl85vryzxqm3c-source/lib/modules.nix:856:5:

      855|
      856|     optionalValue =
         |     ^
      857|       if isDefined then { value = mergedValue; }

    … while evaluating a branch condition

     at /nix/store/lwyjz70qh12nq6cb7fixl85vryzxqm3c-source/lib/modules.nix:857:7:

      856|     optionalValue =
      857|       if isDefined then { value = mergedValue; }
         |       ^
      858|       else {};

    (stack trace truncated; use '--show-trace' to show the full trace)

    error: The option `disko.devices.lvm_vg.<name>.lvs.<name>.size' is used but not defined.

This is especially noticeable when using `documentation.nixos.includeAllModules` locally.

Fixed the issue itself by adding a `defaultText` and added the
`disko-doc` job to the `checks` output so that CI hopefully catches this
from now on.
2024-03-05 17:35:13 +01:00

93 lines
3 KiB
Nix

{
description = "Disko - declarative disk partitioning";
# FIXME: in future we don't want lock here to give precedence to a USB live-installer's registry,
# but garnix currently does not allow this.
#inputs.nixpkgs.url = "nixpkgs";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
outputs = { self, nixpkgs, ... }:
let
supportedSystems = [
"x86_64-linux"
"i686-linux"
"aarch64-linux"
"riscv64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
nixosModules.default = self.nixosModules.disko; # convention
nixosModules.disko = import ./module.nix;
lib = import ./lib {
inherit (nixpkgs) lib;
};
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
disko = pkgs.callPackage ./package.nix { };
disko-install = pkgs.callPackage ./disko-install.nix { };
default = self.packages.${system}.disko;
} // pkgs.lib.optionalAttrs (!pkgs.buildPlatform.isRiscV64) {
disko-doc = pkgs.callPackage ./doc.nix { };
});
# TODO: disable bios-related tests on aarch64...
# Run checks: nix flake check -L
checks = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
# FIXME: aarch64-linux seems to hang on boot
nixosTests = nixpkgs.lib.optionalAttrs pkgs.hostPlatform.isx86_64 (import ./tests {
inherit pkgs;
makeTest = import (pkgs.path + "/nixos/tests/make-test-python.nix");
eval-config = import (pkgs.path + "/nixos/lib/eval-config.nix");
});
disko-install = pkgs.callPackage ./tests/disko-install {
inherit self;
};
shellcheck = pkgs.runCommand "shellcheck" { nativeBuildInputs = [ pkgs.shellcheck ]; } ''
cd ${./.}
shellcheck disk-deactivate/disk-deactivate disko
touch $out
'';
in
# FIXME: aarch64-linux seems to hang on boot
nixpkgs.lib.optionalAttrs pkgs.hostPlatform.isx86_64 (nixosTests // { inherit disko-install; }) //
pkgs.lib.optionalAttrs (!pkgs.buildPlatform.isRiscV64 && !pkgs.hostPlatform.isx86_32) {
inherit shellcheck;
inherit (self.packages.${system}) disko-doc;
});
nixosConfigurations.testmachine = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./tests/disko-install/configuration.nix
./example/hybrid.nix
./module.nix
];
};
formatter = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.writeShellApplication {
name = "format";
runtimeInputs = with pkgs; [
nixpkgs-fmt
deno
deadnix
];
text = ''
set -o xtrace
nixpkgs-fmt "$@"
deno fmt "$@"
deadnix --edit "$@"
'';
}
);
};
}