nix/flake.nix
2024-10-07 21:43:09 +02:00

80 lines
1.7 KiB
Nix

{
description = "Arnie's nix flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
devshell,
}:
let
systems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
in
{
lib = {
forAllSystems =
function:
systems (
system:
function (
import nixpkgs {
inherit system;
overlays = [ devshell.overlays.default ];
config.allowUnfreePredicate = (pkg: builtins.elem (nixpkgs.lib.getName pkg) [ "terraform" ]);
}
)
);
golangci-config-file = ./.golangci.yml;
cd_root = "cd $PRJ_ROOT;";
control4_env = self.lib.forAllSystems (
pkgs:
pkgs.buildEnv {
name = "control4_env";
paths = [
pkgs.lua5_1
pkgs.lua51Packages.busted
pkgs.stylua
pkgs.nodejs_22
];
}
);
};
formatter = self.lib.forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
devShells = self.lib.forAllSystems (pkgs: {
default = pkgs.devshell.mkShell {
name = "c3c-nix";
packages = [ pkgs.nix-tree ];
commands = [
{
name = "fix";
command = ''
${self.lib.cd_root}
nix fmt .
'';
}
];
};
});
};
}