Skip to content

Commit

Permalink
Don't use flake-parts here
Browse files Browse the repository at this point in the history
It only provides a very minor benefit and can easily be replaced with
a manual approach. That should address
hercules-ci/flake-parts#252.
  • Loading branch information
antifuchs committed Sep 17, 2024
1 parent 3bc5be2 commit 734979e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 105 deletions.
65 changes: 1 addition & 64 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 46 additions & 41 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,56 @@
description = "Regenerate go module vendorHashes from inputs.";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.tailscale.url = "github:tailscale/tailscale";

outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} ({
withSystem,
flake-parts-lib,
...
}: let
inherit (flake-parts-lib) importApply;
in {
systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];

perSystem = {
config,
self',
inputs',
pkgs,
...
}: {
formatter = pkgs.alejandra;
outputs = {
self,
nixpkgs,
tailscale,
}: let
systems = [
"aarch64-darwin"
"aarch64-linux"
"riscv64-linux"
"x86_64-darwin"
"x86_64-linux"
];
eachSystem = f:
nixpkgs.lib.genAttrs systems (
system:
f rec {
inherit system;
pkgs = nixpkgs.legacyPackages.${system};
devshell = import ./. {nixpkgs = pkgs;};
}
);
in {
formatter = eachSystem ({pkgs, ...}: pkgs.alejandra);

packages = {
default = config.packages.nardump;
nardump = pkgs.buildGo123Module rec {
pname = "nardump";
version = inputs.tailscale.rev;
src = "${inputs.tailscale}/cmd/nardump";
vendorHash = null;
packages = eachSystem ({
system,
pkgs,
...
}: {
default = self.packages.${system}.nardump;
nardump = pkgs.buildGo123Module rec {
pname = "nardump";
version = tailscale.rev;
src = "${tailscale}/cmd/nardump";
vendorHash = null;

# Fake up a go module inside the nardump dir, so we don't
# have to download & cache the entirety of tailscale's
# deps:
prePatch = ''
cat >go.mod <<EOF
module github.com/tailscale/tailscale/cmd/nardump
go 1.23.0
require ()
EOF
'';
};
};
};
flake = {
flakeModules.default = ./flake-module.nix;
# Fake up a go module inside the nardump dir, so we don't
# have to download & cache the entirety of tailscale's
# deps:
prePatch = ''
cat >go.mod <<EOF
module github.com/tailscale/tailscale/cmd/nardump
go 1.23.0
require ()
EOF
'';
};
});
flakeModules.default = ./flake-module.nix;
};
}

0 comments on commit 734979e

Please sign in to comment.