summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock12
-rw-r--r--flake.nix19
-rw-r--r--src/nix.rs14
3 files changed, 15 insertions, 30 deletions
diff --git a/flake.lock b/flake.lock
index d1142e0..f1d1f08 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
"nodes": {
"nix-filter": {
"locked": {
- "lastModified": 1710156097,
- "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=",
+ "lastModified": 1730207686,
+ "narHash": "sha256-SCHiL+1f7q9TAnxpasriP6fMarWE5H43t25F5/9e28I=",
"owner": "numtide",
"repo": "nix-filter",
- "rev": "3342559a24e85fc164b295c3444e8a139924675b",
+ "rev": "776e68c1d014c3adde193a18db9d738458cd2ba4",
"type": "github"
},
"original": {
@@ -17,11 +17,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1726142289,
- "narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=",
+ "lastModified": 1730272153,
+ "narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "280db3decab4cbeb22a4599bd472229ab74d25e1",
+ "rev": "2d2a9ddbe3f2c00747398f3dc9b05f7f2ebb0f53",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index 429b61c..040f5a3 100644
--- a/flake.nix
+++ b/flake.nix
@@ -28,7 +28,7 @@
];
forAllSystems = lib.genAttrs allSystems;
- nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
+ nixpkgsFor = nixpkgs.legacyPackages;
in
{
checks = forAllSystems (
@@ -133,15 +133,10 @@
let
pkgs = nixpkgsFor.${system};
nixForecastPackages = lib.makeScope pkgs.newScope (final: self.overlays.default final pkgs);
-
- isCompatible = lib.meta.availableOn pkgs.stdenv.hostPlatform;
- filteredPackages = lib.filterAttrs (
- _: deriv: isCompatible deriv && lib.isDerivation deriv
- ) nixForecastPackages;
in
- filteredPackages
- // {
- default = filteredPackages.nix-forecast or pkgs.emptyFile;
+ {
+ inherit (nixForecastPackages) nix-forecast;
+ default = self.packages.${system}.nix-forecast;
}
);
@@ -163,8 +158,6 @@
pname = "nix-forecast";
inherit (passthru.cargoTOML.package) version;
- cargoLock.lockFile = ./Cargo.lock;
-
src = nix-filter {
root = self;
include = [
@@ -175,12 +168,14 @@
];
};
+ cargoLock.lockFile = ./Cargo.lock;
+
nativeBuildInputs = [
installShellFiles
makeBinaryWrapper
];
- buildInputs = lib.optionals stdenv.isDarwin [
+ buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.SystemConfiguration
darwin.libiconv
diff --git a/src/nix.rs b/src/nix.rs
index a2268a2..165fabf 100644
--- a/src/nix.rs
+++ b/src/nix.rs
@@ -8,13 +8,6 @@ use serde::{Deserialize, Serialize};
use serde_json::Value;
use tracing::{event, instrument, Level};
-/// JSON output of `nix path-info`
-#[derive(Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-struct PathInfo {
- path: String,
-}
-
/// JSON output of `nix build`
#[derive(Clone, Debug, Eq, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
@@ -94,11 +87,8 @@ pub fn closure_paths(store_path: &str) -> Result<Vec<String>> {
.output()?;
if output.status.success() {
- let path_infos: Vec<PathInfo> = serde_json::from_slice(&output.stdout)?;
- let paths = path_infos
- .into_iter()
- .map(|path_info| path_info.path)
- .collect();
+ let path_infos: HashMap<String, Value> = serde_json::from_slice(&output.stdout)?;
+ let paths = path_infos.into_keys().collect();
Ok(paths)
} else {
let code = output.status.code().unwrap_or(1);