From 4851b881befbcb978fc6ef23e55e1e5658a2fd12 Mon Sep 17 00:00:00 2001 From: Bart Nagel Date: Mon, 9 Mar 2026 17:52:01 -0700 Subject: [PATCH] Add flake.nix --- .gitignore | 3 ++- flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 42 +++++++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index d512ff3..22fc7db 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ .env.test .env.production .env.local -.env.development.local \ No newline at end of file +.env.development.local +/result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..3848312 --- /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": 1772963539, + "narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9dcb002ca1690658be4a04645215baea8b95f31d", + "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 0000000..f50fbb6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,42 @@ +{ + description = "batctl - battery control TUI"; + + 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}; + version = "0.1.0"; + in { + packages.default = pkgs.buildGoModule { + pname = "batctl"; + inherit version; + + src = ./.; + + vendorHash = "sha256-irJksXupZGHzZ5vbFeI9laKi5+LyATc1lMxpMLLl69w="; + + ldflags = [ "-s" "-w" "-X main.version=${version}" ]; + + meta = with pkgs.lib; { + description = "Battery control TUI"; + homepage = "https://github.com/Ooooze/batctl"; + license = licenses.mit; + mainProgram = "batctl"; + platforms = platforms.linux; + }; + }; + + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + go + gopls + gotools + ]; + }; + }); +}