From 1d0fa6144706d939790df097bb8324556f9a1461 Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Sun, 1 Nov 2020 20:27:07 +0000 Subject: [PATCH] Setup FPGA config set --- configuration.nix | 2 +- externals/packages/fujproj/default.nix | 24 ++++++++++++++++++++++++ externals/rules/fpga.rules | 7 ++++++- packages.nix | 14 -------------- sets/fpga.nix | 26 ++++++++++++++++++++++++++ sets/neovim.nix | 10 ++++++++++ system/starlight/default.nix | 1 + 7 files changed, 68 insertions(+), 16 deletions(-) create mode 100644 externals/packages/fujproj/default.nix create mode 100644 sets/fpga.nix create mode 100644 sets/neovim.nix diff --git a/configuration.nix b/configuration.nix index 6caf036..575fc86 100644 --- a/configuration.nix +++ b/configuration.nix @@ -11,6 +11,7 @@ ./system/current ./packages.nix ./fonts.nix + ./sets/neovim.nix ]; nix = { @@ -40,7 +41,6 @@ environment = { variables = { - EDITOR = "nvim"; TERMINAL = "alacritty"; # for Sway diff --git a/externals/packages/fujproj/default.nix b/externals/packages/fujproj/default.nix new file mode 100644 index 0000000..748668d --- /dev/null +++ b/externals/packages/fujproj/default.nix @@ -0,0 +1,24 @@ +{ stdenv, fetchFromGitHub, cmake, pkgconfig, libusb1, libftdi1 }: + +stdenv.mkDerivation rec { + pname = "fujprog"; + version = "4.8"; + + src = fetchFromGitHub { + owner = "kost"; + repo = pname; + rev = "v${version}"; + sha256 = "08kzkzd5a1wfd1aycywdynxh3qy6n7z9i8lihkahmb4xac3chmz5"; + }; + + nativeBuildInputs = [ cmake pkgconfig ]; + buildInputs = [ libftdi1 libusb1 ]; + + meta = with stdenv.lib; { + description = "FPGA JTAG programmer for ULX2/3S boards"; + homepage = "https://github.com/kost/fujprog"; + license = licenses.bsd2; + platforms = platforms.linux; + maintainers = with maintainers; [ artemist ]; + }; +} diff --git a/externals/rules/fpga.rules b/externals/rules/fpga.rules index 7e72cd1..ff61f45 100644 --- a/externals/rules/fpga.rules +++ b/externals/rules/fpga.rules @@ -1,3 +1,8 @@ - # TinyFPGA Bx SUBSYSTEM=="tty", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6130", TAG+="uaccess" + +# Fomu +SUBSYSTEM=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="5bf0", MODE="0664", GROUP="plugdev" + +# ULX3S +SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="0664", GROUP="plugdev" diff --git a/packages.nix b/packages.nix index 6078aa3..7432bf1 100644 --- a/packages.nix +++ b/packages.nix @@ -25,18 +25,9 @@ in vlc_qt5 youtubeDL - # Drawing and art - krita - xournal - xournalpp - # Books calibre - # Emulation - mgba - mupen64plus - # Wine and tools cabextract samba @@ -110,7 +101,6 @@ in libarchive lsof mercurialFull - neovim nix-index nixops openssl @@ -151,7 +141,6 @@ in # Development arduino - bear binutils-unwrapped ccache clang-tools @@ -162,7 +151,6 @@ in gnumake go gopls - jetbrains.clion llvm.clang llvm.lld nasm @@ -171,7 +159,6 @@ in patchelf python37Packages.python-language-server rnix-lsp - rr rustup valgrind vscode @@ -214,7 +201,6 @@ in evince gnome3.eog gnome3.gnome-system-monitor - googleearth libreoffice-fresh zathura diff --git a/sets/fpga.nix b/sets/fpga.nix new file mode 100644 index 0000000..c562d63 --- /dev/null +++ b/sets/fpga.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + # Synthesis + icestorm + nextpnr + trellis + yosys + # Testing + ghdl + symbiyosys + verilog + # Programming + dfu-util + tinyprog + wishbone-tool + ( callPackage ../externals/packages/fujproj { } ) + + # CPU stuff + pkgsCross.riscv64-embedded.buildPackages.binutils + pkgsCross.riscv64-embedded.buildPackages.gcc + pkgsCross.riscv32-embedded.buildPackages.binutils + pkgsCross.riscv32-embedded.buildPackages.gcc + ]; +} diff --git a/sets/neovim.nix b/sets/neovim.nix new file mode 100644 index 0000000..358f8ca --- /dev/null +++ b/sets/neovim.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + programs.neovim = { + enable = true; + vimAlias = true; + defaultEditor = true; + configure.customRC = "source ~/.config/nvim/init.vim\n"; + }; +} diff --git a/system/starlight/default.nix b/system/starlight/default.nix index 93103b9..1c343e4 100644 --- a/system/starlight/default.nix +++ b/system/starlight/default.nix @@ -5,6 +5,7 @@ ./boot-config.nix ./hardware-configuration.nix ../../services/ssh.nix + ../../sets/fpga.nix ../../private/starlight.nix ];