forked from FG42/FG42
Reformat all the nix files using nixpkgs-fmt
This commit is contained in:
parent
7659a028f7
commit
38986f37da
|
@ -13,14 +13,15 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
{ pkgs, lib, elispDepsFile }:
|
{ pkgs, lib, elispDepsFile }:
|
||||||
with builtins;
|
with builtins;
|
||||||
let
|
let
|
||||||
reader = import ./elisp_reader.nix { inherit lib; };
|
reader = import ./elisp_reader.nix { inherit lib; };
|
||||||
elispAst = reader.fromElisp (builtins.readFile elispDepsFile);
|
elispAst = reader.fromElisp (builtins.readFile elispDepsFile);
|
||||||
dependsOnForm = filter (x: head x == "depends-on") elispAst;
|
dependsOnForm = filter (x: head x == "depends-on") elispAst;
|
||||||
elispPkgs = if length dependsOnForm == 0
|
elispPkgs =
|
||||||
|
if length dependsOnForm == 0
|
||||||
then throw "Can't find the form 'depends-on' on 'deps.el'"
|
then throw "Can't find the form 'depends-on' on 'deps.el'"
|
||||||
else tail (head dependsOnForm);
|
else tail (head dependsOnForm);
|
||||||
in elispPkgs
|
in
|
||||||
|
elispPkgs
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
# Fg42 - Emacs Editor for advance users
|
|
||||||
#
|
|
||||||
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, version 2.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
{ pkgs, fg42, version }:
|
|
||||||
{
|
|
||||||
desktop = pkgs.writeText "FG42.desktop" ''
|
|
||||||
[Desktop Entry]
|
|
||||||
Encoding=UTF-8
|
|
||||||
Name=FG42
|
|
||||||
GenericName=FG42
|
|
||||||
Comment=Emacs Editor for advance users
|
|
||||||
MimeType=text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-java;application/x-shellscript;text/x-c;text/x-c++;text/x-ruby;text/x-python;text/x-clojure;text/css;text/html;text/x-javascript;
|
|
||||||
Type=Application
|
|
||||||
Terminal=false
|
|
||||||
Categories=Development;TextEditor;
|
|
||||||
StartupWMClass=FG42
|
|
||||||
Exec=${fg42} %F
|
|
||||||
Icon=fg42
|
|
||||||
Version=${version}
|
|
||||||
'';
|
|
||||||
}
|
|
|
@ -73,7 +73,8 @@ let
|
||||||
matchSymbol =
|
matchSymbol =
|
||||||
let
|
let
|
||||||
symbolChar = ''([^${notInSymbol}]|\\.)'';
|
symbolChar = ''([^${notInSymbol}]|\\.)'';
|
||||||
in mkMatcher ''(${symbolChar}+)([${notInSymbol}]|$).*'' symbolMaxLength;
|
in
|
||||||
|
mkMatcher ''(${symbolChar}+)([${notInSymbol}]|$).*'' symbolMaxLength;
|
||||||
|
|
||||||
maxTokenLength = foldl' max 0 [
|
maxTokenLength = foldl' max 0 [
|
||||||
commentMaxLength
|
commentMaxLength
|
||||||
|
@ -291,7 +292,8 @@ let
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw "Unrecognized token on line ${toString state.line}: ${rest}";
|
throw "Unrecognized token on line ${toString state.line}: ${rest}";
|
||||||
in (builtins.foldl' readToken { acc = []; pos = 0; skip = 0; line = startLineNumber; mod = 0; } (stringToCharacters elisp)).acc;
|
in
|
||||||
|
(builtins.foldl' readToken { acc = [ ]; pos = 0; skip = 0; line = startLineNumber; mod = 0; } (stringToCharacters elisp)).acc;
|
||||||
|
|
||||||
tokenizeElisp = elisp:
|
tokenizeElisp = elisp:
|
||||||
tokenizeElisp' { inherit elisp; };
|
tokenizeElisp' { inherit elisp; };
|
||||||
|
@ -302,7 +304,8 @@ let
|
||||||
# Convert literal value tokens in a flat list to their
|
# Convert literal value tokens in a flat list to their
|
||||||
# corresponding nix representation.
|
# corresponding nix representation.
|
||||||
parseValues = tokens:
|
parseValues = tokens:
|
||||||
map (token:
|
map
|
||||||
|
(token:
|
||||||
if token.type == "string" then
|
if token.type == "string" then
|
||||||
token // {
|
token // {
|
||||||
value = substring 1 (stringLength token.value - 2) token.value;
|
value = substring 1 (stringLength token.value - 2) token.value;
|
||||||
|
@ -336,7 +339,8 @@ let
|
||||||
token
|
token
|
||||||
else
|
else
|
||||||
token
|
token
|
||||||
) tokens;
|
)
|
||||||
|
tokens;
|
||||||
|
|
||||||
# Convert pairs of opening and closing tokens to their
|
# Convert pairs of opening and closing tokens to their
|
||||||
# respective collection types, i.e. lists and vectors. Also,
|
# respective collection types, i.e. lists and vectors. Also,
|
||||||
|
@ -434,12 +438,14 @@ let
|
||||||
throw ''"Dotted pair notation"-dot outside list on line ${toString token.line}''
|
throw ''"Dotted pair notation"-dot outside list on line ${toString token.line}''
|
||||||
else if isList token.value then
|
else if isList token.value then
|
||||||
let
|
let
|
||||||
collectionContents = foldl' parseToken {
|
collectionContents = foldl' parseToken
|
||||||
|
{
|
||||||
acc = [ ];
|
acc = [ ];
|
||||||
dotted = false;
|
dotted = false;
|
||||||
inList = token.type == "list";
|
inList = token.type == "list";
|
||||||
inherit (state) depthReduction;
|
inherit (state) depthReduction;
|
||||||
} token.value;
|
}
|
||||||
|
token.value;
|
||||||
in
|
in
|
||||||
state // {
|
state // {
|
||||||
acc = state.acc ++ (
|
acc = state.acc ++ (
|
||||||
|
@ -630,7 +636,8 @@ let
|
||||||
flags =
|
flags =
|
||||||
(foldl'
|
(foldl'
|
||||||
parseFlag
|
parseFlag
|
||||||
{ acc = state.block.flags;
|
{
|
||||||
|
acc = state.block.flags;
|
||||||
flag = null;
|
flag = null;
|
||||||
inherit (state) line;
|
inherit (state) line;
|
||||||
}
|
}
|
||||||
|
@ -683,7 +690,8 @@ let
|
||||||
in
|
in
|
||||||
(foldl'
|
(foldl'
|
||||||
parseToken
|
parseToken
|
||||||
{ acc = [];
|
{
|
||||||
|
acc = [ ];
|
||||||
mod = 0;
|
mod = 0;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
skip = 0;
|
skip = 0;
|
||||||
|
|
|
@ -13,9 +13,14 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
{ lib, stdenv, emacs29, callPackage, writeShellApplication, noether
|
{ lib
|
||||||
, emacsParams ? {},
|
, stdenv
|
||||||
fg42Params ? {}
|
, emacs29
|
||||||
|
, callPackage
|
||||||
|
, writeShellApplication
|
||||||
|
, noether
|
||||||
|
, emacsParams ? { }
|
||||||
|
, fg42Params ? { }
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
lemacs = emacs29.override ({
|
lemacs = emacs29.override ({
|
||||||
|
@ -47,4 +52,5 @@ let
|
||||||
DISPLAY=:1 ${fg42}/bin/fg42-wm
|
DISPLAY=:1 ${fg42}/bin/fg42-wm
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in { inherit fg42 run-test-wm; }
|
in
|
||||||
|
{ inherit fg42 run-test-wm; }
|
||||||
|
|
65
nix/fg42.nix
65
nix/fg42.nix
|
@ -13,21 +13,49 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
{ lib, stdenv, elispPkgs, srcDir, emacsPackagesFor, ourPackages, direnv
|
{ lib
|
||||||
, makeFontsConf, nix, nixpkgs-fmt
|
, stdenv
|
||||||
, nil, # nix lsp server
|
, elispPkgs
|
||||||
|
, srcDir
|
||||||
|
, emacsPackagesFor
|
||||||
|
, ourPackages
|
||||||
|
, direnv
|
||||||
|
, makeFontsConf
|
||||||
|
, nix
|
||||||
|
, nixpkgs-fmt
|
||||||
|
, nil
|
||||||
|
, # nix lsp server
|
||||||
|
|
||||||
# python deps
|
# python deps
|
||||||
python311, python3Packages,
|
python311
|
||||||
# This is a set of system tools required for FG42
|
, python3Packages
|
||||||
|
, # This is a set of system tools required for FG42
|
||||||
# to work.
|
# to work.
|
||||||
pyright, emacs, ripgrep, git, texinfo, vazir-fonts, fira-code, nerdfonts
|
pyright
|
||||||
, fira-mono, noto-fonts, gcc, ltex-ls, bash, tree-sitter, fd
|
, emacs
|
||||||
, aspellWithDicts,
|
, ripgrep
|
||||||
|
, git
|
||||||
supportWM ? true, xorg, slock,
|
, texinfo
|
||||||
|
, vazir-fonts
|
||||||
supportPython ? true, supportVerilog ? true, svls, verilator, }:
|
, fira-code
|
||||||
|
, nerdfonts
|
||||||
|
, fira-mono
|
||||||
|
, noto-fonts
|
||||||
|
, gcc
|
||||||
|
, ltex-ls
|
||||||
|
, bash
|
||||||
|
, tree-sitter
|
||||||
|
, fd
|
||||||
|
, aspellWithDicts
|
||||||
|
, supportWM ? true
|
||||||
|
, xorg
|
||||||
|
, slock
|
||||||
|
, supportPython ? true
|
||||||
|
, supportVerilog ? true
|
||||||
|
, svls
|
||||||
|
, verilator
|
||||||
|
,
|
||||||
|
}:
|
||||||
with builtins;
|
with builtins;
|
||||||
let
|
let
|
||||||
version = "4.0.0";
|
version = "4.0.0";
|
||||||
|
@ -43,7 +71,15 @@ let
|
||||||
dicts = aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]);
|
dicts = aspellWithDicts (dicts: with dicts; [ en en-computers en-science ]);
|
||||||
|
|
||||||
runtimeBins = [
|
runtimeBins = [
|
||||||
ripgrep git tree-sitter direnv nix nil dicts fd nixpkgs-fmt
|
ripgrep
|
||||||
|
git
|
||||||
|
tree-sitter
|
||||||
|
direnv
|
||||||
|
nix
|
||||||
|
nil
|
||||||
|
dicts
|
||||||
|
fd
|
||||||
|
nixpkgs-fmt
|
||||||
]
|
]
|
||||||
++ (lib.optional (!stdenv.buildPlatform.isRiscV) [
|
++ (lib.optional (!stdenv.buildPlatform.isRiscV) [
|
||||||
# Not supported on Risc-V
|
# Not supported on Risc-V
|
||||||
|
@ -83,7 +119,8 @@ let
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
in stdenv.mkDerivation (final: rec {
|
in
|
||||||
|
stdenv.mkDerivation (final: rec {
|
||||||
inherit version;
|
inherit version;
|
||||||
pname = "fg42";
|
pname = "fg42";
|
||||||
src = srcDir;
|
src = srcDir;
|
||||||
|
|
|
@ -22,8 +22,8 @@ let
|
||||||
(x: builtins.typeOf x == "string")
|
(x: builtins.typeOf x == "string")
|
||||||
(builtins.split _sep _s);
|
(builtins.split _sep _s);
|
||||||
|
|
||||||
in {
|
in
|
||||||
elispStr
|
{ elispStr
|
||||||
, alwaysEnsure ? false
|
, alwaysEnsure ? false
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
@ -94,4 +94,5 @@ in {
|
||||||
map recurse item
|
map recurse item
|
||||||
else
|
else
|
||||||
[ ];
|
[ ];
|
||||||
in lib.flatten (map recurse (readFunction elispStr))
|
in
|
||||||
|
lib.flatten (map recurse (readFunction elispStr))
|
||||||
|
|
Loading…
Reference in New Issue