Revamp nix packaging
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,4 @@
|
|||||||
/target
|
/target
|
||||||
|
|
||||||
|
result
|
||||||
|
result-*
|
||||||
|
31
default.nix
31
default.nix
@ -1,22 +1,35 @@
|
|||||||
{
|
{
|
||||||
lib
|
lib
|
||||||
, fetchFromGitHub
|
, stdenv
|
||||||
|
, buildPackages
|
||||||
, rustPlatform
|
, rustPlatform
|
||||||
, makeWrapper
|
, installShellFiles
|
||||||
, mpv
|
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
|
in
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage rec {
|
||||||
pname = "thumbctl";
|
pname = cargoToml.package.name;
|
||||||
version = "0.1.0";
|
version = cargoToml.package.version;
|
||||||
src = lib.cleanSource ./.;
|
src = lib.cleanSource ./.;
|
||||||
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
|
||||||
cargoHash = "";
|
nativeBuildInputs = [
|
||||||
|
installShellFiles
|
||||||
|
];
|
||||||
|
|
||||||
|
postInstall = let
|
||||||
|
emulator = stdenv.hostPlatform.emulator buildPackages;
|
||||||
|
in ''
|
||||||
|
installShellCompletion --cmd thumbctl \
|
||||||
|
--bash <(${emulator} $out/bin/thumbctl generate-completions --shell bash) \
|
||||||
|
--zsh <(${emulator} $out/bin/thumbctl generate-completions --shell zsh) \
|
||||||
|
--fish <(${emulator} $out/bin/thumbctl generate-completions --shell fish)
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
license = licenses.mit;
|
license = licenses.gpl3Only;
|
||||||
maintainers = with maintainers; [ h7x4 ];
|
maintainers = with maintainers; [ h7x4 ];
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
mainProgram = "thumbctl";
|
mainProgram = "thumbctl";
|
||||||
|
10
flake.nix
10
flake.nix
@ -25,7 +25,9 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
rust-bin = rust-overlay.lib.mkRustBin { } pkgs.buildPackages;
|
rust-bin = rust-overlay.lib.mkRustBin { } pkgs.buildPackages;
|
||||||
toolchain = rust-bin.stable.latest.default;
|
toolchain = rust-bin.stable.latest.default.override {
|
||||||
|
extensions = [ "rust-src" "rust-analyzer" "rust-std" ];
|
||||||
|
};
|
||||||
in f system pkgs toolchain);
|
in f system pkgs toolchain);
|
||||||
in {
|
in {
|
||||||
apps = forAllSystems (system: pkgs: _: {
|
apps = forAllSystems (system: pkgs: _: {
|
||||||
@ -42,12 +44,6 @@
|
|||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
toolchain
|
toolchain
|
||||||
pkgs.pkg-config
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
# pkgs.systemdLibs.dev
|
|
||||||
pkgs.dbus.dev
|
|
||||||
];
|
];
|
||||||
|
|
||||||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||||
|
Reference in New Issue
Block a user