mirror of
https://github.com/nix-community/disko
synced 2024-11-10 06:14:14 +00:00
feat: trim the build to the minimum
on a slow finicky target machine, no time to pull gcc
This commit is contained in:
parent
15b62fd7a1
commit
fa17cfe878
2 changed files with 29 additions and 18 deletions
15
Makefile
15
Makefile
|
@ -1,15 +0,0 @@
|
||||||
PREFIX ?= /usr/local
|
|
||||||
SHARE ?= $(PREFIX)/share/disko
|
|
||||||
|
|
||||||
all:
|
|
||||||
|
|
||||||
SOURCES = disko cli.nix default.nix types.nix
|
|
||||||
|
|
||||||
install:
|
|
||||||
mkdir -p $(PREFIX)/bin $(SHARE)
|
|
||||||
sed \
|
|
||||||
-e "s|libexec_dir=\".*\"|libexec_dir=\"$(SHARE)\"|" \
|
|
||||||
-e "s|#!/usr/bin/env.*|#!/usr/bin/env bash|" \
|
|
||||||
disko > $(PREFIX)/bin/disko
|
|
||||||
chmod 755 $(PREFIX)/bin/disko
|
|
||||||
cp -r $(SOURCES) $(SHARE)
|
|
32
flake.nix
32
flake.nix
|
@ -9,12 +9,38 @@
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
};
|
};
|
||||||
packages.x86_64-linux.disko = let
|
packages.x86_64-linux.disko = let
|
||||||
|
inherit (nixpkgs) lib;
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
in pkgs.stdenv.mkDerivation {
|
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";
|
||||||
name = "disko";
|
name = "disko";
|
||||||
src = ./.;
|
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"
|
||||||
|
];
|
||||||
|
} // {
|
||||||
meta.description = "Format disks with nix-config";
|
meta.description = "Format disks with nix-config";
|
||||||
installFlags = [ "PREFIX=$(out)" ];
|
|
||||||
};
|
};
|
||||||
packages.x86_64-linux.default = self.packages.x86_64-linux.disko;
|
packages.x86_64-linux.default = self.packages.x86_64-linux.disko;
|
||||||
checks.x86_64-linux = let
|
checks.x86_64-linux = let
|
||||||
|
|
Loading…
Reference in a new issue