mirror of
https://github.com/go-gitea/gitea.git
synced 2025-11-08 13:37:28 -05:00
`flake-utils` is currently only used for outputting system-specific dev shells. This can actually be achieved only using functionality already present within `nixpkgs`, thus there is no need for an extra dependency. Additionally, we move to use the `packages` and `env` args for `mkShell` to more clearly outline what they are used for. --- Further reading: https://determinate.systems/blog/best-practices-for-nix-at-work/#avoid-flake-helper-libraries-if-possible As a side note, using `with` to import large scopes is [discouraged by official Nix resources](https://nix.dev/guides/best-practices#with-scopes), so an alternative approach to list installed packages could be something like this: ```nix packages = (builtins.attrValues { inherit (pkgs) # generic git git-lfs gnumake gnused gnutar gzip zip # frontend cairo pixman pkg-config # linting uv # backend gofumpt sqlite ; inherit # frontend nodejs pnpm # linting python3 # backend go ; }) ++ linuxOnlyInputs; ``` But I saw this as too pedantic to include in the initial PR. Co-authored-by: 6543 <6543@obermui.de>
95 lines
2.2 KiB
Nix
95 lines
2.2 KiB
Nix
{
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
|
};
|
|
outputs =
|
|
{ nixpkgs, ... }:
|
|
let
|
|
supportedSystems = [
|
|
"aarch64-darwin"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"x86_64-linux"
|
|
];
|
|
|
|
forEachSupportedSystem =
|
|
f:
|
|
nixpkgs.lib.genAttrs supportedSystems (
|
|
system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
};
|
|
in
|
|
f { inherit pkgs; }
|
|
);
|
|
in
|
|
{
|
|
devShells = forEachSupportedSystem (
|
|
{ pkgs, ... }:
|
|
{
|
|
default =
|
|
let
|
|
inherit (pkgs) lib;
|
|
|
|
# only bump toolchain versions here
|
|
go = pkgs.go_1_25;
|
|
nodejs = pkgs.nodejs_24;
|
|
python3 = pkgs.python312;
|
|
pnpm = pkgs.pnpm_10;
|
|
|
|
# Platform-specific dependencies
|
|
linuxOnlyInputs = lib.optionals pkgs.stdenv.isLinux [
|
|
pkgs.glibc.static
|
|
];
|
|
|
|
linuxOnlyEnv = lib.optionalAttrs pkgs.stdenv.isLinux {
|
|
CFLAGS = "-I${pkgs.glibc.static.dev}/include";
|
|
LDFLAGS = "-L ${pkgs.glibc.static}/lib";
|
|
};
|
|
in
|
|
pkgs.mkShell {
|
|
packages =
|
|
with pkgs;
|
|
[
|
|
# generic
|
|
git
|
|
git-lfs
|
|
gnumake
|
|
gnused
|
|
gnutar
|
|
gzip
|
|
zip
|
|
|
|
# frontend
|
|
nodejs
|
|
pnpm
|
|
cairo
|
|
pixman
|
|
pkg-config
|
|
|
|
# linting
|
|
python3
|
|
uv
|
|
|
|
# backend
|
|
go
|
|
gofumpt
|
|
sqlite
|
|
]
|
|
++ linuxOnlyInputs;
|
|
|
|
env = {
|
|
GO = "${go}/bin/go";
|
|
GOROOT = "${go}/share/go";
|
|
|
|
TAGS = "sqlite sqlite_unlock_notify";
|
|
STATIC = "true";
|
|
}
|
|
// linuxOnlyEnv;
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|