From 49592d7f01a0a33a3a862db38c785e68ffc4f0b1 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Mon, 5 Oct 2020 09:38:58 +0800 Subject: [PATCH] Use the unstable version for the nth time I also fixed the long-time occuring error when using the newest version of the channel (or the unstable one). It turns out to be a simple type error with the `my.user' attribute. (To be honest the error messages are quite horrible.) On another note, I also accidentally bricked my NixOS setup after a garbage collection and a horrible update. The breakage includes not being able to use any of the builtin tools of Nix (e.g., nix, nix-env, nixos-rebuild) due to a shared library error that has been garbage collected. Which means I have to reinstall it. (I seem to have a talent for breaking things, if only I'm paid for it.) --- Makefile | 8 +++- default.nix | 6 --- modules/default.nix | 12 ++++-- modules/desktop/files.nix | 6 +-- modules/desktop/fonts.nix | 12 +++++- modules/desktop/graphics.nix | 2 +- modules/desktop/music.nix | 11 ++++-- modules/dev/android.nix | 9 +++-- modules/dev/base.nix | 2 +- modules/dev/data.nix | 0 modules/dev/default.nix | 1 + modules/dev/documentation.nix | 2 +- modules/dev/gamedev.nix | 4 +- modules/dev/go.nix | 25 ++++++++++++ modules/dev/javascript.nix | 2 +- modules/dev/math.nix | 11 ++---- modules/dev/perl.nix | 4 +- modules/dev/python.nix | 39 +++++++++++++++++++ modules/dev/vcs.nix | 0 modules/drivers/default.nix | 7 ++++ modules/drivers/veikk.nix | 16 ++++++++ modules/editors/emacs.nix | 23 +++++++---- modules/editors/neovim.nix | 5 --- modules/editors/vscode.nix | 0 modules/shell/base.nix | 10 +++++ .../fair-and-square/config/bspwm/bspwmrc | 1 + .../fair-and-square/config/polybar/config | 18 +-------- .../config/rofi/themes/fds-center-menu.rasi | 2 +- .../config/rofi/themes/fds-mini-sidebar.rasi | 2 +- modules/themes/fair-and-square/default.nix | 3 +- 30 files changed, 168 insertions(+), 75 deletions(-) mode change 100644 => 100755 modules/dev/data.nix create mode 100755 modules/dev/go.nix create mode 100755 modules/dev/python.nix mode change 100644 => 100755 modules/dev/vcs.nix create mode 100755 modules/drivers/default.nix create mode 100755 modules/drivers/veikk.nix mode change 100644 => 100755 modules/editors/vscode.nix diff --git a/Makefile b/Makefile index 34f9a8b9..ab06b963 100755 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ HOST := zilch HOME := /home/$(USER) DOTS := /etc/dotfiles -NIXOS_VERSION := 20.03 +NIXOS_VERSION := 20.09 NIXOS_PREFIX := $(PREFIX)/etc/nixos FLAGS := -I "config=$$(pwd)/config" \ -I "modules=$$(pwd)/modules" \ @@ -14,9 +14,13 @@ 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: + @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://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 diff --git a/default.nix b/default.nix index 57c427ec..97ab37d3 100755 --- a/default.nix +++ b/default.nix @@ -74,10 +74,4 @@ device: username: extraGroups = [ "wheel" "video" "libvirtd" ]; shell = pkgs.zsh; }; - - # 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? } diff --git a/modules/default.nix b/modules/default.nix index 9c40da06..61fd8675 100755 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,14 +1,18 @@ { config, options, lib, ... }: + with lib; -let mkOptionStr = value: mkOption - { type = types.str; - default = value; }; + +let + mkOptionStr = value: mkOption + { type = types.str; + default = value; }; in { imports = [ ./desktop ./dev + ./drivers ./editors ./shell ./services @@ -23,7 +27,7 @@ in { # Convenience aliases home = mkOption { type = options.home-manager.users.type.functor.wrapped; }; - user = mkOption { type = types.submodule; }; + user = mkOption { type = options.users.users.type; }; packages = mkOption { type = with types; listOf package; }; # Environment diff --git a/modules/desktop/files.nix b/modules/desktop/files.nix index 3226a525..7e6389bc 100755 --- a/modules/desktop/files.nix +++ b/modules/desktop/files.nix @@ -21,6 +21,7 @@ in { }) # Bring the search engine to the desktop! 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. @@ -28,11 +29,6 @@ in { udiskie # An automounter for external devices with authentication. ]; - # Enable peer-to-peer synchro summoning service. - my.home.services = { - syncthing.enable = true; - }; - # Clean 'yer home! my.env = { RECOLL_CONFDIR = "$XDG_DATA_HOME/recoll"; diff --git a/modules/desktop/fonts.nix b/modules/desktop/fonts.nix index b5256581..30f6d2af 100755 --- a/modules/desktop/fonts.nix +++ b/modules/desktop/fonts.nix @@ -14,10 +14,18 @@ with lib; # Enable fontconfig to easily discover fonts installed from home-manager. fonts = { enableFontDir = true; - enableGhostscriptFonts = true; - fontconfig.enable = true; + enableDefaultFonts = true; + fontconfig = { + enable = true; + defaultFonts = { + sansSerif = [ "Source Sans Pro" "IBM Plex Sans" ]; + serif = [ "Source Serif Pro" "IBM Plex Serif" ]; + monospace = [ "Source Code Pro" "IBM Plex Mono" ]; + }; + }; fonts = with pkgs; [ + dejavu_fonts fira-code # The programming font with fancy symbols. ibm-plex # IBM's face, is it professional? iosevka # The fancy monofont with fancy ligatures. diff --git a/modules/desktop/graphics.nix b/modules/desktop/graphics.nix index a2bfdbeb..cdbec533 100755 --- a/modules/desktop/graphics.nix +++ b/modules/desktop/graphics.nix @@ -22,7 +22,7 @@ in { my.packages = with pkgs; [ font-manager # Self-explanatory name is self-explanatory. - imagemagick # A command-line tool for manipulating images. + imagemagick7 # A command-line tool for manipulating images. graphviz # The biz central for graphical flowcharts. ] ++ diff --git a/modules/desktop/music.nix b/modules/desktop/music.nix index 74c195a3..d3e5d46f 100755 --- a/modules/desktop/music.nix +++ b/modules/desktop/music.nix @@ -19,19 +19,22 @@ in { my.packages = with pkgs; (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). - unstable.musescore # A music composer for creating musical cheatsheets. + musescore # A music composer for creating musical cheatsheets. soundfont-fluid # A soundfont for it or something. - unstable.supercollider # Programming platform for synthesizing them 'zics. + sonic-pi # A pie made up of them supersonic sounds created from electricity. + supercollider # Programming platform for synthesizing them 'zics. ] else []) ++ (if cfg.production.enable then [ - unstable.ardour # A DAW focuses on hardware recording but it can be used for something else. + ardour # A DAW focuses on hardware recording but it can be used for something else. audacity # Belongs in the great city of "Simple tools for short audio samples". carla # A plugin host useful for a consistent hub for them soundfonts and SFZs. fluidsynth # Synth for fluid sounds. + geonkick # Create them percussions. helm # A great synthesizer plugin. hydrogen # Them drum beats composition will get good. - unstable.polyphone # Edit your fonts for sound. + polyphone # Edit your fonts for sound. + #zrythm # An up-and-coming DAW in Linux town. 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 d4d25c5a..5493b9ff 100755 --- a/modules/dev/android.nix +++ b/modules/dev/android.nix @@ -12,10 +12,11 @@ with lib; config = mkIf config.modules.dev.android.enable { my.packages = with pkgs; [ - unstable.android-studio # The apartment for Android development. - unstable.dart # It's JavaScript except saner and slimmer. - unstable.flutter # It's Electron except saner and slimmer. - unstable.kotlin # It's Java except saner and slimmer. + 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. + scrcpy # Cast your phone over TCP/IP! ]; # Enable Android Debug Bridge for some device debugging. diff --git a/modules/dev/base.nix b/modules/dev/base.nix index 174df315..a9be7896 100755 --- a/modules/dev/base.nix +++ b/modules/dev/base.nix @@ -12,7 +12,7 @@ with lib; config = mkIf config.modules.dev.base.enable { my.packages = with pkgs; [ - caddy2 # THE ULTIMATE HTTPS/2 SERVER FOR 'YER GOLFIN' SESSIONS!!! + caddy # THE ULTIMATE HTTPS/2 SERVER FOR 'YER GOLFIN' SESSIONS!!! cmake # Yo, I heard you like Makefiles. cookiecutter # A project scaffolding tool. gnumake # Make your life easier with GNU Make. diff --git a/modules/dev/data.nix b/modules/dev/data.nix old mode 100644 new mode 100755 diff --git a/modules/dev/default.nix b/modules/dev/default.nix index e44fe325..1c9abd9a 100755 --- a/modules/dev/default.nix +++ b/modules/dev/default.nix @@ -13,6 +13,7 @@ ./lisp.nix ./math.nix ./perl.nix + ./python.nix ./rust.nix ./vcs.nix ]; diff --git a/modules/dev/documentation.nix b/modules/dev/documentation.nix index df0ae73b..e15b9bbe 100755 --- a/modules/dev/documentation.nix +++ b/modules/dev/documentation.nix @@ -38,7 +38,7 @@ in # TODO: Make Neuron its own package. (let - neuronRev = "3c46adea8cfa2262ac2d50d3d9b1a96cb13a512d"; + neuronRev = "5c37dd3bbfff7d203883417bee2e2970d41cd70d"; neuronSrc = builtins.fetchTarball "https://github.com/srid/neuron/archive/${neuronRev}.tar.gz"; in import neuronSrc {}) # Neurons and zettels are good for the brain. ] ++ diff --git a/modules/dev/gamedev.nix b/modules/dev/gamedev.nix index f5ddc7cc..543ca191 100755 --- a/modules/dev/gamedev.nix +++ b/modules/dev/gamedev.nix @@ -29,8 +29,8 @@ in ] else []) ++ (if cfg.unity3d.enable then [ - unstable.unity3d # The Unity, not to be confused with a certain ideal. - unstable.unityhub # The ideal hub for your Unity projects. + unity3d # The Unity, not to be confused with a certain ideal. + unityhub # The ideal hub for your Unity projects. ] else []); }; } diff --git a/modules/dev/go.nix b/modules/dev/go.nix new file mode 100755 index 00000000..10601638 --- /dev/null +++ b/modules/dev/go.nix @@ -0,0 +1,25 @@ +# Ah yes, Rust... +# The programming language that made me appreciate/tolerate C++ even more. +{ config, options, lib, pkgs, ... }: + +with lib; +{ + options.modules.dev.rust = { + enable = mkOption { + type = types.bool; + default = false; + }; + }; + + config = mkIf config.modules.dev.rust.enable { + my.packages = with pkgs; [ + rustup + ]; + + my.env = { + CARGO_HOME = "$XDG_DATA_HOME/cargo"; + RUSTUP_HOME = "$XDG_DATA_HOME/rustup"; + PATH = [ "$CARGO_HOME/bin" ]; + }; + }; +} diff --git a/modules/dev/javascript.nix b/modules/dev/javascript.nix index 7a1d84f3..1c57203f 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 [ - unstable.deno # The Deltarune of Node. + deno # The Deltarune of Node. ] else []) ++ (if cfg.node.enable then [ diff --git a/modules/dev/math.nix b/modules/dev/math.nix index b2a945b8..dd43adcf 100755 --- a/modules/dev/math.nix +++ b/modules/dev/math.nix @@ -12,23 +12,20 @@ in type = types.bool; default = false; }; in { - python.enable = mkEnableOption; + enable = mkEnableOption; r.enable = mkEnableOption; }; - config = { + config = mkIf cfg.enable { my.packages = with pkgs; [ gnuplot # I came for the plots. + julia # A statistics-focused languaged named after a character in an iconic fighting game. octave # Matlab's hipster brother. ] ++ - (if cfg.python.enable then [ - python # Serious question: do I really need to install this? - python38Packages.sympy # The Python library that always being noticed. - ] else []) ++ - (if cfg.r.enable then [ R # Rated G for accessibility. + rstudio # It's not that kind of studio. ] else []); }; } diff --git a/modules/dev/perl.nix b/modules/dev/perl.nix index 61307559..11b89599 100755 --- a/modules/dev/perl.nix +++ b/modules/dev/perl.nix @@ -5,7 +5,7 @@ with lib; let perlWithPackages = pkgs.perl.withPackages (p: with pkgs.perlPackages; [ - ModernBuild + ModuleBuild ModuleInfo ModuleInstall ModernPerl @@ -19,6 +19,6 @@ in { }; config = mkIf config.modules.dev.perl.enable { - my.packages = perlWithPackages; + my.packages = [ perlWithPackages ]; }; } diff --git a/modules/dev/python.nix b/modules/dev/python.nix new file mode 100755 index 00000000..bd288176 --- /dev/null +++ b/modules/dev/python.nix @@ -0,0 +1,39 @@ +# Another language for portable shell scripting. +# This installs Python 3 with my usual packages. +# For projects with other libraries (e.g., Django, Pytorch), you can just have a `default.nix` (and a `shell.nix` for more convenience). +{ config, options, lib, pkgs, ... }: + +with lib; + +let + cfg = config.modules.dev.python; +in { + options.modules.dev.python = let + mkBoolOption = bool: mkOption { + type = types.bool; + default = bool; + }; in { + enable = mkBoolOption false; + math.enable = mkBoolOption false; + }; + + config = mkIf cfg.enable { + my.packages = with pkgs; [ + (python37.withPackages (p: with python3Packages; [ + beautifulsoup4 # How soups are beautiful again? + requests # The requests for your often-asked questions. + pytools # It's the little things that counts. + pytest # Try to make a good grade or else. + poetry # It rhymes... + scrapy # Create an extractor from a box of scraps. + setuptools # Setup your stuff. + ] + + ++ (if cfg.math.enable then [ + numpy # Numbers are also good, right? + sympy # When will you notice that math is good? + ] else []))) + ]; + }; +} + diff --git a/modules/dev/vcs.nix b/modules/dev/vcs.nix old mode 100644 new mode 100755 diff --git a/modules/drivers/default.nix b/modules/drivers/default.nix new file mode 100755 index 00000000..064941a6 --- /dev/null +++ b/modules/drivers/default.nix @@ -0,0 +1,7 @@ +{ config, lib, ... }: + +{ + imports = [ + ./veikk.nix + ]; +} diff --git a/modules/drivers/veikk.nix b/modules/drivers/veikk.nix new file mode 100755 index 00000000..68323ec1 --- /dev/null +++ b/modules/drivers/veikk.nix @@ -0,0 +1,16 @@ +# Installs the VEIKK Linux driver at https://github.com/jlam55555/veikk-linux-driver. +{ config, options, lib, pkgs, ... }: + +with lib; +{ + options.modules.drivers.veikk = { + enable = mkOption { + type = types.bool; + default = false; + }; + }; + + config = mkIf config.modules.drivers.veikk.enable { + boot.extraModulePackages = [ pkgs.veikk-linux-driver ]; + }; +} diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 68b5d854..04ef216a 100755 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -4,6 +4,16 @@ { config, options, lib, pkgs, ... }: with lib; +let + emacsOrgProtocolDesktopEntry = pkgs.makeDesktopItem { + name = "org-protocol"; + desktopName = "Org-Protocol"; + exec = "emacsclient %u"; + icon = "emacs-icon"; + type = "Application"; + mimeType = "x-scheme-handler/org-protocol"; + }; +in { options.modules.editors.emacs = { enable = mkOption { @@ -14,7 +24,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.unstable.emacs; + default = pkgs.emacs; }; }; @@ -24,6 +34,8 @@ with lib; epkgs.vterm ])) + emacsOrgProtocolDesktopEntry + # Doom dependencies git (ripgrep.override { withPCRE2 = true; }) @@ -49,6 +61,9 @@ with lib; ## :tools editorconfig editorconfig-core-c + ## :tools lookup + wordnet + ## :tools lookup & :lang org+roam sqlite ]; @@ -56,11 +71,5 @@ with lib; fonts.fonts = with pkgs; [ emacs-all-the-icons-fonts ]; - - # Placing the Doom Emacs config. - my.home.xdg.configFile."doom" = { - source = ../../config/emacs; - recursive = true; - }; }; } diff --git a/modules/editors/neovim.nix b/modules/editors/neovim.nix index 69be412a..430e904a 100755 --- a/modules/editors/neovim.nix +++ b/modules/editors/neovim.nix @@ -21,11 +21,6 @@ with lib; withPython3 = true; withRuby = true; }; - - xdg.configFile."nvim" = { - source = ../../config/nvim; - recursive = true; - }; }; }; } diff --git a/modules/editors/vscode.nix b/modules/editors/vscode.nix old mode 100644 new mode 100755 diff --git a/modules/shell/base.nix b/modules/shell/base.nix index 7b27d7cc..368d5a5a 100755 --- a/modules/shell/base.nix +++ b/modules/shell/base.nix @@ -22,6 +22,7 @@ with lib; hexyl # Binary viewer with a cool name on the command-line. hledger # Do your accountancy thing ON THE COMMAND LINE, sure why not! httpie # Want a piece of the HTTP pie. + gitAndTools.tig # The Deltarune of Git. gopass # The improved version of Password Store which is a password manager for hipsters. graphviz # The biz central for graphical flowcharts. maim # A command-line interface for parsing screenshots. @@ -34,5 +35,14 @@ with lib; unzip # Unzip what? The world may never know. youtube-dl # A program that can be sued for false advertisement as you can download from other video sources. ]; + + my.home = { + programs.bat = { + enable = true; + config = { + theme = "base16"; + }; + }; + }; }; } diff --git a/modules/themes/fair-and-square/config/bspwm/bspwmrc b/modules/themes/fair-and-square/config/bspwm/bspwmrc index 4943865d..29a47a5c 100755 --- a/modules/themes/fair-and-square/config/bspwm/bspwmrc +++ b/modules/themes/fair-and-square/config/bspwm/bspwmrc @@ -25,4 +25,5 @@ xsetroot -cursor_name left_ptr # Rules bspc rule -a code-oss desktop=^2 bspc rule -a firefox desktop=^1 +bspc rule -a Emacs state=tiled diff --git a/modules/themes/fair-and-square/config/polybar/config b/modules/themes/fair-and-square/config/polybar/config index f8c11a2a..40200dc3 100755 --- a/modules/themes/fair-and-square/config/polybar/config +++ b/modules/themes/fair-and-square/config/polybar/config @@ -59,23 +59,7 @@ modules-left = bspwm modules-center = date - modules-right = pulseaudio eth memory home-fs root-fs - - -[module/home-fs] - type = internal/fs - mount-0 = /home - format-margin = 0 - format-padding = 0 - label-margin = 0 - label-padding = 0 - - format-mounted-prefix = "" - format-mounted-prefix-margin-right = 1 - format-unmounted-prefix = "" - format-unmounted-prefix-margin-right = 1 - label-mounted = %free% - label-unmounted = N/A + modules-right = pulseaudio eth memory root-fs [module/root-fs] diff --git a/modules/themes/fair-and-square/config/rofi/themes/fds-center-menu.rasi b/modules/themes/fair-and-square/config/rofi/themes/fds-center-menu.rasi index 0a661615..03c5722d 100755 --- a/modules/themes/fair-and-square/config/rofi/themes/fds-center-menu.rasi +++ b/modules/themes/fair-and-square/config/rofi/themes/fds-center-menu.rasi @@ -35,7 +35,7 @@ window { background-color: transparent; height: 65%; - width: 45%; + width: 55%; position: center; location: center; text-color: @foreground; 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 18e62f21..4aeeabac 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 @@ -36,7 +36,7 @@ window { background-color: transparent; height: 65%; - width: 35%; + width: 45%; position: center; location: center; text-color: @foreground; diff --git a/modules/themes/fair-and-square/default.nix b/modules/themes/fair-and-square/default.nix index 9f06b416..13b21460 100755 --- a/modules/themes/fair-and-square/default.nix +++ b/modules/themes/fair-and-square/default.nix @@ -28,8 +28,6 @@ with lib; xserver = { displayManager = { lightdm.enable = true; - lightdm.greeters.mini.enable = true; - lightdm.greeters.mini.user = config.my.username; defaultSession = "none+bspwm"; }; enable = true; @@ -77,6 +75,7 @@ with lib; gtk-xft-hinting=1 gtk-xft-hintstyle=hintfull gtk-xft-rgba=none + gtk-font-name=Sans 10 ''; } ];