mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-22 07:11:01 +00:00
feat(nix): add comprehensive Nix flake
This commit is contained in:
parent
bedde4a037
commit
1a928f9c8d
4 changed files with 207 additions and 0 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -3,3 +3,10 @@ TODO.md
|
|||
Lazydocker.code-workspace
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# Ignore build outputs from performing a nix-build or `nix build` command
|
||||
result
|
||||
result-*
|
||||
|
||||
# Ignore automatically generated direnv output
|
||||
.direnv
|
||||
|
|
|
|||
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
|
|
@ -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": 1755078291,
|
||||
"narHash": "sha256-Hu/gTDoi4uy6TAKISPHQusSMy8U6xUbLSDjKBYdhDIY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3385ca0cd7e14c1a1eb80401fe011705ff012323",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-25.05",
|
||||
"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
|
||||
}
|
||||
138
flake.nix
Normal file
138
flake.nix
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
{
|
||||
description = "The lazier way to manage everything docker";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
flake-utils,
|
||||
}:
|
||||
let
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
|
||||
gitCommit = self.rev or self.dirtyRev or "dev";
|
||||
version = "0.24.1";
|
||||
|
||||
in
|
||||
flake-utils.lib.eachSystem supportedSystems (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
lazydocker = pkgs.buildGoModule rec {
|
||||
pname = "lazydocker";
|
||||
inherit version;
|
||||
|
||||
src = ./.;
|
||||
|
||||
vendorHash = null;
|
||||
|
||||
# Disable integration tests that require specific environment
|
||||
doCheck = false;
|
||||
|
||||
nativeBuildInputs = with pkgs; [ git ];
|
||||
|
||||
buildInputs = with pkgs; [ git ];
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X main.commit=${gitCommit}"
|
||||
"-X main.version=${version}"
|
||||
"-X main.buildSource=nix"
|
||||
];
|
||||
|
||||
meta = with pkgs.lib; {
|
||||
description = "The lazier way to manage everything docker";
|
||||
homepage = "https://github.com/jesseduffield/lazydocker";
|
||||
license = licenses.mit;
|
||||
maintainers = [ "jesseduffield" ];
|
||||
platforms = platforms.unix;
|
||||
mainProgram = "lazydocker";
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
default = lazydocker;
|
||||
inherit lazydocker;
|
||||
};
|
||||
|
||||
apps = {
|
||||
default = flake-utils.lib.mkApp {
|
||||
drv = lazydocker;
|
||||
name = "lazydocker";
|
||||
};
|
||||
lazydocker = flake-utils.lib.mkApp {
|
||||
drv = lazydocker;
|
||||
name = "lazydocker";
|
||||
};
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = "lazydocker-dev";
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
# Go toolchain
|
||||
go_1_24
|
||||
gotools
|
||||
golangci-lint
|
||||
|
||||
# Development tools
|
||||
git
|
||||
gnumake
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "Lazydocker development environment"
|
||||
echo "Go version: $(go version)"
|
||||
echo "Git version: $(git --version)"
|
||||
echo ""
|
||||
'';
|
||||
|
||||
# Environment variables for development
|
||||
CGO_ENABLED = "0";
|
||||
};
|
||||
|
||||
# Formatting check
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
|
||||
# Development checks
|
||||
checks = {
|
||||
# Ensure the package builds
|
||||
build = lazydocker;
|
||||
|
||||
# Format check
|
||||
format =
|
||||
pkgs.runCommand "check-format"
|
||||
{
|
||||
buildInputs = [ pkgs.nixpkgs-fmt ];
|
||||
}
|
||||
''
|
||||
nixpkgs-fmt --check ${./.}
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
}
|
||||
)
|
||||
// {
|
||||
# Global overlay for other flakes to use
|
||||
overlays.default = final: prev: {
|
||||
lazydocker = self.packages.${final.system}.lazydocker;
|
||||
};
|
||||
|
||||
# CI/CD support
|
||||
hydraJobs = self.packages;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue