Commit graph

94 commits

Author SHA1 Message Date
d6bf7ac375 Enterprise: Goodbye, old friend..
Gone, but not forgotten (thanks, Git), Enterprise will live on in our
memories (and git log).

With this commit, we have finally let go of:
- sound
- networking
- hw
- nvidia

And some more stuff from home.nix and configuration.nix for Enterprise.

I'll probably come back to this commit to refer to it in future, so ite better
to leave as many clues here as possible.
2022-06-04 01:35:42 +05:30
586f56baa5 Hermes: Moved agenix module to host-specific dir
For now, thats all I need. Beside, it was weird before to have the top module
and keys in separate sections
2022-06-04 01:27:18 +05:30
f725be7383 Hermes: Disable backup module
While the backup stuff is still likely broken. Once I'm certan all the repos and
ocnfig are in place, I'll think about restoring it.
2022-06-04 01:14:34 +05:30
527e463208 Hermes: Enable Backup module
This is admittedly a failure, because restic is a one way street. It takes what
is on disk and pushes to backup location.

Which means, if I want to restore the backup, I have to restore first, by way of
imperatively setting up restic repos in advance and then setting up the backup
servies for restic.

This is not ideal, and Syncthing has proven to be more suitable solution for my
needs.

But, considering my possible future requirements, I should start thinking about
solving this problem.
2022-06-02 22:11:24 +05:30
9ff1246638 Hermes: Enable secrets module
Now the agenix secrets are automatically decryped using the age secret key.
2022-06-02 18:57:10 +05:30
c590a170da Hermes: Minor cleanup 2022-06-02 12:03:55 +00:00
ec43c4544e Hermes/Fonts: Enable Fonts module and add cascadia-code
Since I've been using WSL2 for past few days, I have been using Windows
Terminal.

While it doesn't really hold a candle to Konsole, it is alright and comes with
Cascadia Code font by default. Over few days, I've come to like this font and
decided to try it out for Emacs within WSL.
2022-06-02 09:17:57 +00:00
95a868f981 Syncthing/Bebop/Hermes: Replace Enterprise with Hermes
And enable Syncthing module for Hermes
2022-06-02 08:50:44 +00:00
0700205e2d Hermes: Initial bringup
This is minimal config for Hermes on WSL2.

Emacs is untested yet and needs ~/org/ to be imperatively copied still.

Email, Syncthing and Backup modules are yet to be set up and might need
some imperative actions.

However, the system is working and automatically logs into correct
default user.
2022-06-02 07:19:59 +00:00
f08d31f2b9 Enterprise; Prepare for cleanup 2022-05-29 21:51:30 +05:30
33a8a7e501 Enterprise: Further modularization
- Plasma desktop
- Fonts
- Users

These are top-level modules in anticipation of new machine, but I expect them to
remain same regardless of particular host.
2022-05-26 23:17:15 +05:30
af2bf49df7 Enterprise: further modularise configuration
Separate below config in their own modules:
- networking
- hardware, boot, filesystem

Again, the philosophy is to move parts of config that are logically related and
generally edited together in its own module. Networking fits the bill because it
barely saw any change and when it did, it was focused area.

hw.nix is bit more complicated, as there are multiple things there, and is
likely grow yet in future, but this stuff is nearly unchanged since I started
using NixOS and is not something I want to change everyday.
2022-05-01 21:01:27 +05:30
aaffd0c038 Revert "Bebop: attempt to setup nixos-generators package"
This reverts commit f22d4337ae.
2022-04-21 23:59:57 +05:30
f22d4337ae Bebop: attempt to setup nixos-generators package
This should be considered ephemeral and temporary.

once the ISO is generated and copied, this part of the config should be removed,
because the way flake is evaluated makes it impossible to dynamically refer to
modules array from nixosConfigurations. It can be solved by general array
variable, but will require slightly complicating the config that I am not
willing to try just yet
2022-04-21 23:56:38 +05:30
f398774bf3 Bebop: Switch back to pihole and remove adguardhome 2022-04-21 23:31:32 +05:30
d83ec9b498 Adguardhome: Add adguardhome module
It is easier to configure and has a NixOS module, it is well maintained, does
not need docker or non-deterministic container and
generally seems allright.

But, it *appears* to have less bells and whistles compared to PiHole. Generally
PiHole has a lot of mindshare, and as crappy as their development practices are,
it is taking a lead.. Its default list alsu has more than twice the number of
entries, so I'm inclined to return to it.
2022-04-21 23:02:35 +05:30
f95c1aa00c Pihole: Add Pi-hole module and setup on bebop
pi-hole is a DNS based ad-blocker.

Currently there is no NixOS module for it, so it is run inside a container.

That means it runs a root, brings in crapload of dependencies and shows pretty
graphs.

ut, looking at 20 minutes of blocked traffic, I realise I need this.
2022-04-21 22:37:55 +05:30
c47fd40433 Enterprise/Syncthing: Declaratively configure systemd service
This meant few things:
- systemd is now handled by the system, not home-manager
  - I could have done it via home-manager, but other devices are using NixOS
  module anyway, so its nice to reuse that code
- Few folders are no more:
  - Roci_Camera : covered by parent Pictures folder
  - HoG_Camera : covered by parent Pictures folder
  - Whatsapp_Backup : This one was doomed since a while.
    On Android the restrictions mean the Whatsapp dir is not top level, but
    buried inside app specific data dir, which is either not accessible to
    syncthing mobile app or soon will not be.
    Dickheads want me to put that data on their Google Drive.
    Well, I'm just not going to keep anything really important in whatsapp alone
    anymore, so there goes that.
- Couple of minor config changes happened as NixOS defaults are slightly
different from Syncthing default, such as better handling for NTFS partitions
etc., which I no longer need

This change marks completion of one of the very first goals I set while
installing NixOS almost 2.5 years ago, of unburdening Syncthing setup on Nix.

After so long, it is finally done. This brings a lot of peace to my mind :)
2022-04-20 21:58:02 +05:30
9e781b1647 meta: Refactor + rearrange
flake.nix is getting bigger and complicated. Might need some fix afterall.

A simple and dumb refactor would be to just collect all common modules and
host-specific files in single files and import them in flake. Should make things
lot simpler. but it is becomming apparent that this is where I can use more Nix
skills in general.
2022-04-20 00:08:33 +05:30
008e831bff Monitoring: Enable monitoring using Prometheus+grafana+systemd
TODO: Add Loki for logs

resource:
https://christine.website/blog/prometheus-grafana-loki-nixos-2020-11-20
2022-04-18 23:16:29 +05:30
ed2e919840 Bebop: Initial setup of Syncthing using declarative NixOS service
This is really good, because all the folders and devices and all their sharing
matrix is now declarative and part of same config as everything else. This
should remove a lot of headache going forward.

Only question is, the secrets management for Syncthing cert and key.

cert is public info encoded into the device ID, so that is mostly taken care of,
kinda.

But, these are still imperatively generated by Syncthing on the first run. I can
generate my own using openssh, but that isn't strictly better because it adds
more imperative overhead.

Lastly, the cert+key+ID combo is unique and every time a new device comes
in/current device needs to be reinstalled (highly unlikely since the dawn on
NixOS, but never say never), then this needs to be adjusted manually. For now,
I'm gonna leave it be, and deal with it when the need arises.

Declaratively deploying key via agenix is currently shelved, because unlike
other uses, this one directly exposes my network and machine to wide internet,
hedging on single SSH key, that cannot be password protected due to limitation
in agenix.
2022-04-18 18:43:25 +05:30
73be53cdb5 Bebop: Enable home-menager as NixOS module
This allows easy config of few applications/services

- git
- htop
- fzf
- neovim

* syncthing is not enabled yet. During previous experimentation it did not work,
so need to look more into it
2022-04-17 22:00:28 +05:30
b7a3e0c394 meta: Move nix.nix from top-level to modules directory
It makes sense
2022-04-16 21:31:56 +05:30
b577a0c90b Minor cleaup and comments 2022-04-15 12:28:30 +05:30
67ba724418 New module to hold config and packages common to all
While setting up Raspberry Pi, I realised there are some packages I consider
bare minimum, even for headless servers (that I own)

- NeoVim
- git
- ripgrep
- fd
- htop
- jq
- wget
- fzf
2022-04-15 12:25:40 +05:30
3e11013c7b Make Fish a common module instead of host specific module 2022-04-15 11:58:17 +05:30
bad999e00b bebop: Initial config
bebop is the Raspberry Pi hanging around my table utterly unused for close to a
year now. About time it saw some use as tiny home server.
2022-04-14 23:35:54 +05:30
8ae17f5bad Clean up, rearrange and add comments in flake.nix
I could in theory just import all flake files from particular host, but so far
there aren't a lot of files in there, and I like the explicitness, and central
point of entry in flake.nix

Not sure what went wrong the last time I tried it. This seems to be working, so
I'll keep it and keep an eye for a while
2022-04-05 18:55:28 +05:30
51a851767f EXPERIMENT: Set up nixpkgs-unfree as root input as well as cachix
nixpkgs-unfree supposedly provides builds for non-free, but redistributable
packages that cache.nixos.org does not build.

Along with cuda-maintainers, it should reduce the burden for using heavy
packages for machine learning quite a bit. So, lets see how this one goes.

I should also start checking how the machine learning story is with NixOS at
all, it is rife with Python and Python has absolutely horrible ecosystem for
managing dependencies.
2022-03-29 22:11:51 +05:30
bf2761e10c doom-emacs: Disable building doom-emacs config via Nix 2022-03-28 22:18:22 +05:30
9167849010 doom-emacs: Get nix-doom-emacs to build and work
It is not perfect, it does not load private files and it generally feels a set
and forget, not-updated-often situation like every other Nix derivation.

It is promising, but the edges are sharp, and not something I'd like to invest
time in right now.
2022-03-28 22:14:28 +05:30
0553add7fc doom-emacs: Initial commit (BROKEN)
Build Doom-emacs config via Nix itself, and comine all in single monolithic,
declarative system mwahahahahaha

Except, its not working yet. It keeps complaining about missing 'beancount' :/

So, this commit will most likely be promptly reverted.
2022-03-28 21:04:24 +05:30
04dfe98ba2 Fish: Move Fish shell config to separate file
Also add new alias to `nixos-rebuild switch -v --offline`

Because offline build takes under a minute on cold-boot while without can take
multiple minutes, often wasting time and bandwidth on useless stuff like
fetching and parsing all inputs to system flake.

Lower time also makes it a as good temporary workaround for the agenix bug.
2022-03-28 00:10:28 +05:30
28322523c8 Enable nvidia and move nvidia config to separate file
- Enable nvidia GPU in sync-mode
   At least one game did not work well enough on Intel
 - Move nvidia config to separate file (nvidia.nix)
 - Refactor and simplify nvidia config
   enabling/mode-changing of nvidia can be done via two simple
   top-level variables instead of changing interdependent booleans
   independently.
   select GPU driver based on top level variable
   Add `nvidia-offload' environment variable shell to env based on top-level variable
2022-03-27 22:41:51 +05:30
629846a1f9 Setup secrets management using agenix
agenix uses age (a utility + standard) that encrypts secrets using ssh key.
This simplifies secrets management quite a bit compared to GPG (my attempts for
which have failed so far).

Changes included:
        - Encrypt all current keys (mail, backups) using age, configured via
        agenix
        - All encrypted keys are committed to git repo and decrypted during boot
        - None of the keys are used anywhere just yet. They will replace file
        paths in future commit after testing
        - Decrypted keys are available after boot under user name with read-only
        permissions at default agenix location (as of this commit)
        - The Nix variable path is provided by agenix and can be used instead of
        having to recreate
        - multiple keys can be specified for single key, but for now I am only
        using one

For now, the code is dirty and can definitely use improvements. It is just at a
place where it is all working right now.

TODO: Get age + agenix in environment packages available at runtime in NixOS

Links:
    - https://github.com/ryantm/agenix
    - https://github.com/hlissner/dotfiles
2022-02-22 03:09:20 +05:30
0d0b6c7d2c Refactor some parts into separate files
Move some logically independent and consisitent parts into separate
modules (files):

        1. Nix config :
           Package, experimental options, automatic garbage-collection config
        2. Backups :
           Restic + rclone + systemd services for backup notifications

This has reduced main configuration.nix by 100+ lines. These parts are also
unlikely to be touched in tandem with other configuration and hence can be
separated out.
2022-02-14 16:15:27 +05:30
cfe9e785a4 Revert "Temporarily pin emacs-overlay"
This reverts commit 4fa3d1f70a.
2021-11-24 13:51:35 +05:30
4fa3d1f70a Temporarily pin emacs-overlay
A change in Emacs 29 changed signature of define-key that broke doom.

Until the issue is fixed, pin emacs-overlay to commit before that.

Doom issue link: https://github.com/hlissner/doom-emacs/issues/5785
2021-11-24 13:46:17 +05:30
dfb3d3f7ee Enable binary cache for nix-community
Finally fully enable binary cache for nix-community and emacs-overlay.
No I don't have to build emacs from scratch for every master update :)

This was done by means of cachix, which is a means to upload built derivations
for others to share with. Nix-community has their own, and it makes using
overlays provided by nix-community that much better. This should shave off 20-25
min per system rebuild.

I am not sure if this will work as is after moving this config to new system,
so here are the steps to follow:

1. nix shell nixpkgs#cachix
2. sudo cachix use nix-community
3. stage/commit cachix.nix and cachix/ from /etc/nixos
4. done

Hopefully this will be enough in the future system move. If not, all the best to
future me.
2021-11-13 12:15:53 +05:30
a6ee16e8dc Use EmacsGcc package from emacs-overlay
Use Emacs master branch with native compilation flag enabled.

I tried Pgtk branch, but it is not always kept up to date with master (currently
3+ months behind) and could have some issues that aren't always tested. It does
mean Wayland integration is imperfect, but right now it is good enough (with few
minor annoyances).

Emacs + Gcc (native-comp)

native-comp is currently in upcoming release branch (28.0.50), while pgtk branch
is yet to be merged. Using both above features is easily available with
emacs-overlay provided by nix-community.

I still haven't been able to get cachix build cache to work, so currrently this
config builds full Emacs on machine. This extends system rebuild by 30+ minutes
and reduces system useability for the same duration.

Updating system frequently is not currently on my radar anyway, and I can
probably stomach keeping the machine humming for 60+ minutes of system
rebuild (compiling Emacs itself takes 25-30 min),
as long as I do it less than once per week. Will see how it goes.
2021-10-31 12:01:55 +05:30
338b82dd4a Switch Sound to PipeWire and move to separate module
PipeWire is new Linux audio and video streams.
Previously I used PulseAudio, and while it worked, it was less than
perfect. Pulse used bit much processing, and in general had few bugs.

Pipewire is supposed to be lighter, more stable, and it can use high
quality codec for bluetooth.

I took this opportunity to move sound-related config to its separate
module (sound.nix). This is a beginning to nicely move inpendent config
sections to their own modules. Sound config has pretty much zero
relations with rest of the config, so it made sense to move it in
separate file. Perhaps I can do the same with other stuff, maybe some services.
2021-09-13 08:08:58 +05:30
4cffebb34c mbsync + msmtp + mu setup via home-manager
Initial setup to email from within emacs.
That required setting up above stuff, detailed below:

mbsync : sync maildir with email host/provider (gmail)
mu : index and search maildir
msmtp : send mail

All of the above have good module under home-manager, making it *relatively*
straightforward to set the whole thing up.
2021-07-20 16:55:19 +05:30
42e7c9c728 Minor re-arrangement 2020-11-03 16:27:55 +05:30
8afac13daa Initial flake implementation
For now, simply copied current configuration.nix and hardware-configuration.nix
to hostname specific directory.
Made minor modifications to remove input impurity from
hardware-configuration.nix (<nixpkgs> to 4{modulesPath}).
Created flake.nix to import the configuration.nix and just build it.

Referred to this guy : https://github.com/MatthewCroughan/nixcfg
2020-11-03 16:10:59 +05:30