File tree Expand file tree Collapse file tree 2 files changed +13
-13
lines changed
nix-script-directives/src Expand file tree Collapse file tree 2 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -163,16 +163,14 @@ impl Directives {
163
163
}
164
164
}
165
165
166
- pub fn maybe_override_nixpkgs_config ( & mut self , new : Option < & Expr > ) -> Result < ( ) > {
167
- if let Some ( expr) = new {
168
- match expr. kind ( ) {
169
- SyntaxKind :: NODE_ATTR_SET => self . nixpkgs_config = Some ( expr. clone ( ) ) ,
170
- other => anyhow:: bail!(
171
- "I expected the nixpkgs config to be a Nix record, but it was a `{:?}`" ,
172
- other,
173
- ) ,
174
- } ;
175
- }
166
+ pub fn override_nixpkgs_config ( & mut self , expr : & Expr ) -> Result < ( ) > {
167
+ match expr. kind ( ) {
168
+ SyntaxKind :: NODE_ATTR_SET => self . nixpkgs_config = Some ( expr. clone ( ) ) ,
169
+ other => anyhow:: bail!(
170
+ "Nixpkgs config was no Nix attribute set, but a `{:?}`" ,
171
+ other,
172
+ ) ,
173
+ } ;
176
174
177
175
Ok ( ( ) )
178
176
}
Original file line number Diff line number Diff line change @@ -184,9 +184,11 @@ impl Opts {
184
184
. merge_runtime_inputs ( & self . runtime_inputs )
185
185
. context ( "could not add runtime inputs provided on the command line" ) ?;
186
186
directives. merge_runtime_files ( & self . runtime_files ) ;
187
- directives
188
- . maybe_override_nixpkgs_config ( self . nixpkgs_config . as_ref ( ) )
189
- . context ( "could not set nixpkgs config provided on the command line" ) ?;
187
+ if let Some ( expr) = & self . nixpkgs_config {
188
+ directives
189
+ . override_nixpkgs_config ( expr)
190
+ . context ( "could not set nixpkgs config provided on the command line" ) ?;
191
+ }
190
192
191
193
// Second place we might bail early: if we're requesting a shell instead
192
194
// of building and running the script.
You can’t perform that action at this time.
0 commit comments