diff --git a/flake.lock b/flake.lock index ff7b4f3..b93b948 100644 --- a/flake.lock +++ b/flake.lock @@ -75,6 +75,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1629284811, @@ -186,6 +204,18 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1719876945, + "narHash": "sha256-Fm2rDDs86sHy0/1jxTOKB1118Q0O3Uc7EC0iXvXKpbI=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/5daf0514482af3f97abaefc78a6606365c9108e2.tar.gz" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1720282526, @@ -207,6 +237,7 @@ "betterfox": "betterfox", "disko": "disko", "firefox-addons": "firefox-addons", + "flake-parts": "flake-parts", "home-manager": "home-manager", "nix-index-database": "nix-index-database", "nix-vscode-extensions": "nix-vscode-extensions", diff --git a/flake.nix b/flake.nix index 06a1f0c..6806cbf 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,8 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -50,46 +52,52 @@ }; outputs = - { self, nixpkgs, ... }@inputs: - let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; - in - { - nixosConfigurations = { - north = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit self inputs; + inputs: + inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" ]; + + flake = { + nixosConfigurations = { + north = inputs.nixpkgs.lib.nixosSystem { + specialArgs = { + inherit (inputs) self; + inherit inputs; + }; + modules = [ + ./hosts/north + "${inputs.self}/users/seb/@north" + ]; }; - modules = [ - ./hosts/north - "${self}/users/seb/@north" - ]; - }; - inspiron = nixpkgs.lib.nixosSystem { - specialArgs = { - inherit self inputs; + inspiron = inputs.nixpkgs.lib.nixosSystem { + specialArgs = { + inherit (inputs) self; + inherit inputs; + }; + modules = [ + ./hosts/inspiron + "${inputs.self}/users/seb/@inspiron" + ]; }; - modules = [ - ./hosts/inspiron - "${self}/users/seb/@inspiron" - ]; }; }; - devShells.${system}.sops = pkgs.mkShell { - packages = [ - pkgs.sops - pkgs.age - pkgs.ssh-to-age - ]; - }; + perSystem = + { pkgs, ... }: + { + devShells.sops = pkgs.mkShell { + packages = [ + pkgs.sops + pkgs.age + pkgs.ssh-to-age + ]; + }; - formatter.${system} = - (inputs.treefmt-nix.lib.evalModule pkgs { - projectRootFile = "flake.nix"; - programs.nixfmt.enable = true; - programs.prettier.enable = true; - }).config.build.wrapper; + formatter = + (inputs.treefmt-nix.lib.evalModule pkgs { + projectRootFile = "flake.nix"; + programs.nixfmt.enable = true; + programs.prettier.enable = true; + }).config.build.wrapper; + }; }; }