atagen

jelq

public

an http based roguelike rpg about jelqing

Star0
Watch0

Commit d2e314cf03d5

tarball

atagen <boss@atagen.co>2026-10-10 15:15 UTC

2 files changed+71-99
nix: replace crane and flake-utils with nixpkgs buildRustPackage

Crane's source filter also needed patching to keep ui.html, and both inputs added lockfile weight for no gain over buildRustPackage and a pkgsFor/forAllSystems pair.
Modified file: flake.lock−50 deletions
@@ -1,38 +1,5 @@
11 {
22 "nodes": {
3- "crane": {
4- "locked": {
5- "lastModified": 1790899423,
6- "narHash": "sha256-THGtz65UGJU+sonZidRboyCMk+9DclpMF7pwL4uDV4M=",
7- "owner": "ipetkov",
8- "repo": "crane",
9- "rev": "47b6b27ed9a3a9181415e4367d0c30ab2a0e0250",
10- "type": "github"
11- },
12- "original": {
13- "owner": "ipetkov",
14- "repo": "crane",
15- "type": "github"
16- }
17- },
18- "flake-utils": {
19- "inputs": {
20- "systems": "systems"
21- },
22- "locked": {
23- "lastModified": 1731533236,
24- "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
25- "owner": "numtide",
26- "repo": "flake-utils",
27- "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
28- "type": "github"
29- },
30- "original": {
31- "owner": "numtide",
32- "repo": "flake-utils",
33- "type": "github"
34- }
35- },
363 "nixpkgs": {
374 "locked": {
385 "lastModified": 1791456040,
@@ -51,25 +18,8 @@
5118 },
5219 "root": {
5320 "inputs": {
54- "crane": "crane",
55- "flake-utils": "flake-utils",
5621 "nixpkgs": "nixpkgs"
5722 }
58- },
59- "systems": {
60- "locked": {
61- "lastModified": 1681028828,
62- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
63- "owner": "nix-systems",
64- "repo": "default",
65- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
66- "type": "github"
67- },
68- "original": {
69- "owner": "nix-systems",
70- "repo": "default",
71- "type": "github"
72- }
7323 }
7424 },
7525 "root": "root",
Modified file: flake.nix+71 additions−49 deletions
@@ -1,71 +1,93 @@
11 {
22 description = "jelqd, a roguelike played entirely over HTTP";
33
4- inputs = {
5- nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6- crane.url = "github:ipetkov/crane";
7- flake-utils.url = "github:numtide/flake-utils";
8- };
4+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
95
106 outputs =
7+ { self, nixpkgs }:
8+ let
9+ inherit (nixpkgs) lib;
10+ systems = [
11+ "x86_64-linux"
12+ "aarch64-linux"
13+ "x86_64-darwin"
14+ "aarch64-darwin"
15+ ];
16+ pkgsFor = lib.genAttrs systems (system: nixpkgs.legacyPackages.${system});
17+ forAllSystems = f: lib.genAttrs systems (system: f pkgsFor.${system});
18+
19+ src = lib.fileset.toSource {
20+ root = ./.;
21+ fileset = lib.fileset.unions [
22+ ./Cargo.toml
23+ ./Cargo.lock
24+ ./src
25+ ./tests
26+ ];
27+ };
28+ in
1129 {
12- self,
13- nixpkgs,
14- crane,
15- flake-utils,
16- }:
17- flake-utils.lib.eachDefaultSystem (
18- system:
19- let
20- pkgs = nixpkgs.legacyPackages.${system};
21- craneLib = crane.mkLib pkgs;
22- src = pkgs.lib.cleanSourceWith {
23- src = ./.;
24- filter = path: type: pkgs.lib.hasSuffix ".html" path || craneLib.filterCargoSources path type;
25- };
26- commonArgs = {
30+ packages = forAllSystems (pkgs: {
31+ default = pkgs.rustPlatform.buildRustPackage {
32+ pname = "jelqd";
33+ version = "0.6.9";
2734 inherit src;
28- strictDeps = true;
35+ cargoLock.lockFile = ./Cargo.lock;
36+ meta.mainProgram = "jelqd";
2937 };
30- cargoArtifacts = craneLib.buildDepsOnly commonArgs;
31- jelqd = craneLib.buildPackage (
32- commonArgs
33- // {
34- inherit cargoArtifacts;
35- meta.mainProgram = "jelqd";
36- }
37- );
38- in
39- {
40- packages.default = jelqd;
38+ });
4139
42- apps.default = flake-utils.lib.mkApp { drv = jelqd; } // {
40+ apps = forAllSystems (pkgs: {
41+ default = {
42+ type = "app";
43+ program = lib.getExe self.packages.${pkgs.stdenv.hostPlatform.system}.default;
4344 meta.description = "Run the jelqd server";
4445 };
46+ });
4547
46- checks = {
48+ checks = forAllSystems (
49+ pkgs:
50+ let
51+ jelqd = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
52+ in
53+ {
4754 inherit jelqd;
48- clippy = craneLib.cargoClippy (
49- commonArgs
50- // {
51- inherit cargoArtifacts;
52- cargoClippyExtraArgs = "--all-targets -- --deny warnings";
53- }
54- );
55- fmt = craneLib.cargoFmt { inherit src; };
56- test = craneLib.cargoTest (commonArgs // { inherit cargoArtifacts; });
57- };
55+ clippy = jelqd.overrideAttrs (old: {
56+ pname = "jelqd-clippy";
57+ nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.clippy ];
58+ buildPhase = "cargo clippy --offline --all-targets -- --deny warnings";
59+ doCheck = false;
60+ installPhase = "touch $out";
61+ });
62+ fmt =
63+ pkgs.runCommand "jelqd-fmt"
64+ {
65+ nativeBuildInputs = [
66+ pkgs.cargo
67+ pkgs.rustfmt
68+ ];
69+ }
70+ ''
71+ cd ${src}
72+ cargo fmt --check
73+ touch $out
74+ '';
75+ }
76+ );
5877
59- devShells.default = craneLib.devShell {
60- checks = self.checks.${system};
78+ devShells = forAllSystems (pkgs: {
79+ default = pkgs.mkShell {
80+ inputsFrom = [ self.packages.${pkgs.stdenv.hostPlatform.system}.default ];
6181 packages = [
82+ pkgs.clippy
83+ pkgs.rustfmt
6284 pkgs.rust-analyzer
6385 pkgs.nushell
6486 pkgs.curl
6587 ];
6688 };
89+ });
6790
68- formatter = pkgs.nixfmt;
69- }
70- );
91+ formatter = forAllSystems (pkgs: pkgs.nixfmt);
92+ };
7193 }