feat(nix): simplify flake.nix, remove devenv
This commit is contained in:
@@ -4,8 +4,6 @@ if ! has nix_direnv_version || ! nix_direnv_version 3.1.0; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.1.0/direnvrc" "sha256-yMJ2OVMzrFaDPn7q8nCBZFRYpL/f0RcHzhmw/i6btJM="
|
||||
fi
|
||||
|
||||
export DEVENV_IN_DIRENV_SHELL=true
|
||||
|
||||
# Load .env file if present
|
||||
dotenv_if_exists
|
||||
|
||||
@@ -20,5 +18,5 @@ if [[ -f .envrc.local ]]; then
|
||||
fi
|
||||
|
||||
if ! use flake . --no-pure-eval; then
|
||||
echo "Devenv could not be built. The devenv environment was not loaded. Make the necessary changes to flake.nix and hit enter to try again." >&2
|
||||
echo "Development shell could not be built. The environment was not loaded. Make the necessary changes to flake.nix and hit enter to try again." >&2
|
||||
fi
|
||||
|
||||
Generated
+11
-260
@@ -23,65 +23,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"cachix": {
|
||||
"inputs": {
|
||||
"devenv": [
|
||||
"devenv"
|
||||
],
|
||||
"flake-compat": [
|
||||
"devenv",
|
||||
"flake-compat"
|
||||
],
|
||||
"git-hooks": [
|
||||
"devenv",
|
||||
"git-hooks"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"devenv",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1760971495,
|
||||
"narHash": "sha256-IwnNtbNVrlZIHh7h4Wz6VP0Furxg9Hh0ycighvL5cZc=",
|
||||
"owner": "cachix",
|
||||
"repo": "cachix",
|
||||
"rev": "c5bfd933d1033672f51a863c47303fc0e093c2d2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"ref": "latest",
|
||||
"repo": "cachix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"devenv": {
|
||||
"inputs": {
|
||||
"cachix": "cachix",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-parts": "flake-parts",
|
||||
"git-hooks": "git-hooks",
|
||||
"nix": "nix",
|
||||
"nixd": "nixd",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770304289,
|
||||
"narHash": "sha256-+g+XMyB1zi50h2N38GE32l7ZONX4oW7Nw6QSXzfNiwk=",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"rev": "fd777e39027d393346e4df672d51ad2bf44b2a12",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -104,58 +45,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1761588595,
|
||||
"narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": [
|
||||
"devenv",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1760948891,
|
||||
"narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-root": {
|
||||
"locked": {
|
||||
"lastModified": 1723604017,
|
||||
"narHash": "sha256-rBtQ8gg+Dn4Sx/s+pvjdq3CB2wQNzx9XGFq/JVGCB6k=",
|
||||
"owner": "srid",
|
||||
"repo": "flake-root",
|
||||
"rev": "b759a56851e10cb13f6b8e5698af7b59c44be26e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "srid",
|
||||
"repo": "flake-root",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
@@ -190,141 +79,25 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"devenv",
|
||||
"flake-compat"
|
||||
],
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"devenv",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1760663237,
|
||||
"narHash": "sha256-BflA6U4AM1bzuRMR8QqzPXqh8sWVCNDzOdsxXEguJIc=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"devenv",
|
||||
"git-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"devenv",
|
||||
"flake-compat"
|
||||
],
|
||||
"flake-parts": [
|
||||
"devenv",
|
||||
"flake-parts"
|
||||
],
|
||||
"git-hooks-nix": [
|
||||
"devenv",
|
||||
"git-hooks"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"devenv",
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-23-11": [
|
||||
"devenv"
|
||||
],
|
||||
"nixpkgs-regression": [
|
||||
"devenv"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1769708679,
|
||||
"narHash": "sha256-uFKkp2/SjIqbu5HtINg/hwHN6qaqcxLIbL/om7dT3kI=",
|
||||
"owner": "cachix",
|
||||
"repo": "nix",
|
||||
"rev": "72bec37fabbfe378d677868ec42eeb83acf07a4c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"ref": "devenv-2.32",
|
||||
"repo": "nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixd": {
|
||||
"inputs": {
|
||||
"flake-parts": [
|
||||
"devenv",
|
||||
"flake-parts"
|
||||
],
|
||||
"flake-root": "flake-root",
|
||||
"nixpkgs": [
|
||||
"devenv",
|
||||
"nixpkgs"
|
||||
],
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1763964548,
|
||||
"narHash": "sha256-JTRoaEWvPsVIMFJWeS4G2isPo15wqXY/otsiHPN0zww=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixd",
|
||||
"rev": "d4bf15e56540422e2acc7bc26b20b0a0934e3f5e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixd",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1767052823,
|
||||
"narHash": "sha256-Fhuljcy7pJ8HacYYATRcm5rdKXx8P6D/0g19ppzDRNY=",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv-nixpkgs",
|
||||
"rev": "538a5124359f0b3d466e1160378c87887e3b51a4",
|
||||
"lastModified": 1779877693,
|
||||
"narHash": "sha256-NOF9NAREhxr50bbBfVcVOq+ArCMSoe8dP79Pk2uyARk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4100e830e085863741bc69b156ec4ccd53ab5be0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"ref": "rolling",
|
||||
"repo": "devenv-nixpkgs",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"alejandra": "alejandra",
|
||||
"devenv": "devenv",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
@@ -354,11 +127,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1770260791,
|
||||
"narHash": "sha256-ADTBfENFjRVDQMcCycyX/pAy6NFI/Ct6Mrar3gsmXI0=",
|
||||
"lastModified": 1779992051,
|
||||
"narHash": "sha256-4YWGv/0NkAdtTW1MXfaLYpfC9BhpCy9k1pWkR0xI9uw=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "42ec85352e419e601775c57256a52f6d48a39906",
|
||||
"rev": "e93ad0df1073b2c969a8f0c1f10b84e870469d40",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -381,28 +154,6 @@
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"devenv",
|
||||
"nixd",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1734704479,
|
||||
"narHash": "sha256-MMi74+WckoyEWBRcg/oaGRvXC9BVVxDZNRMpL+72wBI=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "65712f5af67234dad91a5a4baee986a8b62dbf8f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
||||
@@ -2,16 +2,12 @@
|
||||
description = "Conventional commits for Jujutsu";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
alejandra = {
|
||||
url = "github:kamadorueda/alejandra/4.0.0";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
devenv = {
|
||||
url = "github:cachix/devenv";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@@ -19,8 +15,16 @@
|
||||
};
|
||||
|
||||
nixConfig = {
|
||||
extra-trusted-public-keys = ["devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" "phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk="];
|
||||
extra-substituters = ["https://devenv.cachix.org" "https://phundrak.cachix.org"];
|
||||
extra-trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
|
||||
"phundrak.cachix.org-1:osJAkYO0ioTOPqaQCIXMfIRz1/+YYlVFkup3R2KSexk="
|
||||
];
|
||||
extra-substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
"https://devenv.cachix.org"
|
||||
"https://phundrak.cachix.org"
|
||||
];
|
||||
};
|
||||
|
||||
outputs = {
|
||||
@@ -29,37 +33,65 @@
|
||||
rust-overlay,
|
||||
alejandra,
|
||||
...
|
||||
} @ inputs:
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system: let
|
||||
overlays = [(import rust-overlay)];
|
||||
pkgs = import nixpkgs {inherit system overlays;};
|
||||
rustVersion = pkgs.rust-bin.stable.latest.default;
|
||||
rustPlatform = pkgs.makeRustPlatform {
|
||||
cargo = rustVersion;
|
||||
rustc = rustVersion;
|
||||
targets = {
|
||||
linux-x86_64 = {
|
||||
crossPkgs = pkgs;
|
||||
triple = "x86_64-unknown-linux-gnu";
|
||||
exeSuffix = "";
|
||||
};
|
||||
linux-aarch64 = {
|
||||
crossPkgs = pkgs.pkgsCross.aarch64-multiplatform;
|
||||
triple = "aarch64-unknown-linux-gnu";
|
||||
exeSuffix = "";
|
||||
};
|
||||
windows-x86_64 = {
|
||||
crossPkgs = pkgs.pkgsCross.mingwW64;
|
||||
triple = "x86_64-pc-windows-gnu";
|
||||
exeSuffix = ".exe";
|
||||
};
|
||||
windows-aarch64 = {
|
||||
crossPkgs = pkgs.pkgsCross.aarch64-windows;
|
||||
triple = "aarch64-pc-windows-gnu";
|
||||
exeSuffix = ".exe";
|
||||
};
|
||||
macos-x86_64 = {
|
||||
crossPkgs = pkgs.pkgsCross.x86_64-darwin;
|
||||
triple = "x86_64-apple-darwin";
|
||||
exeSuffix = "";
|
||||
};
|
||||
macos-aarch64 = {
|
||||
crossPkgs = pkgs.pkgsCross.aarch64-darwin;
|
||||
triple = "aarch64-apple-darwin";
|
||||
exeSuffix = "";
|
||||
};
|
||||
};
|
||||
mkRustBuild = import ./nix/package.nix;
|
||||
packages = {
|
||||
linux-x86_64 = mkRustBuild {inherit pkgs; target = targets.linux-x86_64; };
|
||||
linux-aarch64 = mkRustBuild { inherit pkgs; target = targets.linux-aarch64; };
|
||||
windows-x86_64 = mkRustBuild { inherit pkgs; target = targets.windows-x86_64; };
|
||||
macos-aarch64 = mkRustBuild { inherit pkgs; target = targets.macos-aarch64; };
|
||||
};
|
||||
defaultBySystem = {
|
||||
"x86_64-linux" = packages.linux-x86_64;
|
||||
"aarch64-linux" = packages.linux-aarch64;
|
||||
"x86_64-windows" = packages.windows-x86_64;
|
||||
"aarch64-macos" = packages.macos-aarch64;
|
||||
};
|
||||
in {
|
||||
formatter = alejandra.defaultPackage.${system};
|
||||
packages = let
|
||||
nativeRustVersion = pkgs.rust-bin.stable.latest.default;
|
||||
nativeRustPlatform = pkgs.makeRustPlatform {
|
||||
cargo = nativeRustVersion;
|
||||
rustc = nativeRustVersion;
|
||||
};
|
||||
mingwPkgs = pkgs.pkgsCross.mingwW64;
|
||||
windowsRustVersion = pkgs.rust-bin.stable.latest.default.override {
|
||||
targets = ["x86_64-pc-windows-gnu"];
|
||||
};
|
||||
windowsRustPlatform = mingwPkgs.makeRustPlatform {
|
||||
cargo = windowsRustVersion;
|
||||
rustc = windowsRustVersion;
|
||||
};
|
||||
in
|
||||
import ./nix/package.nix {inherit pkgs nativeRustPlatform windowsRustPlatform;};
|
||||
devShell = import ./nix/shell.nix {
|
||||
inherit inputs pkgs rustVersion;
|
||||
packages =
|
||||
packages
|
||||
// {
|
||||
default = defaultBySystem.${system} or packages.linux-x86_64;
|
||||
};
|
||||
devShell = import ./nix/shell.nix {inherit pkgs rustVersion;};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
+9
-15
@@ -1,8 +1,6 @@
|
||||
{
|
||||
target,
|
||||
pkgs,
|
||||
nativeRustPlatform,
|
||||
windowsRustPlatform,
|
||||
...
|
||||
}: let
|
||||
cargoToml = fromTOML (builtins.readFile ../Cargo.toml);
|
||||
name = cargoToml.package.name;
|
||||
@@ -16,18 +14,14 @@
|
||||
meta = {
|
||||
inherit (cargoToml.package) description homepage;
|
||||
};
|
||||
postBuild = "${pkgs.upx}/bin/upx target/*/release/${name}${target.exeSuffix}";
|
||||
};
|
||||
nativeBuild =
|
||||
nativeRustPlatform.buildRustPackage buildArgs
|
||||
// {
|
||||
postBuild = "${pkgs.upx}/bin/upx target/*/release/${name}";
|
||||
rustVersion = pkgs.rust-bin.stable.latest.default.override {
|
||||
targets = [target.triple];
|
||||
};
|
||||
windowsBuild =
|
||||
windowsRustPlatform.buildRustPackage buildArgs
|
||||
// {
|
||||
postBuild = "${pkgs.upx}/bin/upx target/*/release/${name}.exe";
|
||||
rustPlatform = target.crossPkgs.makeRustPlatform {
|
||||
cargo = rustVersion;
|
||||
rustc = rustVersion;
|
||||
};
|
||||
in {
|
||||
default = nativeBuild;
|
||||
windows = windowsBuild;
|
||||
}
|
||||
in
|
||||
rustPlatform.buildRustPackage buildArgs
|
||||
|
||||
+1
-8
@@ -1,13 +1,8 @@
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
rustVersion,
|
||||
...
|
||||
}:
|
||||
inputs.devenv.lib.mkShell {
|
||||
inherit inputs pkgs;
|
||||
modules = [
|
||||
{
|
||||
pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
(rustVersion.override {
|
||||
extensions = [
|
||||
@@ -27,5 +22,3 @@ inputs.devenv.lib.mkShell {
|
||||
typos
|
||||
];
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user