pub-solar-os/shell/devos.nix
teutat3s c63c3da345
nix: set nix.package to force overlays/
overrides.nix to apply

use nix as default version alias in devshell as well
2022-08-24 00:55:57 +02:00

69 lines
1.7 KiB
Nix

{ pkgs, extraModulesPath, inputs, lib, ... }:
let
inherit (pkgs)
agenix
cachix
editorconfig-checker
mdbook
nix
nixpkgs-fmt
nvfetcher
;
hooks = import ./hooks;
pkgWithCategory = category: package: { inherit package category; };
devos = pkgWithCategory "devos";
linter = pkgWithCategory "linter";
docs = pkgWithCategory "docs";
in
{
_file = toString ./.;
imports = [ "${extraModulesPath}/git/hooks.nix" ];
git = { inherit hooks; };
# override for our own welcome
devshell.name = pkgs.lib.mkForce "PubSolarOS";
# tempfix: remove when merged https://github.com/numtide/devshell/pull/123
devshell.startup.load_profiles = pkgs.lib.mkForce (pkgs.lib.noDepEntry ''
# PATH is devshell's exorbitant privilige:
# fence against its pollution
_PATH=''${PATH}
# Load installed profiles
for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do
# If that folder doesn't exist, bash loves to return the whole glob
[[ -f "$file" ]] && source "$file"
done
# Exert exorbitant privilige and leave no trace
export PATH=''${_PATH}
unset _PATH
'');
commands = with pkgs; [
(devos nix)
(devos agenix)
{
category = "devos";
name = pkgs.nvfetcher.pname;
help = pkgs.nvfetcher.meta.description;
command = "cd $PRJ_ROOT/pkgs; ${pkgs.nvfetcher}/bin/nvfetcher -c ./sources.toml $@";
}
(linter nixpkgs-fmt)
(linter editorconfig-checker)
(docs mdbook)
]
++ lib.optionals (!pkgs.stdenv.buildPlatform.isi686) [
(devos cachix)
]
++ lib.optionals (pkgs.stdenv.hostPlatform.isLinux && !pkgs.stdenv.buildPlatform.isDarwin) [
(devos inputs.nixos-generators.defaultPackage.${pkgs.system})
(devos deploy-rs)
]
;
}