From d01e59791826fed31fb9f242af2c9de4f62156b7 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sun, 6 Sep 2020 04:50:16 +0800 Subject: [PATCH] Restructured the project setup I've also added a little module for version control systems now that I'm finding myself often packaging software. --- Makefile | 3 ++ README.adoc | 2 +- hosts/zilch/default.nix | 19 ++++++- modules/desktop/cad.nix | 1 + modules/desktop/files.nix | 5 ++ modules/desktop/graphics.nix | 6 +++ modules/dev/android.nix | 8 +-- modules/dev/base.nix | 1 + modules/dev/default.nix | 1 + modules/dev/documentation.nix | 5 +- modules/dev/gamedev.nix | 5 ++ modules/dev/perl.nix | 18 ++++--- modules/dev/vcs.nix | 20 +++++++ modules/editors/emacs.nix | 4 +- modules/shell/base.nix | 3 +- modules/shell/zsh.nix | 15 ++++++ packages/default.nix | 5 +- packages/defold.nix | 51 ------------------ .../README.adoc | 0 .../config/alacritty/alacritty.yml | 0 .../config/bspwm/bspwmrc | 0 .../config/dunst/dunstrc | 0 .../config/polybar/config | 0 .../config/rofi/config.rasi | 0 .../config/rofi/themes/dmenu.rasi | 0 .../config/rofi/themes/fds-center-menu.rasi | 0 .../config/rofi/themes/fds-mini-sidebar.rasi | 0 .../config/wallpaper | Bin .../default.nix | 0 29 files changed, 103 insertions(+), 69 deletions(-) create mode 100644 modules/dev/vcs.nix delete mode 100755 packages/defold.nix rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/README.adoc (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/config/alacritty/alacritty.yml (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/config/bspwm/bspwmrc (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/config/dunst/dunstrc (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/config/polybar/config (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/config/rofi/config.rasi (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/config/rofi/themes/dmenu.rasi (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/config/rofi/themes/fds-center-menu.rasi (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/config/rofi/themes/fds-mini-sidebar.rasi (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/config/wallpaper (100%) rename templates/themes/fair-and-square/{{{ cookiecutter.name }} => {{ cookiecutter.project_slug }}}/default.nix (100%) diff --git a/Makefile b/Makefile index f0e02f75..34f9a8b9 100755 --- a/Makefile +++ b/Makefile @@ -41,3 +41,6 @@ upgrade: update switch rollback: @sudo nix-env --rollback +test: + @nixos-rebuild $(FLAGS) test + diff --git a/README.adoc b/README.adoc index 2b442ee6..24c73fb0 100755 --- a/README.adoc +++ b/README.adoc @@ -92,7 +92,7 @@ In this case, it is my https://github.com/foo-dogsquared/dotflies[dotfiles] dire 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. +* Though my custom packages are now placed in my https://github.com/foo-dogsquared/nur-packages[NUR repo], the `packages/` folder still exists here intended for "private" packages. 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]. See the <> section for more information. diff --git a/hosts/zilch/default.nix b/hosts/zilch/default.nix index ffa05873..2bdfbe30 100755 --- a/hosts/zilch/default.nix +++ b/hosts/zilch/default.nix @@ -98,6 +98,7 @@ racket.enable = true; }; rust.enable = true; + vcs.enable = true; }; editors = { @@ -155,10 +156,16 @@ maim (tesseract.override { enableLanguages = [ "eng" ]; }) slop + virt-manager xclip xdg-user-dirs xorg.xwininfo zbar + + # My custom packages. + # fds-nur.brl-cad + # fds-nur.hypermail + # fds-nur.wikiman ]; # Setting up the shell environment. @@ -168,7 +175,15 @@ READ = "zathura"; SUDO_ASKPASS = ; }; - my.alias.dots = "USER=${config.my.username} make -C /etc/dotfiles"; + + # foo-dogsquared is my only alias. + my.alias = { + # Convenience alias for my NixOS config. + dots = "USER=${config.my.username} make -C /etc/dotfiles"; + + # Assume you've installed Doom Emacs. + org-capture = "$XDG_CONFIG_HOME/emacs/bin/org-capture"; + }; # Set your time zone. time.timeZone = "Asia/Manila"; @@ -212,4 +227,6 @@ }; }; }; + + my.user.extraGroups = [ "docker" ]; } diff --git a/modules/desktop/cad.nix b/modules/desktop/cad.nix index 12003df4..fe58a999 100755 --- a/modules/desktop/cad.nix +++ b/modules/desktop/cad.nix @@ -15,6 +15,7 @@ with lib; freecad # FREE AS A BIRD, FREE AS A ALL-YOU-CAN-EAT BUFFER! kicad # The CAD for ki which is a form of energy found everywhere. leocad # A CAD for leos, a well-known brand of toys. + openscad # A programmable CAD for programmers. ]; }; } diff --git a/modules/desktop/files.nix b/modules/desktop/files.nix index 70fae593..3226a525 100755 --- a/modules/desktop/files.nix +++ b/modules/desktop/files.nix @@ -28,6 +28,11 @@ 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/graphics.nix b/modules/desktop/graphics.nix index beae71b0..a2bfdbeb 100755 --- a/modules/desktop/graphics.nix +++ b/modules/desktop/graphics.nix @@ -12,6 +12,7 @@ in { type = types.bool; default = bool; }; in { + programmable.enable = mkBoolDefault false; raster.enable = mkBoolDefault false; vector.enable = mkBoolDefault false; _3d.enable = mkBoolDefault false; @@ -22,8 +23,13 @@ in { [ font-manager # Self-explanatory name is self-explanatory. imagemagick # A command-line tool for manipulating images. + graphviz # The biz central for graphical flowcharts. ] ++ + (if cfg.programmable.enable then [ + processing # A visually-oriented language with an energertic train conductor as the mascot. + ] else []) ++ + (if cfg.raster.enable then [ gimp # Adobe Photoshop replacement. krita # A good painting program useful for "pure" digital arts. diff --git a/modules/dev/android.nix b/modules/dev/android.nix index 64f8cc0b..d4d25c5a 100755 --- a/modules/dev/android.nix +++ b/modules/dev/android.nix @@ -12,13 +12,15 @@ with lib; config = mkIf config.modules.dev.android.enable { my.packages = with pkgs; [ - android-studio # The apartment for Android development. - dart # It's JavaScript except saner and slimmer. + 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. - kotlin # It's Java except saner and slimmer. + unstable.kotlin # It's Java except saner and slimmer. ]; # Enable Android Debug Bridge for some device debugging. programs.adb.enable = true; + + my.user.extraGroups = [ "adbusers" ]; }; } diff --git a/modules/dev/base.nix b/modules/dev/base.nix index 0c027922..da74c674 100755 --- a/modules/dev/base.nix +++ b/modules/dev/base.nix @@ -13,6 +13,7 @@ with lib; config = mkIf config.modules.dev.base.enable { my.packages = with pkgs; [ caddy2 # 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. hyperfine # You shouldn't be feel just fine with your programs... diff --git a/modules/dev/default.nix b/modules/dev/default.nix index c395c3f3..a166b3eb 100755 --- a/modules/dev/default.nix +++ b/modules/dev/default.nix @@ -13,5 +13,6 @@ ./math.nix ./perl.nix ./rust.nix + ./vcs.nix ]; } diff --git a/modules/dev/documentation.nix b/modules/dev/documentation.nix index dab0ae3b..df0ae73b 100755 --- a/modules/dev/documentation.nix +++ b/modules/dev/documentation.nix @@ -33,10 +33,13 @@ in hugo # An SSG for your DDD (documentation-driven development) workflow. languagetool # A grammar checker with a HUGE data set. pandoc # The Swiss army knife for document conversion. + R # Rated G for accessibility. vale # The customizable linter for your intended writings. # TODO: Make Neuron its own package. - (let neuronSrc = builtins.fetchTarball "https://github.com/srid/neuron/archive/master.tar.gz"; + (let + neuronRev = "3c46adea8cfa2262ac2d50d3d9b1a96cb13a512d"; + 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 ed75d7ae..f5ddc7cc 100755 --- a/modules/dev/gamedev.nix +++ b/modules/dev/gamedev.nix @@ -13,6 +13,7 @@ in type = types.bool; default = bool; }; in { + defold.enable = mkBoolOption false; godot.enable = mkBoolOption false; unity3d.enable = mkBoolOption false; }; @@ -23,6 +24,10 @@ in godot # The Godot, not to be confused with a certain prosecutor. ] else []) ++ + (if cfg.defold.enable then [ + defold + ] 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. diff --git a/modules/dev/perl.nix b/modules/dev/perl.nix index a48794f8..61307559 100755 --- a/modules/dev/perl.nix +++ b/modules/dev/perl.nix @@ -2,7 +2,15 @@ { config, options, lib, pkgs, ... }: with lib; -{ +let + perlWithPackages = pkgs.perl.withPackages (p: with pkgs.perlPackages; + [ + ModernBuild + ModuleInfo + ModuleInstall + ModernPerl + ]); +in { options.modules.dev.perl = { enable = mkOption { type = types.bool; @@ -11,12 +19,6 @@ with lib; }; config = mkIf config.modules.dev.perl.enable { - my.packages = with pkgs; [ - perl - perlPackages.ModernPerl - perlPackages.ModuleBuild - perlPackages.ModuleInfo - perlPackages.ModuleInstall - ]; + my.packages = perlWithPackages; }; } diff --git a/modules/dev/vcs.nix b/modules/dev/vcs.nix new file mode 100644 index 00000000..b34af9ea --- /dev/null +++ b/modules/dev/vcs.nix @@ -0,0 +1,20 @@ +# All of the version control systems are here! +{ config, options, lib, pkgs, ... }: + +with lib; +{ + options.modules.dev.vcs = { + enable = mkOption { + type = types.bool; + default = false; + }; + }; + + config = mkIf config.modules.dev.vcs.enable { + my.packages = with pkgs; [ + git + mercurial + subversion + ]; + }; +} diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index d8bf584d..68b5d854 100755 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -32,8 +32,8 @@ with lib; # Optional depedencies fd # faster projectile imagemagick # image-dired - # (lib.mkIf (config.programs.gnupg.agent.enable) - # pinentry_emacs) # gnupg-emacs + (lib.mkIf (config.programs.gnupg.agent.enable) + pinentry_emacs) # gnupg-emacs zstd # for undo-fu-sessions # Module dependencies diff --git a/modules/shell/base.nix b/modules/shell/base.nix index d28f216b..7b27d7cc 100755 --- a/modules/shell/base.nix +++ b/modules/shell/base.nix @@ -15,7 +15,7 @@ with lib; aria2 # The sequel to aria(1). 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. @@ -23,6 +23,7 @@ with lib; hledger # Do your accountancy thing ON THE COMMAND LINE, sure why not! httpie # Want a piece of the HTTP pie. 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. jq # A command-line interface for parsing JSON. pup # A command-line interface for parsing HTML. diff --git a/modules/shell/zsh.nix b/modules/shell/zsh.nix index 3d26f187..4dfe2d03 100755 --- a/modules/shell/zsh.nix +++ b/modules/shell/zsh.nix @@ -31,6 +31,21 @@ with lib; RPROMPT=\"[%D %*]\" "; + interactiveShellInit = '' + # Use lf to switch directories and bind it to ctrl-o + lfcd () { + tmp="$(mktemp)" + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" >/dev/null + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi + } + bindkey -s '^o' 'lfcd\n' + ''; + + ohMyZsh.plugins = [ "history-substring-search" ]; syntaxHighlighting.enable = true; }; diff --git a/packages/default.nix b/packages/default.nix index 84bd772e..6dcebf03 100755 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,6 +1,9 @@ [ (self: super: with super; { - # defold = (callPackage ./defold.nix {}); + nur-foo-dogsquared = import ( + fetchTarball "https://github.com/foo-dogsquared/nix-expressions/archive/master.tar.gz") { }; + ); + ); # Add packages from the unstable channel with `pkgs.unstable.$PKG`. unstable = import { inherit config; }; diff --git a/packages/defold.nix b/packages/defold.nix deleted file mode 100755 index 36b1d973..00000000 --- a/packages/defold.nix +++ /dev/null @@ -1,51 +0,0 @@ -# https://defold.com/open/ -# It'sa game engine for cross-platform development. -{ stdenv, fetchFromGitHub, -autoconf, -automake, -cmake, -curl, -freeglut, -git, -jdk11, -libtool, -libuuid, -mesa_glu, -openalSoft, -python2, -rpm, -valgrind, -waf, -xorgproto, -libXi, -libXext, -}: - -stdenv.mkDerivation rec { - pname = "defold"; - version = "1.2.171"; - - src = fetchFromGitHub { - owner = "defold"; - repo = "defold"; - rev = "v1.2.171"; - sha256 = "1anpwxgai1qk6c97zslfvj5b6s66fyk459cfnxnqm7d8sq9d0qg2"; - }; - - buildPhase = '' - ./scripts/build.py shell --platform=${stdenv.system} - ./scripts/build.py install_ext --platform=${stdenv.system} - ./scripts/build.py build_engine --platform=${stdenv.system} - ''; - - enableParallelBuilding = true; - doCheck = true; - - meta = with stdenv.lib; { - description = "A free and open-source game engine for cross-platform development."; - homepage = "https://defold.com/"; - license = licenses.free; - maintainers = [ maintainers.foo-dogsquared ]; - platforms = [ "i686-linux" "x86_64-linux" ]; - }; -} diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/README.adoc b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/README.adoc similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/README.adoc rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/README.adoc diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/config/alacritty/alacritty.yml b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/alacritty/alacritty.yml similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/config/alacritty/alacritty.yml rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/alacritty/alacritty.yml diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/config/bspwm/bspwmrc b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/bspwm/bspwmrc similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/config/bspwm/bspwmrc rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/bspwm/bspwmrc diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/config/dunst/dunstrc b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/dunst/dunstrc similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/config/dunst/dunstrc rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/dunst/dunstrc diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/config/polybar/config b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/polybar/config similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/config/polybar/config rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/polybar/config diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/config/rofi/config.rasi b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/rofi/config.rasi similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/config/rofi/config.rasi rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/rofi/config.rasi diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/config/rofi/themes/dmenu.rasi b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/rofi/themes/dmenu.rasi similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/config/rofi/themes/dmenu.rasi rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/rofi/themes/dmenu.rasi diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/config/rofi/themes/fds-center-menu.rasi b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/rofi/themes/fds-center-menu.rasi similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/config/rofi/themes/fds-center-menu.rasi rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/rofi/themes/fds-center-menu.rasi diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/config/rofi/themes/fds-mini-sidebar.rasi b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/rofi/themes/fds-mini-sidebar.rasi similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/config/rofi/themes/fds-mini-sidebar.rasi rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/rofi/themes/fds-mini-sidebar.rasi diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/config/wallpaper b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/wallpaper similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/config/wallpaper rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/config/wallpaper diff --git a/templates/themes/fair-and-square/{{ cookiecutter.name }}/default.nix b/templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/default.nix similarity index 100% rename from templates/themes/fair-and-square/{{ cookiecutter.name }}/default.nix rename to templates/themes/fair-and-square/{{ cookiecutter.project_slug }}/default.nix