From 1dc50ae17dfc599741766a4dd8e65e661a13dbc0 Mon Sep 17 00:00:00 2001 From: derped Date: Mon, 11 Sep 2023 20:05:16 +0200 Subject: [PATCH] Add formatter to project. --- flake.lock | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 8 +++++- 2 files changed, 86 insertions(+), 1 deletion(-) diff --git a/flake.lock b/flake.lock index 0f06ad9..4847647 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,28 @@ { "nodes": { + "alejandra": { + "inputs": { + "fenix": "fenix", + "flakeCompat": "flakeCompat", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660510326, + "narHash": "sha256-xFumnivtVwu5fFBOrTxrv6fv3geHKF04RGP23EsDVaI=", + "owner": "kamadorueda", + "repo": "alejandra", + "rev": "ef03f7ef74ec97fd91a016a51c9c9667fb315652", + "type": "github" + }, + "original": { + "owner": "kamadorueda", + "ref": "3.0.0", + "repo": "alejandra", + "type": "github" + } + }, "blobs": { "flake": false, "locked": { @@ -16,6 +39,28 @@ "type": "gitlab" } }, + "fenix": { + "inputs": { + "nixpkgs": [ + "alejandra", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1657607339, + "narHash": "sha256-HaqoAwlbVVZH2n4P3jN2FFPMpVuhxDy1poNOR7kzODc=", + "owner": "nix-community", + "repo": "fenix", + "rev": "b814c83d9e6aa5a28d0cf356ecfdafb2505ad37d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -32,6 +77,22 @@ "type": "github" } }, + "flakeCompat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "mailserver": { "inputs": { "blobs": "blobs", @@ -181,6 +242,7 @@ }, "root": { "inputs": { + "alejandra": "alejandra", "mailserver": "mailserver", "nixpkgs": "nixpkgs_2", "nixpkgs-git": "nixpkgs-git", @@ -189,6 +251,23 @@ "sops-nix": "sops-nix" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1657557289, + "narHash": "sha256-PRW+nUwuqNTRAEa83SfX+7g+g8nQ+2MMbasQ9nt6+UM=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "caf23f29144b371035b864a1017dbc32573ad56d", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "sops-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 36d8788..9cfe238 100644 --- a/flake.nix +++ b/flake.nix @@ -5,15 +5,20 @@ nixpkgs-stable.url = "github:/NixOS/nixpkgs/nixos-22.11"; nixpkgs-unstable.url = "github:/NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:/NixOS/nixpkgs/nixos-unstable"; + alejandra = { + url = github:kamadorueda/alejandra/3.0.0; + inputs.nixpkgs.follows = "nixpkgs"; + }; mailserver.url = "gitlab:/simple-nixos-mailserver/nixos-mailserver"; sops-nix = { url = github:Mic92/sops-nix; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, sops-nix, mailserver, ... }@attrs: let + outputs = { self, nixpkgs, alejandra, mailserver, sops-nix, ... }@attrs: let lib = nixpkgs.lib; fn = import ./fn.nix { inherit lib; }; + mappedFormatter = builtins.mapAttrs (arch: packages: packages.default) alejandra.packages; system = "x86_64-linux"; machineList = fn.lst { p = (toString ./machines); t = "directory"; b = false; }; configFiles = fn.lst { p = (toString ./config); b = true; }; @@ -37,6 +42,7 @@ }; }; in { + formatter = mappedFormatter; nixosConfigurations = lib.listToAttrs (map nixosSystemFor machineList); }; }