Skip to content

Commit 14002c4

Browse files
committed
chore: Replace alejandra with nixfmt-rfc-style
1 parent 14cf7cf commit 14002c4

File tree

1 file changed

+75
-51
lines changed

1 file changed

+75
-51
lines changed

flake.nix

Lines changed: 75 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -21,47 +21,76 @@
2121
};
2222
};
2323

24-
outputs = {
25-
self,
26-
nixpkgs,
27-
flake-utils,
28-
uv2nix,
29-
pyproject-nix,
30-
pyproject-build-systems,
31-
...
32-
}:
24+
outputs =
25+
{
26+
self,
27+
nixpkgs,
28+
flake-utils,
29+
uv2nix,
30+
pyproject-nix,
31+
pyproject-build-systems,
32+
...
33+
}:
3334
flake-utils.lib.eachDefaultSystem (
34-
system: let
35-
pkgs = import nixpkgs {inherit system;};
36-
nixTools = with pkgs; [alejandra deadnix statix];
37-
pyTools = with pkgs; [black ruff uv];
35+
system:
36+
let
37+
pkgs = import nixpkgs { inherit system; };
38+
nixTools = with pkgs; [
39+
deadnix
40+
nixfmt-rfc-style
41+
statix
42+
];
43+
pyTools = with pkgs; [
44+
black
45+
ruff
46+
uv
47+
];
3848
python = pkgs.python313; # NOTE: Keep in-sync with pyproject.toml.
39-
devPkgs = [python] ++ pyTools ++ nixTools ++ (with pkgs; [just pre-commit]);
40-
ciPkgs = [python] ++ pyTools ++ nixTools ++ (with pkgs; [just skopeo]);
49+
devPkgs = [
50+
python
51+
]
52+
++ pyTools
53+
++ nixTools
54+
++ (with pkgs; [
55+
just
56+
pre-commit
57+
]);
58+
ciPkgs = [
59+
python
60+
]
61+
++ pyTools
62+
++ nixTools
63+
++ (with pkgs; [
64+
just
65+
skopeo
66+
]);
4167

42-
43-
workspace = uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ./.;};
44-
overlay = workspace.mkPyprojectOverlay {sourcePreference = "wheel";};
45-
pythonSet = (pkgs.callPackage pyproject-nix.build.packages {inherit python;}).overrideScope (
46-
nixpkgs.lib.composeManyExtensions [pyproject-build-systems.overlays.default overlay]
68+
workspace = uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./.; };
69+
overlay = workspace.mkPyprojectOverlay { sourcePreference = "wheel"; };
70+
pythonSet = (pkgs.callPackage pyproject-nix.build.packages { inherit python; }).overrideScope (
71+
nixpkgs.lib.composeManyExtensions [
72+
pyproject-build-systems.overlays.default
73+
overlay
74+
]
4775
);
4876
venvCI = pythonSet.mkVirtualEnv "volt-env-ci" workspace.deps.all;
4977
venvRelease = pythonSet.mkVirtualEnv "volt-env-release" workspace.deps.optionals;
50-
app = (pkgs.callPackages pyproject-nix.build.util {}).mkApplication {
78+
app = (pkgs.callPackages pyproject-nix.build.util { }).mkApplication {
5179
venv = venvRelease;
5280
package = pythonSet.volt;
5381
};
54-
in {
82+
in
83+
{
5584
apps = {
5685
default = {
5786
type = "app";
5887
program = "${venvRelease}/bin/${app.pname}";
5988
};
6089
};
6190
devShells = {
62-
ci = pkgs.mkShellNoCC {packages = ciPkgs ++ [venvCI];};
91+
ci = pkgs.mkShellNoCC { packages = ciPkgs ++ [ venvCI ]; };
6392
default = pkgs.mkShell rec {
64-
nativeBuildInputs = [python.pkgs.venvShellHook];
93+
nativeBuildInputs = [ python.pkgs.venvShellHook ];
6594
packages = devPkgs;
6695
env = {
6796
UV_PYTHON_DOWNLOADS = "never";
@@ -79,36 +108,31 @@
79108
'';
80109
};
81110
};
82-
formatter = pkgs.alejandra;
83-
packages = let
84-
readFileOr = path: default:
85-
with builtins;
86-
if pathExists path
87-
then (readFile path)
88-
else default;
89-
imgTag =
90-
if app.version != "0.0.dev0"
91-
then app.version
92-
else "latest";
93-
imgAttrs = rec {
94-
name = "ghcr.io/bow/${app.pname}";
95-
tag = imgTag;
96-
contents = [app];
97-
config = {
98-
Entrypoint = ["/bin/${app.pname}"];
99-
Labels = {
100-
"org.opencontainers.image.revision" = readFileOr "${self}/.rev" "";
101-
"org.opencontainers.image.source" = "https://github.com/bow/${app.pname}";
102-
"org.opencontainers.image.title" = "${app.pname}";
103-
"org.opencontainers.image.url" = "https://${name}";
111+
formatter = pkgs.nixfmt-rfc-style;
112+
packages =
113+
let
114+
readFileOr = path: default: with builtins; if pathExists path then (readFile path) else default;
115+
imgTag = if app.version != "0.0.dev0" then app.version else "latest";
116+
imgAttrs = rec {
117+
name = "ghcr.io/bow/${app.pname}";
118+
tag = imgTag;
119+
contents = [ app ];
120+
config = {
121+
Entrypoint = [ "/bin/${app.pname}" ];
122+
Labels = {
123+
"org.opencontainers.image.revision" = readFileOr "${self}/.rev" "";
124+
"org.opencontainers.image.source" = "https://github.com/bow/${app.pname}";
125+
"org.opencontainers.image.title" = "${app.pname}";
126+
"org.opencontainers.image.url" = "https://${name}";
127+
};
104128
};
105129
};
130+
in
131+
{
132+
default = venvRelease;
133+
dockerArchive = pkgs.dockerTools.buildLayeredImage imgAttrs;
134+
dockerArchiveStreamer = pkgs.dockerTools.streamLayeredImage imgAttrs;
106135
};
107-
in {
108-
default = venvRelease;
109-
dockerArchive = pkgs.dockerTools.buildLayeredImage imgAttrs;
110-
dockerArchiveStreamer = pkgs.dockerTools.streamLayeredImage imgAttrs;
111-
};
112136
}
113137
);
114138
}

0 commit comments

Comments
 (0)