2022-08-17 12:53:51 +00:00
|
|
|
{
|
|
|
|
description = "Description for the project";
|
|
|
|
|
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, ... }: {
|
2022-10-23 10:29:30 +00:00
|
|
|
nixosModules.disko = import ./module.nix;
|
2022-08-17 12:53:51 +00:00
|
|
|
lib = import ./. {
|
|
|
|
inherit (nixpkgs) lib;
|
|
|
|
};
|
2022-11-05 19:25:08 +00:00
|
|
|
packages.x86_64-linux.disko = let
|
2022-11-06 05:12:15 +00:00
|
|
|
inherit (nixpkgs) lib;
|
2022-11-05 19:25:08 +00:00
|
|
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
2022-11-06 05:12:15 +00:00
|
|
|
inclFiles = {src, name}: files: lib.cleanSourceWith {
|
|
|
|
inherit src name;
|
|
|
|
filter = _path: _type: _type == "regular"
|
|
|
|
&& lib.any (file: builtins.baseNameOf _path == file) files;
|
|
|
|
};
|
|
|
|
in derivation rec{
|
|
|
|
system = "x86_64-linux";
|
2022-11-05 19:25:08 +00:00
|
|
|
name = "disko";
|
2022-11-06 05:12:15 +00:00
|
|
|
builder = "/bin/sh";
|
|
|
|
PATH = "${pkgs.coreutils}/bin:${pkgs.gnused}/bin";
|
|
|
|
passAsFile = ["buildPhase"];
|
|
|
|
buildPhase = ''
|
|
|
|
mkdir -p $out/bin $out/share/disko
|
|
|
|
cp -r $src/* $out/share/disko
|
|
|
|
sed \
|
|
|
|
-e "s|libexec_dir=\".*\"|libexec_dir=\"$out/share/disko\"|" \
|
|
|
|
-e "s|#!/usr/bin/env.*|#!/usr/bin/env bash|" \
|
|
|
|
$src/disko > $out/bin/disko
|
|
|
|
chmod 755 $out/bin/disko
|
|
|
|
'';
|
|
|
|
args = ["-c" ". $buildPhasePath"];
|
|
|
|
src = inclFiles { inherit name; src = ./.; } [
|
|
|
|
"disko"
|
|
|
|
"cli.nix"
|
|
|
|
"default.nix"
|
|
|
|
"types.nix"
|
|
|
|
"options.nix"
|
|
|
|
];
|
|
|
|
} // {
|
2022-11-05 19:25:08 +00:00
|
|
|
meta.description = "Format disks with nix-config";
|
|
|
|
};
|
|
|
|
packages.x86_64-linux.default = self.packages.x86_64-linux.disko;
|
2022-08-17 12:53:51 +00:00
|
|
|
checks.x86_64-linux = let
|
|
|
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
2022-08-25 13:16:26 +00:00
|
|
|
in
|
2022-08-17 12:53:51 +00:00
|
|
|
# Run tests: nix flake check -L
|
2022-08-25 13:16:26 +00:00
|
|
|
import ./tests {
|
|
|
|
inherit pkgs;
|
2022-08-17 12:53:51 +00:00
|
|
|
makeTest = import (pkgs.path + "/nixos/tests/make-test-python.nix");
|
2022-09-30 10:55:28 +00:00
|
|
|
eval-config = import (pkgs.path + "/nixos/lib/eval-config.nix");
|
2022-08-17 12:53:51 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|