-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
93 lines (88 loc) · 2.48 KB
/
flake.nix
File metadata and controls
93 lines (88 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
git-hooks-nix = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
systems.url = "github:nix-systems/default";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
imports = [
inputs.treefmt-nix.flakeModule
inputs.git-hooks-nix.flakeModule
];
perSystem =
{
pkgs,
lib,
...
}:
let
name = "msn-show-source";
pname = name;
src = ./.;
buildNpmPackage = pkgs.buildNpmPackage;
importNpmLock = pkgs.importNpmLock;
nodejs = pkgs.nodejs;
meta = {
description = "Userscript to add the source article to MSN News";
homepage = "https://github.com/elanora96/msn-show-source";
license = lib.licenses.isc;
maintainers = with lib.maintainers; [ elanora96 ];
platforms = lib.platforms.all;
};
in
{
packages.default = buildNpmPackage {
inherit
name
pname
src
meta
;
npmDeps = importNpmLock { npmRoot = src; };
npmConfigHook = importNpmLock.npmConfigHook;
buildInputs = [ nodejs ];
installPhase = ''
mkdir -p $out
cp -r ./dist $out/dist
'';
};
devShells.default = pkgs.mkShell {
packages = [
importNpmLock.hooks.linkNodeModulesHook
nodejs
];
npmDeps = importNpmLock.buildNodeModules {
npmRoot = src;
inherit nodejs;
};
};
pre-commit.settings.hooks = {
treefmt.enable = true;
};
treefmt = {
projectRootFile = "flake.nix"; # Used to find the project root
programs = {
biome = {
enable = true;
settings = builtins.fromJSON (builtins.readFile ./biome.json);
};
nixfmt.enable = true;
};
};
};
};
}