feat: simplify flake.nix, correct package derivation

This commit is contained in:
2025-05-25 00:56:17 +02:00
parent 03ae4c610e
commit 06fa652f96
3 changed files with 36 additions and 86 deletions

View File

@@ -1,61 +1,38 @@
{
description = "System information in JSON format for eww";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
rust-overlay,
}:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustVersion = (pkgs.rust-bin.fromRustupToolchainFile ./rustup-toolchain.toml);
rustPlatform = pkgs.makeRustPlatform {
cargo = rustVersion;
rustc = rustVersion;
};
appName = "pumo-system-info";
appRustBuild = rustPlatform.buildRustPackage {
pname = appName;
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
doCheck = true;
};
outputs = {
nixpkgs,
rust-overlay,
...
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux"];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor = nixpkgs.legacyPackages;
in {
packages = forAllSystems (system: {
default = pkgsFor.${system}.callPackage ./. {};
});
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
devShells = forAllSystems (
system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {inherit system overlays;};
rustVersion = pkgs.rust-bin.fromRustupToolchainFile ./rustup-toolchain.toml;
in
{
packages.pumoSystemInfo = appRustBuild;
formatter = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
defaultPackage = appRustBuild;
devShell =
with pkgs;
mkShell {
buildInputs = [
bacon
cargo
cargo-deny
cargo-msrv
cargo-tarpaulin
just
rustVersion
];
};
}
pkgs.mkShell {
buildInputs = with pkgs; [
bacon
cargo
rustVersion
];
}
);
};
}