nix: initial tooling setup

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ib47aeafee9474f491cfebddd3fa935826a6a6964
This commit is contained in:
raf 2025-11-02 19:53:22 +03:00
commit 2c4cf83f47
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
3 changed files with 114 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

43
flake.lock generated Normal file
View file

@ -0,0 +1,43 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1760924934,
"narHash": "sha256-tuuqY5aU7cUkR71sO2TraVKK2boYrdW3gCSXUkF4i44=",
"owner": "ipetkov",
"repo": "crane",
"rev": "c6b4d5308293d0d04fcfeee92705017537cad02f",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1761880412,
"narHash": "sha256-QoJjGd4NstnyOG4mm4KXF+weBzA2AH/7gn1Pmpfcb0A=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a7fc11be66bdfb5cdde611ee5ce381c183da8386",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"crane": "crane",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

70
flake.nix Normal file
View file

@ -0,0 +1,70 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
};
outputs = {
nixpkgs,
crane,
...
}: let
# FIXME: allow multi-system when I can be arsed to write the abstractions
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.mkLib pkgs;
src = craneLib.cleanCargoSource ./.;
commonArgs = {
pname = "feel-ci";
inherit src;
strictDeps = true;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
# Build individual workspace members
server = craneLib.buildPackage (commonArgs
// {
inherit cargoArtifacts;
pname = "server";
cargoExtraArgs = "--package server";
});
evaluator = craneLib.buildPackage (commonArgs
// {
inherit cargoArtifacts;
pname = "evaluator";
cargoExtraArgs = "--package evaluator";
});
queue-runner = craneLib.buildPackage (commonArgs
// {
inherit cargoArtifacts;
pname = "queue-runner";
cargoExtraArgs = "--package queue-runner";
});
common = craneLib.buildPackage (commonArgs
// {
inherit cargoArtifacts;
pname = "common";
cargoExtraArgs = "--package common";
});
in {
packages.${system} = {
inherit server evaluator queue-runner common;
};
devShells.${system}.default = craneLib.devShell {
name = "fc";
inputsFrom = [server];
packages = with pkgs; [
rust-analyzer
postgresql
pkg-config
openssl
];
};
};
}