mirror of
https://git.sr.ht/~bryan_bennett/flake_env
synced 2025-12-17 07:01:23 +01:00
Add source filtering
This resolves #4 by excluding the git subdirectory when building as a flake. Test builds with `nix build path:.` before and after the change.
This commit is contained in:
parent
4013e8fca6
commit
8119738ddc
3 changed files with 36 additions and 4 deletions
17
default.nix
17
default.nix
|
|
@ -1,8 +1,9 @@
|
||||||
{ buildDunePackage
|
{ buildDunePackage
|
||||||
, lib
|
|
||||||
, core
|
, core
|
||||||
, core_unix
|
, core_unix
|
||||||
, findlib
|
, findlib
|
||||||
|
, lib
|
||||||
|
, nix-filter
|
||||||
, ocaml
|
, ocaml
|
||||||
, ppx_yojson_conv
|
, ppx_yojson_conv
|
||||||
, ppx_yojson_conv_lib
|
, ppx_yojson_conv_lib
|
||||||
|
|
@ -13,7 +14,19 @@
|
||||||
buildDunePackage {
|
buildDunePackage {
|
||||||
pname = "flake_env";
|
pname = "flake_env";
|
||||||
version = "0.1";
|
version = "0.1";
|
||||||
src = ./.;
|
src = nix-filter {
|
||||||
|
root = ./.;
|
||||||
|
include = [
|
||||||
|
"bin"
|
||||||
|
"lib"
|
||||||
|
./dune-project
|
||||||
|
./flake.nix
|
||||||
|
./default.nix
|
||||||
|
./flake.lock
|
||||||
|
./flake_env.opam
|
||||||
|
./direnvrc
|
||||||
|
];
|
||||||
|
};
|
||||||
duneVersion = "3";
|
duneVersion = "3";
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace direnvrc --replace "@flake_env@" "$out/bin/flake_env"
|
substituteInPlace direnvrc --replace "@flake_env@" "$out/bin/flake_env"
|
||||||
|
|
|
||||||
16
flake.lock
generated
16
flake.lock
generated
|
|
@ -20,6 +20,21 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-filter": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1701697642,
|
||||||
|
"narHash": "sha256-L217WytWZHSY8GW9Gx1A64OnNctbuDbfslaTEofXXRw=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-filter",
|
||||||
|
"rev": "c843418ecfd0344ecb85844b082ff5675e02c443",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-filter",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1702272962,
|
"lastModified": 1702272962,
|
||||||
|
|
@ -39,6 +54,7 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
|
"nix-filter": "nix-filter",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,12 @@
|
||||||
url = "github:hercules-ci/flake-parts";
|
url = "github:hercules-ci/flake-parts";
|
||||||
inputs.nixpkgs-lib.follows = "nixpkgs";
|
inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
nix-filter = {
|
||||||
|
url = "github:numtide/nix-filter";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs @ { flake-parts, ... }:
|
outputs = inputs @ { flake-parts, nix-filter, ... }:
|
||||||
flake-parts.lib.mkFlake { inherit inputs; }
|
flake-parts.lib.mkFlake { inherit inputs; }
|
||||||
({ lib, ... }: {
|
({ lib, ... }: {
|
||||||
systems = [
|
systems = [
|
||||||
|
|
@ -20,7 +23,7 @@
|
||||||
];
|
];
|
||||||
perSystem = { config, pkgs, self', ... }: {
|
perSystem = { config, pkgs, self', ... }: {
|
||||||
packages = {
|
packages = {
|
||||||
flake_env = pkgs.ocamlPackages.callPackage ./default.nix { };
|
flake_env = pkgs.ocamlPackages.callPackage ./default.nix { inherit nix-filter; };
|
||||||
default = config.packages.flake_env;
|
default = config.packages.flake_env;
|
||||||
};
|
};
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue