aboutsummaryrefslogtreecommitdiff
path: root/main.rs
diff options
context:
space:
mode:
authoraxtloss <3alouchi2006@gmail.com>2021-10-05 17:41:40 +0200
committeraxtloss <3alouchi2006@gmail.com>2021-10-05 17:41:40 +0200
commitf9d38e687a234de36074590f42fca2e7d442b4a7 (patch)
tree86308f53e3fbc3603ea18f0d1a200190c5dcf8c8 /main.rs
parent11dacd2b73ccfcf0aaa9dc029fb0a8851761b909 (diff)
downloadnix-tool-f9d38e687a234de36074590f42fca2e7d442b4a7.tar.gz
nix-tool-f9d38e687a234de36074590f42fca2e7d442b4a7.tar.bz2
add all the files
Diffstat (limited to 'main.rs')
-rw-r--r--main.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.rs b/main.rs
new file mode 100644
index 0000000..f9e1927
--- /dev/null
+++ b/main.rs
@@ -0,0 +1,7 @@
+use std::io::{Read, Write};
+fn main() -> Result<(), Box<(dyn std::error::Error + 'static)>> {
+ let args: std::vec::Vec<String> = std::env::args().collect();
+ let mut buffer = String::new();
+ std::io::stdin().read_to_string(&mut buffer)?;
+ write!(std::fs::File::create("newConfiguration.nix")?, "{}", format!("{}environment.systemPackages = with pkgs;\n [\n{}\n{}",std::fs::read_to_string(&args[1]).expect("cant open new configuration").split("environment.systemPackages = with pkgs;\n [").collect::<Vec<&str>>()[0],&buffer.replace(" ", "\n"),std::fs::read_to_string(&args[1]).expect("cant open new configuration").split("environment.systemPackages = with pkgs;\n [").collect::<Vec<&str>>()[1])).expect("cant write into new configuration");
+ Ok(()) } \ No newline at end of file