File tree 8 files changed +176
-14
lines changed
8 files changed +176
-14
lines changed Original file line number Diff line number Diff line change 3
3
4
4
inputs = {
5
5
nixpkgs . url = "github:NixOS/nixpkgs/nixos-24.05" ;
6
+
6
7
flake-parts . url = "github:hercules-ci/flake-parts" ;
8
+
9
+ crane . url = "github:ipetkov/crane" ;
10
+
11
+ treefmt-nix . url = "github:numtide/treefmt-nix" ;
12
+
13
+ advisory-db = {
14
+ url = "github:rustsec/advisory-db" ;
15
+ flake = false ;
16
+ } ;
7
17
} ;
8
18
9
19
outputs =
15
25
} :
16
26
flake-parts . lib . mkFlake { inherit inputs ; } {
17
27
systems = nixpkgs . lib . systems . flakeExposed ;
28
+ imports = [
29
+ inputs . treefmt-nix . flakeModule
30
+ ./nix/pkgs/flake-module.nix
31
+ ./nix/checks/flake-module.nix
32
+ ./nix/shells.nix
33
+ ./nix/treefmt.nix
34
+ ] ;
18
35
perSystem =
19
36
{
20
37
config ,
21
38
pkgs ,
22
39
self' ,
40
+ system ,
23
41
...
24
42
} :
25
43
{
26
- packages = rec {
27
- # This package depends on git submodules so use a shell command like 'nix build .?submodules=1'.
28
- cln = pkgs . callPackage nix/pkgs/default.nix { inherit self pkgs ; } ;
29
- default = cln ;
44
+ _module . args . pkgs = import inputs . nixpkgs {
45
+ inherit system ;
46
+ overlays = [ ( final : prev : { craneLib = ( inputs . crane . mkLib pkgs ) ; } ) ] ;
30
47
} ;
31
48
apps = {
32
49
lightningd = {
42
59
program = "${ self' . packages . cln } /bin/reckless" ;
43
60
} ;
44
61
} ;
45
- checks = {
46
- cln = self' . packages . cln ;
47
- } ;
48
- formatter = pkgs . nixfmt-rfc-style ;
49
62
} ;
50
63
} ;
51
64
}
Original file line number Diff line number Diff line change
1
+ { inputs , self , ... } :
2
+ {
3
+ perSystem =
4
+ { pkgs , config , ... } :
5
+ let
6
+ advisory-db = inputs . advisory-db ;
7
+ in
8
+ {
9
+ checks = {
10
+ cln = config . packages . cln ;
11
+ rust = config . packages . rust ;
12
+ cargo-audit = pkgs . craneLib . cargoAudit {
13
+ src = ../../. ;
14
+ inherit advisory-db ;
15
+ } ;
16
+ formatting = config . treefmt . build . check self ;
17
+ } ;
18
+ } ;
19
+ }
Original file line number Diff line number Diff line change 2
2
self ,
3
3
lib ,
4
4
pkgs ,
5
+ config ,
5
6
} :
6
7
with pkgs ;
7
8
let
@@ -28,12 +29,10 @@ stdenv.mkDerivation {
28
29
autoconf
29
30
autogen
30
31
automake
31
- cargo
32
32
gettext
33
33
gitMinimal
34
34
libtool
35
35
lowdown
36
- protobuf
37
36
py3
38
37
unzip
39
38
which
@@ -83,6 +82,7 @@ stdenv.mkDerivation {
83
82
# The `clnrest` plugin requires a Python environment to run
84
83
postInstall = ''
85
84
rm -r $out/libexec/c-lightning/plugins/clnrest
85
+ cp ${ config . packages . rust } /bin/cln-grpc $out/libexec/c-lightning/plugins
86
86
'' ;
87
87
88
88
meta = with lib ; {
Original file line number Diff line number Diff line change
1
+ { self , ... } :
2
+ {
3
+ perSystem =
4
+ { pkgs , config , ... } :
5
+ {
6
+ packages = rec {
7
+ # This package depends on git submodules so use a shell command like 'nix build .?submodules=1'.
8
+ cln = pkgs . callPackage ./default.nix { inherit self pkgs config ; } ;
9
+ rust = pkgs . callPackage ./rust.nix { craneLib = pkgs . craneLib ; } ;
10
+ default = cln ;
11
+ } ;
12
+ } ;
13
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ pkgs ,
3
+ lib ,
4
+ craneLib ,
5
+ ...
6
+ } :
7
+ let
8
+ version = builtins . readFile ../../.version ;
9
+ src = lib . cleanSourceWith {
10
+ src = ../../. ;
11
+ filter = path : type : ( lib . hasSuffix "\. proto" path ) || ( craneLib . filterCargoSources path type ) ;
12
+ } ;
13
+ in
14
+ craneLib . buildPackage {
15
+ pname = "rust" ;
16
+ inherit src version ;
17
+ strictDeps = true ;
18
+ nativeBuildInputs = with pkgs ; [ protobuf ] ;
19
+ }
Original file line number Diff line number Diff line change
1
+ { self , ... } :
2
+ {
3
+ perSystem =
4
+ {
5
+ config ,
6
+ pkgs ,
7
+ system ,
8
+ ...
9
+ } :
10
+ {
11
+ devShells = {
12
+ rust = pkgs . craneLib . devShell {
13
+ checks = {
14
+ inherit ( self . checks . ${ system } ) rust ;
15
+ } ;
16
+ } ;
17
+ } ;
18
+ } ;
19
+ }
Original file line number Diff line number Diff line change
1
+ { ... } :
2
+ {
3
+ perSystem =
4
+ { pkgs , lib , ... } :
5
+ {
6
+ treefmt = {
7
+ projectRootFile = "flake.nix" ;
8
+ programs . nixfmt . enable = true ;
9
+ } ;
10
+ } ;
11
+ }
You can’t perform that action at this time.
0 commit comments