92 lines
2.3 KiB
Nix
92 lines
2.3 KiB
Nix
{
|
|
inputs = {
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
|
|
nixpkgsMaster.url = "github:NixOS/nixpkgs/master";
|
|
|
|
nur.url = "github:nix-community/NUR";
|
|
|
|
home-manager = {
|
|
url = "github:nix-community/home-manager/release-22.05";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
nix-pre-commit-hooks = {
|
|
url = "github:cachix/pre-commit-hooks.nix/master";
|
|
inputs.flake-utils.follows = "flake-utils";
|
|
};
|
|
|
|
sops-nix = {
|
|
url = "github:Mic92/sops-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
outputs =
|
|
{ self
|
|
, nixpkgs
|
|
, flake-utils
|
|
, home-manager
|
|
, nur
|
|
, nix-pre-commit-hooks
|
|
, ...
|
|
}@inputs: flake-utils.lib.eachSystem [
|
|
"x86_64-linux"
|
|
]
|
|
(system:
|
|
let
|
|
pkgs = import nixpkgs { inherit system; };
|
|
inherit (pkgs) lib;
|
|
in
|
|
{
|
|
checks = {
|
|
pre-commit-check = nix-pre-commit-hooks.lib.${system}.run {
|
|
src = self;
|
|
hooks = {
|
|
black.enable = true;
|
|
nixpkgs-fmt.enable = true;
|
|
shellcheck.enable = true;
|
|
};
|
|
};
|
|
};
|
|
devShell = pkgs.mkShell {
|
|
buildInputs = (with pkgs; [
|
|
black
|
|
just
|
|
nixpkgs-fmt
|
|
shellcheck
|
|
sops
|
|
ssh-to-age
|
|
]);
|
|
|
|
shellHook = ''
|
|
${self.checks.${system}.pre-commit-check.shellHook}
|
|
'';
|
|
};
|
|
}) // {
|
|
overlay = import ./pkgs;
|
|
|
|
nixosConfigurations = nixpkgs.lib.mapAttrs
|
|
(hostname: { system
|
|
, extraModules ? [ ]
|
|
, nixpkgs ? inputs.nixpkgs
|
|
}: nixpkgs.lib.nixosSystem rec {
|
|
inherit system;
|
|
specialArgs = { inherit self system; };
|
|
|
|
modules = [
|
|
(./hosts + "/${hostname}/configuration.nix")
|
|
./modules
|
|
{
|
|
_module.args.inputs = inputs;
|
|
}
|
|
] ++ [{
|
|
nixpkgs.overlays = [ nur.overlay ];
|
|
}] ++ [
|
|
home-manager.nixosModules.home-manager
|
|
] ++ (with inputs; [
|
|
sops-nix.nixosModules.sops
|
|
]) ++ extraModules;
|
|
})
|
|
(import ./hosts inputs);
|
|
};
|
|
}
|