From 75a04804a6d792cd7893261172ad91b8930666a9 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Wed, 19 Aug 2020 00:48:02 +0800 Subject: [PATCH] Update the config to use the stable versions of nixpkgs separated with the unstable branch --- Makefile | 10 +++-- README.adoc | 10 +++-- default.nix | 14 +++++-- hosts/zilch/README.adoc | 15 +++++++ hosts/zilch/config/recoll/recoll.conf | 12 +++--- hosts/zilch/default.nix | 58 +++++++++++++-------------- modules/default.nix | 5 ++- modules/desktop/multimedia.nix | 2 + modules/desktop/music.nix | 2 +- modules/dev/android.nix | 4 +- modules/dev/base.nix | 10 ++++- modules/dev/default.nix | 1 + modules/dev/javascript.nix | 2 +- modules/editors/emacs.nix | 2 +- modules/shell/base.nix | 2 +- modules/shell/default.nix | 1 - modules/shell/git.nix | 22 ---------- modules/shell/zsh.nix | 9 +++-- packages/default.nix | 6 ++- 19 files changed, 102 insertions(+), 85 deletions(-) create mode 100644 hosts/zilch/README.adoc delete mode 100755 modules/shell/git.nix diff --git a/Makefile b/Makefile index 23f9556d..9f5f47b7 100755 --- a/Makefile +++ b/Makefile @@ -13,9 +13,12 @@ FLAGS := -I "config=$$(pwd)/config" \ 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. 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/nixos-${NIXOS_VERSION}" nixos + @sudo nix-channel --add "https://nixos.org/channels/nixos-unstable" nixos-unstable + @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 @@ -24,7 +27,8 @@ switch: @sudo nixos-rebuild $(FLAGS) switch install: channels update - @echo "import "$(DOTS)" \"$${HOST:-$$(hostname)}\" \"$${USER}\"" | sudo tee "${NIXOS_PREFIX}/configuration.nix" + @sudo nixos-generate-config --root "$(PREFIX)" && sudo cp --update "$(NIXOS_PREFIX)/hardware-configuration.nix" "$$(pwd)/hosts/$(HOST)/hardware-configuration.nix" + @echo "import \"$(DOTS)\" \"$(HOST)\" \"$${USER}\"" | sudo tee "${NIXOS_PREFIX}/configuration.nix" @sudo nixos-install --root "$(PREFIX)" $(FLAGS) @sudo rm -r "$(PREFIX)/etc/dotfiles" && sudo cp -r "$(DOTS)" "$(PREFIX)/etc/dotfiles" @sudo nixos-enter --root "$(PREFIX)" -c chown $(USER):users $(DOTS) diff --git a/README.adoc b/README.adoc index 0f71f8a0..56de8b42 100755 --- a/README.adoc +++ b/README.adoc @@ -30,9 +30,10 @@ For more information, simply inspect the Makefile. Assuming you did install, your project will have the following stuff. -- 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. +- 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. - 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 <> section. === Precautions @@ -80,7 +81,7 @@ Each folder inside of this directory represents one machine. It is also used on the installation phase (from `make install`) by setting the `HOST` variable (i.e., `HOST=zilch make -C /etc/install`) with the folder name as the argument. * 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 NUR or the unstable branch of Emacs. +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]. @@ -126,5 +127,6 @@ A wallpaper can be placed at `config/wallpaper` for convenience. This is where you can add certain packages, enable certain settings, setup your files to the home directory, and pass the theme metadata. * For convenience, you should make the NixOS theme module as a https://github.com/cookiecutter/cookiecutter[Cookiecutter template] to easily replace the color schemes, fonts, and what-have-you. -I have my theme templates stored in link:./templates[`./templates`]. +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. diff --git a/default.nix b/default.nix index d303b96e..9abbbfe3 100755 --- a/default.nix +++ b/default.nix @@ -8,6 +8,7 @@ device: username: { pkgs, options, lib, config, ... }: + { networking.hostName = lib.mkDefault device; my.username = username; @@ -21,7 +22,12 @@ device: username: /etc/nixos/hardware-configuration.nix ] else []); - ### NixOS + # GARBAGE DAY! + nix.gc = { + automatic = true; + dates = "daily"; + options = "--delete-older-than 3d"; + }; nix.autoOptimiseStore = true; nix.nixPath = options.nix.nixPath.default ++ [ # So we can use absolute import paths @@ -33,7 +39,7 @@ device: username: nixpkgs.overlays = import ./packages; nixpkgs.config.allowUnfree = true; # forgive me Stallman senpai - # These are the things I want installed on all my systems + # These are the things I want installed on all my systems. environment.systemPackages = with pkgs; [ # Just the bear necessities~ coreutils @@ -52,8 +58,8 @@ device: username: cachix # less time buildin' mo time nixin' ]; - # Default settings for primary user account. `my` is defined in - # modules/default.nix + # Default settings for primary user account. + # `my` is defined in 'modules/default.nix'. my.user = { isNormalUser = true; uid = 1000; diff --git a/hosts/zilch/README.adoc b/hosts/zilch/README.adoc new file mode 100644 index 00000000..e8484740 --- /dev/null +++ b/hosts/zilch/README.adoc @@ -0,0 +1,15 @@ += Zilch, the main workstation + +This is Zilch, the main machine (and only desktop as of 2020-08-16). +As such, it contains muh games and other stuff I attempt to bring over to Linux such as my music production workflow (I'm also learning how to compose music __properly__) and computer-aided designing with computers. + +Just to make this note seem more important, I'll just list the games I'm currently into: + +- https://play0ad.com/[0 A.D.] +- https://wesnoth.org/[Battle for Wesnoth] +- http://www.bay12games.com/dwarves/[Dwarf Fortress] +- https://endless-sky.github.io/[Endless Sky] +- https://www.minetest.net/[Minetest] +- https://openmw.org/en/[OpenMW] +- https://veloren.net/[Veloren] + diff --git a/hosts/zilch/config/recoll/recoll.conf b/hosts/zilch/config/recoll/recoll.conf index 3a8cc792..8d521cbe 100755 --- a/hosts/zilch/config/recoll/recoll.conf +++ b/hosts/zilch/config/recoll/recoll.conf @@ -1,12 +1,12 @@ # My desktop search settings. # The main directories to create an index. -topdirs = ~/writings # My writings on stuff. - ~/projects # My projects on stuff. - ~/library # Personal library which contains my references, documents, and movies. - ~/Documents # The ol' hangout for gamesaves. - ~/Videos # XDG Video directory. - ~/Pictures # Muh screenshots. +topdirs = ~/writings + ~/projects + ~/library + ~/Documents + ~/Videos + ~/Pictures # A list of wildcards to be ignored during index scanning. skippedNames = #* CVS Cache cache* .cache caughtspam tmp \ diff --git a/hosts/zilch/default.nix b/hosts/zilch/default.nix index 1ebf8aa7..a9abafb1 100755 --- a/hosts/zilch/default.nix +++ b/hosts/zilch/default.nix @@ -71,8 +71,13 @@ base.enable = true; documentation = { enable = true; + jupyter.enable = true; latex.enable = true; }; + gamedev = { + godot.enable = true; + unity3d.enable = true; + }; java.enable = true; javascript = { deno.enable = true; @@ -98,7 +103,6 @@ shell = { base.enable = true; - git.enable = true; lf.enable = true; zsh.enable = true; }; @@ -112,10 +116,16 @@ # defold nim # Jack the nimble, jack jumped over the nightstick, and got over not being the best pick. python # *insert Monty Python quote here* + ]; + my.packages = with pkgs; [ # Muh games. - zeroad - wesnoth + 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! ]; my.env = { @@ -130,25 +140,27 @@ time.timeZone = "Asia/Manila"; services.openssh.enable = true; services.lorri.enable = true; + + # Setup GnuPG. programs.gnupg.agent = { enable = true; enableSSHSupport = true; pinentryFlavor = "gnome3"; }; + # Install a proprietary Nvidia graphics driver. + services.xserver.videoDrivers = [ "nvidiaLegacy390" ]; + # Enable sound. sound.enable = true; hardware.pulseaudio.enable = true; + # Additional host-specific program configurations. my.home.programs = { # My personal Git config. git = { enable = true; - # Enable the syntax highlighter with Delta. - # https://github.com/dandavison/delta - delta.enable = true; - # Enable Large File Storage. lfs.enable = true; @@ -160,29 +172,13 @@ }; }; - my.home.services = { - # Unison backup strat. - unison = { - enable = true; - - pairs.mainbackup = - let - homeDirectory = "/home/${config.my.username}"; - backupDrive = "/run/media/${config.my.username}/Seagate Backup Plus Drive"; - in { - roots = [ - homeDirectory - backupDrive - ]; - commandOptions = { - # Unison may delete the entire stuff so indicate that the other is a mount point. - mountpoint = backupDrive; - force = homeDirectory; - - # My GnuPG keys. - path = ".gnupg .password-store"; - }; - }; - }; + # Moving all of the host-specific configurations into its appropriate place. + my.home.xdg.dataFile = + let insertXDGDataFolder = name: { + source = ./config + "/${name}"; + recursive = true; + }; in { + "recoll" = insertXDGDataFolder "recoll"; + "unison" = insertXDGDataFolder "unison"; }; } diff --git a/modules/default.nix b/modules/default.nix index 81b53d7d..9c40da06 100755 --- a/modules/default.nix +++ b/modules/default.nix @@ -63,6 +63,7 @@ in { config = { # Convenience aliases home-manager.users.${config.my.username} = mkAliasDefinitions options.my.home; + home-manager.useGlobalPkgs = true; users.users.${config.my.username} = mkAliasDefinitions options.my.user; my.user.packages = config.my.packages; @@ -80,14 +81,14 @@ in { ''; my.home.xdg.configFile = { - "zsh/extra.zshrc".text = + "zsh/.zshrc".text = let aliasLines = mapAttrsToList (key: value: "alias ${key}=\"${value}\"") config.my.alias; in '' # This file is autogenerated, do not edit it! ${concatStringsSep "\n" aliasLines} ${config.my.zsh.rc} ''; - "zsh/extra.zshenv".text = '' + "zsh/.zshenv".text = '' # This file is autogenerated, please do not edit it! ${config.my.zsh.env} ''; diff --git a/modules/desktop/multimedia.nix b/modules/desktop/multimedia.nix index 62797892..fd477f10 100755 --- a/modules/desktop/multimedia.nix +++ b/modules/desktop/multimedia.nix @@ -15,6 +15,8 @@ with lib; hexchat # The ultimate IRC client for neckbeards. mpv # The ultimate media player for hipsters. newsboat # The ultimate RSS aggregator for some person. + obs-studio # Open Broadcasting Studio Studio, the reliable recording workflow. + obs-linuxbrowser # OBS plugin for browser source. openshot-qt # A decent video editor. thunderbird # The ultimate email client for dumbasses like me. zathura # The ultimate PDF viewer for run-of-the-mill ricing. diff --git a/modules/desktop/music.nix b/modules/desktop/music.nix index 6f22713b..0ebe292d 100755 --- a/modules/desktop/music.nix +++ b/modules/desktop/music.nix @@ -31,7 +31,7 @@ in { fluidsynth # Synth for fluid sounds. helm # A great synthesizer plugin. hydrogen # Them drum beats composition will get good. - polyphone # Edit your fonts for sound. + unstable.polyphone # Edit your fonts for sound. zynaddsubfx # Ze most advanced synthesizer I've seen so far (aside from the upcoming Vital syntehsizer). # As of 2020-07-03, lmms has some trouble regarding Qt or something so at least use the "unstable" channel just to be safe. diff --git a/modules/dev/android.nix b/modules/dev/android.nix index a4c80baf..a93ab8da 100755 --- a/modules/dev/android.nix +++ b/modules/dev/android.nix @@ -14,8 +14,8 @@ with lib; my.packages = with pkgs; [ android-studio # The apartment for Android development. dart # It's JavaScript except saner and slimmer. - flutter # It's Electron except saner and slimmer. - kotlin # It's Java except saner and slimmer. + unstable.flutter # It's Electron except saner and slimmer. + unstable.kotlin # It's Java except saner and slimmer. ]; # Enable Android Debug Bridge for some device debugging. diff --git a/modules/dev/base.nix b/modules/dev/base.nix index f91957d1..2fc892c1 100755 --- a/modules/dev/base.nix +++ b/modules/dev/base.nix @@ -14,10 +14,16 @@ with lib; my.packages = with pkgs; [ caddy2 # THE ULTIMATE HTTPS/2 SERVER FOR 'YER GOLFIN' SESSIONS!!! cookiecutter # A project scaffolding tool. - direnv # Augment your shell with automatic environment variables loading and unloading. gnumake # Make your life easier with GNU Make. - tldr # What manuals should include. + stow # Build your symlink farm. + tldr # What manuals should include. universal-ctags # Enable fast traveling to your code (assuming written in a supported language). ]; + + # Augment your shell with automatic environment variables loading and unloading. + my.home.programs = { + direnv.enable = true; + fish.enable = true; + }; }; } diff --git a/modules/dev/default.nix b/modules/dev/default.nix index dd71668c..c395c3f3 100755 --- a/modules/dev/default.nix +++ b/modules/dev/default.nix @@ -11,6 +11,7 @@ ./javascript.nix ./lisp.nix ./math.nix + ./perl.nix ./rust.nix ]; } diff --git a/modules/dev/javascript.nix b/modules/dev/javascript.nix index da0388c1..22edd4ab 100755 --- a/modules/dev/javascript.nix +++ b/modules/dev/javascript.nix @@ -21,7 +21,7 @@ in config = { my.packages = with pkgs; (if cfg.deno.enable then [ - deno # The Deltarune of Node. + unstable.deno # The Deltarune of Node. ] else []) ++ (if cfg.node.enable then [ diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 630a48b1..4a925c70 100755 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -15,7 +15,7 @@ with lib; # Just make sure the unstable version of Emacs is available as a package by creating an overlay. pkg = mkOption { type = types.package; - default = pkgs.emacsUnstable; + default = pkgs.emacs; }; }; diff --git a/modules/shell/base.nix b/modules/shell/base.nix index 7f651624..633646a7 100755 --- a/modules/shell/base.nix +++ b/modules/shell/base.nix @@ -14,7 +14,7 @@ with lib; my.packages = with pkgs; [ aspell # Hunt down a spelling bee champion to come to your shell. bat # cat(1) with wings. - buku # A developer-oriented browser-independent bookmark manager. + # buku # A developer-oriented browser-independent bookmark manager. exa # ls(1) after an exodus. fd # find(1) after a cognitive behavioral therapy. fzf # A fuzzy finder that enables fuzzy finding not furry finding, a common misconception. diff --git a/modules/shell/default.nix b/modules/shell/default.nix index b935b5f5..81aeb886 100755 --- a/modules/shell/default.nix +++ b/modules/shell/default.nix @@ -5,7 +5,6 @@ with lib; { imports = [ ./base.nix - ./git.nix ./lf.nix ./zsh.nix ]; diff --git a/modules/shell/git.nix b/modules/shell/git.nix deleted file mode 100755 index bc0486c2..00000000 --- a/modules/shell/git.nix +++ /dev/null @@ -1,22 +0,0 @@ -# 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 = mkOption { - type = types.submodule; - }; - }; - - config = mkIf config.modules.shell.git.enable { - modules.shell.git.config = mkAliasDefinitions options.programs.git; - }; -} diff --git a/modules/shell/zsh.nix b/modules/shell/zsh.nix index 5d70af45..3d26f187 100755 --- a/modules/shell/zsh.nix +++ b/modules/shell/zsh.nix @@ -17,9 +17,6 @@ with lib; enableCompletion = true; autosuggestions.enable = true; histFile = "\$XDG_DATA_HOME/zsh/history"; - loginShellInit = " - export ZDOTDIR=\"\$XDG_CONFIG_HOME/zsh\" - "; # Adding basic version control support to the zsh prompt. # https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Zsh @@ -36,5 +33,11 @@ with lib; syntaxHighlighting.enable = true; }; + + my.home.home.file = { + ".zshenv".text = '' + export ZDOTDIR="$XDG_CONFIG_HOME/zsh" + ''; + }; }; } diff --git a/packages/default.nix b/packages/default.nix index 50a54d6c..84bd772e 100755 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,7 +1,11 @@ [ (self: super: with super; { # defold = (callPackage ./defold.nix {}); + + # Add packages from the unstable channel with `pkgs.unstable.$PKG`. + unstable = import { inherit config; }; }) - (import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz)) + # The unstable branch of Emacs. + # (import (builtins.fetchTarball https://github.com/nix-community/emacs-overlay/archive/master.tar.gz)) ]