summaryrefslogblamecommitdiff
path: root/flake.nix
blob: 3dff6658dd012d59569e371ac3eba1905bb8b67a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                   





                           


                       

                                                       
                       
                                     
            
                                             

                     

                                                 
            
                                     


                                   
                                                                   



            
{
  inputs = {
    flake-utils.url = "github:numtide/flake-utils";
    naersk.url = "github:nix-community/naersk";
  };

  outputs = { self, nixpkgs, flake-utils, naersk }:
    flake-utils.lib.eachDefaultSystem (
      system: let
        pkgs = nixpkgs.legacyPackages."${system}";
        naersk-lib = naersk.lib."${system}";

        deps = with pkgs; [
          openssl
          pkg-config
          libvirt
        ];
      in
        rec {
          # `nix build`
          packages.solarctl = naersk-lib.buildPackage {
            pname = "solarctl";
            root = ./.;
            nativeBuildInputs = deps;
          };
          defaultPackage = packages.solarctl;

          # `nix run`
          apps.solarctl = flake-utils.lib.mkApp {
            drv = packages.solarctl;
          };
          defaultApp = apps.solarctl;

          # `nix develop`
          devShell = pkgs.mkShell {
            nativeBuildInputs = with pkgs; [ rustc cargo ] ++ deps;
          };
        }
    );
}