about summary refs log tree commit diff
path: root/pkgs/profpatsch/nman/nman.rs
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-11 13:27:18 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-02-11 13:29:38 +0100
commit5bd756eaf27882820cb59e0ecf9c305f08b3b3e3 (patch)
tree7c9a2be8c947b6fb4ae3e144a0cf8de3c61b0efc /pkgs/profpatsch/nman/nman.rs
parent249ebd12a60a8828f79af0a36b1e049afac8b4d0 (diff)
modules/user/sternenseemann/sway: fix startup by enabling opengl
sway needs opengl driver's to be enabled and loadable in order to start.
I previously didn't notice this oversight as I still had them loaded and
did not reboot after the rebuild.
Diffstat (limited to 'pkgs/profpatsch/nman/nman.rs')
-rw-r--r--pkgs/profpatsch/nman/nman.rs34
1 files changed, 34 insertions, 0 deletions
diff --git a/pkgs/profpatsch/nman/nman.rs b/pkgs/profpatsch/nman/nman.rs
new file mode 100644
index 00000000..16bd6271
--- /dev/null
+++ b/pkgs/profpatsch/nman/nman.rs
@@ -0,0 +1,34 @@
+#[derive(Debug)]
+enum DrvOutput<'a> {
+    Out,
+    Bin,
+    Lib,
+    Man,
+    Dev,
+    DevDoc,
+    DevMan,
+    Other(&'a [u8]),
+}
+
+#[derive(Debug)]
+struct DrvWithOutput<'a> {
+    drv_path: &'a [u8],
+    output: DrvOutput<'a>,
+}
+
+fn parse_drv_path<'a>(path: &'a [u8]) -> Option<DrvWithOutput<'a>> {
+    let mut split = path.split(|c| char::from(c.to_owned()) == '!');
+    split.next().map(|p| DrvWithOutput {
+        drv_path: p,
+        output: split.next().map(|s| DrvOutput::Other(s))
+                            .unwrap_or(DrvOutput::Out),
+    }).and_then(|parsed| match split.next() {
+        Some(_) => None,
+        None => Some(parsed),
+    })
+}
+
+fn main() -> std::io::Result<()> {
+    println!("{:?}", parse_drv_path(b"/nix/store/58i9psln992xjwk8ig1v3l3a4p9sslnp-lowdown-0.7.9.drv"));
+    Ok(())
+}