default.nix: init, flake.nix: add app
This commit is contained in:
parent
a89cb24c86
commit
e9190f7879
|
@ -1 +1,2 @@
|
|||
/target
|
||||
result
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
lib
|
||||
, fetchFromGitHub
|
||||
, rustPlatform
|
||||
, makeWrapper
|
||||
, mpv
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "greg-ng";
|
||||
version = "0.1.0";
|
||||
src = lib.cleanSource ./.;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
outputHashes = {
|
||||
"mpvipc-async-0.1.0" = "sha256-2TQ2d4q9/DTxTZe9kOAoKBhsmegRZw32x3G2hbluS6U=";
|
||||
};
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/bin/greg-ng \
|
||||
--prefix PATH : '${lib.makeBinPath [ mpv ]}'
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ h7x4 ];
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
mainProgram = "greg-ng";
|
||||
};
|
||||
}
|
20
flake.nix
20
flake.nix
|
@ -8,6 +8,8 @@
|
|||
|
||||
outputs = { self, nixpkgs, rust-overlay }:
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
|
@ -15,7 +17,8 @@
|
|||
"aarch64-darwin"
|
||||
"armv7l-linux"
|
||||
];
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let
|
||||
|
||||
forAllSystems = f: lib.genAttrs systems (system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
|
@ -27,6 +30,16 @@
|
|||
toolchain = rust-bin.stable.latest.default;
|
||||
in f system pkgs toolchain);
|
||||
in {
|
||||
apps = forAllSystems (system: pkgs: _: {
|
||||
default = self.apps.${system}.greg-ng;
|
||||
greg-ng = let
|
||||
package = self.packages.${system}.greg-ng;
|
||||
in {
|
||||
type = "app";
|
||||
program = lib.getExe package;
|
||||
};
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system: pkgs: toolchain: {
|
||||
default = pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
|
@ -37,5 +50,10 @@
|
|||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||
};
|
||||
});
|
||||
|
||||
packages = forAllSystems (system: pkgs: _: {
|
||||
default = self.packages.${system}.greg-ng;
|
||||
greg-ng = pkgs.callPackage ./default.nix { };
|
||||
});
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue