build with central nixpkgs

Signed-off-by: jolheiser <git@jolheiser.com>
main
jolheiser 2024-10-30 20:07:26 -05:00
parent a6f4760ef5
commit 13d625fa4f
No known key found for this signature in database
2 changed files with 130 additions and 93 deletions

View File

@ -1,24 +1,46 @@
{
"nodes": {
"jolheiser": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1730336659,
"narHash": "sha256-DYQUprBce8sXdBj7Ub1h/52GnGvxiXelvucVTcTXE8I=",
"ref": "refs/heads/main",
"rev": "69856a465c69e5b456ef652f0f5f17a12b9d8c02",
"revCount": 3,
"type": "git",
"url": "https://git.jolheiser.com/nixpkgs.git"
},
"original": {
"type": "git",
"url": "https://git.jolheiser.com/nixpkgs.git"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1715653339,
"narHash": "sha256-7lR9tpVXviSccl07GXI0+ve/natd24HAkuy1sQp0OlI=",
"lastModified": 1729880355,
"narHash": "sha256-RP+OQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "abd6d48f8c77bea7dc51beb2adfa6ed3950d2585",
"rev": "18536bf04cd71abd345f9579158841376fdd0c5a",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
"jolheiser": "jolheiser",
"nixpkgs": [
"jolheiser",
"nixpkgs"
]
}
}
},

View File

@ -1,18 +1,21 @@
{
description = "jolheiser helix derivation";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
jolheiser.url = "git+https://git.jolheiser.com/nixpkgs.git";
nixpkgs.follows = "jolheiser/nixpkgs";
};
outputs = {
self,
outputs =
{
nixpkgs,
}: let
...
}:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
tomlFormat = pkgs.formats.toml {};
config = import ./config.nix {pkgs = pkgs;};
buildGrammar = grammar: let
tomlFormat = pkgs.formats.toml { };
config = import ./config.nix { pkgs = pkgs; };
buildGrammar =
grammar:
let
source = pkgs.fetchgit {
inherit (grammar) url rev sha256;
};
@ -21,7 +24,10 @@
pkgs.stdenv.mkDerivation {
pname = "helix-tree-sitter-grammar-${grammar.name}";
version = grammar.rev;
buildInputs = [pkgs.helix pkgs.git];
buildInputs = [
pkgs.helix
pkgs.git
];
src = source;
dontInstall = true;
buildPhase = ''
@ -49,31 +55,40 @@
runHook postBuild
'';
};
builtGrammars =
builtins.map (grammar: {
builtGrammars = builtins.map (grammar: {
inherit (grammar) name;
artifact = buildGrammar grammar;
})
config.grammars;
}) config.grammars;
ignoreFile = pkgs.writeText "ignore" (builtins.concatStringsSep "\n" config.ignore);
configFile = pkgs.writeText "config.toml" (builtins.readFile (tomlFormat.generate "helix-config" config.settings));
languageFile = pkgs.writeText "languages.toml" (builtins.readFile (tomlFormat.generate "helix-languages" config.languages));
themeFiles =
pkgs.lib.mapAttrsToList (
name: value: {
configFile = pkgs.writeText "config.toml" (
builtins.readFile (tomlFormat.generate "helix-config" config.settings)
);
languageFile = pkgs.writeText "languages.toml" (
builtins.readFile (tomlFormat.generate "helix-languages" config.languages)
);
themeFiles = pkgs.lib.mapAttrsToList (name: value: {
inherit name;
file = pkgs.writeText "${name}.toml" (builtins.readFile (tomlFormat.generate "helix-theme-${name}" value));
}
)
config.themes;
themeLinks = builtins.map (theme: "ln -s ${theme.file} $out/home/helix/themes/${theme.name}.toml") themeFiles;
grammarLinks = builtins.map (grammar: "ln -s ${grammar.artifact}/${grammar.name}.so $out/lib/runtime/grammars/${grammar.name}.so") builtGrammars;
queryLinks = builtins.map (grammar: "ln -s ${grammar.artifact}/queries $out/lib/runtime/queries/${grammar.name}") builtGrammars;
in {
file = pkgs.writeText "${name}.toml" (
builtins.readFile (tomlFormat.generate "helix-theme-${name}" value)
);
}) config.themes;
themeLinks = builtins.map (
theme: "ln -s ${theme.file} $out/home/helix/themes/${theme.name}.toml"
) themeFiles;
grammarLinks = builtins.map (
grammar: "ln -s ${grammar.artifact}/${grammar.name}.so $out/lib/runtime/grammars/${grammar.name}.so"
) builtGrammars;
queryLinks = builtins.map (
grammar: "ln -s ${grammar.artifact}/queries $out/lib/runtime/queries/${grammar.name}"
) builtGrammars;
in
{
packages.x86_64-linux.default =
pkgs.runCommand "hx" {
buildInputs = [pkgs.makeWrapper];
} ''
pkgs.runCommand "hx"
{
buildInputs = [ pkgs.makeWrapper ];
}
''
mkdir $out
ln -s ${pkgs.helix}/* $out
rm $out/bin