mirror of
https://github.com/vlinkz/nix-software-center.git
synced 2024-09-11 21:37:38 +03:00
More flake support
This commit is contained in:
parent
6dbd2726e4
commit
e3b80a820e
7
data/icons/selection-mode-symbolic.svg
Normal file
7
data/icons/selection-mode-symbolic.svg
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g fill="#2e3436">
|
||||||
|
<path d="m 9.492188 0.140625 c -0.851563 -0.1601562 -1.722657 -0.1796875 -2.574219 -0.0664062 c -1.703125 0.2343752 -3.328125 1.0078122 -4.601563 2.2929692 c -2.546875 2.566406 -3.050781 6.542968 -1.230468 9.664062 c 1.824218 3.125 5.527343 4.636719 9.015624 3.6875 c 3.492188 -0.953125 5.910157 -4.136719 5.894532 -7.753906 c -0.003906 -0.550782 -0.453125 -0.996094 -1.003906 -0.996094 c -0.550782 0.003906 -0.996094 0.453125 -0.996094 1.007812 c 0.011718 2.71875 -1.792969 5.097657 -4.417969 5.8125 c -2.625 0.714844 -5.394531 -0.414062 -6.761719 -2.765624 c -1.371094 -2.351563 -0.996094 -5.316407 0.917969 -7.246094 c 1.917969 -1.933594 4.878906 -2.335938 7.238281 -0.988282 c 0.480469 0.277344 1.09375 0.109376 1.367188 -0.371093 c 0.273437 -0.480469 0.105468 -1.089844 -0.375 -1.363281 c -0.785156 -0.449219 -1.621094 -0.753907 -2.472656 -0.914063 z m 0 0"/>
|
||||||
|
<path d="m 15.753906 3.660156 c 0.175782 -0.199218 0.261719 -0.460937 0.246094 -0.726562 c -0.019531 -0.265625 -0.140625 -0.511719 -0.339844 -0.6875 c -0.199218 -0.175782 -0.460937 -0.261719 -0.726562 -0.246094 c -0.265625 0.019531 -0.511719 0.140625 -0.6875 0.339844 l -6.296875 7.195312 l -2.242188 -2.242187 c -0.390625 -0.390625 -1.023437 -0.390625 -1.414062 0 c -0.1875 0.1875 -0.292969 0.441406 -0.292969 0.707031 s 0.105469 0.519531 0.292969 0.707031 l 3 3 c 0.195312 0.195313 0.464843 0.304688 0.742187 0.292969 c 0.273438 -0.007812 0.535156 -0.132812 0.71875 -0.339844 z m 0 0"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.6 KiB |
@ -82,40 +82,42 @@ fn main() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
SubCommands::Channel { rebuild: dorebuild, arguments } => {
|
SubCommands::Channel { rebuild: dorebuild, arguments } => {
|
||||||
match dorebuild {
|
match channel() {
|
||||||
true => match rebuild(arguments) {
|
Ok(_) => {
|
||||||
Ok(_) => (),
|
if dorebuild {
|
||||||
Err(err) => {
|
match rebuild(arguments) {
|
||||||
eprintln!("{}", err);
|
Ok(_) => (),
|
||||||
std::process::exit(1);
|
Err(err) => {
|
||||||
}
|
eprintln!("{}", err);
|
||||||
},
|
std::process::exit(1);
|
||||||
false => match channel() {
|
}
|
||||||
Ok(_) => (),
|
}
|
||||||
Err(err) => {
|
|
||||||
eprintln!("{}", err);
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Err(err) => {
|
||||||
|
eprintln!("{}", err);
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SubCommands::Flake { rebuild: dorebuild, flakepath, arguments } => {
|
SubCommands::Flake { rebuild: dorebuild, flakepath, arguments } => {
|
||||||
match dorebuild {
|
match flake(&flakepath) {
|
||||||
true => match rebuild(arguments) {
|
Ok(_) => {
|
||||||
Ok(_) => (),
|
if dorebuild {
|
||||||
Err(err) => {
|
match rebuild(arguments) {
|
||||||
eprintln!("{}", err);
|
Ok(_) => (),
|
||||||
std::process::exit(1);
|
Err(err) => {
|
||||||
|
eprintln!("{}", err);
|
||||||
|
std::process::exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false => match flake(&flakepath) {
|
Err(err) => {
|
||||||
Ok(_) => (),
|
eprintln!("{}", err);
|
||||||
Err(err) => {
|
std::process::exit(1);
|
||||||
eprintln!("{}", err);
|
}
|
||||||
std::process::exit(1);
|
}
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,7 +166,7 @@ fn channel() -> Result<(), Box<dyn Error>> {
|
|||||||
fn flake(path: &str) -> Result<(), Box<dyn Error>> {
|
fn flake(path: &str) -> Result<(), Box<dyn Error>> {
|
||||||
let mut cmd = Command::new("nix")
|
let mut cmd = Command::new("nix")
|
||||||
.arg("flake")
|
.arg("flake")
|
||||||
.arg("upgrade")
|
.arg("update")
|
||||||
.arg(path)
|
.arg(path)
|
||||||
.spawn()?;
|
.spawn()?;
|
||||||
let x = cmd.wait()?;
|
let x = cmd.wait()?;
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
use adw::gio;
|
use adw::gio;
|
||||||
use nix_software_center::ui::window::AppModel;
|
use nix_software_center::ui::window::AppModel;
|
||||||
use relm4::*;
|
use relm4::*;
|
||||||
|
use nix_software_center::config::PKGDATADIR;
|
||||||
fn main() {
|
fn main() {
|
||||||
pretty_env_logger::init();
|
pretty_env_logger::init();
|
||||||
let res = gio::Resource::load("@PKGDATA_DIR@".to_string() + "/resources.gresource").unwrap();
|
if let Ok(res) = gio::Resource::load(PKGDATADIR.to_string() + "/resources.gresource") {
|
||||||
gio::resources_register(&res);
|
gio::resources_register(&res);
|
||||||
|
}
|
||||||
let app = RelmApp::new("dev.vlinkz.NixSoftwareCenter");
|
let app = RelmApp::new("dev.vlinkz.NixSoftwareCenter");
|
||||||
let application = app.app.clone();
|
let application = app.app.clone();
|
||||||
app.run::<AppModel>(application);
|
app.run::<AppModel>(application);
|
||||||
|
@ -11,7 +11,9 @@ resources = gnome.compile_resources(
|
|||||||
'resources',
|
'resources',
|
||||||
'resources.gresource.xml',
|
'resources.gresource.xml',
|
||||||
gresource_bundle: true,
|
gresource_bundle: true,
|
||||||
source_dir: meson.current_build_dir()
|
source_dir: meson.current_build_dir(),
|
||||||
|
install: true,
|
||||||
|
install_dir: pkgdatadir,
|
||||||
)
|
)
|
||||||
|
|
||||||
config = configure_file(
|
config = configure_file(
|
||||||
|
@ -11,6 +11,8 @@ use std::{
|
|||||||
process::Command,
|
process::Command,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::ui::window::{SystemPkgs, UserPkgs};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
struct NewPackageBase {
|
struct NewPackageBase {
|
||||||
packages: HashMap<String, NewPackage>,
|
packages: HashMap<String, NewPackage>,
|
||||||
@ -21,11 +23,20 @@ struct NewPackage {
|
|||||||
version: IString,
|
version: IString,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn checkcache() -> Result<(), Box<dyn Error>> {
|
pub fn checkcache(syspkgs: SystemPkgs, userpkgs: UserPkgs) -> Result<(), Box<dyn Error>> {
|
||||||
// setuplegacypkgscache().unwrap();
|
match syspkgs {
|
||||||
// setupupdatecache().unwrap();
|
SystemPkgs::Legacy => {
|
||||||
// setupnewestver().unwrap();
|
setuplegacypkgscache().unwrap();
|
||||||
setupflakepkgscache()?;
|
setupupdatecache().unwrap();
|
||||||
|
setupnewestver().unwrap();
|
||||||
|
}
|
||||||
|
SystemPkgs::Flake => {
|
||||||
|
setupflakepkgscache()?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if userpkgs == UserPkgs::Profile {
|
||||||
|
setupprofilepkgscache()?;
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,13 +183,15 @@ fn setupflakepkgscache() -> Result<(), Box<dyn Error>> {
|
|||||||
if Path::new(format!("{}/chnver.txt", &cachedir).as_str()).exists() {
|
if Path::new(format!("{}/chnver.txt", &cachedir).as_str()).exists() {
|
||||||
fs::remove_file(format!("{}/chnver.txt", &cachedir).as_str())?;
|
fs::remove_file(format!("{}/chnver.txt", &cachedir).as_str())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let vout = Command::new("nixos-version")
|
let vout = Command::new("nixos-version").arg("--json").output()?;
|
||||||
.arg("--json")
|
|
||||||
.output()?;
|
|
||||||
|
|
||||||
let versiondata: Value = serde_json::from_str(&String::from_utf8_lossy(&vout.stdout))?;
|
let versiondata: Value = serde_json::from_str(&String::from_utf8_lossy(&vout.stdout))?;
|
||||||
let rev = versiondata.get("nixpkgsRevision").unwrap().as_str().unwrap();
|
let rev = versiondata
|
||||||
|
.get("nixpkgsRevision")
|
||||||
|
.unwrap()
|
||||||
|
.as_str()
|
||||||
|
.unwrap();
|
||||||
let dlver = versiondata.get("nixosVersion").unwrap().as_str().unwrap();
|
let dlver = versiondata.get("nixosVersion").unwrap().as_str().unwrap();
|
||||||
|
|
||||||
let mut relver = dlver.split('.').collect::<Vec<&str>>()[0..2].join(".");
|
let mut relver = dlver.split('.').collect::<Vec<&str>>()[0..2].join(".");
|
||||||
@ -214,23 +227,13 @@ fn setupflakepkgscache() -> Result<(), Box<dyn Error>> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn writeprofilepkgs(outfile: &str) -> Result<(), Box<dyn Error>> {
|
|
||||||
let output = Command::new("nix")
|
|
||||||
.arg("search")
|
|
||||||
.arg("nixpkgs")
|
|
||||||
.arg("--json")
|
|
||||||
.output()?;
|
|
||||||
let mut file = fs::File::create(outfile)?;
|
|
||||||
file.write_all(&output.stdout)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
if !Path::new(&format!("{}/flakever.txt", &cachedir)).exists() {
|
if !Path::new(&format!("{}/flakever.txt", &cachedir)).exists() {
|
||||||
let mut sysver = fs::File::create(format!("{}/flakever.txt", &cachedir))?;
|
let mut sysver = fs::File::create(format!("{}/flakever.txt", &cachedir))?;
|
||||||
sysver.write_all(rev.as_bytes())?;
|
sysver.write_all(rev.as_bytes())?;
|
||||||
writesyspkgs(&format!("{}/syspackages.json", &cachedir))?;
|
writesyspkgs(&format!("{}/syspackages.json", &cachedir))?;
|
||||||
} else {
|
} else {
|
||||||
let oldver = fs::read_to_string(&Path::new(format!("{}/flakever.txt", &cachedir).as_str()))?;
|
let oldver =
|
||||||
|
fs::read_to_string(&Path::new(format!("{}/flakever.txt", &cachedir).as_str()))?;
|
||||||
let sysver = rev;
|
let sysver = rev;
|
||||||
if oldver != sysver {
|
if oldver != sysver {
|
||||||
println!("OLD FLAKEVER: {}, != NEW: {}", oldver, sysver);
|
println!("OLD FLAKEVER: {}, != NEW: {}", oldver, sysver);
|
||||||
@ -244,41 +247,6 @@ fn setupflakepkgscache() -> Result<(), Box<dyn Error>> {
|
|||||||
writesyspkgs(&format!("{}/syspackages.json", &cachedir))?;
|
writesyspkgs(&format!("{}/syspackages.json", &cachedir))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Check nix profile nixpkgs version
|
|
||||||
let client = reqwest::blocking::Client::builder()
|
|
||||||
.user_agent("request")
|
|
||||||
.build()?;
|
|
||||||
let response = client.get("https://api.github.com/repos/NixOS/nixpkgs/commits/nixpkgs-unstable").send()?;
|
|
||||||
if response.status().is_success() {
|
|
||||||
let profilerevjson = response.text()?;
|
|
||||||
let profilerevdata: Value = serde_json::from_str(&profilerevjson)?;
|
|
||||||
let profilerev = profilerevdata.get("sha").unwrap().as_str().unwrap();
|
|
||||||
println!("PROFILE REV {}", profilerev);
|
|
||||||
|
|
||||||
if !Path::new(&format!("{}/profilever.txt", &cachedir)).exists() {
|
|
||||||
let mut sysver = fs::File::create(format!("{}/profilever.txt", &cachedir))?;
|
|
||||||
sysver.write_all(profilerev.as_bytes())?;
|
|
||||||
writeprofilepkgs(&format!("{}/profilepackages.json", &cachedir))?;
|
|
||||||
} else {
|
|
||||||
let oldver = fs::read_to_string(&Path::new(format!("{}/profilever.txt", &cachedir).as_str()))?;
|
|
||||||
let sysver = profilerev;
|
|
||||||
if oldver != sysver {
|
|
||||||
println!("OLD PROFILEVER: {}, != NEW: {}", oldver, sysver);
|
|
||||||
let mut sysver = fs::File::create(format!("{}/profilever.txt", &cachedir))?;
|
|
||||||
sysver.write_all(profilerev.as_bytes())?;
|
|
||||||
writeprofilepkgs(&format!("{}/profilepackages.json", &cachedir))?;
|
|
||||||
} else {
|
|
||||||
println!("PROFILEVER UP TO DATE");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !Path::new(&format!("{}/profilepackages.json", &cachedir)).exists() {
|
|
||||||
writeprofilepkgs(&format!("{}/profilepackages.json", &cachedir))?;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Check newest nixpkgs version
|
// Check newest nixpkgs version
|
||||||
let revurl = format!("https://channels.nixos.org/nixos-{}/git-revision", relver);
|
let revurl = format!("https://channels.nixos.org/nixos-{}/git-revision", relver);
|
||||||
let response = reqwest::blocking::get(revurl)?;
|
let response = reqwest::blocking::get(revurl)?;
|
||||||
@ -295,55 +263,81 @@ fn setupflakepkgscache() -> Result<(), Box<dyn Error>> {
|
|||||||
dl = true;
|
dl = true;
|
||||||
}
|
}
|
||||||
let mut sysver = fs::File::create(format!("{}/newver.txt", &cachedir))?;
|
let mut sysver = fs::File::create(format!("{}/newver.txt", &cachedir))?;
|
||||||
sysver.write_all(newrev.as_bytes())?;
|
sysver.write_all(newrev.as_bytes())?;
|
||||||
// if !Path::new(&format!("{}/newver.txt", &cachedir)).exists() {
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// if Path::new(format!("{}/chnver.txt", &cachedir).as_str()).exists()
|
|
||||||
// && fs::read_to_string(&Path::new(format!("{}/chnver.txt", &cachedir).as_str()))? == dlver
|
|
||||||
// && Path::new(format!("{}/packages.json", &cachedir).as_str()).exists()
|
|
||||||
// {
|
|
||||||
// return Ok(());
|
|
||||||
// } else {
|
|
||||||
// let oldver = fs::read_to_string(&Path::new(format!("{}/chnver.txt", &cachedir).as_str()))?;
|
|
||||||
// let sysver = &dlver;
|
|
||||||
// // Change to debug msg
|
|
||||||
// println!("OLD: {}, != NEW: {}", oldver, sysver);
|
|
||||||
// }
|
|
||||||
// if Path::new(format!("{}/chnver.txt", &cachedir).as_str()).exists() {
|
|
||||||
// fs::remove_file(format!("{}/chnver.txt", &cachedir).as_str())?;
|
|
||||||
// }
|
|
||||||
// let mut sysver = fs::File::create(format!("{}/chnver.txt", &cachedir))?;
|
|
||||||
// sysver.write_all(dlver.as_bytes())?;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let outfile = format!("{}/packages.json", &cachedir);
|
let outfile = format!("{}/packages.json", &cachedir);
|
||||||
if dl {
|
if dl {
|
||||||
dlfile(&url, &outfile)?;
|
dlfile(&url, &outfile)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn setupprofilepkgscache() -> Result<(), Box<dyn Error>> {
|
||||||
|
let cachedir = format!("{}/.cache/nix-software-center", env::var("HOME")?);
|
||||||
|
fn writeprofilepkgs(outfile: &str) -> Result<(), Box<dyn Error>> {
|
||||||
|
let output = Command::new("nix")
|
||||||
|
.arg("search")
|
||||||
|
.arg("nixpkgs")
|
||||||
|
.arg("--json")
|
||||||
|
.output()?;
|
||||||
|
let mut file = fs::File::create(outfile)?;
|
||||||
|
file.write_all(&output.stdout)?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
// Check nix profile nixpkgs version
|
||||||
|
let client = reqwest::blocking::Client::builder()
|
||||||
|
.user_agent("request")
|
||||||
|
.build()?;
|
||||||
|
let response = client
|
||||||
|
.get("https://api.github.com/repos/NixOS/nixpkgs/commits/nixpkgs-unstable")
|
||||||
|
.send()?;
|
||||||
|
if response.status().is_success() {
|
||||||
|
let profilerevjson = response.text()?;
|
||||||
|
let profilerevdata: Value = serde_json::from_str(&profilerevjson)?;
|
||||||
|
let profilerev = profilerevdata.get("sha").unwrap().as_str().unwrap();
|
||||||
|
println!("PROFILE REV {}", profilerev);
|
||||||
|
|
||||||
|
if !Path::new(&format!("{}/profilever.txt", &cachedir)).exists() {
|
||||||
|
let mut sysver = fs::File::create(format!("{}/profilever.txt", &cachedir))?;
|
||||||
|
sysver.write_all(profilerev.as_bytes())?;
|
||||||
|
writeprofilepkgs(&format!("{}/profilepackages.json", &cachedir))?;
|
||||||
|
} else {
|
||||||
|
let oldver =
|
||||||
|
fs::read_to_string(&Path::new(format!("{}/profilever.txt", &cachedir).as_str()))?;
|
||||||
|
let sysver = profilerev;
|
||||||
|
if oldver != sysver {
|
||||||
|
println!("OLD PROFILEVER: {}, != NEW: {}", oldver, sysver);
|
||||||
|
let mut sysver = fs::File::create(format!("{}/profilever.txt", &cachedir))?;
|
||||||
|
sysver.write_all(profilerev.as_bytes())?;
|
||||||
|
writeprofilepkgs(&format!("{}/profilepackages.json", &cachedir))?;
|
||||||
|
} else {
|
||||||
|
println!("PROFILEVER UP TO DATE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !Path::new(&format!("{}/profilepackages.json", &cachedir)).exists() {
|
||||||
|
writeprofilepkgs(&format!("{}/profilepackages.json", &cachedir))?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
// nix-instantiate --eval -E '(builtins.getFlake "/home/victor/nix").inputs.nixpkgs.outPath'
|
// nix-instantiate --eval -E '(builtins.getFlake "/home/victor/nix").inputs.nixpkgs.outPath'
|
||||||
// nix-env -f /nix/store/sjmq1gphj1arbzf4aqqnygd9pf4hkfkf-source -qa --json > packages.json
|
// nix-env -f /nix/store/sjmq1gphj1arbzf4aqqnygd9pf4hkfkf-source -qa --json > packages.json
|
||||||
fn setupupdatecache() -> Result<(), Box<dyn Error>> {
|
fn setupupdatecache() -> Result<(), Box<dyn Error>> {
|
||||||
let vout = Command::new("nix-instantiate")
|
let vout = Command::new("nix-instantiate")
|
||||||
.arg("-I")
|
.arg("-I")
|
||||||
.arg("nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos")
|
.arg("nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos")
|
||||||
.arg("<nixpkgs/lib>")
|
.arg("<nixpkgs/lib>")
|
||||||
.arg("-A")
|
.arg("-A")
|
||||||
.arg("version")
|
.arg("version")
|
||||||
.arg("--eval")
|
.arg("--eval")
|
||||||
.arg("--json")
|
.arg("--json")
|
||||||
.output()?;
|
.output()?;
|
||||||
|
|
||||||
let dlver = String::from_utf8_lossy(&vout.stdout)
|
let dlver = String::from_utf8_lossy(&vout.stdout)
|
||||||
.to_string()
|
.to_string()
|
||||||
.replace('"', "");
|
.replace('"', "");
|
||||||
// let dlver = fs::read_to_string("/run/current-system/nixos-version")?;
|
// let dlver = fs::read_to_string("/run/current-system/nixos-version")?;
|
||||||
|
|
||||||
let mut relver = dlver.split('.').collect::<Vec<&str>>().join(".")[0..5].to_string();
|
let mut relver = dlver.split('.').collect::<Vec<&str>>().join(".")[0..5].to_string();
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
<gresources>
|
<gresources>
|
||||||
<gresource prefix="/dev/vlinkz/NixSoftwareCenter/">
|
<gresource prefix="/dev/vlinkz/NixSoftwareCenter/">
|
||||||
<file preprocess="xml-stripblanks" alias="icons/scalable/emblems/compass-symbolic.svg">../data/icons/compass-symbolic.svg</file>
|
<file preprocess="xml-stripblanks" alias="icons/scalable/emblems/compass-symbolic.svg">../data/icons/compass-symbolic.svg</file>
|
||||||
|
<file preprocess="xml-stripblanks" alias="icons/scalable/emblems/selection-mode-symbolic.svg">../data/icons/selection-mode-symbolic.svg</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
@ -110,7 +110,10 @@ impl Worker for UpdateAsyncHandler {
|
|||||||
let syspkgs = self.syspkgs.clone();
|
let syspkgs = self.syspkgs.clone();
|
||||||
relm4::spawn(async move {
|
relm4::spawn(async move {
|
||||||
println!("STARTED");
|
println!("STARTED");
|
||||||
let result = runcmd(NscCmd::Rebuild, systenconfig, flakeargs, syspkgs).await;
|
let result = match syspkgs {
|
||||||
|
SystemPkgs::Legacy => runcmd(NscCmd::Rebuild, systenconfig, flakeargs, syspkgs).await,
|
||||||
|
SystemPkgs::Flake => runcmd(NscCmd::All, systenconfig, flakeargs, syspkgs).await,
|
||||||
|
};
|
||||||
match result {
|
match result {
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
println!("REBUILD DONE");
|
println!("REBUILD DONE");
|
||||||
@ -150,24 +153,14 @@ impl Worker for UpdateAsyncHandler {
|
|||||||
let userpkgs = self.userpkgs.clone();
|
let userpkgs = self.userpkgs.clone();
|
||||||
relm4::spawn(async move {
|
relm4::spawn(async move {
|
||||||
println!("STARTED");
|
println!("STARTED");
|
||||||
// if syspkgs == SystemPkgs::Flake {
|
|
||||||
// if let Some(fa) = &flakeargs {
|
|
||||||
// match updateflake(fa.split('#').collect::<Vec<_>>().first().unwrap().to_string()).await {
|
|
||||||
// Ok(true) => {
|
|
||||||
// println!("FLAKE DONE");
|
|
||||||
// }
|
|
||||||
// _ => {
|
|
||||||
// println!("FLAKE FAILED");
|
|
||||||
// sender.output(UpdatePageMsg::FailedWorking);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
let result = runcmd(NscCmd::All, systemconfig, flakeargs, syspkgs).await;
|
let result = runcmd(NscCmd::All, systemconfig, flakeargs, syspkgs).await;
|
||||||
match result {
|
match result {
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
println!("ALL pkexec DONE");
|
println!("ALL pkexec DONE");
|
||||||
match updateenv().await {
|
match match userpkgs {
|
||||||
|
UserPkgs::Env => updateenv().await,
|
||||||
|
UserPkgs::Profile => updateprofile().await,
|
||||||
|
} {
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
println!("ALL DONE");
|
println!("ALL DONE");
|
||||||
sender.output(UpdatePageMsg::DoneWorking);
|
sender.output(UpdatePageMsg::DoneWorking);
|
||||||
@ -251,7 +244,7 @@ async fn runcmd(
|
|||||||
.args(&rebuildargs)
|
.args(&rebuildargs)
|
||||||
.stderr(Stdio::piped())
|
.stderr(Stdio::piped())
|
||||||
.spawn()?,
|
.spawn()?,
|
||||||
SystemPkgs::Flake => tokio::process::Command::new("pkexec")
|
SystemPkgs::Flake => { println!("ALL FLAKE UPDATE!!!!!!!!!!!!!!!!!!!!!!"); tokio::process::Command::new("pkexec")
|
||||||
.arg(&exe)
|
.arg(&exe)
|
||||||
.arg("flake")
|
.arg("flake")
|
||||||
.arg("--rebuild")
|
.arg("--rebuild")
|
||||||
@ -261,7 +254,7 @@ async fn runcmd(
|
|||||||
.arg("switch")
|
.arg("switch")
|
||||||
.args(&rebuildargs)
|
.args(&rebuildargs)
|
||||||
.stderr(Stdio::piped())
|
.stderr(Stdio::piped())
|
||||||
.spawn()?,
|
.spawn()? },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -489,6 +489,8 @@ impl Component for AppModel {
|
|||||||
searchvs.set_name(Some("search"));
|
searchvs.set_name(Some("search"));
|
||||||
updatesvs.set_name(Some("updates"));
|
updatesvs.set_name(Some("updates"));
|
||||||
frontvs.set_icon_name(Some("compass"));
|
frontvs.set_icon_name(Some("compass"));
|
||||||
|
installedvs.set_icon_name(Some("selection-mode"));
|
||||||
|
updatesvs.set_icon_name(Some("emblem-synchronizing-symbolic"));
|
||||||
ComponentParts { model, widgets }
|
ComponentParts { model, widgets }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +41,10 @@ impl Worker for WindowAsyncHandler {
|
|||||||
match msg {
|
match msg {
|
||||||
WindowAsyncHandlerMsg::CheckCache(cr, syspkgs, userpkgs) => {
|
WindowAsyncHandlerMsg::CheckCache(cr, syspkgs, userpkgs) => {
|
||||||
println!("CHECK CACHE");
|
println!("CHECK CACHE");
|
||||||
|
let syspkgs2 = syspkgs.clone();
|
||||||
|
let userpkgs2 = userpkgs.clone();
|
||||||
relm4::spawn(async move {
|
relm4::spawn(async move {
|
||||||
match checkcache() {
|
match checkcache(syspkgs2, userpkgs2) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
println!("FAILED TO CHECK CACHE");
|
println!("FAILED TO CHECK CACHE");
|
||||||
|
Loading…
Reference in New Issue
Block a user