Flake cleanup

This commit is contained in:
Erwin Boskma 2023-07-03 13:54:33 +02:00
parent 9043ee4fa5
commit e44c8501c9
Signed by: erwin
SSH key fingerprint: SHA256:9LmFDe1C6jSrEyqxxvX8NtJBmcbB105XoqyUZF092bg
4 changed files with 51 additions and 45 deletions

View file

@ -1,7 +0,0 @@
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
src = ./.;
}).defaultNix

View file

@ -1,43 +1,60 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
flake-utils.url = "github:numtide/flake-utils";
naersk = {
url = "github:nmattia/naersk/master";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = { self, nixpkgs, utils, naersk }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
naersk-lib = pkgs.callPackage naersk { };
in
rec {
outputs = {
self,
nixpkgs,
flake-utils,
naersk,
rust-overlay,
}:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {inherit system overlays;};
naersk-lib = pkgs.callPackage naersk {};
defaultPackage = naersk-lib.buildPackage {
root = ./.;
pname = "pamedia";
buildInputs = with pkgs; [ libpulseaudio ];
nativeBuildInputs = with pkgs; [ pkg-config ];
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
buildInputs = [
rustToolchain
pkgs.libpulseaudio.dev
];
nativeBuildInputs = [
pkgs.pkgconf
];
in rec {
packages.pamedia = naersk-lib.buildPackage {
inherit buildInputs nativeBuildInputs;
root = ./.;
pname = "pamedia";
};
packages.default = packages.pamedia;
defaultApp = flake-utils.lib.mkApp {
drv = self.defaultPackage."${system}";
};
overlays = final: prev: {
pamedia = packages.pamedia;
};
devShell = with pkgs;
mkShell {
buildInputs = [cargo rustc rustfmt pre-commit rustPackages.clippy cargo-edit cargo-feature cargo-outdated rust-analyzer] ++ buildInputs;
nativeBuildInputs = [libnotify] ++ nativeBuildInputs;
};
defaultApp = utils.lib.mkApp {
drv = self.defaultPackage."${system}";
};
overlays = final: prev: {
pamedia = defaultPackage;
};
devShell = with pkgs; mkShell {
buildInputs = [ cargo rustc rustfmt pre-commit rustPackages.clippy cargo-edit cargo-feature cargo-outdated ] ++ defaultPackage.buildInputs;
nativeBuildInputs = [ ] ++ defaultPackage.nativeBuildInputs;
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
});
});
}

3
rust-toolchain.toml Normal file
View file

@ -0,0 +1,3 @@
[toolchain]
channel = "stable"
components = [ "rustfmt", "clippy" ]

View file

@ -1,7 +0,0 @@
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
src = ./.;
}).shellNix