GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — coder/flake.nix at main · coder/coder Expand file tree/ Copy pathflake.nixMore file actions 452 lines (417 loc) · 15 KB / Copy pathflake.nixFile metadata and controls452 lines (417 loc) · 15 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 { description = "Development environments on your infrastructure"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-pinned.url = "github:nixos/nixpkgs/5deee6281831847857720668867729617629ef1f"; flake-utils.url = "github:numtide/flake-utils"; pnpm2nix = { url = "github:ThomasK33/pnpm2nix-nzbr"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; drpc = { url = "github:storj/drpc/v0.0.34"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-utils.follows = "flake-utils"; }; }; outputs = { self, nixpkgs, nixpkgs-pinned, nixpkgs-unstable, flake-utils, drpc, pnpm2nix, }: flake-utils.lib.eachDefaultSystem ( system: let pkgs = import nixpkgs { inherit system; # Workaround for: google-chrome has an unfree license (‘unfree’), refusing to evaluate. config.allowUnfree = true; }; # pinnedPkgs is used to pin packages that need to stay in sync with CI. # Everything else uses unstable. pinnedPkgs = import nixpkgs-pinned { inherit system; }; unstablePkgs = import nixpkgs-unstable { inherit system; # Workaround for: terraform has an unfree license (‘bsl11’), refusing to evaluate. config.allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [ "terraform" ]; }; formatter = pkgs.nixfmt-rfc-style; nodejs = unstablePkgs.nodejs_22; pnpm = pkgs.pnpm_10.override { inherit nodejs; # Ensure it points to the above nodejs version }; mise = pkgs.stdenvNoCC.mkDerivation rec { pname = "mise"; version = "2026.10.25"; target = { x86_64-linux = "linux-x64"; aarch64-linux = "linux-arm64"; x86_64-darwin = "macos-x64"; aarch64-darwin = "macos-arm64"; }.${system}; src = pkgs.fetchurl { url = "https://github.com/jdx/mise/releases/download/v${version}/mise-v${version}-${target}"; hash = { x86_64-linux = "sha256-XTYuzFeNx8FGZ5uEHdqUnWRyy/hv9WNdt6/cobaz/Yc="; aarch64-linux = "sha256-uwnoixMWTKkGkaXMBCcm0HnwuiarVVJzRMsXPC6DyZg="; x86_64-darwin = "sha256-4G6z8DEd7b9llS7CwCRzmISGU7MC5qrZnXNxrZujMwE="; aarch64-darwin = "sha256-ij7wB2WwCSeBl6umJ6wA1unGP2rrBNT0ss/g5Z3cL9Y="; }.${system}; }; dontUnpack = true; installPhase = '' install -Dm755 "$src" "$out/bin/mise" ''; }; # Check in https://search.nixos.org/packages to find new packages. # Use `nix --extra-experimental-features nix-command --extra-experimental-features flakes flake update` # to update the lock file if packages are out-of-date. # From https://nixos.wiki/wiki/Google_Cloud_SDK gdk = pkgs.google-cloud-sdk.withExtraComponents [ pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin ]; proto_gen_go_1_30 = pkgs.buildGoModule rec { name = "protoc-gen-go"; owner = "protocolbuffers"; repo = "protobuf-go"; rev = "v1.30.0"; src = pkgs.fetchFromGitHub { inherit owner repo rev; # Updated with ./scripts/update-flake.sh`. sha256 = "sha256-GTZQ40uoi62Im2F4YvlZWiSNNJ4fEAkRojYa0EYz9HU="; }; subPackages = [ "cmd/protoc-gen-go" ]; vendorHash = null; }; # Keep protoc aligned with mise.toml so local Nix shells use # the same codegen tool version as CI and release workflows, # regardless of nixpkgs channel defaults. protobuf_23_4 = let releases = { x86_64-linux = { platform = "linux-x86_64"; hash = "sha256-BQLyhqye2GC2KaeWWhRSex8t0THkKD+iPC1/GEZyqpo="; }; aarch64-linux = { platform = "linux-aarch_64"; hash = "sha256-HHdQtuA4MFtaf8PQzaHr798Qak8wp4e/gm7S/EfDln0="; }; aarch64-darwin = { platform = "osx-aarch_64"; hash = "sha256-jHr66GJraBHntYl9FtlAwtv1Cx4TXtlYoB22VmvdpyY="; }; x86_64-darwin = { platform = "osx-x86_64"; hash = "sha256-B+X9zxsHCNM2fcXm640TXefkB9dTFskxVc/YqzYu7IA="; }; }; target = releases.${system} or null; in if target != null then pkgs.runCommand "protobuf-23.4" { nativeBuildInputs = [ pkgs.unzip ]; src = pkgs.fetchurl { url = "https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-${target.platform}.zip"; hash = target.hash; }; } '' mkdir -p "$out" cd "$out" unzip "$src" chmod +x "$out/bin/protoc" '' else throw "protobuf 23.4 is not defined for ${system}"; # Custom sqlc build from coder/sqlc fork to fix ambiguous column bug, see: # - https://github.com/coder/sqlc/pull/1 # - https://github.com/sqlc-dev/sqlc/pull/4159 # # To update hashes: # 1. Run: `nix --extra-experimental-features 'nix-command flakes' build .#devShells.x86_64-linux.default` # 2. Nix will fail with the correct sha256 hash for src # 3. Update the sha256 and run again # 4. Nix will fail with the correct vendorHash # 5. Update the vendorHash sqlc-custom = unstablePkgs.buildGo126Module { pname = "sqlc"; version = "coder-fork-337309bfb9524f38466a5090e310040fc7af0203"; src = pkgs.fetchFromGitHub { owner = "coder"; repo = "sqlc"; rev = "337309bfb9524f38466a5090e310040fc7af0203"; sha256 = "sha256-i8hZaaMlNJyW0hUWYcuNqUcwRdQU747055OknZsJ9Es="; }; subPackages = [ "cmd/sqlc" ]; vendorHash = "sha256-4Cb15MhKyhRvYVKfMqBwuC3WBBIJE6AinJt02+TSMVY="; }; paralleltestctx = unstablePkgs.buildGo126Module { pname = "paralleltestctx"; version = "0.0.2-unstable-2026-10-20"; src = pkgs.fetchFromGitHub { owner = "coder"; repo = "paralleltestctx"; rev = "95009df793fb85bcbe71628e6dded30e5cfdb3c3"; sha256 = "sha256-8uvRRSDPgXGtSL5YFdd5gxPAt0d9jXZ+kPivrkkgI7c="; }; subPackages = [ "cmd/paralleltestctx" ]; vendorHash = "sha256-gWFc1Cm+UMNcvBxUgyVrreFXbwR8rwac4L2QBUDKo6M="; }; # Keep this pin aligned with mise.toml when updating Terraform. terraform_1_15_5 = let releases = { x86_64-linux = { platform = "linux_amd64"; hash = "sha256-RjhigFjnGlUhKxxWNxLqwDuQISj0B0Dz3IF03xITUGE="; }; aarch64-linux = { platform = "linux_arm64"; hash = "sha256-mI6VChwjBYCTsOZqstX7U/wYNF7PvVhxrPUduskyXt0="; }; aarch64-darwin = { platform = "darwin_arm64"; hash = "sha256-seyz/g0KApDBq2+D2WfUPyXaBdC2ce4Ps1UlImjc6Vo="; }; x86_64-darwin = { platform = "darwin_amd64"; hash = "sha256-/ekjh8+cDedCVQA8hSkfj77eVFhcENBjXKekNjPU0XE="; }; }; target = releases.${system} or null; in if target != null then pkgs.runCommand "terraform-1.17.1" { nativeBuildInputs = [ pkgs.unzip ]; src = pkgs.fetchurl { url = "https://releases.hashicorp.com/terraform/1.17.1/terraform_1.17.1_${target.platform}.zip"; hash = target.hash; }; } '' mkdir -p "$out/bin" unzip -p "$src" terraform > "$out/bin/terraform" chmod +x "$out/bin/terraform" '' else unstablePkgs.terraform; # Packages required to build the frontend frontendPackages = with pkgs; [ cairo pango pixman libpng libjpeg giflib librsvg python312Packages.setuptools # Needed for node-gyp ] ++ (lib.optionals stdenv.targetPlatform.isDarwin [ darwin.apple_sdk_12_3.frameworks.Foundation xcbuild ]); migrate = pkgs.go-migrate.overrideAttrs (_oldAttrs: { # Coder only needs migrate for migration creation and local Postgres # migrations. The nixpkgs default build includes every database # driver and is broken by a bad Go and driver combination, so rebuild # only with the driver we need. tags = [ "postgres" ]; }); googleChrome = if pkgs.stdenv.isLinux then pkgs.google-chrome.overrideAttrs ( finalAttrs: oldAttrs: { version = "155.0.8059.84"; src = pkgs.fetchurl { url = "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${finalAttrs.version}-1_amd64.deb"; hash = "sha256-j70q5pzffumLdRPDOWp7Xgb5dPhiX91ZDfMJHdDD6d4="; }; # Chrome no longer ships standalone ANGLE libraries. installPhase = builtins.replaceStrings [ '' # Make sure that libGL and libvulkan are found by ANGLE libGLESv2.so patchelf --set-rpath $rpath $out/share/google/$appname/lib*GL* '' ] [ "" ] oldAttrs.installPhase; } ) else pkgs.google-chrome; # The minimal set of packages to build Coder. devShellPackages = with pkgs; [ # google-chrome is not available on aarch64 linux (lib.optionalDrvAttr (!stdenv.isLinux || !stdenv.isAarch64) googleChrome) # strace is not available on OSX (lib.optionalDrvAttr (!pkgs.stdenv.isDarwin) strace) bat cairo curl cosign delve dive drpc.defaultPackage.${system} formatter fzf gawk gcc13 gdk getopt gh git git-lfs (lib.optionalDrvAttr stdenv.isLinux glibcLocales) gnumake gnused gnugrep gnutar unstablePkgs.go_1_26 gofumpt migrate (pinnedPkgs.golangci-lint) gopls gotestsum hadolint jq kubectl kubectx kubernetes-helm lazydocker lazygit less mise unstablePkgs.mockgen moreutils nfpm nix-prefetch-git nodejs openssh openssl paralleltestctx pango pixman pkg-config pnpm postgresql_16 proto_gen_go_1_30 protobuf_23_4 ripgrep rsync shellcheck (pinnedPkgs.shfmt) # sqlc sqlc-custom syft terraform_1_15_5 typos which # Needed for many LD system libs! (lib.optional stdenv.isLinux util-linux) vim wget yq-go zip zsh zstd ] ++ frontendPackages; # buildSite packages the site directory. buildSite = pnpm2nix.packages.${system}.mkPnpmPackage { inherit nodejs pnpm; src = ./site/.; # Required for the `canvas` package! extraBuildInputs = frontendPackages; installInPlace = true; distDir = "out"; }; version = "v0.0.0-nix-${self.shortRev or self.dirtyShortRev}"; # To make faster subsequent builds, you could extract the `.zst` # slim bundle into it's own derivation. buildFat = osArch: unstablePkgs.buildGo126Module { name = "coder-${osArch}"; # Updated with ./scripts/update-flake.sh`. # This should be updated whenever go.mod changes! vendorHash = "sha256-6sdvX0Wglj0CZiig2VD45JzuTcxwg7yrGoPPQUYvuqU="; proxyVendor = true; src = ./.; nativeBuildInputs = with pkgs; [ getopt openssl zstd ]; preBuild = '' # Replaces /usr/bin/env with an absolute path to the interpreter. patchShebangs ./scripts ''; buildPhase = '' runHook preBuild # Unpack the site contents. mkdir -p ./site/out ./site/node_modules/ cp -r ${buildSite.out}/* ./site/out touch ./site/node_modules/.installed # Build and copy the binary! export CODER_FORCE_VERSION=${version} # Flagging 'site/node_modules/.installed' as an old file, # as we do not want to trigger codegen during a build. make -j -o 'site/node_modules/.installed' build/coder_${osArch} ''; installPhase = '' mkdir -p $out/bin cp -r ./build/coder_${osArch} $out/bin/coder ''; }; in rec { inherit formatter; devShells = { default = (pkgs.mkShell.override ( pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin { stdenv = pkgs.overrideSDK pkgs.stdenv "12.3"; } )) { buildInputs = devShellPackages; LOCALE_ARCHIVE = with pkgs; lib.optionalDrvAttr stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive"; NODE_OPTIONS = "--max-old-space-size=8192"; GOPRIVATE = "coder.com,cdr.dev,go.coder.com,github.com/cdr,github.com/coder"; }; }; packages = { default = packages.${system}; proto_gen_go = proto_gen_go_1_30; site = buildSite; # Copying `OS_ARCHES` from the Makefile. x86_64-linux = buildFat "linux_amd64"; aarch64-linux = buildFat "linux_arm64"; x86_64-darwin = buildFat "darwin_amd64"; aarch64-darwin = buildFat "darwin_arm64"; x86_64-windows = buildFat "windows_amd64.exe"; aarch64-windows = buildFat "windows_arm64.exe"; }; } ); } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |