Add skidder-cli to nix flake outputs

This commit is contained in:
Ross Smyth
2025-05-14 13:03:34 -04:00
committed by Michael Davis
parent 778853ae64
commit ed7e6634d8
3 changed files with 63 additions and 26 deletions

35
default.nix Normal file
View File

@@ -0,0 +1,35 @@
{
lib,
rustPlatform,
}: let
fs = lib.fileset;
files = fs.difference (fs.gitTracked ./.) (fs.unions [
./.github
./.envrc
./flake.lock
(fs.fileFilter (file: lib.strings.hasInfix ".git" file.name) ./.)
(fs.fileFilter (file: file.hasExt "md") ./.)
(fs.fileFilter (file: file.hasExt "nix") ./.)
]);
in
rustPlatform.buildRustPackage {
strictDeps = true;
pname = with builtins; (fromTOML (readFile ./cli/Cargo.toml)).package.name;
version = with builtins; (fromTOML (readFile ./cli/Cargo.toml)).package.version;
src = fs.toSource {
root = ./.;
fileset = files;
};
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
cargoBuildFlags = [ "-p skidder-cli" ];
doCheck = false;
meta.mainProgram = "skidder-cli";
}

32
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1738680400,
"narHash": "sha256-ooLh+XW8jfa+91F1nhf9OF7qhuA/y1ChLx6lXDNeY5U=",
"lastModified": 1746904237,
"narHash": "sha256-3e+AVBczosP5dCLQmMoMEogM57gmZ2qrVSrmq9aResQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "799ba5bffed04ced7067a91798353d360788b30d",
"rev": "d89fc19e405cb2d55ce7cc114356846a0ee5e956",
"type": "github"
},
"original": {
@@ -16,22 +16,6 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1736320768,
"narHash": "sha256-nIYdTAiKIGnFNugbomgBJR+Xv5F1ZQU+HfaBqJKroC0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4bc9c909d9ac828a039f288cf872d16d38185db8",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
@@ -40,14 +24,16 @@
},
"rust-overlay": {
"inputs": {
"nixpkgs": "nixpkgs_2"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1738808867,
"narHash": "sha256-m5rbY/ck0NAlfSBxo++vl7EZn8fkZ02H3kGGc7q883c=",
"lastModified": 1747190175,
"narHash": "sha256-s33mQ2s5L/2nyllhRTywgECNZyCqyF4MJeM3vG/GaRo=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "ae46f37fb727030ddc2ef65a675b751484c90032",
"rev": "58160be7abad81f6f8cb53120d5b88c16e01c06d",
"type": "github"
},
"original": {

View File

@@ -3,22 +3,38 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ nixpkgs, rust-overlay, ... }:
{ self, nixpkgs, rust-overlay }:
let
inherit (nixpkgs) lib;
forEachSystem = lib.genAttrs lib.systems.flakeExposed;
in
{
packages = forEachSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
toolchain = pkgs.rust-bin.stable.latest.default;
in {
skidder-cli = pkgs.callPackage ./. { };
default = self.packages.${system}.skidder-cli;
});
devShell = forEachSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
overlays = [ (import rust-overlay) ];
};
toolchain = pkgs.rust-bin.stable.latest.default;
in