Improve flake (#9)

This commit is contained in:
diniamo
2025-06-07 05:08:42 +02:00
committed by GitHub
parent 1aef7d8d57
commit c4fe0bea1d
3 changed files with 44 additions and 95 deletions

65
flake.lock generated
View File

@@ -1,23 +1,5 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1743315132,
@@ -34,59 +16,24 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1736320768,
"narHash": "sha256-nIYdTAiKIGnFNugbomgBJR+Xv5F1ZQU+HfaBqJKroC0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4bc9c909d9ac828a039f288cf872d16d38185db8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1743388531,
"narHash": "sha256-OBcNE+2/TD1AMgq8HKMotSQF8ZPJEFGZdRoBJ7t/HIc=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "011de3c895927300651d9c2cb8e062adf17aa665",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
"systems": "systems"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"repo": "default-linux",
"type": "github"
}
}

View File

@@ -1,46 +1,32 @@
{
description = "Simple TUI audio mixer for PipeWire";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
systems.url = "github:nix-systems/default-linux";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
rust = pkgs.rust-bin.stable.latest.default;
nativeBuildInputs = with pkgs; [
rust
outputs = { self, nixpkgs, systems, ... }: let
eachSystem = callback: nixpkgs.lib.genAttrs (import systems) (system: callback nixpkgs.legacyPackages.${system});
in {
devShells = eachSystem (pkgs: {
default = with pkgs; mkShell {
packages = [
rustc
cargo
pkg-config
rustPlatform.bindgenHook
];
buildInputs = with pkgs; [
pipewire
];
in
{
devShells.default = pkgs.mkShell {
inherit nativeBuildInputs;
inherit buildInputs;
};
};
});
packages.default = let
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in pkgs.rustPlatform.buildRustPackage rec {
inherit nativeBuildInputs;
inherit buildInputs;
pname = cargoToml.package.name;
version = cargoToml.package.version;
src = self;
cargoLock.lockFile = ./Cargo.lock;
};
}
);
packages = eachSystem (pkgs: let
package = pkgs.callPackage ./package.nix {};
in {
default = package;
wiremix = package;
});
};
}

16
package.nix Normal file
View File

@@ -0,0 +1,16 @@
{rustPlatform, lib, pkg-config, pipewire}: let
cargoPackage = (lib.importTOML ./Cargo.toml).package;
in rustPlatform.buildRustPackage {
pname = cargoPackage.name;
version = cargoPackage.version;
src = lib.cleanSource ./.;
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
];
buildInputs = [ pipewire ];
cargoLock.lockFile = ./Cargo.lock;
}