From 68b18356174ef3ec23dd98580032119616947f29 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Mon, 30 Mar 2026 09:54:45 +0100 Subject: [PATCH] feat: unfree flag --- src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 58b5a1e..70ac147 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,6 +12,10 @@ use runix::{ #[derive(Parser, Debug)] #[command(version, about)] struct Args { + /// Enables unfree packages, if not already allowed by the local Nix config + #[arg(short = 'u', long, required = false)] + allow_unfree: bool, + /// List of packages to include in the shell. /// /// to implicitly use nixpkgs @@ -25,16 +29,20 @@ fn preprocess(s: &str) -> Result { Ok(Installable::from(if s.contains('#') { s.to_owned() } else { - format!("nixpkgs#{}", s) + format!("nixpkgs#{s}") })) } #[tokio::main] async fn main() -> Result<(), runix::default::NixCommandLineRunError> { let cli = Args::parse(); + std::env::set_var("NIXPKGS_ALLOW_UNFREE", "1"); + Shell { flake: FlakeArgs::default(), - eval: EvaluationArgs::default(), + eval: EvaluationArgs { + impure: cli.allow_unfree.into(), + }, source: SourceArgs::default(), installables: InstallablesArgs::from(cli.pkgs), }