fork/eza

git clone https://git.julia.blue/fork/eza

Christina Sørensenbuild(deps): flake bump 2025-01-16e34b430d

main
4.8 KiB193 linesraw
1# SPDX-FileCopyrightText: 2024 Christina Sørensen
2# SPDX-License-Identifier: EUPL-1.2
3#
4# SPDX-FileCopyrightText: 2014-2024 Christina Sørensen, eza contributors
5# SPDX-License-Identifier: MIT
6{
7  description = "eza: a modern, maintained replacement for ls";
8
9  inputs = {
10    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
11    systems.url = "github:nix-systems/default";
12
13    flake-utils = {
14      url = "github:numtide/flake-utils";
15      inputs = {
16        systems.follows = "systems";
17      };
18    };
19
20    naersk = {
21      url = "github:nix-community/naersk";
22      inputs.nixpkgs.follows = "nixpkgs";
23    };
24
25    rust-overlay = {
26      url = "github:oxalica/rust-overlay";
27      inputs = {
28        nixpkgs.follows = "nixpkgs";
29      };
30    };
31
32    treefmt-nix = {
33      url = "github:numtide/treefmt-nix";
34      inputs = {
35        nixpkgs.follows = "nixpkgs";
36      };
37    };
38
39    powertest = {
40      url = "github:eza-community/powertest";
41      inputs = {
42        nixpkgs.follows = "nixpkgs";
43        flake-utils.follows = "flake-utils";
44        naersk.follows = "naersk";
45        treefmt-nix.follows = "treefmt-nix";
46        rust-overlay.follows = "rust-overlay";
47      };
48    };
49
50    pre-commit-hooks = {
51      url = "github:cachix/pre-commit-hooks.nix";
52      inputs.nixpkgs.follows = "nixpkgs";
53    };
54
55    advisory-db = {
56      url = "github:rustsec/advisory-db";
57      flake = false;
58    };
59  };
60  outputs =
61    {
62      self,
63      flake-utils,
64      naersk,
65      nixpkgs,
66      treefmt-nix,
67      rust-overlay,
68      powertest,
69      pre-commit-hooks,
70      ...
71    }:
72    flake-utils.lib.eachDefaultSystem (
73      system:
74      let
75        overlays = [ (import rust-overlay) ];
76
77        pkgs = (import nixpkgs) {
78          inherit system overlays;
79        };
80
81        toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
82
83        naersk' = pkgs.callPackage naersk {
84          cargo = toolchain;
85          rustc = toolchain;
86          clippy = toolchain;
87        };
88
89        treefmtEval = treefmt-nix.lib.evalModule pkgs .config/treefmt.nix;
90
91        darwinBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [
92          pkgs.libiconv
93          pkgs.darwin.apple_sdk.frameworks.Security
94        ];
95
96        buildInputs = [ pkgs.zlib ] ++ darwinBuildInputs;
97      in
98      rec {
99        # For `nix fmt`
100        formatter = treefmtEval.config.build.wrapper;
101
102        packages = {
103          default = import ./nix/eza.nix { inherit pkgs naersk' buildInputs; };
104
105          check = naersk'.buildPackage {
106            inherit buildInputs;
107            src = ./.;
108            mode = "check";
109          };
110
111          test = naersk'.buildPackage {
112            inherit buildInputs;
113            src = ./.;
114            mode = "test";
115          };
116
117          clippy = naersk'.buildPackage {
118            inherit buildInputs;
119            src = ./.;
120            mode = "clippy";
121          };
122        } // (import ./nix/trycmd.nix { inherit pkgs naersk' buildInputs; });
123
124        devShells.default = pkgs.mkShell {
125          inherit (self.checks.${system}.pre-commit-check) shellHook;
126          nativeBuildInputs =
127            with pkgs;
128            [
129              # cargo
130              # clippy
131              rustup
132              toolchain
133              just
134              pandoc
135              convco
136              zip
137              reuse
138
139              # For releases
140              b3sum
141              cargo-bump
142
143              # For generating demo
144              vhs
145
146              powertest.packages.${pkgs.system}.default
147
148              cargo-hack
149              cargo-udeps
150              cargo-outdated
151            ]
152            ++ darwinBuildInputs;
153        };
154
155        checks = {
156          pre-commit-check =
157            let
158              toFilter = [
159                "yamlfmt"
160                "nixfmt"
161                "taplo"
162                "shellcheck" # this doesn't respect our excludes:w
163              ];
164              filterFn = n: _v: (!builtins.elem n toFilter);
165              treefmtFormatters = pkgs.lib.mapAttrs (_n: v: { inherit (v) enable; }) (
166                pkgs.lib.filterAttrs filterFn (import .config/treefmt.nix).programs
167              );
168            in
169            pre-commit-hooks.lib.${system}.run {
170              src = ./.;
171              hooks = treefmtFormatters // {
172                nixfmt-rfc-style.enable = true;
173                convco.enable = true;
174                reuse = {
175                  enable = true;
176                  name = "reuse";
177                  entry = with pkgs; "${reuse}/bin/reuse lint";
178                  pass_filenames = false;
179                };
180              };
181            };
182          formatting = treefmtEval.config.build.check self;
183          build = packages.check;
184          inherit (packages)
185            default
186            test
187            trycmd
188            ;
189          lint = packages.clippy;
190        };
191      }
192    );
193}