From 82d46b221e330ab2e818d6c48ee2b33fc92bbe4f Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Sun, 3 Dec 2023 16:41:22 +0800 Subject: [PATCH] flake: formatter: use genAttrs --- flake.lock | 22 +++++++++++++++++++--- flake.nix | 17 ++++++++++------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index 76d5963..95d8b37 100755 --- a/flake.lock +++ b/flake.lock @@ -191,7 +191,7 @@ "nixpkgs" ], "systems": [ - "systems" + "systems-linux" ], "wlroots": [ "wlroots" @@ -240,7 +240,7 @@ "nixpkgs" ], "systems": [ - "systems" + "systems-linux" ] }, "locked": { @@ -517,6 +517,7 @@ "sops-nix": "sops-nix", "spicetify-nix": "spicetify-nix", "systems": "systems", + "systems-linux": "systems-linux", "wlroots": "wlroots", "xdph": "xdph" } @@ -591,6 +592,21 @@ } }, "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems-linux": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -632,7 +648,7 @@ "nixpkgs" ], "systems": [ - "systems" + "systems-linux" ] }, "locked": { diff --git a/flake.nix b/flake.nix index d2dfaf3..00bd6ab 100755 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ url = "github:hyprwm/Hyprland"; inputs.nixpkgs.follows = "nixpkgs"; inputs.hyprland-protocols.follows = "hyprland-protocols"; - inputs.systems.follows = "systems"; + inputs.systems.follows = "systems-linux"; inputs.wlroots.follows = "wlroots"; inputs.xdph.follows = "xdph"; }; @@ -70,6 +70,8 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; + systems.url = "github:nix-systems/default"; + systems-linux.url = "github:nix-systems/default-linux"; ### De-dupe crane = { @@ -99,7 +101,7 @@ hyprland-protocols = { url = "github:hyprwm/hyprland-protocols"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.systems.follows = "systems"; + inputs.systems.follows = "systems-linux"; }; nvfetcher = { url = "github:berberman/nvfetcher"; @@ -120,7 +122,7 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; - systems.url = "github:nix-systems/default-linux"; + wlroots = { type = "gitlab"; host = "gitlab.freedesktop.org"; @@ -132,7 +134,7 @@ url = "github:hyprwm/xdg-desktop-portal-hyprland"; inputs.nixpkgs.follows = "nixpkgs"; inputs.hyprland-protocols.follows = "hyprland-protocols"; - inputs.systems.follows = "systems"; + inputs.systems.follows = "systems-linux"; }; # TODO: Unused, Soon(TM) @@ -150,9 +152,10 @@ }; }; - outputs = inputs: { - formatter.x86_64-linux = inputs.nixpkgs.legacyPackages.x86_64-linux.alejandra; - formatter.x86_64-darwin = inputs.nixpkgs.legacyPackages.x86_64-darwin.alejandra; + outputs = inputs: let + eachSystem = inputs.nixpkgs.lib.genAttrs (import inputs.systems); + in { + formatter = eachSystem (system: inputs.nixpkgs.legacyPackages.${system}.alejandra); ### NixOS nixosConfigurations = {