diff --git a/flake.lock b/flake.lock index 16622d0..6a18981 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1650194139, @@ -18,6 +33,7 @@ }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 6943640..3287972 100644 --- a/flake.nix +++ b/flake.nix @@ -2,62 +2,44 @@ description = "xeals's Nix repository"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; - outputs = { self, nixpkgs }: + outputs = { self, nixpkgs, flake-utils }: let - inherit (nixpkgs) lib; - - supportedSystems = [ - "aarch64-darwin" - "aarch64-linux" - "i686-linux" - "x86_64-darwin" - "x86_64-linux" - ]; - - forAllSystems = f: lib.genAttrs supportedSystems (system: f system); - + inherit (flake-utils.lib) mkApp; in - { + flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + packages = + lib.filterAttrs + (_: drv: builtins.elem system (drv.meta.platforms or [ ])) + (import ./pkgs/top-level/all-packages.nix { inherit pkgs; }); - nixosModules = lib.mapAttrs (_: path: import path) (import ./modules); - - nixosModule = { - imports = lib.attrValues self.nixosModules; + apps = { + alacritty = mkApp { drv = pkgs.alacritty-ligatures; exePath = "/bin/alacritty"; }; + protonmail-bridge = mkApp { drv = pkgs.protonmail-bridge; }; + protonmail-bridge-headless = mkApp { drv = pkgs.protonmail-bridge; }; + psst-cli = mkApp { drv = pkgs.psst; exePath = "/bin/psst-cli"; }; + psst-gui = mkApp { drv = pkgs.psst; exePath = "/bin/psst-gui"; }; + samrewritten = mkApp { drv = pkgs.samrewritten; }; + spotify-ripper = mkApp { drv = pkgs.spotify-ripper; }; + }; + }) + // { + nixosModules = lib.mapAttrs (_: path: import path) (import ./modules) // { + default = { + imports = lib.attrValues self.nixosModules; + }; }; overlays = import ./overlays // { - pkgs = _final: prev: import ./pkgs/top-level/all-packages.nix { pkgs = prev; }; + pkgs = _: prev: import ./pkgs/top-level/all-packages.nix { pkgs = prev; }; + default = _: _: { xeals = nixpkgs.lib.composeExtensions self.overlays.pkgs; }; }; - - overlay = _final: _prev: { - xeals = nixpkgs.lib.composeExtensions self.overlays.pkgs; - }; - - packages = forAllSystems (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - xPkgs = import ./pkgs/top-level/all-packages.nix { inherit pkgs; }; - in - lib.filterAttrs - (_attr: drv: builtins.elem system (drv.meta.platforms or [ ])) - xPkgs); - - apps = forAllSystems (system: - let - mkApp = opts: { type = "app"; } // opts; - pkgs = self.packages.${system}; - in - { - alacritty = mkApp { program = "${pkgs.alacritty-ligatures}/bin/alacritty"; }; - protonmail-bridge = mkApp { program = "${pkgs.protonmail-bridge}/bin/protonmail-bridge"; }; - protonmail-bridge-headless = mkApp { program = "${pkgs.protonmail-bridge}/bin/protonmail-bridge"; }; - psst-cli = mkApp { program = "${pkgs.psst}/bin/psst-cli"; }; - psst-gui = mkApp { program = "${pkgs.psst}/bin/psst-gui"; }; - samrewritten = mkApp { program = "${pkgs.samrewritten}/bin/samrewritten"; }; - spotify-ripper = mkApp { program = "${pkgs.spotify-ripper}/bin/spotify-ripper"; }; - }); - }; }