2022-08-17 12:53:51 +00:00
|
|
|
{
|
2022-12-09 13:22:45 +00:00
|
|
|
description = "Disko - declarative disk partitioning";
|
2022-08-17 12:53:51 +00:00
|
|
|
|
2022-12-23 16:25:47 +00:00
|
|
|
# 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";
|
2022-08-17 12:53:51 +00:00
|
|
|
|
2023-02-06 14:24:34 +00:00
|
|
|
outputs = { self, nixpkgs, ... }:
|
|
|
|
let
|
|
|
|
supportedSystems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"i686-linux"
|
|
|
|
"aarch64-linux"
|
2023-04-27 16:28:55 +00:00
|
|
|
"riscv64-linux"
|
2023-02-06 14:24:34 +00:00
|
|
|
];
|
|
|
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
2023-01-10 07:05:45 +00:00
|
|
|
in
|
2023-02-06 14:24:34 +00:00
|
|
|
{
|
2023-06-22 10:59:09 +00:00
|
|
|
nixosModules.default = self.nixosModules.disko; # convention
|
2023-02-06 14:24:34 +00:00
|
|
|
nixosModules.disko = import ./module.nix;
|
2023-09-26 13:57:59 +00:00
|
|
|
lib = import ./lib {
|
2023-02-06 14:24:34 +00:00
|
|
|
inherit (nixpkgs) lib;
|
|
|
|
};
|
|
|
|
packages = forAllSystems (system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
disko = pkgs.callPackage ./package.nix { };
|
2024-02-27 19:41:22 +00:00
|
|
|
disko-install = pkgs.callPackage ./disko-install.nix { };
|
2023-02-06 14:24:34 +00:00
|
|
|
default = self.packages.${system}.disko;
|
2023-08-13 17:36:39 +00:00
|
|
|
} // pkgs.lib.optionalAttrs (!pkgs.buildPlatform.isRiscV64) {
|
|
|
|
disko-doc = pkgs.callPackage ./doc.nix { };
|
2023-02-06 14:24:34 +00:00
|
|
|
});
|
|
|
|
# TODO: disable bios-related tests on aarch64...
|
|
|
|
# Run checks: nix flake check -L
|
|
|
|
checks = forAllSystems (system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2023-09-02 14:52:58 +00:00
|
|
|
# FIXME: aarch64-linux seems to hang on boot
|
|
|
|
nixosTests = nixpkgs.lib.optionalAttrs pkgs.hostPlatform.isx86_64 (import ./tests {
|
2023-02-06 14:24:34 +00:00
|
|
|
inherit pkgs;
|
|
|
|
makeTest = import (pkgs.path + "/nixos/tests/make-test-python.nix");
|
|
|
|
eval-config = import (pkgs.path + "/nixos/lib/eval-config.nix");
|
2023-09-02 14:52:58 +00:00
|
|
|
});
|
2024-02-27 19:41:22 +00:00
|
|
|
|
|
|
|
disko-install = pkgs.callPackage ./tests/disko-install {
|
|
|
|
inherit self;
|
|
|
|
};
|
|
|
|
|
2023-02-06 14:24:34 +00:00
|
|
|
shellcheck = pkgs.runCommand "shellcheck" { nativeBuildInputs = [ pkgs.shellcheck ]; } ''
|
|
|
|
cd ${./.}
|
|
|
|
shellcheck disk-deactivate/disk-deactivate disko
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
in
|
2023-09-02 14:52:58 +00:00
|
|
|
# FIXME: aarch64-linux seems to hang on boot
|
2024-02-27 19:41:22 +00:00
|
|
|
nixpkgs.lib.optionalAttrs pkgs.hostPlatform.isx86_64 (nixosTests // { inherit disko-install; }) //
|
2024-03-05 16:35:13 +00:00
|
|
|
pkgs.lib.optionalAttrs (!pkgs.buildPlatform.isRiscV64 && !pkgs.hostPlatform.isx86_32) {
|
|
|
|
inherit shellcheck;
|
|
|
|
inherit (self.packages.${system}) disko-doc;
|
|
|
|
});
|
2024-02-27 19:41:22 +00:00
|
|
|
|
|
|
|
nixosConfigurations.testmachine = nixpkgs.lib.nixosSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
modules = [
|
|
|
|
./tests/disko-install/configuration.nix
|
|
|
|
./example/hybrid.nix
|
|
|
|
./module.nix
|
|
|
|
];
|
|
|
|
};
|
2023-02-07 15:51:33 +00:00
|
|
|
formatter = forAllSystems (system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
in
|
|
|
|
pkgs.writeShellApplication {
|
2023-09-15 06:00:46 +00:00
|
|
|
name = "format";
|
2023-02-07 15:51:33 +00:00
|
|
|
runtimeInputs = with pkgs; [
|
|
|
|
nixpkgs-fmt
|
2023-09-15 06:00:46 +00:00
|
|
|
deno
|
2023-09-15 06:03:10 +00:00
|
|
|
deadnix
|
2023-02-07 15:51:33 +00:00
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
set -o xtrace
|
|
|
|
nixpkgs-fmt "$@"
|
2023-09-15 06:00:46 +00:00
|
|
|
deno fmt "$@"
|
2023-09-15 06:03:10 +00:00
|
|
|
deadnix --edit "$@"
|
2023-02-07 15:51:33 +00:00
|
|
|
'';
|
|
|
|
}
|
|
|
|
);
|
2023-02-06 14:24:34 +00:00
|
|
|
};
|
2022-08-17 12:53:51 +00:00
|
|
|
}
|