]> git.giacomolli.uk - onehouse/blob - flake.nix
Exchange bounded M31 Modbus TCP requests
[onehouse] / flake.nix
1 {
2 description = "OneHouse";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 systems.url = "github:nix-systems/default";
7 };
8
9 outputs =
10 {
11 self,
12 nixpkgs,
13 systems,
14 }:
15 let
16 allSystems = import systems;
17 # The program runs on Linux. The development shell also supports macOS.
18 linuxSystems = builtins.filter (nixpkgs.lib.hasSuffix "-linux") allSystems;
19 forEachSystem = nixpkgs.lib.genAttrs allSystems;
20 forEachLinuxSystem = nixpkgs.lib.genAttrs linuxSystems;
21 date = self.lastModifiedDate;
22 revision = self.shortRev or self.dirtyShortRev or "unknown";
23 version = "${builtins.substring 0 4 date}-${builtins.substring 4 2 date}-${builtins.substring 6 2 date}-${revision}";
24 in
25 {
26 packages = forEachLinuxSystem (
27 system:
28 let
29 pkgs = nixpkgs.legacyPackages.${system};
30 onehouse = pkgs.callPackage ./nix/package.nix {
31 src = self;
32 inherit version;
33 };
34 in
35 {
36 inherit onehouse;
37 default = onehouse;
38 }
39 );
40
41 devShells = forEachSystem (system: {
42 default = import ./nix/devshell.nix {
43 pkgs = nixpkgs.legacyPackages.${system};
44 };
45 });
46
47 checks = forEachLinuxSystem (system: {
48 package = self.packages.${system}.default;
49 });
50
51 formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt);
52 };
53 }