nix/flake.nix
2024-10-02 22:05:05 +02:00

67 lines
1.5 KiB
Nix

{
description = "Arnie's nix flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-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;";
};
formatter = self.lib.forAllSystems (pkgs: pkgs.nixpkgs-fmt);
devShells = self.lib.forAllSystems (pkgs: {
default = pkgs.devshell.mkShell {
name = "nix";
packages = [
pkgs.nix-tree
pkgs.golangci-lint
];
commands = [
{
name = "fix";
command = ''
${self.lib.cd_root}
nix fmt .
'';
}
];
};
});
packages = self.lib.forAllSystems (pkgs:
{
control4_env = pkgs.mkShell {
packages = [
pkgs.lua5_1
];
};
}
);
};
}