Add nix init script
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
{
|
||||
inputs = {
|
||||
nix.url = "git+ssh://git@git.c3c.cz/C3C/nix";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nix }:
|
||||
{
|
||||
formatter = nix.formatter;
|
||||
|
||||
devShells = nix.lib.forAllSystems (pkgs: {
|
||||
default = nix.lib.mkDevenvShell {
|
||||
inherit pkgs;
|
||||
inputs = {
|
||||
self = self;
|
||||
nixpkgs = pkgs;
|
||||
};
|
||||
|
||||
modules = [
|
||||
{
|
||||
packages = with pkgs; [
|
||||
|
||||
];
|
||||
|
||||
scripts = {
|
||||
menu = {
|
||||
description = "Print this menu";
|
||||
exec = ''
|
||||
echo "Commands:"
|
||||
echo -n ${
|
||||
builtins.toJSON (
|
||||
builtins.mapAttrs (s: value: value.description) self.devShells.${pkgs.system}.default.config.scripts
|
||||
)
|
||||
}' | \
|
||||
${pkgs.jq}/bin/jq -r 'to_entries | map(" \(.key)\n" + " - \(if .value == "" then "no description provided" else .value end)") | "" + .[]'
|
||||
'';
|
||||
};
|
||||
|
||||
fix = {
|
||||
exec = ''
|
||||
${nix.lib.cd_root}
|
||||
nix fmt ./*.nix
|
||||
${pkgs.golangci-lint}/bin/golangci-lint run --sort-results --out-format tab --config ${nix.lib.golangci-config-file} --fix --issues-exit-code 0 ./...
|
||||
stylua ./src
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user