{ description = "personal NixOS configurations"; inputs = { # Nixpkgs, NixOS's official repo nixpkgs.url = "github:nixos/nixpkgs/release-22.05"; futils.url = "github:numtide/flake-utils"; # We use the unstable nixpkgs repo for some packages. nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; emacs-overlay.url = "github:nix-community/emacs-overlay"; agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; }; nur.url = "github:nix-community/NUR"; home-manager = { url = "github:nix-community/home-manager/release-22.05"; # We want home-manager to use the same set of nixpkgs as our system. 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"; }; }; }; # Output config, or config for NixOS system outputs = { self, ... }@inputs: let inherit (inputs.futils.lib) eachSystem system; mySystems = [ system.x86_64-linux ]; eachMySystem = eachSystem mySystems; lib = import ./nix { inherit inputs; }; in eachMySystem (system: let pkgs = import inputs.nixpkgs { inherit system; }; home-manager = inputs.home-manager.defaultPackage."${system}"; ci = import ./ops/ci { inherit pkgs; }; in rec { packages = pkgs // { inherit home-manager; tools = import ./tools { inherit pkgs; }; users.fcuny = import ./users/fcuny { inherit pkgs; }; }; checks = { pre-commit = inputs.pre-commit-hooks.lib.${system}.run { src = ./.; hooks = { 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" ]; }; nixpkgs-fmt = { enable = true; }; shellcheck = { enable = true; }; }; }; }; devShells = { default = pkgs.mkShell { name = "NixOS-config"; buildInputs = with pkgs; [ gitAndTools.pre-commit nixUnstable nixfmt nixpkgs-fmt rnix-lsp home-manager git go gopls ]; inherit (self.checks.${system}.pre-commit) shellHook; }; }; }) // { nixosConfigurations = { carmel = lib.mkSystem { hostname = "carmel"; }; aptos = lib.mkSystem { hostname = "aptos"; }; tahoe = lib.mkSystem { hostname = "tahoe"; }; }; }; }