style(nix): alejandra -> nixfmt-rfc-style

This commit is contained in:
seth 2024-08-06 23:26:02 -04:00 committed by Sefa Eyeoglu
parent bdb2ef7c4c
commit 068da95e36
4 changed files with 127 additions and 106 deletions

146
flake.nix
View file

@ -10,83 +10,91 @@
};
};
outputs = {
self,
nixpkgs,
rust-overlay,
}: let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
outputs =
{
self,
nixpkgs,
rust-overlay,
}:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
in {
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
redis
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
in
{
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
redis
# linters & formatters
actionlint
nodePackages.prettier
# linters & formatters
actionlint
nodePackages.prettier
# rust tools
clippy
rustfmt
rust-analyzer
# rust tools
clippy
rustfmt
rust-analyzer
# nix tools
self.formatter.${system}
deadnix
nil
statix
];
# nix tools
self.formatter.${system}
deadnix
nil
statix
];
inputsFrom = [self.packages.${pkgs.system}.refraction];
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
};
});
formatter = forAllSystems (pkgs: pkgs.alejandra);
nixosModules.default = import ./nix/module.nix self;
packages = forAllSystems ({
lib,
pkgs,
system,
...
}: let
packages' = self.packages.${system};
mkStatic = pkgs.callPackage ./nix/static.nix {
inherit (self.packages.${pkgs.system}) refraction;
rust-overlay = rust-overlay.packages.${system};
};
mkContainerFor = refraction:
pkgs.dockerTools.buildLayeredImage {
name = "refraction";
tag = "latest-${refraction.stdenv.hostPlatform.qemuArch}";
config.Cmd = [(lib.getExe refraction)];
inherit (refraction) architecture;
inputsFrom = [ self.packages.${pkgs.system}.refraction ];
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
};
in {
refraction = pkgs.callPackage ./nix/derivation.nix {inherit self;};
});
static-x86_64 = mkStatic {arch = "x86_64";};
static-aarch64 = mkStatic {arch = "aarch64";};
container-x86_64 = mkContainerFor packages'.static-x86_64;
container-aarch64 = mkContainerFor packages'.static-aarch64;
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
default = packages'.refraction;
});
nixosModules.default = import ./nix/module.nix self;
overlays.default = _: prev: {
refraction = prev.callPackage ./nix/derivation.nix {inherit self;};
packages = forAllSystems (
{
lib,
pkgs,
system,
...
}:
let
packages' = self.packages.${system};
mkStatic = pkgs.callPackage ./nix/static.nix {
inherit (self.packages.${pkgs.system}) refraction;
rust-overlay = rust-overlay.packages.${system};
};
mkContainerFor =
refraction:
pkgs.dockerTools.buildLayeredImage {
name = "refraction";
tag = "latest-${refraction.stdenv.hostPlatform.qemuArch}";
config.Cmd = [ (lib.getExe refraction) ];
inherit (refraction) architecture;
};
in
{
refraction = pkgs.callPackage ./nix/derivation.nix { inherit self; };
static-x86_64 = mkStatic { arch = "x86_64"; };
static-aarch64 = mkStatic { arch = "aarch64"; };
container-x86_64 = mkContainerFor packages'.static-x86_64;
container-aarch64 = mkContainerFor packages'.static-aarch64;
default = packages'.refraction;
}
);
overlays.default = _: prev: {
refraction = prev.callPackage ./nix/derivation.nix { inherit self; };
};
};
};
}