From b9785fed44d451a0e60b261697f837e264514a60 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 20 Aug 2020 02:35:23 +0800 Subject: [PATCH] Go back to using stable channels and add unstable channel as a separate channel NixOS 20.09 is just around the corner anyways so the packages will be updated soonish. --- README.adoc | 56 ++++++++++++++++--- default.nix | 4 +- hosts/zilch/default.nix | 21 ++++++- hosts/zilch/modules/overlays.nix | 15 +++++ modules/dev/base.nix | 3 +- modules/dev/documentation.nix | 2 +- modules/dev/gamedev.nix | 6 +- modules/dev/perl.nix | 22 ++++++++ modules/editors/emacs.nix | 2 +- .../config/rofi/themes/fds-mini-sidebar.rasi | 4 +- .../config/rofi/themes/fds-mini-sidebar.rasi | 4 +- 11 files changed, 116 insertions(+), 23 deletions(-) create mode 100644 hosts/zilch/modules/overlays.nix create mode 100644 modules/dev/perl.nix diff --git a/README.adoc b/README.adoc index 56de8b42..b9e27852 100755 --- a/README.adoc +++ b/README.adoc @@ -1,7 +1,8 @@ = foo-dogsquared's NixOS config +:toc: This is the configuration setup for my https://nixos.org[NixOS] instance. -This setup is stolen from https://github.com/hlissner/dotfiles[hlissner's NixOS config] foot:[The author and one-man maintainer of Doom Emacs.]. +This setup is stolen from https://github.com/hlissner/dotfiles[hlissner's NixOS config] footnote:[The author and one-man maintainer of Doom Emacs.]. The whole setup is mostly intended for single-user systems but you can easily configure it for multi-user systems. @@ -61,36 +62,73 @@ nixos-config ├── hosts/ ├── modules/ ├── packages/ +├── templates/ ├── default.nix* ├── Makefile* └── 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. +* The directory paid with the most attention would most likely be the `modules/` folder which contains cluster-wide footnote:[Whenever I say 'cluster-wide', I really mean my laptop (which I have none at the moment) and desktop (which I have only one at the moment).] modules intended to be used in each device. ** Another folder worthy of attention is the `modules/themes` which sets up a complete desktop environment for you so you don't have to. For more information, see the <> section. -* The `config/` directory is simply the ad hoc configuration of several programs. +* The `config/` directory is simply the all-seeing cluster-wide ad hoc configuration of several programs. In this case, it is my https://github.com/foo-dogsquared/dotflies[dotfiles] directory. -* The `hosts/` contains the individual system configuration of my machine (I've only one but I plan to NixOS for my new ones). -Each folder inside of this directory represents one machine. +* The `hosts/` contains the machine-specific configurations of the machine (I've only one but I plan to install NixOS for my new ones). 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. +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]. +* 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). + + + + +== Hosts + +Each machine is represented with a directory in link:./hosts/[`./hosts`] with the name of the directory as the name of the machine. +footnote:[It is basically using the pets approach (from pets versus cattle thing).] + +Each host should have an entrypoint at `./hosts/$HOST/default.nix` which is then used from the entrypoint of this setup at link:./default.nix[`./default.nix`] (i.e., `import /etc/dotfiles "$HOST" "$USER"`). +It may contain machine-specific configurations (e.g., specific systemd units, Recoll index building, GNU Nano configurations), other Nix modules for modularity, and other sorts of knick-knacks (e.g., other wallpapers, machine-specific scripts). + +For best practice, you may want to follow the following project structure: + +[source, tree] +---- +./hosts/$HOST +├── config/ +├── modules/ +├── default.nix* +├── hardware-configuration.nix* +└── README.adoc +---- + +* `config/` contains the specific config files. + +* `modules/` stores the other Nix modules to be used in `default.nix`. + +* `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.) + == Themes My setup feature themes as a NixOS module (in link:./modules/themes[`modules/themes`]) which sets up a complete graphical environment. -This lets me easily switch my graphical setup with a simple toggle (i.e., `theme.$THEME_NAME.enable = true;`). -For safety, you should have a bare installation ala-Arch Linux. +This lets me easily switch my graphical setup with a simple toggle (i.e., `theme.$THEME_NAME.enable = true;`) in my machine configuration (i.e., `./hosts/$HOST/default.nix`). +For safety from conflicting modules and configuration, you should have a bare installation ala-Arch Linux. As you can see in the `default.nix` of the `modules/theme` directory, a theme should also pass in certain data to `modules.theme` as if it's enabled. The following is an example metadata object of a theme. diff --git a/default.nix b/default.nix index 9abbbfe3..dcfc13e5 100755 --- a/default.nix +++ b/default.nix @@ -4,7 +4,7 @@ # License: MIT # # This is ground zero, where the absolute essentials go, to be present on all systems I use nixos on. -# Most of which are single user systems (the ones that aren't are configured from their hosts/*/default.nix). +# Contains cluser-wide configurations shared between all of the systems (located in `hosts/`). device: username: { pkgs, options, lib, config, ... }: @@ -49,7 +49,7 @@ device: username: killall ntfs3g sshfs - udiskie + udiskie unzip vim wget diff --git a/hosts/zilch/default.nix b/hosts/zilch/default.nix index a9abafb1..c0c7723b 100755 --- a/hosts/zilch/default.nix +++ b/hosts/zilch/default.nix @@ -1,3 +1,5 @@ +# My NixOS config... +# This is where the specific setup go from setting environment variables, specific aliases, installing specific packages (e.g., muh games), and so forth. { config, pkgs, lib, ... }: { @@ -5,6 +7,8 @@ ./hardware-configuration.nix ]; + nixpkgs.overlays = import ./modules/overlays.nix; + # Use the systemd-boot EFI boot loader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -74,7 +78,7 @@ jupyter.enable = true; latex.enable = true; }; - gamedev = { + game-dev = { godot.enable = true; unity3d.enable = true; }; @@ -126,15 +130,28 @@ unstable.openmw # Losing is even more meh1 unstable.wesnoth # Losing is frustrating! unstable.zeroad # Losing is fun and frustrating! + + # Installing some of the dependencies required for my scripts. + ffcast + giflib + leptonica + libpng + libwebp + maim + (tesseract.override { enableLanguages = [ "eng" ]; }) + slop + xdg-user-dirs + zbar ]; + # Setting up the shell environment. my.env = { BROWSER = "firefox"; FILE = "lf"; READ = "zathura"; SUDO_ASKPASS = ; }; - my.alias.dots = "USER=${config.my.username} make -C /etc/install"; + my.alias.dots = "USER=${config.my.username} make -C /etc/dotfiles"; # Set your time zone. time.timeZone = "Asia/Manila"; diff --git a/hosts/zilch/modules/overlays.nix b/hosts/zilch/modules/overlays.nix new file mode 100644 index 00000000..8e9b4dc3 --- /dev/null +++ b/hosts/zilch/modules/overlays.nix @@ -0,0 +1,15 @@ +# 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"; + }; + }); + }) +] diff --git a/modules/dev/base.nix b/modules/dev/base.nix index 2fc892c1..0c027922 100755 --- a/modules/dev/base.nix +++ b/modules/dev/base.nix @@ -15,7 +15,8 @@ with lib; caddy2 # THE ULTIMATE HTTPS/2 SERVER FOR 'YER GOLFIN' SESSIONS!!! cookiecutter # A project scaffolding tool. gnumake # Make your life easier with GNU Make. - stow # Build your symlink farm. + hyperfine # You shouldn't be feel just fine with your programs... + stow # Build your symlink farm on the other side of the country, er, filesystem. tldr # What manuals should include. universal-ctags # Enable fast traveling to your code (assuming written in a supported language). ]; diff --git a/modules/dev/documentation.nix b/modules/dev/documentation.nix index dab0ae3b..b68c1d9c 100755 --- a/modules/dev/documentation.nix +++ b/modules/dev/documentation.nix @@ -42,7 +42,7 @@ in (if cfg.jupyter.enable then [ jupyter # The interactive notebook. - iruby # The Ruby kernel for Jupyter. + unstable.iruby # The Ruby kernel for Jupyter. ] else []) ++ (if cfg.latex.enable then [ diff --git a/modules/dev/gamedev.nix b/modules/dev/gamedev.nix index 07ba32f1..59a2dd73 100755 --- a/modules/dev/gamedev.nix +++ b/modules/dev/gamedev.nix @@ -20,12 +20,12 @@ in config = { my.packages = with pkgs; (if cfg.godot.enable then [ - godot # The Godot, not to be confused with a certain prosecutor. + unstable.godot # The Godot, not to be confused with a certain prosecutor. ] else []) ++ (if cfg.unity3d.enable then [ - unity3d # The Unity, not to be confused with a certain ideal. - unityhub # The ideal hub for your Unity projects. + unstable.unity3d # The Unity, not to be confused with a certain ideal. + unstable.unityhub # The ideal hub for your Unity projects. ] else []); }; } diff --git a/modules/dev/perl.nix b/modules/dev/perl.nix new file mode 100644 index 00000000..a48794f8 --- /dev/null +++ b/modules/dev/perl.nix @@ -0,0 +1,22 @@ +# The language for portable shell scripting. +{ config, options, lib, pkgs, ... }: + +with lib; +{ + options.modules.dev.perl = { + enable = mkOption { + type = types.bool; + default = false; + }; + }; + + config = mkIf config.modules.dev.perl.enable { + my.packages = with pkgs; [ + perl + perlPackages.ModernPerl + perlPackages.ModuleBuild + perlPackages.ModuleInfo + perlPackages.ModuleInstall + ]; + }; +} diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 4a925c70..ea7a8830 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.emacs; + default = pkgs.unstable.emacs; }; }; diff --git a/modules/themes/fair-and-square/config/rofi/themes/fds-mini-sidebar.rasi b/modules/themes/fair-and-square/config/rofi/themes/fds-mini-sidebar.rasi index 6f0bb66a..18e62f21 100755 --- a/modules/themes/fair-and-square/config/rofi/themes/fds-mini-sidebar.rasi +++ b/modules/themes/fair-and-square/config/rofi/themes/fds-mini-sidebar.rasi @@ -37,8 +37,8 @@ window { height: 65%; width: 35%; - position: southwest; - location: southwest; + position: center; + location: center; text-color: @foreground; } diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name | slugify }}/config/rofi/themes/fds-mini-sidebar.rasi b/templates/themes/fair-and-square/{{ cookiecutter.name | slugify }}/config/rofi/themes/fds-mini-sidebar.rasi index 296a7e01..db27ef6f 100755 --- a/templates/themes/fair-and-square/{{ cookiecutter.name | slugify }}/config/rofi/themes/fds-mini-sidebar.rasi +++ b/templates/themes/fair-and-square/{{ cookiecutter.name | slugify }}/config/rofi/themes/fds-mini-sidebar.rasi @@ -37,8 +37,8 @@ window { height: 65%; width: 35%; - position: southwest; - location: southwest; + position: center; + location: center; text-color: @foreground; }