diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..f8964420 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "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": 1766651565, + "narHash": "sha256-QEhk0eXgyIqTpJ/ehZKg9IKS7EtlWxF3N7DXy42zPfU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e2499d5539c16d0d173ba53552a4ff8547f4539", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "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", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..a616b077 --- /dev/null +++ b/flake.nix @@ -0,0 +1,119 @@ +{ + description = "Irssi - A modular text mode chat client with IRC support"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + + # Common build inputs for both the package and dev shell + buildInputs = with pkgs; [ + glib + openssl + ncurses + perl + ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ + utf8proc + ]; + + # Native build inputs (tools needed at build time) + nativeBuildInputs = with pkgs; [ + meson + ninja + pkg-config + perl + ]; + + in + { + packages = { + default = self.packages.${system}.irssi; + + irssi = pkgs.stdenv.mkDerivation { + pname = "irssi"; + version = "1.5-head"; + + src = ./.; + + inherit nativeBuildInputs buildInputs; + + mesonFlags = [ + "-Dwith-perl=yes" + "-Dwith-proxy=yes" + ]; + + meta = with pkgs.lib; { + description = "A modular text mode chat client with IRC support"; + homepage = "https://irssi.org/"; + license = licenses.gpl2Plus; + maintainers = []; + platforms = platforms.unix; + }; + }; + + # Variant without Perl scripting support + irssi-minimal = pkgs.stdenv.mkDerivation { + pname = "irssi-minimal"; + version = "1.5-head"; + + src = ./.; + + nativeBuildInputs = with pkgs; [ + meson + ninja + pkg-config + perl # Perl is needed at build time for generating help files + ]; + + buildInputs = with pkgs; [ + glib + openssl + ncurses + ]; + + mesonFlags = [ + "-Dwith-perl=no" + ]; + + meta = with pkgs.lib; { + description = "A modular text mode chat client with IRC support (minimal build)"; + homepage = "https://irssi.org/"; + license = licenses.gpl2Plus; + platforms = platforms.unix; + }; + }; + }; + + devShells.default = pkgs.mkShell { + name = "irssi-dev"; + + inherit buildInputs; + + nativeBuildInputs = nativeBuildInputs ++ (with pkgs; [ + # Additional development tools + gdb + valgrind + ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ + strace + ]); + + shellHook = '' + echo "Irssi development environment" + echo "" + echo "Build commands:" + echo " meson setup Build" + echo " ninja -C Build" + echo "" + echo "Run tests:" + echo " ninja -C Build test" + echo "" + ''; + }; + } + ); +}