Update the Nix config

A bunch of minor updates here, a bunch of minor changes there.
All of the Nix changes is here for all the world to see.
This commit is contained in:
Gabriel Arazas 2020-10-07 06:56:04 +08:00
parent 91ff5c8add
commit ef12c29f36
17 changed files with 211 additions and 102 deletions

View File

@ -14,31 +14,32 @@ config: $(NIXOS_PREFIX)/configuration.nix
home: $(HOME)/dotfiles
# The channels will be used on certain modules like in `packages/default.nix` where it will be referred to install certain packages from the unstable channel.
unstable_channels:
channels:
@sudo nix-channel --add "https://nixos.org/channels/nixos-unstable" nixos
@sudo nix-channel --add "https://github.com/rycee/home-manager/archive/master.tar.gz" home-manager
@sudo nix-channel --add "https://nixos.org/channels/nixpkgs-unstable" nixpkgs-unstable
channels:
@sudo nix-channel --add "https://nixos.org/channels/nixos-${NIXOS_VERSION}" nixos
@sudo nix-channel --add "https://github.com/rycee/home-manager/archive/release-${NIXOS_VERSION}.tar.gz" home-manager
@sudo nix-channel --add "https://nixos.org/channels/nixpkgs-unstable" nixpkgs-unstable
update:
@sudo nix-channel --update
switch:
@sudo nixos-rebuild $(FLAGS) switch
# 'boot' and 'switch' are somewhat the same except 'boot' takes care of setting the kernel so use this if you've changed the kernel settings.
boot:
@sudo nixos-rebuild $(FLAGS) boot
install: channels update
@sudo nixos-generate-config --root "$(PREFIX)" && sudo cp --update "$(NIXOS_PREFIX)/hardware-configuration.nix" "$$(pwd)/hosts/$(HOST)/hardware-configuration.nix"
@sudo nixos-generate-config --root "$(PREFIX)"
@echo "import \"$(DOTS)\" \"$(HOST)\" \"$${USER}\"" | sudo tee "${NIXOS_PREFIX}/configuration.nix"
@sudo nixos-install --root "$(PREFIX)" $(FLAGS)
@sudo cp -r "$(DOTS)" "$(PREFIX)/etc/dotfiles"
@sudo nixos-enter --root "$(PREFIX)" -c chown $(USER):users $(DOTS)
@sudo nixos-enter --root "$(PREFIX)" --command "chown $(USER):users $(DOTS) --recursive"
@sudo nixos-enter --root "$(PREFIX)" --command "make -C $(DOTS) channels"
@echo "Set password for $(USER)" && sudo nixos-enter --root "$(PREFIX)" --command "passwd $(USER)"
clean:
@sudo nix-collect-garbage -d
@nix-collect-garbage -d
upgrade: update switch

View File

@ -31,10 +31,10 @@ To correct this behavior, simply configure the `PREFIX` variable (e.g., `PREFIX=
For more information, simply inspect the link:./Makefile[`./Makefile`].
Assuming you did install, your project will have the following stuff.
Assuming you did install, your NixOS setup will have the following stuff.
- Add the nixpkgs unstable channel as `nixpkgs-unstable` (i.e., `nix-channels --update https://nixos.org/channels/nixos-unstable`).
- Have the https://github.com/rycee/home-manager[home-manager] installed with the stable release.
- Uses the NixOS unstable channel (https://nixos.org/channels/nixos-unstable) for its package set.
- 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).
To setup your graphical installation, see the <<Themes>> section.
@ -45,8 +45,8 @@ There are some things you need to keep in mind when using this setup.
* This setup is not meant to be fully reproducible.
It is a personal setup for a person who wants to live on the bleeding edge, personally.
Despite being a NixOS setup which should be reproducible on paper, it mainly uses the unstable versions of the channels and packages.
If we're to install this setup at separate times, the full list of installed packages with their depedencies and versions wouldn't be the same.
Despite being a NixOS setup which should be reproducible on paper, it mainly uses the unstable versions of the channels and packages meaning you would have a different installation each time (unless you do something like https://nixos.org/guides/towards-reproducibility-pinning-nixpkgs.html[pinning the nixpkgs repo] or using https://www.tweag.io/blog/2020-05-25-flakes/[the flakes feature]).
footnote:[I'm most likely using the Nix flakes some time in the future.]
* It may use third-party channels for certain versions of the packages, hammering the first precaution even further regarding reproducibility.
@ -117,7 +117,6 @@ For best practice, you may want to follow the following project structure:
├── config/
├── modules/
├── default.nix*
├── hardware-configuration.nix*
└── README.adoc
----
@ -128,9 +127,6 @@ For best practice, you may want to follow the following project structure:
* `default.nix` is the entrypoint for our host module.
It contains configuration of our link:./modules[`./modules`], NixOS (i.e., `man configuration.nix`), https://github.com/rycee/home-manager[home-manager] (i.e., `man home-configuration.nix`), and other things you might want to include in the host-specific `$HOST/modules/` folder.
* `hardware-configuration.nix` is there for hardware configurations...
(I plan to remove this one since it should use the dynamically generated hardware config at `/etc/nixos/hardware-configuration.nix`.)
* A README file in whatever format you prefer.
(I just choose https://asciidoctor.org/[Asciidoctor] with the `.adoc` file extension since it's my go-to document format.)
@ -209,9 +205,9 @@ footnote:[Don't forget to visit the nixpkgs repo and look at the source code for
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.
* You can configure your system from the system-wide packages, user-specific packages, boot loader settings, graphical environments, and what-have-you stored in text files.
That fact alone blew my mind ever since I saw @hlissner's NixOS and the temptation just keeps growing ever since I see more NixOS-related posts.
This is where the real power of NixOS (and also https://guix.gnu.org/[GuixSD]) really made it worth the try: declarative system and local 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.
@ -227,6 +223,14 @@ 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.
* Hipster points.
https://www.archlinux.org/[Arch?]
https://k1ss.org/[KISS Linux?]
https://www.gentoo.org/[Gentoo?]
http://www.linuxfromscratch.org/[Linux From Scratch?]
Forget that!
NixOS-influenced distros are the future and I'll continue to shill it for the rest of my computing shtick.
=== Want to learn NixOS?
@ -255,6 +259,9 @@ The https://nixos.wiki/[unofficial NixOS wiki] is one of the more reliable sourc
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.
=== Problems encountered along the way
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.

View File

@ -1,7 +1,8 @@
# Paths to synchronize
path = writings
path = projects
path = library
path = phone
path = projects
path = writings
# My GnuPG keys
path = .gnupg
@ -18,6 +19,7 @@ ignore = Name *~
ignore = Name .*~
ignore = Name *.o
ignore = Name *.tmp
ignore = Name *.qcow2
# Node cache
ignore = Name node_modules
@ -25,6 +27,9 @@ ignore = Name node_modules
# Rust build caches
ignore = Name target
# Nix build result
ignore = Name result
# The diff command with the unified style (the same style Git uses for showing diffs)
diff = diff --unified

View File

@ -3,12 +3,14 @@
{ config, pkgs, lib, ... }:
{
nixpkgs.overlays = import ./modules/overlays.nix;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Change the Linux kernel version.
boot.kernelPackages = pkgs.linuxPackages_5_8;
boot.extraModulePackages = [ pkgs.linuxPackages_5_8.nvidia_x11 ];
# Clean up the /tmp directory.
boot.cleanTmpDir = true;
@ -57,12 +59,24 @@
};
};
# Enable some font configs.
fonts = {
enableDefaultFonts = true;
fontconfig.enable = true;
};
# Module configurations.
modules = {
desktop = {
audio = {
enable = true;
composition.enable = true;
production.enable = true;
};
browsers = {
brave.enable = true;
firefox.enable = true;
nyxt.enable = true;
};
cad.enable = true;
fonts.enable = true;
@ -73,10 +87,6 @@
_3d.enable = true;
};
multimedia.enable = true;
music = {
composition.enable = true;
production.enable = true;
};
research.enable = true;
};
@ -93,6 +103,7 @@
godot.enable = true;
unity3d.enable = true;
};
go.enable = true;
java.enable = true;
javascript = {
deno.enable = true;
@ -102,10 +113,19 @@
guile.enable = true;
racket.enable = true;
};
perl.enable = true;
python = {
enable = true;
math.enable = true;
};
rust.enable = true;
vcs.enable = true;
};
drivers = {
veikk.enable = true;
};
editors = {
default = "nvim";
emacs.enable = true;
@ -115,16 +135,6 @@
services = {
recoll.enable = true;
unison = {
enable = true;
flags =
let
homeDirectory = "/home/${config.my.username}";
backupDrive = "/run/media/${config.my.username}/Seagate Backup Plus Drive";
in ''
-root ${homeDirectory} -root ${backupDrive} -auto -batch -fat -force ${homeDirectory} -mountpoint ${backupDrive} -ignorearchives
'';
};
};
shell = {
@ -145,12 +155,12 @@
my.packages = with pkgs; [
# Muh games.
unstable.dwarf-fortress # Losing is fun!
unstable.endless-sky # Losing is meh!
unstable.minetest # Losing?! What's that?
unstable.openmw # Losing is even more meh1
unstable.wesnoth # Losing is frustrating!
unstable.zeroad # Losing is fun and frustrating!
dwarf-fortress # Losing is fun!
endless-sky # Losing is meh!
minetest # Losing?! What's that?
openmw # Losing is even more meh1
wesnoth # Losing is frustrating!
zeroad # Losing is fun and frustrating!
# Installing some of the dependencies required for my scripts.
ffcast
@ -167,12 +177,14 @@
xorg.xwininfo
zbar
# Some other packages.
screenkey
]
# My custom packages.
# fds-nur.brl-cad
# fds-nur.hypermail
# fds-nur.wikiman
nur.foo-dogsquared.segno
];
++ (with pkgs.nur.foo-dogsquared; [
segno
]);
# Setting up the shell environment.
my.env = {
@ -206,15 +218,22 @@
# Install a proprietary Nvidia graphics driver.
services.xserver = {
libinput = {
enable = true;
middleEmulation = true;
};
videoDrivers = [ "nvidiaLegacy390" ];
# digimend.enable = true;
# videoDrivers = [ "nvidiaLegacy390" ];
};
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
# Enable OpenGL.
hardware = {
opengl.enable = true;
};
# Additional host-specific program configurations.
my.home = {
programs = {
@ -232,7 +251,33 @@
userEmail = "${config.my.email}";
};
};
services = {
unison = let
homeDirectory = "/home/${config.my.username}";
backupDrive = "/run/media/${config.my.username}/Seagate Backup Plus Drive";
in {
enable = true;
pairs.mainBackup = {
roots = [ homeDirectory backupDrive ];
commandOptions = {
auto = "true";
batch = "true";
fat = "true";
force = "${homeDirectory}";
links = "false";
ui = "text";
};
};
};
};
};
my.user.extraGroups = [ "docker" ];
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "20.03"; # Did you read the comment?
}

View File

@ -1,15 +0,0 @@
# All of the machine-specific overlays.
[
(self: super:
{
rofi = super.rofi.overrideAttrs (oldAttrs: {
name = "rofi-next";
src = super.fetchFromGitHub {
owner = "davatorium";
repo = "rofi";
rev = "802a9489e7fbf809890ab6bf39e62664fa4c134f";
sha256 = "1qjqw7v6qdmc5bxfaq57cb8hf99vr0prp5bn4yzal7r5im855s8f";
};
});
})
]

View File

@ -1,22 +1,35 @@
# My audio tools...
# I create "music" (with no experience whatsoever) so here's my "music" workflow.
# TODO: I may have to switch to Pipewire for the FUTURE.
{ config, options, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.desktop.music;
cfg = config.modules.desktop.audio;
in {
options.modules.desktop.music =
options.modules.desktop.audio =
let mkBoolDefault = bool: mkOption {
type = types.bool;
default = bool;
}; in {
enable = mkBoolDefault false;
composition.enable = mkBoolDefault false;
production.enable = mkBoolDefault false;
};
config = {
config = mkIf cfg.enable {
# Enable JACK for the most serious audio applications.
services.jack = {
alsa.enable = true;
jackd.enable = true;
};
my.packages = with pkgs;
[
cadence
] ++
(if cfg.composition.enable then [
lilypond # Prevent your compositions to be forever lost when you're in grave by engraving them now (or whenever you feel like it).
musescore # A music composer for creating musical cheatsheets.
@ -40,5 +53,11 @@ in {
# 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 []);
# Required when enabling JACK daemon.
my.user.extraGroups = [ "jackaudio" ];
# Add the sequencer and the MIDI kernel module.
boot.kernelModules = [ "snd-seq" "snd-rawmidi" ];
};
}

View File

@ -3,13 +3,13 @@
{
imports = [
./audio.nix
./browsers.nix
./cad.nix
./files.nix
./fonts.nix
./graphics.nix
./multimedia.nix
./music.nix
./research.nix
];
}

View File

@ -22,13 +22,19 @@ in {
unison
magic-wormhole # Magically transfer stuff between your wormholes!
qbittorrent # Free version of uBittorrent.
transmission # One of the components for sailing the high seas.
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.
];
services = {
# Enable Syncthing for them cross-device syncing.
syncthing.enable = true;
# Argh! Open t' gateweh t' th' high seas!
transmission.enable = true;
};
# Clean 'yer home!
my.env = {
RECOLL_CONFDIR = "$XDG_DATA_HOME/recoll";

View File

@ -25,7 +25,7 @@ with lib;
};
fonts = with pkgs; [
dejavu_fonts
dejavu_fonts # Makes you feel like you've seen them before.
fira-code # The programming font with fancy symbols.
ibm-plex # IBM's face, is it professional?
iosevka # The fancy monofont with fancy ligatures.

View File

@ -8,6 +8,7 @@
./data.nix
./documentation.nix
./gamedev.nix
./go.nix
./java.nix
./javascript.nix
./lisp.nix

View File

@ -38,7 +38,7 @@ in
# TODO: Make Neuron its own package.
(let
neuronRev = "5c37dd3bbfff7d203883417bee2e2970d41cd70d";
neuronRev = "2ea28ba1f023f169657a31a3cad621f1d745c606";
neuronSrc = builtins.fetchTarball "https://github.com/srid/neuron/archive/${neuronRev}.tar.gz";
in import neuronSrc {}) # Neurons and zettels are good for the brain.
] ++

View File

@ -1,25 +1,19 @@
# Ah yes, Rust...
# The programming language that made me appreciate/tolerate C++ even more.
# Go, go, Golang coders!
{ config, options, lib, pkgs, ... }:
with lib;
{
options.modules.dev.rust = {
options.modules.dev.go = {
enable = mkOption {
type = types.bool;
default = false;
};
};
config = mkIf config.modules.dev.rust.enable {
config = mkIf config.modules.dev.go.enable {
my.packages = with pkgs; [
rustup
delve # Wait, Go doesn't have a proper debugger?
go # The other zoomer proglang (READ: proglang is a zoomer term for programming language).
];
my.env = {
CARGO_HOME = "$XDG_DATA_HOME/cargo";
RUSTUP_HOME = "$XDG_DATA_HOME/rustup";
PATH = [ "$CARGO_HOME/bin" ];
};
};
}

View File

@ -12,7 +12,7 @@ with lib;
config = mkIf config.modules.dev.vcs.enable {
my.packages = with pkgs; [
git
gitAndTools.gitFull
mercurial
subversion
];

View File

@ -96,10 +96,15 @@ let
version = "4.2.0";
sha256 = "1in8lj5gim3jdy33harib9z8qayp5jn8pz6j0zpicbzxx87g2hm1";
}
# Creating a Rust mini-IDE.
{
name = "rust";
publisher = "rust-lang";
version = "0.7.8";
sha256 = "039ns854v1k4jb9xqknrjkj8lf62nfcpfn0716ancmjc4f0xlzb3";
}
];
vscode-with-extensions = pkgs.vscode-with-extensions.override {
vscodeExtensions = extensions;
};
in
{
options.modules.editors.vscode = {
@ -110,8 +115,21 @@ in
};
config = mkIf config.modules.editors.vscode.enable {
my.packages = [
vscode-with-extensions
];
my.home = {
programs.vscode = {
enable = true;
extensions = extensions;
userSettings = {
"diffEditor.codeLens" = true;
"editor.fontFamily" = "'Iosevka', 'Droid Sans Mono', 'monospace', monospace, 'Droid Sans Fallback'";
"editor.fontLigatures" = true;
"eslint.alwaysShowStatus" = true;
"git.alwaysShowStagedChangesResourceGroup" = true;
"update.mode" = "none";
"workbench.colorTheme" = "Nord";
"workbench.iconTheme" = "material-icon-theme";
};
};
};
};
}

View File

@ -31,7 +31,6 @@ in
Service = {
Environment = [ "RECOLL_CONFDIR=\"$XDG_DATA_HOME/recoll\"" ];
ExecStart = "${(pkgs.recoll.override { withGui = false; })}/bin/recollindex ${cfg.flags}";
Restart = "on-failure";
};
Install = {

View File

@ -1,13 +1,9 @@
[
(self: super: with super; {
# Add packages from the unstable channel with `pkgs.unstable.$PKG`.
unstable = import <nixpkgs-unstable> { inherit config; };
veikk-linux-driver = (callPackage ./veikk-driver.nix { kernel = pkgs.linux_5_8; });
nur.foo-dogsquared = import (
fetchTarball "https://github.com/foo-dogsquared/nur-packages/archive/develop.tar.gz"
) { inherit pkgs; };
})
# The unstable branch of Emacs.
# (import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz))
]

33
packages/veikk-driver.nix Executable file
View File

@ -0,0 +1,33 @@
{ stdenv, fetchFromGitHub, kernel }:
stdenv.mkDerivation rec {
name = "veikk-linux-driver";
version = "2.0.0";
src = fetchFromGitHub {
owner = "jlam55555";
repo = "veikk-linux-driver";
rev = "v2.0";
sha256 = "11mg74ds58jwvdmi3i7c4chxs6v9g09r9ll22pc2kbxjdnrp8zrn";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
patchPhase = ''
sed -i Makefile -e 's/modprobe veikk//' -e 's/depmod//'
'';
INSTALL_MOD_PATH = "\${out}";
makeFlags = [
"BUILD_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
meta = with stdenv.lib; {
description = "Linux device driver for supported VEIKK tablets (e.g., S640, A50, A30).";
homepage = "https://github.com/jlam55555/veikk-linux-driver";
licenses = licenses.free;
maintainers = with maintainers; [ foo-dogsquared ];
platforms = platforms.linux;
};
}