From 10c568a57308280525bd2aed804f3a6790a4cebe Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 5 Mar 2026 10:44:35 +0000 Subject: [PATCH 1/8] feat: add Nix package support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add flake.nix at the repo root and packaging/nix/default.nix: - packaging/nix/default.nix: rustPlatform.buildRustPackage derivation using the committed Cargo.lock (cargoLock.lockFile) — no vendoring or network fetch required. Restricted to linux platforms since lsu shells out to systemctl/journalctl (no libsystemd linkage needed). - flake.nix: exposes packages.x86_64-linux.default (nix build / nix run) and devShells.x86_64-linux.default (nix develop) via nixpkgs-unstable. https://claude.ai/code/session_01RW5qWaTiTQPK3rFMTsNjUF --- flake.nix | 21 +++++++++++++++++++++ packaging/nix/default.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 flake.nix create mode 100644 packaging/nix/default.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0cb56d3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +# Copyright (c) 2026 l5yth +# SPDX-License-Identifier: Apache-2.0 +{ + description = "Terminal UI for systemd services and their journal"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs }: + let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + packages.${system}.default = + pkgs.callPackage ./packaging/nix/default.nix { }; + + devShells.${system}.default = pkgs.mkShell { + inputsFrom = [ self.packages.${system}.default ]; + packages = [ pkgs.cargo pkgs.rustfmt pkgs.clippy ]; + }; + }; +} diff --git a/packaging/nix/default.nix b/packaging/nix/default.nix new file mode 100644 index 0000000..329b6d6 --- /dev/null +++ b/packaging/nix/default.nix @@ -0,0 +1,26 @@ +# Copyright (c) 2026 l5yth +# SPDX-License-Identifier: Apache-2.0 +# +# Standalone derivation for lsu. +# Can be called directly from a flake or from nixpkgs: +# pkgs.callPackage ./packaging/nix/default.nix { } +{ lib, rustPlatform }: + +rustPlatform.buildRustPackage { + pname = "lsu"; + version = "0.1.2"; + + src = lib.cleanSource ../..; + + cargoLock.lockFile = ../../Cargo.lock; + + meta = { + description = "Terminal UI for systemd services and their journal"; + homepage = "https://github.com/l5yth/lsu"; + license = lib.licenses.asl20; + maintainers = [ ]; + # lsu shells out to systemctl/journalctl; systemd is Linux-only. + platforms = lib.platforms.linux; + mainProgram = "lsu"; + }; +} From b546af92db43b2361c4de0f333001fa7bb3f75aa Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 5 Mar 2026 10:46:43 +0000 Subject: [PATCH 2/8] ci: add Nix build job to Linux workflow Add a nix job to .github/workflows/linux.yml that installs Nix via cachix/install-nix-action and runs `nix build .#` to verify the flake derivation builds cleanly on every push/PR to main. https://claude.ai/code/session_01RW5qWaTiTQPK3rFMTsNjUF --- .github/workflows/linux.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 8e9bfff..36358d2 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -91,3 +91,19 @@ jobs: run: | FEATURES="-ipc-sandbox -network-sandbox -pid-sandbox -mount-sandbox -usersandbox -userpriv" \ ebuild /var/db/repos/localrepo/app-misc/lsu/lsu-9999.ebuild fetch unpack compile test + + nix: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Install Nix + uses: cachix/install-nix-action@v30 + with: + extra_nix_config: | + experimental-features = nix-command flakes + + - name: Build Nix package + run: nix build .# From 6a96941e651c0aff48d9584a447a11c2194438ab Mon Sep 17 00:00:00 2001 From: l5y <220195275+l5yth@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:38:49 +0100 Subject: [PATCH 3/8] address review comments --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 28 ++++++++++++++++++++-------- packaging/nix/default.nix | 2 +- 3 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..bb1d357 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1772624091, + "narHash": "sha256-QKyJ0QGWBn6r0invrMAK8dmJoBYWoOWy7lN+UHzW1jc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "80bdc1e5ce51f56b19791b52b2901187931f5353", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 0cb56d3..5d7925e 100644 --- a/flake.nix +++ b/flake.nix @@ -7,15 +7,27 @@ outputs = { self, nixpkgs }: let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; + systems = [ + "x86_64-linux" + "aarch64-linux" + "armv6l-linux" + "armv7l-linux" + ]; + forAllSystems = f: nixpkgs.lib.genAttrs systems f; in { - packages.${system}.default = - pkgs.callPackage ./packaging/nix/default.nix { }; + packages = forAllSystems (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + default = pkgs.callPackage ./packaging/nix/default.nix { }; + }); - devShells.${system}.default = pkgs.mkShell { - inputsFrom = [ self.packages.${system}.default ]; - packages = [ pkgs.cargo pkgs.rustfmt pkgs.clippy ]; - }; + devShells = forAllSystems (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + default = pkgs.mkShell { + inputsFrom = [ self.packages.${system}.default ]; + packages = [ pkgs.cargo pkgs.rustfmt pkgs.clippy ]; + }; + }); }; } diff --git a/packaging/nix/default.nix b/packaging/nix/default.nix index 329b6d6..4c75034 100644 --- a/packaging/nix/default.nix +++ b/packaging/nix/default.nix @@ -8,7 +8,7 @@ rustPlatform.buildRustPackage { pname = "lsu"; - version = "0.1.2"; + version = (lib.importTOML ../../Cargo.toml).package.version; src = lib.cleanSource ../..; From c866280af683030ad7e2720b5a9dc9978ce321c1 Mon Sep 17 00:00:00 2001 From: l5y <220195275+l5yth@users.noreply.github.com> Date: Thu, 5 Mar 2026 18:54:03 +0100 Subject: [PATCH 4/8] address review comments --- .github/workflows/linux.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 36358d2..c7e9d62 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -94,16 +94,12 @@ jobs: nix: runs-on: ubuntu-latest + container: + image: nixpkgs/nix-flakes steps: - name: Checkout uses: actions/checkout@v6 - - name: Install Nix - uses: cachix/install-nix-action@v30 - with: - extra_nix_config: | - experimental-features = nix-command flakes - - name: Build Nix package run: nix build .# From 8efe53274538f9424db5931ae337938f6817e2c6 Mon Sep 17 00:00:00 2001 From: l5y <220195275+l5yth@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:05:07 +0100 Subject: [PATCH 5/8] address review comments --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index c7e9d62..f83971a 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -99,7 +99,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@v4 - name: Build Nix package run: nix build .# From 6a435c93eab8e1230d3cbe5a49c8f3bf51c084a2 Mon Sep 17 00:00:00 2001 From: l5y <220195275+l5yth@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:08:47 +0100 Subject: [PATCH 6/8] address review comments --- .github/workflows/linux.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index f83971a..a5cdbcc 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -94,12 +94,15 @@ jobs: nix: runs-on: ubuntu-latest - container: - image: nixpkgs/nix-flakes steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Build Nix package - run: nix build .# + run: | + docker run --rm \ + -v "${{ github.workspace }}":/repo \ + -w /repo \ + nixpkgs/nix-flakes \ + nix build .# From 46dcb284c1aa7d0b6bc4ebf1a81b3c5547d9f206 Mon Sep 17 00:00:00 2001 From: l5y <220195275+l5yth@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:13:05 +0100 Subject: [PATCH 7/8] update readme --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0813c67..5ad683f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ [![Codecov](https://codecov.io/gh/l5yth/lsu/graph/badge.svg)](https://codecov.io/gh/l5yth/lsu) [![GitHub Release](https://img.shields.io/github/v/release/l5yth/lsu)](https://github.com/l5yth/lsu/releases) [![Crates.io](https://img.shields.io/crates/v/lsu.svg)](https://crates.io/crates/lsu) -[![AUR Version](https://img.shields.io/aur/version/lsu-bin)](https://aur.archlinux.org/packages/lsu-bin) +[![AUR Version](https://img.shields.io/aur/version/lsu-bin?logo=archlinux)](https://aur.archlinux.org/packages/lsu-bin) +[![Nix Flake](https://img.shields.io/badge/nix-flake-5277C3?logo=nixos)](https://github.com/l5yth/lsu/blob/main/flake.nix) +[![Gentoo](https://img.shields.io/badge/gentoo-ebuild-54487A?logo=gentoo)](https://github.com/l5yth/lsu/tree/main/packaging/gentoo) [![Top Language](https://img.shields.io/github/languages/top/l5yth/lsu)](https://github.com/l5yth/lsu) [![License: Apache-2.0](https://img.shields.io/github/license/l5yth/lsu)](https://github.com/l5yth/lsu/blob/main/LICENSE) From a751a131aaca3d2a594ccccb81b5acace0ebd7ec Mon Sep 17 00:00:00 2001 From: l5y <220195275+l5yth@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:17:38 +0100 Subject: [PATCH 8/8] address review comments --- .github/workflows/linux.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index a5cdbcc..45d0ca4 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -105,4 +105,4 @@ jobs: -v "${{ github.workspace }}":/repo \ -w /repo \ nixpkgs/nix-flakes \ - nix build .# + sh -c 'git config --global --add safe.directory /repo && nix build .#'