blob: 072ad80fb9f6d54c39cf372a339a7ecf6f95a1b2 (
plain) (
tree)
|
|
{
description = "personal NixOS configurations";
inputs = {
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-23.05";
};
futils.url = "github:numtide/flake-utils";
home-manager = {
type = "github";
owner = "nix-community";
repo = "home-manager";
ref = "release-23.05";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
darwin = {
url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks = {
type = "github";
owner = "cachix";
repo = "pre-commit-hooks.nix";
ref = "master";
inputs = {
flake-utils.follows = "futils";
nixpkgs.follows = "nixpkgs";
nixpkgs-stable.follows = "nixpkgs";
};
};
};
# Output config, or config for NixOS system
outputs = inputs@{ self, darwin, home-manager, ... }:
let
myLib = import ./nix inputs;
lib = inputs.nixpkgs.lib // builtins;
supportedSystems = [ "aarch64-darwin" ];
forAllSystems = lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system:
import inputs.nixpkgs {
inherit system;
config = { allowUnfree = true; };
});
in
{
templates = import ./templates;
checks = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in
{
pre-commit-check = inputs.pre-commit-hooks.lib."${system}".run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
trailing-whitespace = {
enable = true;
entry =
"${pkgs.python3Packages.pre-commit-hooks}/bin/trailing-whitespace-fixer";
types = [ "text" ];
};
end-of-file-fixer = {
enable = true;
entry =
"${pkgs.python3Packages.pre-commit-hooks}/bin/end-of-file-fixer";
types = [ "text" ];
};
check-executables-have-shebangs = {
entry =
"${pkgs.python3Packages.pre-commit-hooks}/bin/check-executables-have-shebangs";
types = [ "text" "executable" ];
};
check-json = {
enable = true;
entry = "${pkgs.python3Packages.pre-commit-hooks}/bin/check-json";
types = [ "json" ];
};
check-toml = {
enable = true;
entry = "${pkgs.python3Packages.pre-commit-hooks}/bin/check-toml";
types = [ "toml" ];
};
check-yaml = {
enable = true;
entry = "${pkgs.python3Packages.pre-commit-hooks}/bin/check-yaml --allow-multiple-documents";
types = [ "yaml" ];
};
shellcheck = {
enable = true;
files = "\\.sh$";
types_or = [ "file" ];
};
};
};
});
devShells = forAllSystems (system: {
default = inputs.nixpkgs.legacyPackages.${system}.mkShell {
name = "fcuny-configuration-on-${system}-system";
buildInputs = with inputs.nixpkgs.legacyPackages.${system}.pkgs; [
gitAndTools.pre-commit
nixfmt
nixpkgs-fmt
rnix-lsp
home-manager
git
nixos-rebuild
];
inherit (self.checks.${system}.pre-commit-check) shellHook;
};
});
packages = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in
{
inherit (inputs.futils.lib) filterPackages flattenTree;
tools = import ./tools { inherit pkgs; };
});
darwinConfigurations = {
"mba-fcuny" = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
home-manager.darwinModules.home-manager
./hosts/mba
];
};
};
};
}
|