Use the Nixpkgs fileset
library to filter source
Now I can change Nix files without causing rebuilds.
This commit is contained in:
parent
d6d6d1b649
commit
4bbc7b8f75
|
@ -10,7 +10,7 @@
|
||||||
# 23.11 and has `lib.fileset`.
|
# 23.11 and has `lib.fileset`.
|
||||||
inputs.nixpkgs-for-fileset.url = "github:NixOS/nixpkgs/nixos-23.11";
|
inputs.nixpkgs-for-fileset.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nix }:
|
outputs = { self, nixpkgs, nix, nixpkgs-for-fileset }:
|
||||||
let
|
let
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||||
forEachSystem = nixpkgs.lib.genAttrs systems;
|
forEachSystem = nixpkgs.lib.genAttrs systems;
|
||||||
|
@ -65,7 +65,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
hydra = final.callPackage ./package.nix {
|
hydra = final.callPackage ./package.nix {
|
||||||
src = self;
|
inherit (nixpkgs-for-fileset.lib) fileset;
|
||||||
|
rawSrc = self;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
26
package.nix
26
package.nix
|
@ -1,7 +1,8 @@
|
||||||
{ stdenv
|
{ stdenv
|
||||||
, lib
|
, lib
|
||||||
|
, fileset
|
||||||
|
|
||||||
, src
|
, rawSrc
|
||||||
|
|
||||||
, buildEnv
|
, buildEnv
|
||||||
|
|
||||||
|
@ -128,13 +129,28 @@ let
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
version = "${builtins.readFile ./version.txt}.${builtins.substring 0 8 (src.lastModifiedDate or "19700101")}.${src.shortRev or "DIRTY"}";
|
version = "${builtins.readFile ./version.txt}.${builtins.substring 0 8 (rawSrc.lastModifiedDate or "19700101")}.${rawSrc.shortRev or "DIRTY"}";
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "hydra";
|
pname = "hydra";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
inherit src;
|
src = fileset.toSource {
|
||||||
|
root = ./.;
|
||||||
|
fileset = fileset.unions ([
|
||||||
|
./version.txt
|
||||||
|
./configure.ac
|
||||||
|
./Makefile.am
|
||||||
|
./src
|
||||||
|
./doc
|
||||||
|
./hydra-module.nix
|
||||||
|
# TODO only when `doCheck`
|
||||||
|
./t
|
||||||
|
] ++ lib.optionals finalAttrs.doCheck [
|
||||||
|
./.perlcriticrc
|
||||||
|
./.yath.rc
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
|
|
||||||
|
@ -251,4 +267,4 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
meta.description = "Build of Hydra on ${stdenv.system}";
|
meta.description = "Build of Hydra on ${stdenv.system}";
|
||||||
passthru = { inherit perlDeps nix; };
|
passthru = { inherit perlDeps nix; };
|
||||||
}
|
})
|
||||||
|
|
Loading…
Reference in a new issue