disko/flake.nix

58 lines
1.8 KiB
Nix
Raw Normal View History

2022-08-17 15:53:51 +03:00
{
description = "Description for the project";
2022-11-06 08:30:18 +03:00
# don't lock to give precedence to a USB live-installer's registry
inputs.nixpkgs.url = "nixpkgs";
2022-08-17 15:53:51 +03:00
outputs = { self, nixpkgs, ... }: {
2022-10-23 13:29:30 +03:00
nixosModules.disko = import ./module.nix;
2022-08-17 15:53:51 +03:00
lib = import ./. {
inherit (nixpkgs) lib;
};
2022-11-05 22:25:08 +03:00
packages.x86_64-linux.disko = let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
2022-11-06 08:30:18 +03:00
inherit (pkgs) lib;
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 22:25:08 +03:00
name = "disko";
builder = "/bin/sh";
PATH = "${pkgs.coreutils}/bin:${pkgs.gnused}/bin";
passAsFile = ["buildPhase"];
buildPhase = ''
mkdir -p $out/bin $out/share/disko
2022-12-01 22:10:21 +03:00
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 22:25:08 +03:00
meta.description = "Format disks with nix-config";
};
packages.x86_64-linux.default = self.packages.x86_64-linux.disko;
2022-08-17 15:53:51 +03:00
checks.x86_64-linux = let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
2022-08-25 16:16:26 +03:00
in
2022-08-17 15:53:51 +03:00
# Run tests: nix flake check -L
2022-08-25 16:16:26 +03:00
import ./tests {
inherit pkgs;
2022-08-17 15:53:51 +03:00
makeTest = import (pkgs.path + "/nixos/tests/make-test-python.nix");
eval-config = import (pkgs.path + "/nixos/lib/eval-config.nix");
2022-08-17 15:53:51 +03:00
};
};
}