nix packaging

This commit is contained in:
Stephen D 2025-01-29 17:14:22 -05:00
parent 327f7418a0
commit 914d67a8dd
3 changed files with 119 additions and 0 deletions

61
flake.lock generated Normal file
View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1738023785,
"narHash": "sha256-BPHmb3fUwdHkonHyHi1+x89eXB3kA1jffIpwPVJIVys=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2b4230bf03deb33103947e2528cac2ed516c5c89",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

32
flake.nix Normal file
View File

@ -0,0 +1,32 @@
{
description = "Cargo wrapper that calls you a good girl if your commands succeed (but only after they fail)";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages = rec {
cargo-gg = pkgs.callPackage ./nix/package.nix { };
default = cargo-gg;
};
devShells.default = pkgs.mkShell {
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
inputsFrom = builtins.attrValues self.packages.${system};
nativeBuildInputs = [
pkgs.rustfmt
pkgs.clippy
];
};
}
);
}

26
nix/package.nix Normal file
View File

@ -0,0 +1,26 @@
{
lib,
rustPlatform,
protobuf,
}:
let
ignoredPaths = [
"nix"
"flake.nix"
"flake.lock"
];
in
rustPlatform.buildRustPackage {
pname = "cargo-gg";
version = "0.1.1";
src = lib.cleanSourceWith {
filter = name: _: !(builtins.elem (baseNameOf name) ignoredPaths);
src = lib.cleanSource ../.;
};
cargoLock.lockFile = ../Cargo.lock;
# skips rebuilding the whole thing with debug info
doCheck = false;
}