yep, more dotfiles
1{
2 inputs = {
3 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4
5 rust-overlay.url = "github:oxalica/rust-overlay";
6 rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
7
8 gitignore.url = "github:hercules-ci/gitignore.nix";
9 gitignore.inputs.nixpkgs.follows = "nixpkgs";
10 };
11
12 outputs = { self, nixpkgs, rust-overlay, gitignore }:
13 let
14 inherit (nixpkgs.lib) genAttrs getExe;
15
16 forAllSystems = genAttrs [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
17 forAllPkgs = function: forAllSystems (system: function pkgs.${system});
18
19 mkApp = (program: { type = "app"; inherit program; });
20
21 pkgs = forAllSystems (system: (import nixpkgs {
22 inherit system;
23 overlays = [ (import rust-overlay) ];
24 }));
25 in
26 {
27 formatter = forAllPkgs (pkgs: pkgs.nixpkgs-fmt);
28
29 packages = forAllPkgs (pkgs: rec {
30 default = app;
31 app = pkgs.callPackage ./package.nix { inherit gitignore; };
32 });
33 apps = forAllSystems (system: rec {
34 default = app;
35 app = mkApp (getExe self.packages.${system}.app);
36 });
37
38 devShells = forAllPkgs (pkgs:
39 with pkgs.lib;
40 let
41 file-rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
42 rust-toolchain = file-rust-toolchain.override { extensions = [ "rust-analyzer" ]; };
43 in
44 {
45 default = pkgs.mkShell rec {
46 nativeBuildInputs = with pkgs; [
47 pkg-config
48 rust-toolchain
49 act
50 ];
51
52 buildInputs = with pkgs; [ ];
53
54 RUST_SRC_PATH = pkgs.rustPlatform.rustLibSrc;
55 LD_LIBRARY_PATH = makeLibraryPath buildInputs;
56
57 # RUST_LOG = "";
58 };
59 });
60 };
61}