maint: Run nix stuff through the formatter

There are several choices for formatting Nix code, but IMHO alejandra is the
right kind of opinionated: <https://github.com/kamadorueda/alejandra>.
This commit is contained in:
Lucas Bergman 2024-02-19 20:31:47 -06:00
parent 847413f4f5
commit fe162968e5
2 changed files with 153 additions and 136 deletions

View File

@ -8,4 +8,5 @@ in
} }
) { ) {
src = ./.; src = ./.;
}).defaultNix })
.defaultNix

View File

@ -6,11 +6,20 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
naersk.url = "github:nix-community/naersk"; naersk.url = "github:nix-community/naersk";
flake-compat = { url = github:edolstra/flake-compat; flake = false; }; flake-compat = {
url = github:edolstra/flake-compat;
flake = false;
};
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = {nixpkgs, flake-utils, naersk, rust-overlay, ...}: outputs = {
nixpkgs,
flake-utils,
naersk,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (system: let flake-utils.lib.eachDefaultSystem (system: let
overlays = [ overlays = [
rust-overlay.overlays.default rust-overlay.overlays.default
@ -26,17 +35,24 @@
verion = "0.0.1"; verion = "0.0.1";
src = ./.; src = ./.;
nativeBuildInputs = [pkgs.pkg-config]; nativeBuildInputs = [pkgs.pkg-config];
buildInputs = ( buildInputs =
if pkgs.stdenv.isDarwin then (
with pkgs.darwin.apple_sdk.frameworks; [ Security SystemConfiguration ] if pkgs.stdenv.isDarwin
else then with pkgs.darwin.apple_sdk.frameworks; [Security SystemConfiguration]
[ pkgs.openssl ]) ++ [rust-bin]; else [pkgs.openssl]
)
++ [rust-bin];
}; };
in in {
{
packages.default = heracles; packages.default = heracles;
}) // { })
nixosModule = {config, pkgs, lib}: with lib; { // {
nixosModule = {
config,
pkgs,
lib,
}:
with lib; {
options = { options = {
services.heracles.enable = mkEnableOption "enable heracles service"; services.heracles.enable = mkEnableOption "enable heracles service";
services.heracles.listen = mkOption { services.heracles.listen = mkOption {
@ -134,7 +150,7 @@
config = mkIf config.services.heracles.enable { config = mkIf config.services.heracles.enable {
environment.etc."heracles.yaml" = { environment.etc."heracles.yaml" = {
text = (generators.toYAML {} config.services.heracles.settings); text = generators.toYAML {} config.services.heracles.settings;
}; };
systemd.services.heracles = { systemd.services.heracles = {
wantedBy = ["multi-user.target" "default.target"]; wantedBy = ["multi-user.target" "default.target"];