add a `flake.nix` for Nix builds

build with `nix build`; enter a dev environment with `nix develop`
wherein you can `cargo build`.
This commit is contained in:
colin 2022-10-20 02:01:14 -07:00
parent 7817439629
commit 93f34bac63
2 changed files with 84 additions and 0 deletions

42
flake.lock Normal file
View File

@ -0,0 +1,42 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1666164185,
"narHash": "sha256-5v+YB4ijeUfg5LCz9ck4gIpCPhIS+qn02OyPJO48bCE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c5203abb1329f7ea084c04acda330ca75d5b9fb5",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.05",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

42
flake.nix Normal file
View File

@ -0,0 +1,42 @@
{
description = "A simple log in screen for use on touch screens.";
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.05";
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils }:
with flake-utils.lib; eachSystem allSystems (system:
let
pkgs = import nixpkgs { inherit system; };
buildInputs = with pkgs; [ gtk3 libhandy_0 lightdm ];
nativeBuildInputs = with pkgs; [ ];
in
rec {
packages = {
# docs: <nixpkgs>/doc/languages-frameworks/rust.section.md
# docs: https://github.com/oxalica/rust-overlay
lightdm-mobile-greeter = pkgs.rustPlatform.buildRustPackage {
pname = "lightdm-mobile-greeter";
version = "6";
inherit buildInputs nativeBuildInputs;
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"light-dm-sys-0.0.1" = "sha256-5o/DZqP6j6xRwf+YmrtQTpcg4PhTvQ0hKC1WauLdqzc=";
};
};
};
};
defaultPackage = packages.lightdm-mobile-greeter;
devShells.default = with pkgs; mkShell {
# Allow cargo to download crates.
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
# include both build and runtime deps in the shell so once can build and run the result.
buildInputs = buildInputs ++ nativeBuildInputs ++ [ cargo ];
};
});
}