template_nixos_package/flake.nix
2024-02-08 01:25:47 +03:00

47 lines
945 B
Nix

{
description = "NixOS Sample Package";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs } @inputs:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
lib = nixpkgs.lib;
in {
packages.${system}.default = pkgs.stdenv.mkDerivation rec {
pname = "Sample Package";
version = "1.0";
# Fetch sources.
src = inputs.self;
# src = pkgs.fetchurl {
# url = "https://git.voronind.com/voronind/nixos_sample_package/archive/v1.tar.gz";
# hash = "sha256-zAXcCiRqOgMBChqabFjCmAaux1Yb9N+Y5jcE22zT3OI=";
# };
# Bins go here.
nativeBuildInputs = with pkgs; [
cargo
rustc
];
# Libs go here.
buildInputs = [
# libGL
];
buildPhase = ''
cargo build --release
'';
installPhase = ''
mkdir -p $out/bin
cp target/release/nixos_sample_package $out/bin
'';
};
};
}