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.
This commit is contained in:
Gabriel Arazas 2020-08-20 02:35:23 +08:00
parent 75a04804a6
commit b9785fed44
11 changed files with 116 additions and 23 deletions

View File

@ -1,7 +1,8 @@
= foo-dogsquared's NixOS config = foo-dogsquared's NixOS config
:toc:
This is the configuration setup for my https://nixos.org[NixOS] instance. 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. 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/ ├── hosts/
├── modules/ ├── modules/
├── packages/ ├── packages/
├── templates/
├── default.nix* ├── default.nix*
├── Makefile* ├── Makefile*
└── README.adoc* └── README.adoc*
---- ----
* The directory paid with the most attention would most likely be the `modules/` folder. * 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.
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.
** Another folder worthy of attention is the `modules/themes` which sets up a complete desktop environment for you so you don't have to. ** 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 <<Themes>> section. For more information, see the <<Themes>> 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. 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). * The `hosts/` contains the machine-specific configurations of the machine (I've only one but I plan to install NixOS for my new ones).
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. 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 <<Hosts>> 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. * 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]. 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 == Themes
My setup feature themes as a NixOS module (in link:./modules/themes[`modules/themes`]) which sets up a complete graphical environment. 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;`). 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, you should have a bare installation ala-Arch Linux. 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. 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. The following is an example metadata object of a theme.

View File

@ -4,7 +4,7 @@
# License: MIT # License: MIT
# #
# This is ground zero, where the absolute essentials go, to be present on all systems I use nixos on. # 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: device: username:
{ pkgs, options, lib, config, ... }: { pkgs, options, lib, config, ... }:

View File

@ -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, ... }: { config, pkgs, lib, ... }:
{ {
@ -5,6 +7,8 @@
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
nixpkgs.overlays = import ./modules/overlays.nix;
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
@ -74,7 +78,7 @@
jupyter.enable = true; jupyter.enable = true;
latex.enable = true; latex.enable = true;
}; };
gamedev = { game-dev = {
godot.enable = true; godot.enable = true;
unity3d.enable = true; unity3d.enable = true;
}; };
@ -126,15 +130,28 @@
unstable.openmw # Losing is even more meh1 unstable.openmw # Losing is even more meh1
unstable.wesnoth # Losing is frustrating! unstable.wesnoth # Losing is frustrating!
unstable.zeroad # Losing is fun and 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 = { my.env = {
BROWSER = "firefox"; BROWSER = "firefox";
FILE = "lf"; FILE = "lf";
READ = "zathura"; READ = "zathura";
SUDO_ASKPASS = <config/bin/askpass>; SUDO_ASKPASS = <config/bin/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. # Set your time zone.
time.timeZone = "Asia/Manila"; time.timeZone = "Asia/Manila";

View File

@ -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";
};
});
})
]

View File

@ -15,7 +15,8 @@ with lib;
caddy2 # THE ULTIMATE HTTPS/2 SERVER FOR 'YER GOLFIN' SESSIONS!!! caddy2 # THE ULTIMATE HTTPS/2 SERVER FOR 'YER GOLFIN' SESSIONS!!!
cookiecutter # A project scaffolding tool. cookiecutter # A project scaffolding tool.
gnumake # Make your life easier with GNU Make. 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. tldr # What manuals should include.
universal-ctags # Enable fast traveling to your code (assuming written in a supported language). universal-ctags # Enable fast traveling to your code (assuming written in a supported language).
]; ];

View File

@ -42,7 +42,7 @@ in
(if cfg.jupyter.enable then [ (if cfg.jupyter.enable then [
jupyter # The interactive notebook. jupyter # The interactive notebook.
iruby # The Ruby kernel for Jupyter. unstable.iruby # The Ruby kernel for Jupyter.
] else []) ++ ] else []) ++
(if cfg.latex.enable then [ (if cfg.latex.enable then [

View File

@ -20,12 +20,12 @@ in
config = { config = {
my.packages = with pkgs; my.packages = with pkgs;
(if cfg.godot.enable then [ (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 []) ++ ] else []) ++
(if cfg.unity3d.enable then [ (if cfg.unity3d.enable then [
unity3d # The Unity, not to be confused with a certain ideal. unstable.unity3d # The Unity, not to be confused with a certain ideal.
unityhub # The ideal hub for your Unity projects. unstable.unityhub # The ideal hub for your Unity projects.
] else []); ] else []);
}; };
} }

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

@ -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
];
};
}

View File

@ -15,7 +15,7 @@ with lib;
# Just make sure the unstable version of Emacs is available as a package by creating an overlay. # Just make sure the unstable version of Emacs is available as a package by creating an overlay.
pkg = mkOption { pkg = mkOption {
type = types.package; type = types.package;
default = pkgs.emacs; default = pkgs.unstable.emacs;
}; };
}; };

View File

@ -37,8 +37,8 @@ window {
height: 65%; height: 65%;
width: 35%; width: 35%;
position: southwest; position: center;
location: southwest; location: center;
text-color: @foreground; text-color: @foreground;
} }

View File

@ -37,8 +37,8 @@ window {
height: 65%; height: 65%;
width: 35%; width: 35%;
position: southwest; position: center;
location: southwest; location: center;
text-color: @foreground; text-color: @foreground;
} }