filter *.nix files as source arguments for lesser rebuilds

This commit is contained in:
778a69cd 2023-08-09 15:48:22 +02:00
parent 6deb3f4226
commit 8038f967cc
3 changed files with 32 additions and 6 deletions

View file

@ -1,5 +1,20 @@
{ {
"nodes": { "nodes": {
"nix-filter": {
"locked": {
"lastModified": 1687178632,
"narHash": "sha256-HS7YR5erss0JCaUijPeyg2XrisEb959FIct3n2TMGbE=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "d90c75e8319d0dd9be67d933d8eb9d0894ec9174",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-filter",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1691080431, "lastModified": 1691080431,
@ -18,6 +33,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View file

@ -1,21 +1,28 @@
{ {
description = "Mobilizon fork for potsda.mn"; description = "Mobilizon fork for potsda.mn";
inputs.nixpkgs.url = "github:erictapen/nixpkgs/mobilizon-3"; inputs = {
nixpkgs.url = "github:erictapen/nixpkgs/mobilizon-3";
nix-filter.url = "github:numtide/nix-filter";
};
outputs = { self, nixpkgs }: outputs = { self, nixpkgs, nix-filter }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
filter = nix-filter.lib;
in in
{ {
packages.x86_64-linux.mobilizon = pkgs.callPackage ./. { packages.x86_64-linux.mobilizon = pkgs.callPackage ./. {
src = ./.; src = filter {
root = ./.;
exclude = [ (filter.matchExt "nix") ];
};
mobilizon-js = self.packages.x86_64-linux.mobilizon-frontend; mobilizon-js = self.packages.x86_64-linux.mobilizon-frontend;
}; };
packages.x86_64-linux.mobilizon-frontend = pkgs.callPackage ./js { }; packages.x86_64-linux.mobilizon-frontend = pkgs.callPackage ./js { inherit filter; };
packages.x86_64-linux.default = self.packages.x86_64-linux.mobilizon; packages.x86_64-linux.default = self.packages.x86_64-linux.mobilizon;

View file

@ -1,7 +1,10 @@
{ lib, yarn, mkYarnPackage, imagemagick }: { lib, filter, yarn, mkYarnPackage, imagemagick }:
mkYarnPackage rec { mkYarnPackage rec {
src = ./.; src = filter {
root = ./.;
exclude = [ (filter.matchExt "nix") ];
};
packageJSON = ./package.json; packageJSON = ./package.json;
yarnLock = ./yarn.lock; yarnLock = ./yarn.lock;