diff options
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 70 |
1 files changed, 40 insertions, 30 deletions
@@ -1,50 +1,59 @@ { + description = "getchoo's flake for nixos and home configurations"; + inputs = { nixpkgsUnstable.url = "nixpkgs/nixos-unstable"; agenix = { url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgsUnstable"; }; + # this is just to avoid having multiple versions in flake.lock + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + flake-utils.url = "github:numtide/flake-utils"; getchoo = { url = "github:getchoo/overlay"; inputs.nixpkgs.follows = "nixpkgs"; + inputs.utils.follows = "flake-utils"; }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; + inputs.utils.follows = "flake-utils"; }; lanzaboote = { url = "github:nix-community/lanzaboote"; inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-compat.follows = "flake-compat"; + inputs.flake-utils.follows = "flake-utils"; + inputs.pre-commit-hooks-nix.follows = "pre-commit-hooks"; }; nixos-wsl = { url = "github:nix-community/NixOS-WSL/main"; inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-compat.follows = "flake-compat"; + inputs.flake-utils.follows = "flake-utils"; }; nixos-hardware.url = "github:NixOS/nixos-hardware"; nur.url = "github:nix-community/NUR"; pre-commit-hooks = { url = "github:cachix/pre-commit-hooks.nix"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows = "nixpkgsUnstable"; + inputs.nixpkgs-stable.follows = "nixpkgs"; + inputs.flake-compat.follows = "flake-compat"; + inputs.flake-utils.follows = "flake-utils"; }; }; outputs = inputs @ { self, nixpkgs, - nixpkgsUnstable, + flake-utils, pre-commit-hooks, ... }: let - supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - - mkPkgsFor = pkgs: forAllSystems (system: import pkgs {inherit system;}); - channels = { - nixpkgs = mkPkgsFor nixpkgs; - nixpkgsUnstable = mkPkgsFor nixpkgsUnstable; - }; - util = import ./util { inherit (nixpkgs) lib; inherit inputs; @@ -54,22 +63,22 @@ users = import ./users {inherit inputs;}; hosts = import ./hosts {inherit inputs;}; - in { - checks = forAllSystems (system: { - pre-commit-check = pre-commit-hooks.lib.${system}.run { - src = ./.; - hooks = { - alejandra.enable = true; - deadnix.enable = true; - statix.enable = true; + in + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + alejandra.enable = true; + deadnix.enable = true; + statix.enable = true; + }; }; }; - }); - devShells = forAllSystems (system: let - pkgs = nixpkgs.legacyPackages.${system}; - in - with pkgs; { + devShells = with pkgs; { default = mkShell { inherit (self.checks.${system}.pre-commit-check) shellHook; packages = [ @@ -78,12 +87,13 @@ statix ]; }; - }); - - formatter = forAllSystems (system: channels.nixpkgs.${system}.alejandra); + }; - homeConfigurations = forAllSystems (system: mapHMUsers (users.users {inherit system;})); + formatter = pkgs.alejandra; - nixosConfigurations = mapHosts hosts; - }; + homeConfigurations = mapHMUsers (users.users {inherit system;}); + }) + // { + nixosConfigurations = mapHosts hosts; + }; } |
