diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 603e6cc..1708180 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /target bezel-linux-amd64 +/result +/.direnv diff --git a/flake.lock b/flake.lock index 0ee7307..40f0c11 100644 --- a/flake.lock +++ b/flake.lock @@ -1,25 +1,59 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1781577229, - "narHash": "sha256-lrp67w8AulE9Ks53n27I45ADSzbOCn4H+CNW1Ck8B+8=", - "owner": "NixOS", + "lastModified": 1782333529, + "narHash": "sha256-KyKnQO9t4VDOYjnrl/AGKykBrdWuuGrhc4l7ljJvBV4=", + "owner": "yzhou216", "repo": "nixpkgs", - "rev": "567a49d1913ce81ac6e9582e3553dd90a955875f", + "rev": "f67b77766802dff449630fb250fdf94d7cdab83f", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixos-unstable", + "owner": "yzhou216", + "ref": "bezel-init", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 5899663..d6e1dfc 100644 --- a/flake.nix +++ b/flake.nix @@ -2,30 +2,33 @@ description = "Bezel - trackpad edge gesture daemon"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:yzhou216/nixpkgs?ref=bezel-init"; # TODO: wait for merge into Nixpkgs master + flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs }: - let - forAllSystems = callback: - nixpkgs.lib.genAttrs [ - "x86_64-linux" - "aarch64-linux" - ] (system: callback nixpkgs.legacyPackages.${system}); - - make-package = pkgs: { - default = pkgs.rustPlatform.buildRustPackage { + outputs = + { + nixpkgs, + flake-utils, + ... + }: + flake-utils.lib.eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + # Build with `$ nix build .#default` + packages.default = pkgs.bezel.overrideAttrs (old: { pname = "bezel"; - version = "0.1.0"; + version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; src = ./.; - cargoLock.lockFile = ./Cargo.lock; - - # evdev and uinput crates typically require libudev to build - nativeBuildInputs = [ pkgs.pkg-config ]; - buildInputs = [ pkgs.udev ]; - }; - }; - in { - packages = forAllSystems make-package; - }; + cargoHash = ""; + cargoSha256 = ""; + cargoDeps = pkgs.rustPlatform.importCargoLock { + lockFile = ./Cargo.lock; + }; + }); + } + ); }