Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use globset to specify src for nix-snapshotter #148

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions flake.lock

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

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
globset = {
url = "github:pdtpartners/globset";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
Expand Down
31 changes: 15 additions & 16 deletions modules/flake/overlays.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
{ self, inputs, ... }:
{
# Provide overlay to add `nix-snapshotter`.
flake.overlays.default = self: super:
let

in {
nix-snapshotter = self.callPackage ../../package.nix {};
flake.overlays.default = self: super: {
nix-snapshotter = self.callPackage ../../package.nix {
inherit (inputs) globset;
};

k3s = super.k3s_1_30.override {
buildGoModule = args: super.buildGoModule (args // super.lib.optionalAttrs (args.pname != "k3s-cni-plugins" && args.pname != "k3s-containerd") {
vendorHash = {
"sha256-XtTahFaWnuHzKDI/U4d/j4C4gRxH163MCGEEM4hu/WM=" = "sha256-XuMP+ffwTdXKL9q9+ZJUQc5ghGEcdY9UdefjCD19OUE=";
"sha256-Mj9Q3TgqZoJluG4/nyuw2WHnB3OJ+/mlV7duzWt1B1A=" = "sha256-9i0vY+CqrLDKYBZPooccX7OtFhS3//mpKTLntvPYDJo=";
}.${args.vendorHash};
patches = (args.patches or []) ++ [
./patches/k3s-nix-snapshotter.patch
];
});
};
k3s = super.k3s_1_30.override {
buildGoModule = args: super.buildGoModule (args // super.lib.optionalAttrs (args.pname != "k3s-cni-plugins" && args.pname != "k3s-containerd") {
vendorHash = {
"sha256-XtTahFaWnuHzKDI/U4d/j4C4gRxH163MCGEEM4hu/WM=" = "sha256-XuMP+ffwTdXKL9q9+ZJUQc5ghGEcdY9UdefjCD19OUE=";
"sha256-Mj9Q3TgqZoJluG4/nyuw2WHnB3OJ+/mlV7duzWt1B1A=" = "sha256-9i0vY+CqrLDKYBZPooccX7OtFhS3//mpKTLntvPYDJo=";
}.${args.vendorHash};
patches = (args.patches or []) ++ [
./patches/k3s-nix-snapshotter.patch
];
});
};
};

perSystem = { system, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
Expand Down
12 changes: 7 additions & 5 deletions package.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, buildGoModule
, closureInfo
, globset
, runCommand
, writeShellScriptBin
, writeText
Expand All @@ -9,13 +10,14 @@
let
nix-snapshotter = buildGoModule {
pname = "nix-snapshotter";
version = "0.2.0";
src = lib.cleanSourceWith {
src = lib.sourceFilesBySuffices ./. [
".go"
version = "0.2.1";
src = lib.fileset.toSource {
root = ./.;
fileset = globset.lib.globs ./. [
"**/*.go"
"**/*.tar"
"go.mod"
"go.sum"
".tar"
];
};
vendorHash = "sha256-QBLePOnfsr6I19ddyZNSFDih6mCaZ/NV2Qz1B1pSHxs=";
Expand Down
Loading