Update the modules

This commit is contained in:
christiangabrielarazas@gmail.com 2020-08-06 23:35:49 +08:00
commit 19674fe7d2
29 changed files with 788 additions and 0 deletions

9
.editorconfig Normal file
View File

@ -0,0 +1,9 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
[*.nix]
indent_style = space
indent_size = 2

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "config"]
path = config
url = https://github.com/foo-dogsquared/dotfiles

47
README.adoc Normal file
View File

@ -0,0 +1,47 @@
= foo-dogsquared's NixOS config
This is the configuration setup for my https://nixos.org[NixOS] instance.
A major part of this setup is inspired (or stolen, whichever you prefer) from https://github.com/hlissner/dotfiles[hlissner's NixOS config].
The difference is https://github.com/rycee/home-manager[home-manager] is a big requirement and uses it a whole lot.
== Getting started
Before installing this setup, be sure to install NixOS and logged in as a user.
This project setup also assumes the operating system has the following configurations:
- Uses the nixpkgs unstable channel as `nixos` (i.e., `nix-channels --update https://nixos.org/channels/nixos-unstable`).
- Have the https://github.com/rycee/home-manager[home-manager] installed with the unstable release.
- You start with the TTY and nothing else is installed (i.e., bare installation similar in spirit to Arch Linux).
[source, shell]
----
git clone <GIT_URL_OF_THIS_REPO>
make
----
== Project structure
The project structure should look like the following:
[source, tree]
----
nixos-config
├── config/
├── home.nix
├── modules/
└── README.adoc
----
- The directory paid with the most attention would most likely be the `modules/` folder.
Each module (and submodule) can contain multiple modules for multiple programs (i.e., `modules/shell/git`, `modules/desktop/bspwm`).
It could also contain a `base.nix` file where Nix packages with no configurations are placed similar to Arch package groups (i.e., `base`, `base-devel`, `xfce`).
- The `config/` directory is simply the ad hoc configuration of several programs.
In this case, it is my https://github.com/foo-dogsquared/dotflies[dotfiles] directory.

1
config Submodule

@ -0,0 +1 @@
Subproject commit 00ff59a0ed36438f39b9b0d784708d8aa14761c7

72
home.nix Normal file
View File

@ -0,0 +1,72 @@
{ config, pkgs, lib, ... }:
{
imports = [
./modules
];
# Setting my personal public information.
# accounts.email.accounts."Gabriel Arazas" = {
# address = "christiangabrielarazas@gmail.com";
# aliases = [ "foo.dogsquared@gmail.com" ];
# };
nixpkgs.config = {
allowUnfree = true;
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Module configurations.
modules = {
desktop = {
files.enable = true;
};
dev = {
base.enable = true;
cc.enable = true;
documentation.enable = true;
rust.enable = true;
};
editors = {
default = "nvim";
emacs.enable = true;
neovim.enable = true;
};
shell = {
base.enable = true;
lf.enable = true;
git.enable = true;
};
};
programs.git = lib.mkIf config.modules.shell.git.enable {
userName = "foo-dogsquared";
userEmail = "christiangabrielarazas@gmail.com";
};
# Additional programs that doesn't need much configuration (or at least personally configured).
# It is pointless to create modules for it, anyways.
# home.packages = with pkgs; [
# cookiecutter # A generic project scaffolding tool.
# ];
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = "foo-dogsquared";
home.homeDirectory = "/home/foo-dogsquared";
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "20.09";
}

10
modules/default.nix Normal file
View File

@ -0,0 +1,10 @@
{ config, options, lib, pkgs, ... }:
{
imports = [
./desktop
./dev
./editors
./shell
];
}

View File

@ -0,0 +1,11 @@
# My apps on my natural desktop environment.
{ config, options, lib, pkgs, ... }:
{
imports = [
./files.nix
./fonts.nix
./graphics.nix
./music.nix
];
}

28
modules/desktop/files.nix Normal file
View File

@ -0,0 +1,28 @@
# A set of tools related to files: managing metadata, backing them up, filesystems, and whatnot.
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.desktop.files;
in {
options.modules.desktop.files = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
exfat # A filesystem usually found on external hard drives.
exiftool # A file metadata reader/writer/manager/helicopter.
hfsprogs # Some programs for HFS/NFS-based filesystems.
ntfs3g # A filesystem for Windows-based systems.
syncthing # A peer-to-peer synchro summoning.
xfce.thunar # A graphical file manager.
xfce.thunar-volman # A Thunar plugin on volume management for external devices.
udiskie # An automounter for external devices with authentication.
];
};
}

22
modules/desktop/fonts.nix Normal file
View File

@ -0,0 +1,22 @@
# My selection of fonts for this setup.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.desktop.fonts = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.desktop.fonts.enable {
home.packages = with pkgs; [
fira-code # The programming font with fancy symbols.
ibm-plex # IBM's face.
noto-fonts # It's all about family and that's what so powerful about it.
noto-fonts-cjk # The universal font, Japanese-Chinese-Korean version.
stix-otf # The font you need for them math moonrunes.
];
};
}

View File

@ -0,0 +1,43 @@
# Being a hack fraud in "jack of all trades, master of none" thing, I also create "graphics".
# This includes tools for raster, vector, and 3D modelling.
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.desktop.graphics;
in {
options.modules.desktop.graphics =
let mkBoolDefault = bool: mkOption {
type = types.bool;
default = bool;
}; in {
enable = mkBoolDefault false;
raster.enable = mkBoolDefault false;
vector.enable = mkBoolDefault false;
_3d.enable = mkBoolDefault false;
};
config = mkIf cfg.enable {
home.packages = with pkgs;
[
font-manager # Self-explanatory name is self-explanatory.
imagemagick # A command-line tool for manipulating images.
] ++
(if cfg.raster.enable then [
gimp # Adobe Photoshop replacement.
krita # A good painting program useful for "pure" digital arts.
aseprite # A pixel art editor.
] else []) ++
(if cfg.vector.enable then [
inkscape # Adobe Illustrator (or Affinity Designer) replacement.
] else []) ++
(if cfg._3d.enable then [
blender # It's a great 3D model editor.
goxel # It's a great voxel editor.
] else []);
};
}

36
modules/desktop/music.nix Normal file
View File

@ -0,0 +1,36 @@
# I create "music" (with no experience whatsoever) so here's my "music" workflow.
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.desktop.music;
in {
options.modules.desktop.music =
let mkBoolDefault = bool: mkOption {
type = types.bool;
default = bool;
}; in {
enable = mkBoolDefault false;
composition = mkBoolDefault false;
production = mkBoolDefault false;
};
config = mkIf cfg.enable {
home.packages = with pkgs;
(if cfg.composition.enable then [
musescore # A music composer for creating musical cheatsheets.
soundfont-fluid # A soundfont for it or something.
supercollider # Programming platform for synthesizing them 'zics.
] else []) ++
(if cfg.production.enable then [
ardour # A DAW focuses on hardware recording but it can be used for something else.
carla # A plugin host useful for a consistent hub for them soundfonts and SFZs.
helm # A great synthesizer plugin.
# As of 2020-07-03, lmms has some trouble regarding Qt or something so at least use the "unstable" channel just to be safe.
# lmms
] else []);
};
}

20
modules/dev/base.nix Normal file
View File

@ -0,0 +1,20 @@
# The utmost requirements for a development workflow.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.dev.base = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.dev.base.enable {
home.packages = with pkgs; [
cookiecutter # A project scaffolding tool.
gnumake # Make your life easier with GNU Make.
universal-ctags # Enable fast traveling to your code (assuming written in a supported language).
];
};
}

22
modules/dev/cc.nix Normal file
View File

@ -0,0 +1,22 @@
# My stuff for C and C++.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.dev.cc = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.dev.cc.enable {
home.packages = with pkgs; [
cmake # Yo dawg, I heard you like Make.
# clang # A C compiler frontend for LLVM.
gcc # A compiler toolchain.
gdb # GNU Debugger.
llvmPackages.libcxx # When GCC has become too bloated for someone's taste.
];
};
}

13
modules/dev/default.nix Normal file
View File

@ -0,0 +1,13 @@
{ config, lib, ... }:
{
imports = [
./base.nix
./cc.nix
./documentation.nix
./gamedev.nix
./javascript.nix
./lisp.nix
./rust.nix
];
}

View File

@ -0,0 +1,38 @@
# My stuff for documentation workflows.
# I mean, documentation is part of the development life, right?
# Mainly includes markup languages and whatnot.
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.dev.documentation;
in
{
options.modules.dev.documentation =
let mkBoolOption = bool: mkOption {
type = types.bool;
default = bool;
}; in {
enable = mkBoolOption false;
# Since my usual LaTeX needs are somewhat big, I'm keeping it as a separate option.
latex.enable = mkBoolOption false;
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
asciidoctor # Keeping Asciidoc alive with the improved version.
hugo # An SSG for your DDD (documentation-driven development) workflow.
pandoc # The Swiss army knife for document conversion.
# TODO: Make Neuron its own package.
(let neuronSrc = builtins.fetchTarball "https://github.com/srid/neuron/archive/master.tar.gz";
in import neuronSrc {}) # Neurons and zettels are good for the brain.
] ++
(if cfg.latex.enable then [
texlive.combined.scheme-medium # The all-in-one LaTeX distribution for your offline typesetting needs.
] else []);
};
}

31
modules/dev/gamedev.nix Normal file
View File

@ -0,0 +1,31 @@
# I've yet to delve into game development but here we are.
# This contains several toolchains such as Unity, Godot Engine, and Love.
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.dev.game-dev;
in
{
options.modules.dev.game-dev =
let mkBoolOption = bool: mkOption {
type = types.bool;
default = bool;
}; in {
godot.enable = mkBoolOption false;
unity3d.enable = mkBoolOption false;
};
config = {
home.packages = with pkgs;
(if cfg.godot.enable then [
godot # The Godot, not to be confused with a certain prosecutor.
] else []) ++
(if cfg.unity3d.enable then [
unity3d
unityhub
] else []);
};
}

20
modules/dev/java.nix Normal file
View File

@ -0,0 +1,20 @@
# Java is a rice variant, a coffee blend, an island, and a programming language.
# It sure is a flexible thing.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.dev.java = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.dev.java.enable {
home.packages = [
jdk # The Java Development Kit.
jre # The Java Runtime Environment for running Java apps.
];
};
}

View File

@ -0,0 +1,31 @@
# JavaScript, the poster boy of hated languages...
# I think it's pretty great, when it works.
# Otherwise, it is a disaster from its syntax and the massive ecosystem among others.
# Since I use/experiment with the ecosystem so stuff like Node and Deno are combined into one module file.
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.dev.javascript;
in
{
options.modules.dev.javascript =
let mkBoolOption = bool: mkOption {
type = types.bool;
default = bool;
}; in {
deno.enable = mkBoolOption false;
node.enable = mkBoolOption false;
};
config = {
home.packages = with pkgs;
(if cfg.deno.enable then [
deno # The Deltarune of Node.
] else []) ++
(if cfg.node.enable then [
node # The JavaScript framework/runtime where you don't have to kill. :)
] else []);
};
}

36
modules/dev/lisp.nix Normal file
View File

@ -0,0 +1,36 @@
# Lisp is great, easy to learn, and weird.
# I've been using it to study creating languages and the famous SICP book.
# FUN FACT: Lisp is a family of languages with those parenthesis representing the mouth lisp, demonstrating how genetics work.
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.dev.lisp;
in
{
options.modules.dev.lisp =
let mkBoolDefault = bool: mkOption {
type = types.bool;
default = bool;
}; in {
clojure.enable = mkBoolDefault false;
guile.enable = mkBoolDefault false;
racket.enable = mkBoolDefault false;
};
config = {
home.packages = with pkgs;
(if cfg.clojure.enable then [
clojure # Improved Java version.
] else []) ++
(if cfg.guile.enable then [
guile # A general-purpose language for stuff, named after a certain American pop culture icon.
] else []) ++
(if cfg.racket.enable then [
racket # A DSL for DSLs.
] else []);
};
}

25
modules/dev/rust.nix Normal file
View File

@ -0,0 +1,25 @@
# Ah yes, Rust...
# The programming language that made me appreciate/tolerate C++ even more.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.dev.rust = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.dev.rust.enable {
home.packages = with pkgs; [
rustup
];
programs.zsh.sessionVariables = mkIf config.modules.shell.zsh.enable {
CARGO_HOME = "${config.xdg.dataHome}/cargo";
RUSTUP_HOME = "${config.xdg.dataHome}/rustup";
PATH = [ "$CARGO_HOME/bin" ];
};
};
}

View File

@ -0,0 +1,20 @@
# All of my text editors (and IDEs) modules are to be put here.
# From Visual Studio Code, Emacs, Neovim, and whatnot.
# The entryway to all of your text editors and IDEs.
{ config, options, lib, pkgs, ... }:
with lib;
{
imports = [
./emacs.nix
./neovim.nix
./vscode.nix
];
options.modules.editors = {
default = mkOption {
type = types.str;
default = "vim";
};
};
}

64
modules/editors/emacs.nix Normal file
View File

@ -0,0 +1,64 @@
# modules/editors/emacs.nix - https://gnu.org/emacs/
# Ah yes, the bane of my endless configuration hell (or heaven, whichever your personal preferences).
# Or specifically, Org-mode...
# Doom Emacs saved me from being a configuration demon.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.editors.emacs = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.editors.emacs.enable {
home.packages = with pkgs; [
# Doom dependencies
git
(ripgrep.override { withPCRE2 = true; })
gnutls
# Optional depedencies
fd # faster projectile
imagemagick # image-dired
# (lib.mkIf (config.programs.gnupg.agent.enable)
# pinentry_emacs) # gnupg-emacs
zstd # for undo-fu-sessions
# Module dependencies
## :checkers spell
aspell
aspellDicts.en
aspellDicts.en-computers
aspellDicts.en-science
## :checkers grammar
languagetool
## :tools editorconfig
editorconfig-core-c
## :tools lookup & :lang org+roam
sqlite
] ++
## :lang javascript
(if config.modules.dev.javascript.node.enable then [
nodePackages.javascript-typescript-langserver # The LSP for JS/TS.
] else []) ++
## :lang cc
(if config.modules.dev.cc.enable then [
ccls
] else []);
# Placing the Doom Emacs config.
xdg.configFile."doom" = {
source = ../../config/emacs;
recursive = true;
};
};
}

View File

@ -0,0 +1,32 @@
# modules/editors/vim.nix - https://neovim.org
# (Neo)Vim is love, (Neo)Vim is life.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.editors.neovim = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.editors.neovim.enable {
home = {
packages = with pkgs; [
editorconfig-core-c # Editorconfig is a MUST, you feel me?!
];
};
programs.neovim = {
enable = true;
withPython3 = true;
withRuby = true;
};
xdg.configFile."nvim" = {
source = ../../config/nvim;
recursive = true;
};
};
}

View File

@ -0,0 +1,42 @@
# Visual Studio Code is the middle ground between a text editor and an IDE.
# Perfect for managing medium-sized software projects.
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.editors.vscode;
in {
options.modules.editors.vscode = {
enable = mkOption {
type = types.bool;
default = false;
};
};
# I'll be using the home-manager module for this one since it already did the work for me.
# If I were to create one from scratch, it'll most likely end up similar anyways.
config = mkIf cfg.enable {
programs.vscode = {
enable = true;
extensions = with pkgs.vscode-extensions; [
# Material Icon theme
PKief.material-icon-theme
# Material theme that comes with multiple variants
Equinusocio.vsc-material-theme
# The official implementation for the Nord color scheme
arcticicestudio.nord-visual-studio-code
# ESLint
dbaeumer.vscode-eslint
# Supercharged Git integration into the editor
eamodio.gitlens
# A code formatter
esbenp.prettier-vscode
];
};
};
}

32
modules/shell/base.nix Normal file
View File

@ -0,0 +1,32 @@
# Here are the base packages for my shell workflow.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.shell.base = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.shell.base.enable {
home.packages = with pkgs; [
aspell # Want to check spelling on the command-line?
bat # cat(1) with wings.
buku # A developer-oriented browser-independent bookmark manager.
exa # ls(1) after an exodus.
fd # find(1) after a cognitive behavioral therpay.
fzf # A fuzzy finder, not furry finder which is a common misconception.
hexyl # Binary viewer on the command-line.
gopass # The improved version of Password Store which is a password manager for hipsters.
maim # A command-line interface for screenshots.
jq # A command-line interface for parsing JSON.
pup # A command-line interface for parsing HTML.
ripgrep # Super-fast full-text searcher.
sqlite # Battle-tested cute little database that can grow into an abomination of a data spaghetti.
tree # I'm not a scammer, I swear.
youtube-dl # A command-line interface for downloading videos.
];
};
}

12
modules/shell/default.nix Normal file
View File

@ -0,0 +1,12 @@
# All of the command-line tools will be put here.
{ config, options, lib, pkgs, ... }:
with lib;
{
imports = [
./base.nix
./git.nix
./lf.nix
./zsh.nix
];
}

21
modules/shell/git.nix Normal file
View File

@ -0,0 +1,21 @@
# modules/shell/git.nix
# Git is great, Git is good, and it is not made out of wood.
# A version control system with the description of the closet furry behind the Linux kernel as the name.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.shell.git = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.shell.git.enable {
home.packages = with pkgs; [
gitAndTools.delta
gitAndTools.diff-so-fancy
];
};
}

24
modules/shell/lf.nix Normal file
View File

@ -0,0 +1,24 @@
# modules/shell/git.nix
# A file manager for hipsters.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.shell.lf = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.shell.lf.enable {
home.packages = with pkgs; [
lf
];
xdg.configFile."lf" = {
source = ../../config/lf;
recursive = true;
};
};
}

23
modules/shell/zsh.nix Normal file
View File

@ -0,0 +1,23 @@
# The Zoomer shell is cool for them prompts.
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.shell.zsh = {
enable = mkOption {
type = types.bool;
default = false;
};
};
# Going to use the home-manager module for zsh since it is cool.
config = mkIf config.modules.shell.zsh.enable {
programs.zsh = {
enable = true;
enableCompletion = true;
enableAutosuggestions = true;
dotDir = "${config.xdg.configHome}";
history.path = "${config.xdg.dataHome}/zsh/history";
};
};
}