mirror of
https://github.com/snowfallorg/nix-software-center.git
synced 2024-09-11 21:27:09 +03:00
Fix profile package listing
This commit is contained in:
parent
8c9b1da67a
commit
8a6810fe08
@ -64,7 +64,7 @@
|
||||
openssl
|
||||
pandoc
|
||||
pango
|
||||
pkgconfig
|
||||
pkg-config
|
||||
polkit
|
||||
wrapGAppsHook4
|
||||
nixos-appstream-data
|
||||
|
@ -158,6 +158,11 @@ pub struct AppScreenshotImage {
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct FlakePkgs {
|
||||
packages: HashMap<String, FlakeJson>
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
struct FlakeJson {
|
||||
pname: IString,
|
||||
@ -236,7 +241,7 @@ pub fn readprofilepkgs() -> Result<HashMap<String, String>, Box<dyn Error + Sen
|
||||
}
|
||||
let file = File::open(cachefile)?;
|
||||
let reader = BufReader::new(file);
|
||||
let profilepkgs: HashMap<String, FlakeJson> = simd_json::serde::from_reader(reader)?;
|
||||
let profilepkgs = profilepkgs.into_iter().filter_map(|(k, v)| if let Some(pkg) = k.strip_prefix("legacyPackages.x86_64-linux.") { Some((pkg.to_string(), v.version.to_string())) } else { None }).collect::<HashMap<_, _>>();
|
||||
let profilepkgs: FlakePkgs = simd_json::serde::from_reader(reader)?;
|
||||
let profilepkgs = profilepkgs.packages.into_iter().map(|(pkg, v)| (pkg.to_string(), v.version.to_string())).collect::<HashMap<_, _>>();
|
||||
Ok(profilepkgs)
|
||||
}
|
@ -957,7 +957,7 @@ impl Component for AppModel {
|
||||
.arg("show-derivation")
|
||||
.arg(&storepath)
|
||||
.output()?;
|
||||
let data: Value = serde_json::from_str(&String::from_utf8_lossy(&output.stdout))?;
|
||||
if let Ok(data) = serde_json::from_str::<Value>(&String::from_utf8_lossy(&output.stdout)) {
|
||||
if let Some(version) = data.as_object().unwrap().values().next().unwrap()["env"].get("version") {
|
||||
let version = version.as_str().unwrap().to_string();
|
||||
pcurrpkgs.insert(
|
||||
@ -970,7 +970,7 @@ impl Component for AppModel {
|
||||
String::default(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user