feat: simplify flake.nix, correct package derivation

This commit is contained in:
Lucien Cartier-Tilet 2025-05-25 00:56:17 +02:00
parent 03ae4c610e
commit 06fa652f96
Signed by: phundrak
SSH Key Fingerprint: SHA256:CE0HPsbW3L2YiJETx1zYZ2muMptaAqTN2g3498KrMkc
3 changed files with 36 additions and 86 deletions

7
default.nix Normal file
View File

@ -0,0 +1,7 @@
{pkgs ? import <nixpkgs> {}}:
pkgs.rustPlatform.buildRustPackage {
pname = "pumo-system-information";
version = "0.1.0";
cargoLock.lockFile = ./Cargo.lock;
src = pkgs.lib.cleanSource ./.;
}

40
flake.lock generated
View File

@ -1,23 +1,5 @@
{ {
"nodes": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1747744144, "lastModified": 1747744144,
@ -36,7 +18,6 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
} }
@ -48,11 +29,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1747967795, "lastModified": 1748054080,
"narHash": "sha256-76s4jDRbQzxRO+5y8ilMp5V30qVgY9R6n8U7aOap8ig=", "narHash": "sha256-rwFiLLNCwkj9bqePtH1sMqzs1xmohE0Ojq249piMzF4=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "f1d5bfa8c692cacd798a3e1fb93d54c1b9ac701a", "rev": "2221d8d53c128beb69346fa3ab36da3f19bb1691",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -60,21 +41,6 @@
"repo": "rust-overlay", "repo": "rust-overlay",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

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