1
1
mirror of https://github.com/divnix/digga.git synced 2024-11-23 03:05:59 +03:00

devos: devshell: add required pkgs to scope explicitly

the `with pkgs` statement in `commands` muddies the origin of the
variables used within:

- editors are unable to provide helpful advice about undefined variables
  because `with pkgs` acts as a blanket "anything is possible" signifier
- at a cursory glance, it may not be immediately clear that `system` is
  coming from `pkgs.system`
- `lib` is coming from `pkgs.lib`, but we can use the `lib` module arg.
- some pkgs within `commands` are still referenced with
  `pkgs.<package-name>` unnecessarily
This commit is contained in:
Chris Montgomery 2022-04-04 09:20:01 -04:00
parent b8d1c7d849
commit 68ade1816c
No known key found for this signature in database
GPG Key ID: A6BA9BA2FDA7C997
2 changed files with 17 additions and 6 deletions

View File

@ -4,7 +4,7 @@
let
pkgs = inputs.nixpkgs.legacyPackages.${system};
unstablePkgs = inputs.nixpkgs-unstable.legacyPackages.${system};
devshell = import inputs.devshell { inherit pkgs system; };
devshell = import inputs.devshell { inherit system; };
nixBin = "${unstablePkgs.nix}/bin/nix";
withCategory = category: attrset: attrset // { inherit category; };

View File

@ -1,6 +1,17 @@
{ pkgs, extraModulesPath, inputs, ... }:
{ pkgs, extraModulesPath, inputs, lib, ... }:
let
inherit (pkgs)
agenix
cachix
editorconfig-checker
mdbook
nixUnstable
nixpkgs-fmt
nvfetcher-bin
system
;
hooks = import ./hooks;
pkgWithCategory = category: package: { inherit package category; };
@ -30,14 +41,14 @@ in
unset _PATH
'');
commands = with pkgs; [
commands = [
(devos nixUnstable)
(devos agenix)
{
category = "devos";
name = pkgs.nvfetcher-bin.pname;
help = pkgs.nvfetcher-bin.meta.description;
command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@";
name = nvfetcher-bin.pname;
help = nvfetcher-bin.meta.description;
command = "cd $PRJ_ROOT/pkgs; ${nvfetcher-bin}/bin/nvfetcher -c ./sources.toml $@";
}
(linter nixpkgs-fmt)
(linter editorconfig-checker)