Add a flake.nix
This commit is contained in:
parent
211907489e
commit
f8c014f72e
3 changed files with 58 additions and 0 deletions
24
README.md
24
README.md
|
|
@ -15,6 +15,30 @@ niv init
|
|||
niv add hercules-ci/gitignore.nix
|
||||
```
|
||||
|
||||
## With Flakes
|
||||
|
||||
Although Flakes usually process sources within the flake using the git fetcher, which takes care of ignoring in its own peculiar way, you can use gitignore.nix to filter sources outside of a flake. You can load flake-based expressions via `builtins.getFlake (toString ./.)` for example or via [`flake-compat`](https://github.com/edolstra/flake-compat).
|
||||
|
||||
```nix
|
||||
# // flake.nix
|
||||
{
|
||||
inputs.gitignore = {
|
||||
url = "github:hercules-ci/gitignore.nix";
|
||||
# Use the same nixpkgs
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
outputs = { self, /* other, inputs, */ gitignore }:
|
||||
let
|
||||
inherit (gitignore.lib) gitignoreSource;
|
||||
in {
|
||||
packages.x86_64.hello = mkDerivation {
|
||||
name = "hello";
|
||||
src = gitignoreSource ./vendored/hello;
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Plain Nix way
|
||||
|
||||
```nix
|
||||
|
|
|
|||
25
flake.lock
generated
Normal file
25
flake.lock
generated
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1632846328,
|
||||
"narHash": "sha256-sFi6YtlGK30TBB9o6CW7LG9mYHkgtKeWbSLAjjrNTX0=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2b71ddd869ad592510553d09fe89c9709fa26b2b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
9
flake.nix
Normal file
9
flake.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
description = "Nix functions for filtering local git sources";
|
||||
|
||||
outputs = { self, nixpkgs }: {
|
||||
lib = import ./default.nix {
|
||||
inherit (nixpkgs) lib;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue