/ flake.nix
flake.nix
 1  {
 2    description = "Controlling air-conditioner with a Raspberry Pi";
 3  
 4    inputs = {
 5      nixpkgs.url = "github:NixOS/nixpkgs/release-25.05";
 6      flake-utils.url = "github:numtide/flake-utils";
 7    };
 8  
 9    outputs =
10      {
11        self,
12        nixpkgs,
13        flake-utils,
14        ...
15      }:
16      flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (
17        system:
18        let
19          pkgs = import nixpkgs {
20            inherit system;
21            overlays = [ self.overlays.default ];
22          };
23        in
24        {
25          packages = {
26            default = pkgs.acremote;
27            backend = pkgs.acremote-backend;
28            frontend = pkgs.acremote-frontend;
29            frontend-elm = pkgs.acremote-frontend-elm;
30            signals = pkgs.acremote-signals;
31          };
32          devShells = {
33            frontend-elm = pkgs.mkShell {
34              buildInputs =
35                (with pkgs; [
36                  elm2nix
37                ])
38                ++ (with pkgs.elmPackages; [
39                  elm
40                  elm-format
41                  elm-live # elm-live -h 0 src/Main.elm --start-page=index.html -- --output=index.js
42                ]);
43              shellHook = ''
44                [[ "$-" == *i* ]] && exec "$SHELL"
45              '';
46            };
47          };
48        }
49      )
50      // {
51        hydraJobs = self.packages;
52        nixosModules.default = import ./outputs/nixos-module.nix;
53        overlays.default =
54          let
55            version = "0.3.0";
56          in
57          final: prev: rec {
58            acremote = final.symlinkJoin {
59              name = "acremote";
60              paths = [
61                acremote-backend
62                #acremote-frontend
63                acremote-frontend-elm
64                acremote-signals
65              ];
66            };
67            acremote-frontend = final.callPackage ./frontend { inherit version; };
68            acremote-frontend-elm = final.callPackage ./frontend-elm { inherit version; };
69            acremote-backend = final.callPackage ./backend { inherit version; };
70            acremote-signals = final.callPackage ./signals { inherit version; };
71          };
72      };
73  }