build: packaged for a flake
This commit is contained in:
parent
4d4d9a91df
commit
c9f5f7d3ea
2 changed files with 157 additions and 49 deletions
96
flake.lock
96
flake.lock
|
@ -1,6 +1,47 @@
|
|||
{
|
||||
"nodes": {
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709965418,
|
||||
"narHash": "sha256-xsKCrFDU6rU3oIqMP3IbuAGiJvsVeBTRqZvwN1p1q4c=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "24002092be13b2efe87700229d143b0d1eaa5d12",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": [
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709126324,
|
||||
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_10": {
|
||||
"locked": {
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
|
@ -157,7 +198,7 @@
|
|||
},
|
||||
"nixago": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixago-exts": "nixago-exts",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
|
@ -180,7 +221,7 @@
|
|||
},
|
||||
"nixago-exts": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixago": "nixago_2",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
|
@ -204,7 +245,7 @@
|
|||
},
|
||||
"nixago-exts_2": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_4",
|
||||
"flake-utils": "flake-utils_5",
|
||||
"nixago": "nixago_3",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
|
@ -230,7 +271,7 @@
|
|||
},
|
||||
"nixago-exts_3": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_6",
|
||||
"flake-utils": "flake-utils_7",
|
||||
"nixago": "nixago_4",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
|
@ -253,7 +294,7 @@
|
|||
},
|
||||
"nixago-exts_4": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_8",
|
||||
"flake-utils": "flake-utils_9",
|
||||
"nixago": "nixago_5",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
|
@ -278,7 +319,7 @@
|
|||
},
|
||||
"nixago_2": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_3",
|
||||
"flake-utils": "flake-utils_4",
|
||||
"nixago-exts": "nixago-exts_2",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
|
@ -304,7 +345,7 @@
|
|||
},
|
||||
"nixago_3": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_5",
|
||||
"flake-utils": "flake-utils_6",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixago",
|
||||
|
@ -330,7 +371,7 @@
|
|||
},
|
||||
"nixago_4": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_7",
|
||||
"flake-utils": "flake-utils_8",
|
||||
"nixago-exts": "nixago-exts_4",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
|
@ -355,7 +396,7 @@
|
|||
},
|
||||
"nixago_5": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_9",
|
||||
"flake-utils": "flake-utils_10",
|
||||
"nixpkgs": [
|
||||
"mfgames-project-setup",
|
||||
"nixago-exts",
|
||||
|
@ -408,8 +449,43 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"fenix": "fenix",
|
||||
"flake-utils": "flake-utils",
|
||||
"mfgames-project-setup": "mfgames-project-setup",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"systems": "systems"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1709904211,
|
||||
"narHash": "sha256-Vv29QP5eIn9ZEapQzXHqwhjm46sddetiZScTWY0/dlA=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "2397e7a887252aa995d3790164b34b6c76ed94b4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1680978846,
|
||||
"narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "x86_64-linux",
|
||||
"rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "x86_64-linux",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
110
flake.nix
110
flake.nix
|
@ -2,48 +2,80 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
|
||||
mfgames-project-setup.url = "git+https://src.mfgames.com/nixos-contrib/mfgames-project-setup-flake.git";
|
||||
|
||||
systems.url = "github:nix-systems/x86_64-linux";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
flake-utils.inputs.systems.follows = "systems";
|
||||
|
||||
fenix = {
|
||||
url = "github:nix-community/fenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ { self, nixpkgs, mfgames-project-setup, ... }:
|
||||
let
|
||||
# Helpers for producing system-specific outputs
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
inherit system;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
});
|
||||
in
|
||||
rec
|
||||
{
|
||||
# Set up the developer shell.
|
||||
devShells = forEachSupportedSystem ({ system, pkgs }:
|
||||
let
|
||||
project-config = mfgames-project-setup.lib.mkConfig {
|
||||
inherit system pkgs;
|
||||
contributorCovenant.enable = true;
|
||||
contributorCovenant.contact = "contact@mfgames.com";
|
||||
developerCertificateOfOrigin.enable = true;
|
||||
rust.enable = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
# Shell
|
||||
default = pkgs.mkShell {
|
||||
packages = [
|
||||
# Rust
|
||||
pkgs.rustup
|
||||
outputs = inputs @ { self, nixpkgs, mfgames-project-setup, flake-utils, fenix, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
# git2 crate
|
||||
pkgs.pkg-config
|
||||
pkgs.openssl
|
||||
]
|
||||
++ project-config.packages;
|
||||
|
||||
shellHook = project-config.shellHook;
|
||||
};
|
||||
rustPlatform = (pkgs.makeRustPlatform {
|
||||
inherit (fenix.packages.${system}.minimal) cargo rustc;
|
||||
});
|
||||
in
|
||||
{
|
||||
# Create a binary for the project.
|
||||
packages = rec {
|
||||
mfgames-conventional-commit = rustPlatform.buildRustPackage {
|
||||
pname = "mfgames-conventional-commit";
|
||||
version = "0.0.1";
|
||||
src = ./.;
|
||||
#cargoBuildFlags = "-p app";
|
||||
|
||||
# Formatting for the Nix files
|
||||
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixpkgs-fmt);
|
||||
};
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgs.pkg-config ];
|
||||
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
|
||||
};
|
||||
|
||||
default = mfgames-conventional-commit;
|
||||
};
|
||||
|
||||
apps = rec {
|
||||
mfgames-conventional-commit = flake-utils.lib.mkApp { drv = self.packages.${system}.mfgames-conventional-commit; };
|
||||
default = mfgames-conventional-commit;
|
||||
};
|
||||
|
||||
# Set up the developer shell.
|
||||
devShells =
|
||||
let
|
||||
project-config = mfgames-project-setup.lib.mkConfig {
|
||||
inherit system pkgs;
|
||||
contributorCovenant.enable = true;
|
||||
contributorCovenant.contact = "contact@mfgames.com";
|
||||
developerCertificateOfOrigin.enable = true;
|
||||
rust.enable = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
# Shell
|
||||
default = pkgs.mkShell {
|
||||
packages = [
|
||||
# Rust
|
||||
pkgs.rustup
|
||||
|
||||
# git2 crate
|
||||
pkgs.pkg-config
|
||||
pkgs.openssl
|
||||
]
|
||||
++ project-config.packages;
|
||||
|
||||
shellHook = project-config.shellHook;
|
||||
};
|
||||
};
|
||||
|
||||
# Formatting for the Nix files
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue