diff --git a/README.adoc b/README.adoc index bed0525b..2b442ee6 100755 --- a/README.adoc +++ b/README.adoc @@ -94,6 +94,7 @@ See the <> section for more details. * The `packages/` folder is my custom packages either the new ones that haven't made into nixpkgs yet or packages with overrides. Also contains third-party package repositories and overlays such as the https://github.com/nix-community/NUR[NUR], https://github.com/nix-community/emacs-overlay[unstable branch of Emacs], or the unstable branch of https://github.com/NixOS/nixpkgs/[nixpkgs]. +See the <> section for more information. * The `templates/` directory is a bunch of https://github.com/cookiecutter/cookiecutter/[Cookiecutter] templates intended for easy creation/deployment of customized systems (e.g., graphical desktop environments, customized modules). @@ -180,3 +181,92 @@ This is where you can add certain packages, enable certain settings, setup your Then, edit `modules/themes/default.nix` to add the theme to the selection. I have my theme templates stored in link:./templates[`./templates`] as an example. + + + +== Packages + +The link:./packages/[`./packages/`] directory contains cluster-wide https://nixos.wiki/wiki/Overlays[overlays], https://nixos.wiki/wiki/Nix_Channels[channels], and custom packages. +The overlays should be put in a separate folder in `./packages/overlays/`. +For any other packages, it should be put on the same level as `./packages/default.nix`. + +To make this section longer, here is the workflow summary in creating a package: + +- Create a test file (i.e., `./packages/$PACKAGE.nix`). +Either as an initial draft or a final prototype that you'll never check once it successfully built. + +- Fetch the to-be package. +In case you want to know the SHA256 hash of the to-be package from fetching (e.g., `fetchTarball`, `fetchFromGitHub`), you can use `lib.fakeSha256` and wait for the error to appear. +It should give you the expected hash. +footnote:[Don't forget to visit the nixpkgs repo and look at the source code for the nth time.] + +- Give the build inputs and the instructions for individual phases (e.g., `unpackPhase`, `preInstallPhase`, `buildPhase`). + + + + +== Why NixOS? + +It'll be a full-time geeky story if I have to explain so I'll put it in a bullet list. + +* You can configure your system from the system-wide packages, user-specific packages, boot loader settings, graphical environments, and what-have-you. +That fact alone blew my mind ever since I saw @hlissner's NixOS and the temptation just keeps growing ever since. +This is where the real power of NixOS (and also https://guix.gnu.org/[GuixSD]) really made it worth: declarative configuration. + +* It is reproducible (in a way, anyway). +Compared to other distros I've used in the past before discovering NixOS (which is only Arch and Fedora), it is very easy to reproduce the config. +In my first day of using NixOS, I just enabled hlissner's default config and I was able to boot in just fine. +(Though, changing my config into something that I want to takes the most time.) + +* Rollbacks... +Rollbacks are good. +In system state, life with a time machine, and fighting games. +You can just `nixos-rebuild switch --rollback` and you'll be back into your previous config. +It's like Windows Restore on steroids. + +* The packaging process is straightforward (or so I've heard). +I've yet to create one but it'll quickly change once I found my ideal set up for starting game dev as a hobby. + + +=== Want to learn NixOS? + +I was able to get up and running with NixOS in a day (which is impressive for the smoothbrain that I am) thanks to these resources: + +* https://nixos.org/manual/nixos/[The NixOS manual] is your starting point. +Personally, I find it a bit confusing but it is still good to get an installation working. + +* https://www.youtube.com/watch?v=NYyImy-lqaA&list=PLRGI9KQ3_HP_OFRG6R-p4iFgMSK1t5BHs[The Nixology video series by Burke Libbey] which gives a practical insight on Nix and NixOS, in general. +I give it a wholehearted recommendation to check it out. + +* I learn a whole lot from tinkering with https://github.com/hlissner/dotfiles[@hlissner's dotfiles]. +It's like the practical application of the things I've learned for the day. +Though, it did cost me to spend a week debugging footnote:[Which mostly compose of trial-and-erroring the hardcore way.] the config from the never-ending tinkering (which is a stupid decision on my part). +It could've been resolved in a day or two if I had joined the https://discord.gg/qvGgnVx[Doom Emacs Discord server]. + +* Speaking of the Doom Emacs Discord server, the https://discord.gg/qvGgnVx[Doom Emacs Discord server] is pretty cool. +Despite it is a Discord server on Doom Emacs, it is welcoming on non-Doom Emacs stuff and you can find a lot of NixOS (and Guix) geeks over there. + +* With the https://stephank.nl/p/2020-06-01-a-nix-primer-by-a-newcomer.html[help of the newcomers documented their learnings], I was able to quickly pick the terminologies surrounding the system. + +If you want to look out for some go-to resources, the https://nixos.org/learn.html[official manuals] will never fade in the list. +It may be horrible for a newcomer (in my opinion) but it is great for someone who's already familiar with Nix. +The https://nixos.wiki/[unofficial NixOS wiki] is one of the more reliable sources especially with its practical example. + +For more learning on the Nix conventions, ecosystem, and practices, I recommend https://nix.dev/[nix.dev] to look out for. +It provides some information that the official (and unofficial) sources misses. + +NixOS is a wildly different beast compared to other distros. +I did go through some rocky road to learning it; +my time learning NixOS is not composed of 100% absorbing the information efficiently. + +* One of the biggest problem I've encountered is the hidden conventions on the code. +The biggest example I can think of is the parameters of a nixpkgs module (i.e., `{ config, options, lib, pkgs, ... }`). +For an acquintance with Nix, it may not be that much of a problem. +However, for a newcomer, it is pretty hard to find those information with those https://nixos.org/learn.html[three manuals]. + +* It does throw a bunch of traditional concepts usually found on most Linux distros with the removal of filesystem hierarchy the biggest change of them all. +Thankfully, there's been remedy to mitigate against the sudden change by retaining `/usr/bin/env` for your scripts. + +* The error messages are horrible (when it's horrible)! +There is a https://opencollective.com/nix-errors-enhancement/updates/revising-our-road-map-phase-3[recent push on improving Nix in that aspect] but it focuses on the formatting. +The interpreter sometimes points at the opposite way (at least to me). diff --git a/default.nix b/default.nix index 2b501d70..57c427ec 100755 --- a/default.nix +++ b/default.nix @@ -58,6 +58,12 @@ device: username: gnumake # for our own makefile cachix # less time buildin' mo time nixin' + + # nix-shell with the modified Nix path. + (writeScriptBin "nix-shell" '' + #!${stdenv.shell} + NIX_PATH="nixpkgs-overlays=/etc/dotfiles/packages/default.nix:$NIX_PATH" ${nix}/bin/nix-shell "$@" + '') ]; # Default settings for primary user account. diff --git a/hosts/hardware-configuration.nix b/hosts/hardware-configuration.nix deleted file mode 100755 index 3732f70c..00000000 --- a/hosts/hardware-configuration.nix +++ /dev/null @@ -1,31 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, ... }: - -{ - imports = - [ - ]; - - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "ohci_pci" "ehci_pci" "usb_storage" "usbhid" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" ]; - boot.extraModulePackages = [ ]; - - fileSystems."/" = - { device = "/dev/disk/by-uuid/8479243e-fce0-44aa-8b1c-66b6915992d5"; - fsType = "ext4"; - }; - - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/F4BC-C230"; - fsType = "vfat"; - }; - - swapDevices = - [ { device = "/dev/disk/by-uuid/df977c05-495e-4bd4-b99a-919cf3caaaa1"; } - ]; - - nix.maxJobs = lib.mkDefault 2; -} diff --git a/hosts/zilch/default.nix b/hosts/zilch/default.nix index aa5d1cf2..ffa05873 100755 --- a/hosts/zilch/default.nix +++ b/hosts/zilch/default.nix @@ -61,6 +61,7 @@ brave.enable = true; firefox.enable = true; }; + cad.enable = true; fonts.enable = true; files.enable = true; graphics = { @@ -73,6 +74,7 @@ composition.enable = true; production.enable = true; }; + research.enable = true; }; dev = { @@ -131,7 +133,6 @@ # Additional programs that doesn't need much configuration (or at least personally configured). # It is pointless to create modules for it, anyways. environment.systemPackages = with pkgs; [ - # defold nim # Jack the nimble, jack jumped over the nightstick, and got over not being the best pick. python # *insert Monty Python quote here* ]; @@ -156,6 +157,7 @@ slop xclip xdg-user-dirs + xorg.xwininfo zbar ]; diff --git a/modules/desktop/multimedia.nix b/modules/desktop/multimedia.nix index ba46a720..0b63ae62 100755 --- a/modules/desktop/multimedia.nix +++ b/modules/desktop/multimedia.nix @@ -12,6 +12,7 @@ with lib; config = mkIf config.modules.desktop.multimedia.enable { my.packages = with pkgs; [ + ffmpeg # The ultimate multimedia toolkit for everybody! hexchat # The ultimate IRC client for neckbeards. kdenlive # A decent free and open source video editor. mpv # The ultimate media player for hipsters. diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index ea7a8830..d8bf584d 100755 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -1,4 +1,3 @@ -# 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. diff --git a/modules/editors/neovim.nix b/modules/editors/neovim.nix index b1363fbe..69be412a 100755 --- a/modules/editors/neovim.nix +++ b/modules/editors/neovim.nix @@ -1,4 +1,3 @@ -# modules/editors/vim.nix - https://neovim.org # (Neo)Vim is love, (Neo)Vim is life. { config, options, lib, pkgs, ... }: diff --git a/modules/editors/vscode.nix b/modules/editors/vscode.nix index 523f0fa3..c3e6e7bf 100644 --- a/modules/editors/vscode.nix +++ b/modules/editors/vscode.nix @@ -1,4 +1,5 @@ # Visual Studio but for codes... +# The code is really stolen from the NixOS wiki at https://nixos.wiki/wiki/Vscode. { config, options, lib, pkgs, ... }: with lib; @@ -17,6 +18,14 @@ let sha256 = "1jh28qqa0qcycmj3h69dxg49l6zka5yb1vsdqyzc9cqnf8m6ps2a"; } + # Make VS Code more practical with style! + { + name = "bracket-pair-colorizer-2"; + publisher = "CoenraadS"; + version = "0.2.0"; + sha256 = "0nppgfbmw0d089rka9cqs3sbd5260dhhiipmjfga3nar9vp87slh"; + } + # Your favorite programming language for a game of barnyard darts. { name = "dart-code"; @@ -25,6 +34,13 @@ let sha256 = "05pyqijwkqby4q9izkddkrhlfd0jhdc1xqdf6342l1r7p8bwyqyr"; } + { + name = "vscode-eslint"; + publisher = "dbaeumer"; + version = "2.1.8"; + sha256 = "18yw1c2yylwbvg5cfqfw8h1r2nk9vlixh0im2px8lr7lw0airl28"; + } + # RULES RULE, INCONSISTENCY DROOLS! { name = "EditorConfig"; @@ -33,7 +49,7 @@ let sha256 = "18r19dn1an81l2nw1h8iwh9x3sy71d4ab0s5fvng5y7dcg32zajd"; } - # Flutter like a butter, sting like a b. + # Flutter like a butter, dart like a bee. { name = "flutter"; publisher = "Dart-Code"; @@ -41,6 +57,14 @@ let sha256 = "1jpb01a3fazwi89b2f59sm8sbzbfaawdxaais53dsay1wbg5hncz"; } + # Git those lens with a magnifying glass, son. + { + name = "gitlens"; + publisher = "eamodio"; + version = "10.2.2"; + sha256 = "00fp6pz9jqcr6j6zwr2wpvqazh1ssa48jnk1282gnj5k560vh8mb"; + } + # Muh consistent theming. { name = "nord-visual-studio-code"; diff --git a/modules/shell/lf.nix b/modules/shell/lf.nix index e1f537d3..c9dcd82c 100755 --- a/modules/shell/lf.nix +++ b/modules/shell/lf.nix @@ -1,4 +1,3 @@ -# modules/shell/git.nix # A file manager for hipsters. { config, options, lib, pkgs, ... }: