mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
feat!: switch to full flake-parts
This commit is contained in:
parent
7d82c3cee9
commit
7d614f784c
55 changed files with 4443 additions and 4188 deletions
141
nix/devshell.nix
Normal file
141
nix/devshell.nix
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
{ self, inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.devshell.flakeModule
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
];
|
||||
|
||||
perSystem = { pkgs, system, ... }:
|
||||
{
|
||||
pre-commit = {
|
||||
check.enable = true;
|
||||
settings = {
|
||||
addGcRoot = true;
|
||||
hooks = {
|
||||
check-added-large-files.enable = true;
|
||||
check-case-conflicts.enable = true;
|
||||
check-executables-have-shebangs.enable = true;
|
||||
check-shebang-scripts-are-executable.enable = false;
|
||||
check-merge-conflicts.enable = true;
|
||||
deadnix.enable = true;
|
||||
detect-private-keys.enable = true;
|
||||
end-of-file-fixer.enable = true;
|
||||
fix-byte-order-marker.enable = true;
|
||||
flake-checker.enable = true;
|
||||
forbid-new-submodules.enable = true;
|
||||
mixed-line-endings.enable = true;
|
||||
nixpkgs-fmt.enable = true;
|
||||
statix.enable = true;
|
||||
trim-trailing-whitespace.enable = true;
|
||||
|
||||
destroyed-symlinks = {
|
||||
enable = true;
|
||||
entry = "${inputs.pre-commit-hooks.checks.${system}.pre-commit-hooks}/bin/destroyed-symlinks";
|
||||
};
|
||||
|
||||
shellcheck = {
|
||||
enable = true;
|
||||
entry = "${pkgs.shellcheck}/bin/shellcheck --shell=bash";
|
||||
};
|
||||
|
||||
shfmt = {
|
||||
enable = true;
|
||||
entry = "${pkgs.shfmt}/bin/shfmt -i 4 -sr -d -s -l";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
devshells.default = {
|
||||
packages = [
|
||||
(builtins.trace "alarm: we pinned nix_2_24 because of https://github.com/shlevy/nix-plugins/issues/20" pkgs.nixVersions.nix_2_24) # Always use the nix version from this flake's nixpkgs version, so that nix-plugins (below) doesn't fail because of different nix versions.
|
||||
pkgs.git
|
||||
pkgs.just
|
||||
pkgs.age
|
||||
pkgs.ssh-to-age
|
||||
pkgs.sops
|
||||
pkgs.home-manager
|
||||
pkgs.nixpkgs-fmt
|
||||
self.packages.${system}.swarsel-build
|
||||
self.packages.${system}.swarsel-deploy
|
||||
];
|
||||
|
||||
commands = [
|
||||
{
|
||||
package = pkgs.statix;
|
||||
help = "Lint flake";
|
||||
}
|
||||
{
|
||||
package = pkgs.deadnix;
|
||||
help = "Check flake for dead code";
|
||||
}
|
||||
{
|
||||
package = pkgs.nix-tree;
|
||||
help = "Interactively browse dependency graphs of Nix derivations";
|
||||
}
|
||||
{
|
||||
package = pkgs.nvd;
|
||||
help = "Diff two nix toplevels and show which packages were upgraded";
|
||||
}
|
||||
{
|
||||
package = pkgs.nix-diff;
|
||||
help = "Explain why two Nix derivations differ";
|
||||
}
|
||||
{
|
||||
package = pkgs.nix-output-monitor;
|
||||
help = "Nix Output Monitor (a drop-in alternative for `nix` which shows a build graph)";
|
||||
name = "nom";
|
||||
}
|
||||
{
|
||||
name = "hm";
|
||||
help = "Manage home-manager config";
|
||||
command = "home-manager";
|
||||
}
|
||||
{
|
||||
name = "fmt";
|
||||
help = "Format flake";
|
||||
command = "nixpkgs-fmt --check \"$FLAKE\"";
|
||||
}
|
||||
{
|
||||
name = "sd";
|
||||
help = "Build and deploy this nix config to nodes";
|
||||
command = "swarsel-deploy \"$@\"";
|
||||
}
|
||||
{
|
||||
name = "sl";
|
||||
help = "Build and deploy a config to nodes";
|
||||
command = "swarsel-deploy \${1} switch";
|
||||
}
|
||||
{
|
||||
name = "sw";
|
||||
help = "Build and switch to the host's config locally";
|
||||
command = "swarsel-deploy $(hostname) switch";
|
||||
}
|
||||
{
|
||||
name = "bld";
|
||||
help = "Build a number of configurations";
|
||||
command = "swarel-build \"$@\"";
|
||||
}
|
||||
{
|
||||
name = "c";
|
||||
help = "Work with the flake git repository";
|
||||
command = "git --git-dir=$FLAKE/.git --work-tree=$FLAKE/ \"$@\"";
|
||||
}
|
||||
];
|
||||
|
||||
devshell.startup.pre-commit-install.text = "pre-commit install";
|
||||
|
||||
env = [
|
||||
{
|
||||
# Additionally configure nix-plugins with our extra builtins file.
|
||||
# We need this for our repo secrets.
|
||||
name = "NIX_CONFIG";
|
||||
value = ''
|
||||
plugin-files = ${pkgs.nix-plugins}/lib/nix/plugins
|
||||
extra-builtins-file = ${self + /nix/extra-builtins.nix}
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue