Skip to content

[nix] cross-compile cmd/cli using flake.nix.#292

Open
c4lliope wants to merge 1 commit intorailwayapp:mainfrom
c4lliope:nix
Open

[nix] cross-compile cmd/cli using flake.nix.#292
c4lliope wants to merge 1 commit intorailwayapp:mainfrom
c4lliope:nix

Conversation

@c4lliope
Copy link
Copy Markdown

(... a small missing piece.)

largely based on: https://wiki.nixos.org/wiki/Go
depends on: https://github.com/numtide/flake-utils

@c4lliope
Copy link
Copy Markdown
Author

oh, I'm a lil silly. I kept the fetchFromGitHub which I was using for a local build. This should use a normal path. Hold up!

@c4lliope
Copy link
Copy Markdown
Author

Yep. There ya go.

For anyone else, until this is merged, import this module to your home-manager profile:

# railpack.home.nix
{ pkgs, edge, ... }: let
  railpack = pkgs.buildGoModule rec {
    pname = "railpack";
    version = "0.9.0";
    subPackages = [ "cmd/cli" ];
    src = pkgs.fetchFromGitHub {
      owner = "railwayapp";
      repo = "railpack";
      rev = "v${version}";
      sha256 = "sha256-7aXv4g1/Bqovq9JMKpH+wYx2JPeklurnZzQmlMaRUXc=";
    };
    vendorHash = "sha256-bn6GsJBRg4S5IWBShlYXk12nNuAnv4MmKZvxE0sujT8=";
  };
in {
  programs.mise = {
    enable = true;
    # enableNushellIntegration = false;
  };

  home.packages =  with pkgs; [
  (pkgs.writeShellScriptBin "railpack" "exec -a $0 ${railpack}/bin/cli $@")
  ];
}

The one mise line is commented because this clobbered my prior nushell env.nu, see: https://home-manager-options.extranix.com/?query=programs.mise&release=release-25.05

@c4lliope
Copy link
Copy Markdown
Author

huh.... is there an ENV var we can use to pass in the NixOS-packaged mise path?

➜ railpack b .

╭──────────────╮
│ Railpack dev │
╰──────────────╯

  ✖ Failed to ensure mise is installed: failed to validate installation: failed to run version check: exit status 127



❄ calliope@chesapeake:  …/radicale   nix !+?     20:59 

❄ calliope@chesapeake:  …/radicale   nix !+?     20:59 
➜ railpack b .

╭──────────────╮
│ Railpack dev │
╰──────────────╯

  ↳ Detected Python
  ⚠ Failed to get package versions from mise: failed to get package versions: failed to run mise command '/tmp/railpack/mise/mise-2025.10.4 --cd /home/calliope/disc/nvme0n1p6/code/kozea/radicale list --current --json': exit status 127


  Could not start dynamically linked executable: /tmp/railpack/mise/mise-2025.10.4
  NixOS cannot run dynamically linked executables intended for generic
  linux environments out of the box. For more information, see:
  https://nix.dev/permalink/stub-ld

  ✖ Failed to run mise command '/tmp/railpack/mise/mise-2025.10.4 latest python@3.13': exit status 127


  Could not start dynamically linked executable: /tmp/railpack/mise/mise-2025.10.4
  NixOS cannot run dynamically linked executables intended for generic
  linux environments out of the box. For more information, see:
  https://nix.dev/permalink/stub-ld

@iloveitaly
Copy link
Copy Markdown
Collaborator

iloveitaly commented Oct 18, 2025

@c4lliope railpack doesn't use nix—did you intent to submit this PR to railpack? Let me know what I'm missing!

Copy link
Copy Markdown
Contributor

@coffee-cup coffee-cup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we merge this then the release action

Comment thread flake.nix
in {
packages.default = pkgs.buildGoModule {
pname = "railpack";
version = "0.9.0";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release action should be updated to bump this, otherwise it will always be out of date

@coffee-cup
Copy link
Copy Markdown
Contributor

railpack doesn't use nix—did you intent to submit this PR to railpack? Let me know what I'm missing!

I think this is so people can install Railpack with Nix.

is there an ENV var we can use to pass in the NixOS-packaged mise path?

@c4lliope there is not, but we can add one. What would you expect it to be?

@c4lliope
Copy link
Copy Markdown
Author

Sorry to drop comms, I'm at https://www.dcstw.com/ and the schedule is packed!

@iloveitaly
Copy link
Copy Markdown
Collaborator

@c4lliope friendly bump here! Would be great to get this merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants