atagen

jelq

public

an http based roguelike rpg about jelqing

Star0
Watch0
9875fd099b4f4c894b314277210e9ecc58e98b6f
1
ssh://brewery@pls.lobotomise.me:33/atagen/jelq.git
flake.nixNix93 lines2.4 KB
1
{
2
  description = "jelqd, a roguelike played entirely over HTTP";
3
4
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
5
6
  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
26
        ];
27
      };
28
    in
29
    {
30
      packages = forAllSystems (pkgs: {
31
        default = pkgs.rustPlatform.buildRustPackage {
32
          pname = "jelqd";
33
          version = "0.6.9";
34
          inherit src;
35
          cargoLock.lockFile = ./Cargo.lock;
36
          meta.mainProgram = "jelqd";
37
        };
38
      });
39
40
      apps = forAllSystems (pkgs: {
41
        default = {
42
          type = "app";
43
          program = lib.getExe self.packages.${pkgs.stdenv.hostPlatform.system}.default;
44
          meta.description = "Run the jelqd server";
45
        };
46
      });
47
48
      checks = forAllSystems (
49
        pkgs:
50
        let
51
          jelqd = self.packages.${pkgs.stdenv.hostPlatform.system}.default;
52
        in
53
        {
54
          inherit jelqd;
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
      );
77
78
      devShells = forAllSystems (pkgs: {
79
        default = pkgs.mkShell {
80
          inputsFrom = [ self.packages.${pkgs.stdenv.hostPlatform.system}.default ];
81
          packages = [
82
            pkgs.clippy
83
            pkgs.rustfmt
84
            pkgs.rust-analyzer
85
            pkgs.nushell
86
            pkgs.curl
87
          ];
88
        };
89
      });
90
91
      formatter = forAllSystems (pkgs: pkgs.nixfmt);
92
    };
93
}