diff --git a/flake.nix b/flake.nix index 3005684b..797e1ab5 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,6 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; catppuccin.url = "github:catppuccin/nix"; tokyonight.url = "github:mrjones2014/tokyonight.nix"; - flake-utils.url = "github:numtide/flake-utils"; wezterm-nightly = { url = "github:wez/wezterm?dir=nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -48,138 +47,113 @@ keep-derivations = true; }; - outputs = inputs@{ self, nixpkgs, home-manager, agenix, flake-utils, ... }: - { - nixosConfigurations = { - server = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - isServer = true; - isLinux = true; - isThinkpad = false; - isDarwin = false; - }; - system = "x86_64-linux"; - modules = [ - home-manager.nixosModules.home-manager - agenix.nixosModules.default - { - environment.systemPackages = - [ agenix.packages.x86_64-linux.default ]; - } - ./nixos-modules/common.nix - ./hosts/server - { - home-manager = { - backupFileExtension = "backup"; - useUserPackages = true; - users.mat = import ./home-manager/server.nix; - extraSpecialArgs = { - inherit inputs; - isServer = true; - isLinux = true; - isThinkpad = false; - isDarwin = false; - }; - }; - } - ]; + outputs = inputs@{ self, nixpkgs, home-manager, agenix, ... }: { + nixosConfigurations = { + server = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + isServer = true; + isLinux = true; + isThinkpad = false; + isDarwin = false; }; - pc = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - isServer = false; - isDarwin = false; - isLinux = true; - isThinkpad = false; - }; - system = "x86_64-linux"; - modules = [ - ./nixos-modules/common.nix - ./hosts/pc - home-manager.nixosModules.home-manager - { - home-manager = { - backupFileExtension = "backup"; - useUserPackages = true; - users.mat = import ./home-manager/home.nix; - extraSpecialArgs = { - inherit inputs; - isServer = false; - isDarwin = false; - isLinux = true; - isThinkpad = false; - }; + system = "x86_64-linux"; + modules = [ + home-manager.nixosModules.home-manager + agenix.nixosModules.default + { + environment.systemPackages = + [ agenix.packages.x86_64-linux.default ]; + } + ./nixos-modules/common.nix + ./hosts/server + { + home-manager = { + backupFileExtension = "backup"; + useUserPackages = true; + users.mat = import ./home-manager/server.nix; + extraSpecialArgs = { + inherit inputs; + isServer = true; + isLinux = true; + isThinkpad = false; + isDarwin = false; }; - } - ]; + }; + } + ]; + }; + pc = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + isServer = false; + isDarwin = false; + isLinux = true; + isThinkpad = false; }; - laptop = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - isServer = false; - isDarwin = false; - isLinux = true; - isThinkpad = true; - }; - system = "x86_64-linux"; - modules = [ - ./nixos-modules/common.nix - ./hosts/laptop - home-manager.nixosModules.home-manager - { - home-manager = { - backupFileExtension = "backup"; - useUserPackages = true; - users.mat = import ./home-manager/home.nix; - extraSpecialArgs = { - inherit inputs; - isServer = false; - isDarwin = false; - isLinux = true; - isThinkpad = true; - }; + system = "x86_64-linux"; + modules = [ + ./nixos-modules/common.nix + ./hosts/pc + home-manager.nixosModules.home-manager + { + home-manager = { + backupFileExtension = "backup"; + useUserPackages = true; + users.mat = import ./home-manager/home.nix; + extraSpecialArgs = { + inherit inputs; + isServer = false; + isDarwin = false; + isLinux = true; + isThinkpad = false; }; - } - ]; + }; + } + ]; + }; + laptop = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + isServer = false; + isDarwin = false; + isLinux = true; + isThinkpad = true; }; + system = "x86_64-linux"; + modules = [ + ./nixos-modules/common.nix + ./hosts/laptop + home-manager.nixosModules.home-manager + { + home-manager = { + backupFileExtension = "backup"; + useUserPackages = true; + users.mat = import ./home-manager/home.nix; + extraSpecialArgs = { + inherit inputs; + isServer = false; + isDarwin = false; + isLinux = true; + isThinkpad = true; + }; + }; + } + ]; }; - homeConfigurations = { - "mac" = home-manager.lib.homeManagerConfiguration { - extraSpecialArgs = { - inherit inputs; - isServer = false; - isDarwin = true; - isLinux = false; - isThinkpad = false; - }; - pkgs = nixpkgs.legacyPackages.aarch64-darwin; - modules = [ ./home-manager/home.nix ]; + }; + homeConfigurations = { + "mac" = home-manager.lib.homeManagerConfiguration { + extraSpecialArgs = { + inherit inputs; + isServer = false; + isDarwin = true; + isLinux = false; + isThinkpad = false; }; + pkgs = nixpkgs.legacyPackages.aarch64-darwin; + modules = [ ./home-manager/home.nix ]; }; - } // inputs.flake-utils.lib.eachDefaultSystem (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - - packages = nixpkgs.lib.filterAttrs - (_: pkg: builtins.any (x: x == system) pkg.meta.platforms) - (import ./packages { - inherit pkgs; - inherit inputs; - }); - - checksForConfigs = configs: extract: - nixpkgs.lib.attrsets.filterAttrs (_: p: p.system == system) - (nixpkgs.lib.attrsets.mapAttrs (_: extract) configs); - in { - inherit packages; - - checks = nixpkgs.lib.lists.foldl nixpkgs.lib.attrsets.unionOfDisjoint - packages [ - (checksForConfigs self.homeConfigurations - (hm: hm.activationPackage)) - (checksForConfigs self.nixosConfigurations - (c: c.config.system.build.toplevel)) - ]; - }); + }; + }; }