From 526db69d14221bb65ea7b99d07d8a9e4f41261a4 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 29 Sep 2025 17:21:58 +0200 Subject: [PATCH] declare a development shell in flake.nix This makes it possible to build i3lock (for development) on any system on which Nix can be installed (= most Linux systems). For example, I start Emacs using `nix develop --command emacs` and that Emacs process is in an environment with all i3lock build deps. See also: https://michael.stapelberg.ch/posts/2025-07-27-dev-shells-with-nix-4-quick-examples/ This file is provided best-effort, but PRs are welcome. --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..d898d110 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1758791193, + "narHash": "sha256-F8WmEwFoHsnix7rt290R0rFXNJiMbClMZyIC/e+HYf0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "25e53aa156d47bad5082ff7618f5feb1f5e02d01", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-25.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..298e425d --- /dev/null +++ b/flake.nix @@ -0,0 +1,28 @@ +{ + description = "development environment for i3lock"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + }; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + devShells.${system}.default = pkgs.mkShell { + buildInputs = with pkgs; [ + cairo + libev + libxkbcommon + pam + pkg-config + xcbutilxrm + xorg.libX11 + xorg.libxcb + xorg.xcbutil + xorg.xcbutilimage + ]; + }; + }; +}