-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
48 lines (47 loc) · 1.66 KB
/
flake.nix
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
{
description = "Helix editor with custom configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
helix = {
url = "github:helix-editor/helix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, helix, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ ];
};
helixPackage = helix.packages.${system}.default;
helixDeps = import ./dependencies.nix { inherit pkgs; };
languagesConfig = import ./config/languages.nix { inherit pkgs; };
editorConfig = import ./config/editor.nix;
tomlFormat = pkgs.formats.toml { };
languagesToml = tomlFormat.generate "languages.toml" languagesConfig;
configToml = tomlFormat.generate "config.toml" editorConfig;
in
{
packages.default = pkgs.symlinkJoin {
name = "helix-wrapped";
paths = [ helixPackage ] ++ helixDeps;
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
mkdir -p $out/config/helix
cp ${configToml} $out/config/helix/config.toml
cp ${languagesToml} $out/config/helix/languages.toml
cp -r ${./config/themes} $out/config/helix/themes
wrapProgram $out/bin/hx \
--set XDG_CONFIG_HOME "$out/config" \
--prefix PATH : ${pkgs.lib.makeBinPath helixDeps}
'';
};
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/hx";
};
}
);
}