Merge branch 'master' into dependabot/github_actions/DeterminateSystems/magic-nix-cache-action-7

This commit is contained in:
Gabriel Arazas 2024-09-21 11:41:56 +00:00 committed by GitHub
commit d5dc77bca3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
463 changed files with 18710 additions and 4566 deletions

8
.envrc
View File

@ -1,3 +1,9 @@
use flake
if [ -n "$(command -v lorri)" ]; then
eval "$(lorri direnv)"
elif [ -n "$(command -v nix)" ]; then
use flake
else
use nix
fi
dotenv_if_exists .production.envrc

View File

@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/magic-nix-cache-action@v7
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/nix-installer-action@v13
with:
extra-conf: |
keep-going = true

View File

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/nix-installer-action@v13
- name: Check flake lockfile
uses: DeterminateSystems/flake-checker-action@v5
- name: Check flake outputs

View File

@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/magic-nix-cache-action@v7
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/nix-installer-action@v13
- name: Build ISO
run: |
nix build .#images.${{ matrix.arch }}.bootstrap-install-iso --impure --out-link build-iso-result

View File

@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/magic-nix-cache-action@v7
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/nix-installer-action@v13
- env:
NIXPKGS_ALLOW_UNFREE: "1"
run: nix develop .#docs --impure -c hugo -s ./docs/

View File

@ -18,7 +18,7 @@ jobs:
id: metadata
run: echo "DATE=$(date +%F)" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/nix-installer-action@v13
- env:
NIXPKGS_ALLOW_UNFREE: "1"
run: nix develop --impure -c mozilla-addons-to-nix pkgs/firefox-addons/firefox-addons.json pkgs/firefox-addons/default.nix

View File

@ -14,7 +14,7 @@ jobs:
contents: write
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v10
- uses: DeterminateSystems/nix-installer-action@v13
- name: Update flake inputs
run: |
nix flake update --commit-lock-file --commit-lockfile-summary "flake.lock: update inputs"

View File

@ -1,6 +1,7 @@
keys:
- &foo-dogsquared DDD7D0BD602E564BAA04FC3514310D9141152B92
- &foo-dogsquared 7C7F9DC0694508015FE4C9F2DD5E7C08041214EE
- &foo-dogsquared-old 8FCE86932583783E515B6FE55F2B001E20ED3763
- &foo-dogsquared-old-2 DDD7D0BD602E564BAA04FC3514310D9141152B92
- &foo-dogsquared-age age17he74we2sm7q7ufv6x26n83hs42v6gkj984m6kwf9xtjduyccqmqtpv37q
- &ni age1jxna9vm7nx4g69s84qgjptxvuzszcypf2rfk4ss2lyhnpe3yxdnqusu6jp
- &plover age1yftkhugwrdnlpl45lthrhvvk720zza2nd085sxvjcxg2guavz3kquktplx
@ -10,8 +11,4 @@ creation_rules:
- path_regex: configs/nixos/plover/(modules/.+/secrets|secrets/[^/]+)\.(yaml|json|ini|env)$
age: *plover
- path_regex: configs/home-manager/foo-dogsquared/(modules/.+/secrets|secrets/[^/]+)\.(yaml|json|inienv)$
key_groups:
- age:
- *foo-dogsquared-age
- gpg:
- *foo-dogsquared
age: *foo-dogsquared-age

View File

@ -10,33 +10,42 @@ This is my NixOS config as a https://www.tweag.io/blog/2020-05-25-flakes/[Nix fl
This configuration setup can be described with a list of features:
* Contain EVERYTHING!
Unify https://github.com/nix-community/nixos-generators[home-manager] and NixOS configuration (and maybe other environments such as nix-darwin and system-manager in case I have use cases for those) into one flake.
Unify https://github.com/nix-community/home-manager[home-manager] and NixOS configuration (and maybe other environments such as nix-darwin and system-manager in case I have use cases for those) into one flake.
Also throw in some NixVim configs in there, some Disko configurations, and make a sticky note about systems-manager and nix-darwin for the near future.
This is basically a monorepo for everything Nix-related needs.
* Fully modular configurations for each of the Nix-configurable environments including my NixOS systems, home-manager configurations, and NixVim builds.
Furthermore, they can be attached to a wider-scoped environment provided there is an integration for it.
For specific examples...
+
--
** We can have our link:./configs/home-manager[home-manager configurations] to be attached to multiple NixOS systems smoothly.
They are also available as a standalone configuration to be deployed by `home-manager` tool which is nice.
** We can include link:./configs/nixvim[NixVim configs] into home-manager configs and NixOS systems.
Similar to home-manager configurations, they are also available as a standalone configuration found in `nixvimConfigurations` attribute in the flake output.
** We can also include link:./configs/disko/[our Disko configurations] to NixOS systems to quickly include filesystem entries.
Once again, also available as a standalone configuration to be usable for `disko` tool.
All of these is made possible with https://flake.parts[flake-parts] with flake modules encouraging each of the configuration to be as composable as the functional paradigm that Nix encourages.
--
* Deploy the same NixOS configuration for more than one system, in multiple output images generated with https://github.com/nix-community/nixos-generators[nixos-generators], and as part of the deployment cluster with https://github.com/serokell/deploy-rs[deploy-rs].
You can even configure what nixpkgs branch (and home-manager branch) it will use.
* Features custom desktop configurations as a fully independent desktop session (aka similar to how typical desktop environments are deployed).
You can even test them quickly in a VM by running `nix run github:foo-dogsquared/nixos-config#run-workflow-with-vm -- $WORKFLOW_NAME`.
* Take full advantage of Nix module system with the cluster-wide custom modules footnote:[Most of them are patterned similarly from nixpkgs which made easy to be upstreamed just in case.].
This design bleeds into configuring the NixOS systems and home-manager users by designing https://foo-dogsquared.github.io/nixos-config/04-nixos-modules/04-host-specific-modules/[host-specific modules] and https://foo-dogsquared.github.io/nixos-config/05-home-manager/#_user_specific_modules[user-specific modules], respectively.
* Integrate every single component of the Nix ecosystem under the sun (that I use, anyways).
Want to declare a NixOS system with two already existing home-manager users as a separate NixOS configuration (`nixosConfigurations`) and as a buildable ISO in the flake output AND have it deployable with deploy-rs?
link:./modules/flake-parts/setups/nixos.nix[I wished for it and I got it.]
This is mainly powered by flakes with https://flake.parts/[Flake Parts] framework allowing me to create bloated abstractions on top.
This is mainly powered by flakes with https://flake.parts/[flake-parts] framework allowing me to create bloated abstractions on top.
* Deploy the same NixOS configuration for more than one system and in multiple output images.
This is configured in link:./configs/flake-parts/nixos.nix[`./configs/flake-parts/nixos.nix`] where not only you can deploy them with https://github.com/serokell/deploy-rs[deploy-rs] but build them as generated by https://github.com/nix-community/nixos-generators[nixos-generators].
You can even configure what nixpkgs branch (and home-manager branch) it will use.
* Similarly, deploy the same home-manager configuration for more than one system.
This time, it is configured with the link:./configs/flake-parts/home-manager.nix[`./configs/flake-parts/home-manager.nix`] file which you can configure what nixpkgs branch it will use.
You can even include link:./configs/home-manager[those same home-manager users] in NixOS systems smoothly.
* OK, OK, deploy EVERYTHING for more than one system with as much customizability and integration with other components as possible (I said this already, right?).
Right now, we will quickly list them like so...
** We have NixVim where we can include link:./configs/nixvim[those same NixVim configs] into home-manager configs and NixOS systems.
** We can also include link:./configs/disko/[our Disko configurations] to NixOS systems to quickly include filesystem entries while being usable in `disko` CLI.
* It has its own https://foo-dogsquared.github.io/nixos-config[website].
* It has its own https://foo-dogsquared.github.io/nixos-config[website] fully managed as a separate subproject.
Which means that it's cool (or over-the-top, whichever you prefer).
It's basically my personal version of nixpkgs: a monorepo of everything I need for Nix-related things unless it sprung into life as its own project footnote:[Speaking of which, I also have some other Nix-related projects stored in this very repo.].
@ -74,6 +83,8 @@ nix-shell -p disko git
disko --mode disko [--arg disk "/dev/sda"] --flake {canonical_flake_url}#external-hdd
nixos-install --no-root-passwd --root /mnt --flake {canonical_flake_url}#graphical-installer-x86_64-linux
----
Also, the installer configuration also includes Guix which means it's also a Guix System installer.
====
Once you have a live installer in boot, you can then simply install the following commands.
@ -115,10 +126,15 @@ The FlakeHub flake follows a rolling release model so all of the releases are un
== Stability promise
THERE'S NO STABILITY PROMISE HERE!
YOU KNOW WHY!?!
BECAUSE DEBUGGING IN NIX (whether in nixpkgs' module system or outside of it) IS ONE OF THE MOST PAINFUL EXPERIENCE IT MIGHT AS WELL BE CLASSIFIED AS A TIME MACHINE BECAUSE OF HOW FAR IT SETS YOU BACK, GODDAMN!
MIGHT AS WELL USE THE BETTER ALTERNATIVE CALLED GUIX AND LEARN GUILE SCHEME FROM SCRATCH INSTEAD. footnote:[Seriously though, it is pretty nice and the community especially its developers does have the advantage of hindsight and using a general-purpose programming language. If you're interested in using declarative operating systems (or even just a home environment), I recommend to try it.]
If you're one of the unfortunate users for whatever reason, sorry but I'm afraid there's no such word as "stability" in this project's dictionary (or most Nix projects, really ;p).
Not every commit successfully builds because of the way how the project is managed (which is very very badly):
* All of the included changes are pushed in one fell swoop over time instead of carefully testing each of them.
* There's barely any testing infrastructure set (at least until I set it up).
* NixOS and home-manager configurations are able to be deployed in pure evaluation mode and suddenly it's not (most of the time, it isn't).
* Module interfaces change all the time.
* Packages can be left unmaintained and vanish at any time. footnote:[The ones I actively maintain are in nixpkgs anyways.]
@ -181,6 +197,9 @@ include::./docs/content/en-US/08-acknowledgement/index.adoc[tag=acknowledgement]
== Copyright
This project is licensed under MIT license.
For those who care, this project is licensed under MIT license.
I just chose it to make it easier to upstream parts of this project to nixpkgs and to make it easier to copy it without much problems (just don't forget to add attribution as indicated from the license).
Please see link:./LICENSE[`./LICENSE`] for the full text.
However, various subprojects found in here may be under different licenses.
An example of this is the custom GNOME Shell extensions found for my main GNOME configuration which are licensed under GPLv3 only.

View File

@ -24,8 +24,11 @@ It is expected that the extra configuration folder is structured similarly to th
./extra-config-stuff
└── modules
├── home-manager
│ └── default.nix
├── nixvim
│ └── default.nix
└── nixos
└── default.nix
----
Once you have an folder containing those extra snippets, you can simply include them like so.
@ -34,3 +37,12 @@ Once you have an folder containing those extra snippets, you can simply include
----
run-workflow-with-vm a-happy-gnome -I extra-config=./extra-config-stuff
----
Another thing, this script is using https://github.com/nix-community/nixos-generators[nixos-generators] to build the VM which in turn basically uses nixpkgs' integration of it (at `${pkgs.path}/nixos/modules/virtualisation/build-vm.nix`).
You can extend it either by adding NixOS modules configuring the virtual machine or by adding certain arguments to the script.
This won't be an exhaustive list of niceties as it involves a script that may change but here's some things you can do.
* You can pass the `SHARED_DIR` environment variable to add a directory to be shared from the host and the guest.
This is useful for testing out spontaneous changes as if you're booting into the system itself.
* You can pass additional arguments as if you're using `qemu-*` utilities which would be useful for changing graphical drivers and all that jazz.

View File

@ -26,6 +26,7 @@ import <nixpkgs/nixos/lib/eval-config.nix> {
<config/modules/nixos/profiles/nix-conf.nix>
<config/modules/nixos/profiles/overlays.nix>
<config/modules/nixos/profiles/desktop>
<home-manager/nixos>
<nixos-generators/formats/vm.nix>
<nixos-generators/format-module.nix>
@ -47,6 +48,7 @@ import <nixpkgs/nixos/lib/eval-config.nix> {
config = {
# Enable the display manager of choice.
services.displayManager.enable = true;
services.xserver.displayManager.gdm.enable = true;
# Configure home-manager-related stuff.

View File

@ -2,8 +2,6 @@
, lib
, meson
, ninja
, nix
, makeWrapper
, inputs ? [ ]
}:
@ -16,18 +14,12 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
meson
ninja
makeWrapper
];
preConfigure = ''
mesonFlagsArray+=("-Dinputs=[${lib.concatStringsSep "," inputs}]")
'';
postInstall = ''
wrapProgram $out/bin/${finalAttrs.pname} \
--prefix PATH ':' '${lib.makeBinPath [ nix ]}'
'';
meta = with lib; {
description = "Quickly run workflow modules with a VM.";
license = licenses.gpl3Plus;

View File

@ -12,6 +12,7 @@ Here is the following list of them used in the repo history:
* `hosts` for NixOS systems (e.g., `hosts/ni`).
* `users` for home-manager configurations (e.g., `users/foo-dogsquared`).
* `nixvimConfigs` for NixVim configurations (e.g., `nixvimConfigs/fiesta`).
* `wrapperPackages` for wrapper-manager packages (e.g., `wrappers/archive-setup`).
* `flake` for flake-parts (seeing it only has one of them, it is constantly referred to as `flake`).
These "codenames" are also used for their environment-specific module structuring (e.g., `hosts.ni.services.backup.enable` for NixOS, `nixvimConfigs.fiesta.setups.tree-sitter` for NixVim, `users.foo-dogsquared.setups.desktop.enable` for home-manager) with the exception of flake-parts where it is basically a free-for-all.

View File

@ -1,17 +1,19 @@
{ inputs, lib, ... }: {
{ inputs, config, lib, ... }: {
imports = [
./dev.nix
./packages.nix
./templates.nix
# The environment configurations.
# Environment configurations.
./disko.nix
./home-manager.nix
./nixos.nix
./nixvim.nix
./wrapper-manager.nix
# Subprojects.
./bahaghari.nix
./wrapper-manager-fds.nix
];
_module.args = {
@ -23,6 +25,12 @@
};
defaultOverlays = lib.attrValues inputs.self.overlays;
defaultSystems = [ "x86_64-linux" ];
};
setups.sharedNixpkgsConfig = {
allowUnfree = true;
};
perSystem = { lib, system, ... }: {
@ -31,7 +39,7 @@
# for building NixOS and home-manager systems.
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
config = config.setups.sharedNixpkgsConfig;
overlays = lib.attrValues inputs.self.overlays ++ [
inputs.nur.overlay
];

View File

@ -1,6 +1,10 @@
# All of the development-related shtick for this project is over here.
{ inputs, ... }: {
flake.lib = import ../../lib { lib = inputs.nixpkgs.lib; };
flake = {
lib = import ../../lib { lib = inputs.nixpkgs.lib; };
foodogsquaredLib = ../../lib;
};
perSystem = { config, lib, pkgs, ... }: {
apps = {

View File

@ -11,25 +11,33 @@
configs = {
# The typical user in desktop environments.
foo-dogsquared = {
nixpkgs = {
branch = "nixos-unstable";
overlays = [
# Neovim nightly!
inputs.neovim-nightly-overlay.overlays.default
# Emacs unstable version!
inputs.emacs-overlay.overlays.default
# Helix master!
inputs.helix-editor.overlays.default
# Get all of the NUR.
inputs.nur.overlay
];
};
homeManagerBranch = "home-manager-unstable";
systems = [ "aarch64-linux" "x86_64-linux" ];
overlays = [
# Neovim nightly!
inputs.neovim-nightly-overlay.overlays.default
# Emacs unstable version!
inputs.emacs-overlay.overlays.default
# Helix master!
inputs.helix-editor.overlays.default
# Get all of the NUR.
inputs.nur.overlay
];
modules = [
inputs.nur.hmModules.nur
inputs.sops-nix.homeManagerModules.sops
inputs.self.homeModules.wrapper-manager
];
nixvim.instance = "fiesta";
nixvim = {
instance = "fiesta";
branch = "nixvim-unstable";
};
deploy = {
autoRollback = true;
magicRollback = true;
@ -37,7 +45,11 @@
};
# The typical user in server environments.
plover.systems = [ "x86_64-linux" ];
plover = {
nixpkgs.branch = "nixos-unstable";
homeManagerBranch = "home-manager-unstable";
systems = [ "x86_64-linux" ];
};
};
# Pretty much the baseline home-manager configuration for the whole

View File

@ -10,13 +10,17 @@
configs = {
# The main desktop.
ni = {
nixpkgs.branch = "nixos-unstable";
systems = [ "x86_64-linux" ];
formats = null;
modules = [
inputs.disko.nixosModules.disko
inputs.sops-nix.nixosModules.sops
inputs.self.nixosModules.wrapper-manager
{ wrapper-manager.documentation.manpage.enable = true; }
];
homeManagerUsers = {
home-manager = {
branch = "home-manager-unstable";
nixpkgsInstance = "global";
users.foo-dogsquared = {
userConfig = {
@ -42,6 +46,8 @@
# A remote server.
plover = {
nixpkgs.branch = "nixos-unstable";
home-manager.branch = "home-manager-unstable";
systems = [ "x86_64-linux" ];
formats = null;
domain = "foodogsquared.one";
@ -59,6 +65,8 @@
# TODO: Remove extra newlines that are here for whatever reason.
#{{{
void = {
nixpkgs.branch = "nixos-unstable";
home-manager.branch = "home-manager-unstable";
systems = [ "x86_64-linux" ];
formats = [ "vm" ];
};
@ -66,13 +74,15 @@
# The barely customized non-graphical installer.
bootstrap = {
nixpkgs.branch = "nixos-unstable-small";
systems = [ "aarch64-linux" "x86_64-linux" ];
formats = [ "install-iso" ];
nixpkgsBranch = "nixos-unstable-small";
};
# The barely customized graphical installer.
graphical-installer = {
nixpkgs.branch = "nixos-unstable";
home-manager.branch = "home-manager-unstable";
systems = [ "aarch64-linux" "x86_64-linux" ];
formats = [ "install-iso-graphical" ];
diskoConfigs = [ "external-hdd" ];
@ -81,11 +91,15 @@
# The WSL system (that is yet to be used).
winnowing = {
nixpkgs = {
branch = "nixos-unstable";
overlays = [
inputs.neovim-nightly-overlay.overlays.default
];
};
home-manager.branch = "home-manager-unstable";
systems = [ "x86_64-linux" ];
formats = null;
overlays = [
inputs.neovim-nightly-overlay.overlays.default
];
modules = [
# Well, well, well...
inputs.nixos-wsl.nixosModules.default
@ -105,6 +119,15 @@
defaultNixConf
../../modules/nixos/profiles/generic.nix
../../modules/nixos/profiles/nix-conf.nix
{
config.documentation.nixos = {
extraModules = [
../../modules/nixos
../../modules/nixos/_private
];
};
}
];
};

View File

@ -1,23 +1,30 @@
{ inputs, ... }:
{ inputs, lib, ... }:
{
setups.nixvim.configs = {
fiesta = {
nixpkgsBranches = [
"nixos-unstable"
];
neovimPackages = p: with p; [
neovim-nightly
components = [
{
nixpkgsBranch = "nixos-unstable";
nixvimBranch = "nixvim-unstable";
neovimPackage = pkgs: pkgs.neovim;
overlays = [
inputs.neovim-nightly-overlay.overlays.default
];
}
];
};
trovebelt = {
nixpkgsBranches = [
"nixos-unstable"
];
neovimPackages = p: with p; [
neovim-nightly
];
components = lib.cartesianProduct {
nixpkgsBranch = [ "nixos-unstable" ];
nixvimBranch = [ "nixvim-unstable" ];
neovimPackage = [ (pkgs: pkgs.neovim) ];
overlays = [
[ inputs.neovim-nightly-overlay.overlays.default ]
[ ]
];
};
};
};

View File

@ -0,0 +1,10 @@
{ lib, ... }:
{
flake = {
wrapperManagerLib = ../../subprojects/wrapper-manager-fds/lib;
wrapperManagerModules = ../../subprojects/wrapper-manager-fds/modules/wrapper-manager;
homeModules.wrapper-manager = ../../subprojects/wrapper-manager-fds/modules/env/home-manager;
nixosModules.wrapper-manager = ../../subprojects/wrapper-manager-fds/modules/env/nixos;
};
}

View File

@ -0,0 +1,19 @@
{ lib, ... }:
{
setups.wrapper-manager = {
configs = {
archive-setup = {
systems = [ "x86_64-linux" ];
nixpkgs.branch = "nixos-unstable";
};
dotfiles-wrapped = {
systems = [ "x86_64-linux" ];
nixpkgs.branch = "nixos-unstable";
};
};
};
flake.wrapperManagerModules.default = ../../modules/wrapper-manager;
}

View File

@ -109,12 +109,20 @@ autocontain -s github\.com Work
autocontain -s gitlab\.com Work
autocontain -s app\.netlify\.com Work
autocontain -s archive\.softwareheritage\.com Work
autocontain -s sourcegraph\.com Work
" So does most freelancing sites.
autocontain -s upwork\.com Work
autocontain -s monster\.com Work
autocontain -s foundit\.com(\.ph?) Work
autocontain -s fiverr\.com Work
autocontain -s (ph\.?)linkedin\.com Work
autocontain -s jobstreet\.com(\.ph?) Work
autocontain -s (ph\.?)jobstreet\.com(\.ph?) Work
autocontain -s mxroute\.com Work
autocontain -s mailbox\.org Work
autocontain -s cloud\.google\.com Work
" Shopping, shopping, shopping!
autocontain -s yelp\.com Shopping

View File

@ -6,7 +6,7 @@
--format bestaudio
--audio-format opus
--output '%(album_artist,artist)s/%(album,playlist)s/%(track_number,playlist_index)d-%(track,title)s.%(ext)s'
--output '%(album_artists.0,artists.0)s/%(album,playlist)s/%(track_number,playlist_index)d-%(track,title)s.%(ext)s'
--download-archive archive
# Add all sorts of metadata.

View File

@ -1,7 +1,8 @@
{ config, lib, pkgs, foodogsquaredLib, bahaghariLib, ... }:
{ config, lib, pkgs, foodogsquaredLib, bahaghariLib, ... }@attrs:
let
inherit (bahaghariLib.tinted-theming) importScheme;
userCfg = config.users.foo-dogsquared;
in
{
imports = [ ./modules ];
@ -19,16 +20,62 @@ in
nixvim.enable = true;
email.enable = true;
email.thunderbird.enable = true;
research.enable = true;
vs-code.enable = true;
custom-homepage = {
enable = true;
sections = lib.mkMerge [
# Merge the upstream since any new files will be overridden. It also
# allows us to attach data to it such as new links to the hardcoded
# sections.
(lib.importTOML "${config.users.foo-dogsquared.programs.custom-homepage.package.src}/data/foodogsquared-homepage/links.toml")
{
services = {
name = "Local services";
flavorText = "For your local productivity";
textOnly = true;
weight = (-50);
icon = {
iconset = "material-design-icons";
name = "room-service";
};
};
}
(lib.mkIf config.services.archivebox.webserver.enable {
services.links = lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.archivebox-webserver.value}";
text = "Archive webserver";
};
YOHOOHOOHOOHOO.links = lib.mkBefore (lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.archivebox-webserver.value}";
text = "ArchiveBox webserver";
});
})
(lib.mkIf (attrs.nixosConfig.suites.filesystem.setups.archive.enable or false) {
YOHOOHOOHOOHOO.links = lib.mkBefore (lib.singleton {
url = "file://${attrs.nixosConfig.state.paths.archive}";
text = "Personal archive";
});
})
];
};
};
services.backup.enable = true;
setups = {
desktop.enable = true;
development.enable = true;
fonts.enable = true;
music.enable = true;
music.mpd.enable = true;
music.spotify.enable = true;
research.enable = true;
};
};
@ -39,12 +86,6 @@ in
# The keyfile required to decrypt the secrets.
sops.age.keyFile = "${config.xdg.configHome}/age/user";
sops.secrets = foodogsquaredLib.sops-nix.getSecrets ./secrets/secrets.yaml {
davfs2-credentials = {
path = "${config.home.homeDirectory}/.davfs2/davfs2.conf";
};
};
# Add our own projects directory since most programs can't decide where it is
# properly.
xdg.userDirs.extraConfig.XDG_PROJECTS_DIR = "${config.home.homeDirectory}/Projects";
@ -65,6 +106,17 @@ in
kanidm.source = ./config/kanidm/config;
};
# Holding these in for whatever reason.
state.packages = {
diff = pkgs.diffoscope;
pager = config.programs.bat.package;
editor =
if userCfg.programs.nixvim.enable then
config.programs.nixvim.finalPackage
else
config.programs.neovim.package;
};
# Automating some files to be fetched on activation.
home.mutableFile = {
# ...my gopass secrets,...

View File

@ -0,0 +1,16 @@
### Hugo ###
# Generated files by hugo
/public/
/resources/_gen/
/assets/jsconfig.json
hugo_stats.json
# Executable may be added to repository
hugo.exe
hugo.darwin
hugo.linux
# Temporary lock file while building
/.hugo_build.lock

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@ -0,0 +1,7 @@
.PHONY: build
build:
hugo --destination public
.PHONY: serve
serve:
hugo serve

View File

@ -0,0 +1,33 @@
= foodogsquared's custom homepage
:toc:
My custom homepage intended to be deployed alongside my home-manager configuration.
In theory, you could deploy this outside of the home-manager config but that's on you (READ: anyone that is not foodogsquared) to figure out.
It should be fairly easy to do that though since all you need is the following list of components to successfully build the website:
* GNU Make for its build automation.
This is structured in this way to make building consistent either with Nix and non-Nix'd environments.
* https://gohugo.io/[Hugo] is the site generator mainly designed to be deployed with one binary.
* https://foo-dogsquared.github.io/panapton[Panapton] to compile the stylesheet with my custom scheme.
In place of this, you could use other Base16 builders but you'll have to recreate the stylesheet template for that particular builder.
There are some design constraints when developing this website.
* This homepage is pretty much designed to be completely possible to use entirely offline.
As such, it has a design constraint of using less (zero as much as possible) remote resources such as a CDN.
Usage of third-party libraries are fine as long as it is bundled nicely (we'll probably use something like https://bun.sh/[Bun] for this).
* We cannot use anything within the site generator requiring a network access mostly because we're relying on the Nix which has sandboxing by default including networking isolation. footnote:[While we can remove it ourselves, it isn't really good practice.]
As a neat side effect, it also strengthens the previous goal of keeping it as offline as possible.
[#development]
== Development
It is recommended to set up the development environment with https://nixos.org/[Nix package manager].
In case it isn't possible to use it, you'll have to install the following tools.
* Hugo v0.130.0 and above
* https://treefmt.com/[treefmt]

View File

@ -0,0 +1,71 @@
:root {
height: 100%;
font-size: 1.1em;
--background: var(--base00);
--foreground: var(--base05);
--accent-color: var(--base0C);
}
body {
min-height: 100%;
margin: 0;
background: var(--background);
font-family: "Source Sans Pro", sans-serif;
}
#links {
--width: 30ch;
--gap: 0.5em;
--header-font-size: 1.5em;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(var(--width), 1fr));
grid-template-rows: max-content;
gap: var(--gap);
margin: calc(var(--gap) * 2);
section[id^="section-"] {
background: var(--foreground);
color: var(--background);
border: var(--gap) solid var(--accent-color);
padding: calc(var(--gap) * 2);
text-align: center;
.nav-icon {
color: currentColor;
fill: currentColor;
svg {
--size: calc(var(--header-font-size) * 2);
width: var(--size);
height: var(--size);
}
}
.nav-header {
font-size: var(--header-font-size);
font-weight: bolder;
}
.flavor-text {
font-size: 0.9em;
font-style: italic;
display: inline-block;
width: 100%;
}
nav {
display: flex;
flex-direction: column;
}
a {
color: var(--background);
&:hover {
color: var(--accent-color);
}
}
}
}

View File

@ -0,0 +1,9 @@
{{- /*
This template applies an ID to an SVG from the Heroicons set to be used with `<use>` element.
*/ -}}
{{- $match := "^\\s*<svg (.*)?>" }}
{{- $name := default .id .name }}
{{- $icon := resources.Get (printf "svg/heroicons/24/solid/%s.svg" .id) }}
{{- $replaceWith := printf `<svg id="%s" ${1}>` $name }}
{{- replaceRE $match $replaceWith $icon.Content | safeHTML -}}

View File

@ -0,0 +1,9 @@
{{- /*
This template applies an ID to an SVG from the Simple Icons set to be used with `<use>` element.
*/ -}}
{{- $match := "<svg (.*)?>\\s*(.*)\\s*</svg>" }}
{{- $name := default .id .name }}
{{- $icon := resources.Get (printf "svg/simple-icons/%s.svg" .id) }}
{{- $replaceWith := printf `<svg id="%s" ${1}>${2}</svg>` $name }}
{{- replaceRE $match $replaceWith $icon.Content | safeHTML }}

View File

@ -0,0 +1,102 @@
{{ $data := newScratch }}
{{/*
Create an automatic way of generating system color schemes, if set by the user.
* If either only one is set, generate an appropriate color scheme with the given color scheme.
For example, if there is only a given dark theme, the theme will generate a light color scheme.
* If given neither, go with the fallback themes.
*/}}
{{ $themes := (index $.Site.Data "foodogsquared-homepage").themes }}
{{ $hasLight := $themes._light }}
{{ $hasDark := $themes._dark }}
{{ $hasSystemTheme := or $hasLight $hasDark }}
{{/*
Take note how the other half get its colors. It's not exactly a color
string but it is a SASS expression to be evaluated and put into string
interpolation in SASS.
*/}}
{{ if (and $hasLight (not $hasDark)) }}
{{- warnf "No given dark theme. Generating one from the light theme..." }}
{{ $palette := $hasLight.palette }}
{{ $darkTheme := dict
"scheme" (printf "%s (light)" $hasLight.scheme)
"base00" $palette.base07
"base01" $palette.base06
"base02" $palette.base05
"base03" $palette.base04
"base04" $palette.base03
"base05" $palette.base02
"base06" $palette.base01
"base07" $palette.base00
"base08" (print "{lighten(saturate(#" $palette.base08 ", 10%), 15%)}")
"base09" (print "{lighten(saturate(#" $palette.base09 ", 10%), 15%)}")
"base0A" (print "{lighten(saturate(#" $palette.base0A ", 10%), 15%)}")
"base0B" (print "{lighten(saturate(#" $palette.base0B ", 10%), 15%)}")
"base0C" (print "{lighten(saturate(#" $palette.base0C ", 10%), 15%)}")
"base0D" (print "{lighten(saturate(#" $palette.base0D ", 10%), 15%)}")
"base0E" (print "{lighten(saturate(#" $palette.base0E ", 10%), 15%)}")
"base0F" (print "{lighten(saturate(#" $palette.base0F ", 10%), 15%)}")
}}
{{ $themes = merge $themes (dict "_dark" $darkTheme) }}
{{ else if (and $hasDark (not $hasLight)) }}
{{- warnf "No given light theme. Generating one from the dark theme..." }}
{{ $palette := $hasDark.palette }}
{{ $lightTheme := dict
"scheme" (printf "%s (light)" $hasDark.scheme)
"base00" $palette.base07
"base01" $palette.base06
"base02" $palette.base05
"base03" $palette.base04
"base04" $palette.base03
"base05" $palette.base02
"base06" $palette.base01
"base07" $palette.base00
"base08" (print "{darken(saturate(#" $palette.base08 ", 10%), 15%)}")
"base09" (print "{darken(saturate(#" $palette.base09 ", 10%), 15%)}")
"base0A" (print "{darken(saturate(#" $palette.base0A ", 10%), 15%)}")
"base0B" (print "{darken(saturate(#" $palette.base0B ", 10%), 15%)}")
"base0C" (print "{darken(saturate(#" $palette.base0C ", 10%), 15%)}")
"base0D" (print "{darken(saturate(#" $palette.base0D ", 10%), 15%)}")
"base0E" (print "{darken(saturate(#" $palette.base0E ", 10%), 15%)}")
"base0F" (print "{darken(saturate(#" $palette.base0F ", 10%), 15%)}")
}}
{{ $themes = merge $themes (dict "_light" $lightTheme) }}
{{ end }}
{{- range $name, $scheme := $themes }}
// This is a template for a colorscheme based from a Base16 data file from
// https://github.com/chriskempson/base16.
@mixin createColorScheme {
{{ $palette := $scheme.palette }}
{{- range $i := seq 0 15 }}
{{- $hex := upper (printf "%02x" $i) }}
{{- $key := printf "base%s" $hex }}
// TODO: Make a better way to interpolate the color strings.
{{/* We're just taking advantage the fact that the SASS color functions
returns the colors in the same format we needed. */}}
{{- $color := printf "#%s" (index $palette $key) }}
--{{ $key }}: {{ $color }};
{{- end }}
}
{{- if eq $name "_light" }}
@media (prefers-color-scheme: light) {
:root, ::backdrop {
@include createColorScheme
}
}
{{- else if eq $name "_dark" }}
@media (prefers-color-scheme: dark) {
:root, ::backdrop {
@include createColorScheme
}
}
{{- end }}
[data-theme="{{ .name }}"]:root, [data-theme="{{ .name }}"]::backdrop {
@include createColorScheme;
}
{{- end }}

View File

@ -0,0 +1,5 @@
baseURL = "./"
defaultContentLanguage = "en"
title = "foodogsquared's homepage"
timeZone = "UTC"
disableKinds = [ "taxonomy", "sitemap", "robotstxt", "rss" ]

View File

@ -0,0 +1,13 @@
[[imports]]
path = "github.com/foo-dogsquared/hugo-mod-simple-icons"
[[imports]]
path = "github.com/Templarian/MaterialDesign"
[[imports.mounts]]
source = "svg/"
target = "assets/svg/material-design-icons/"
[[imports.mounts]]
source = "meta.json"
target = "data/icons/material-design-icons/meta.json"

View File

@ -0,0 +1,91 @@
[quicklinks]
name = "Quicklinks"
flavorText = "For the quick-wilting brain"
textOnly = true
weight = -100
links = [
{ url = "org-protocol://wiki-open-up-b4-u-todo-anything?where=latest", text = "YOUR GODFORSAKEN TODO LIST" },
{ url = "org-protocol://wiki-open-journal?when=today", text = "Open journal for today" },
{ url = "org-protocol://roam-node?node=41da43fe-a8a9-4a2e-a361-05a11ce8b318", text = "Open todo for today" },
{ url = "https://search.brave.com", text = "Brave Search" },
{ url = "https://login.tailscale.com", text = "Tailscale" },
{ url = "https://devdocs.io", text = "Devdocs" },
]
icon.iconset = "material-design-icons"
icon.name = "fast-forward"
[applications]
name = "Applications"
flavorText = "Self-hosting is not the answer to everything, btw"
weight = -1
textOnly = false
links = [
{ url = "https://start.foodogsquared.one", text = "The other homepage" },
{ url = "https://code.foodogsquared.one", icon = "gitea", text = "Personal forge" },
{ url = "https://pass.foodogsquared.one", icon = "bitwarden", text = "Password manager" },
{ url = "https://monitoring.foodogsquared.one", icon = "grafana", text = "Monitoring application" },
]
icon.iconset = "material-design-icons"
icon.name = "developer-board"
[dev]
name = "Software dev"
flavorText = "...is just standing on a house of cards"
textOnly = true
weight = -25
links = [
{ url = "https://github.com", text = "GitHub" },
{ url = "https://sourcegraph.com", text = "SourceGraph" },
{ url = "https://devdocs.io", text = "Devdocs" },
{ url = "https://vscode.dev", text = "Online Visual Studio Code" },
{ url = "https://cloud.oracle.com", text = "Oracle Cloud" },
{ url = "https://cloud.hetzner.com", text = "Hetzner Cloud" },
{ url = "https://portal.azure.com", text = "Azure Cloud" },
{ url = "https://manpages.debian.org", text = "Debian Manpages" },
]
grid.row = 2
icon.iconset = "simple-icons"
icon.name = "github"
[design]
name = "Design"
flavorText = "No matter how hard I try, it's pretty crap"
textOnly = true
links = [
{ url = "https://app.diagrams.net/", text = "lazy way of drawing things" },
{ url = "https://figma.com", text = "Figma..." },
{ url = "https://www.awwwards.com/", text = "Awwwards" },
{ url = "https://dribbble.com", text = "Dribbble" },
{ url = "https://simpleicons.org/", text = "Simple Icons" },
{ url = "https://pictogrammers.com/library/mdi/", text = "Material Design Icons" },
]
icon.iconset = "material-design-icons"
icon.name = "pencil-ruler"
[music]
name = "Music"
flavorText = "Jammin' and groovin'"
textOnly = true
links = [
{ url = "https://music.youtube.com", text = "YouTube Music" },
{ url = "https://open.spotify.com", text = "Spotify" },
{ url = "https://www.last.fm", text = "last.fm" },
{ url = "https://modarchive.org/", text = "The Mod Archive" },
]
icon.iconset = "material-design-icons"
icon.name = "music"
[YOHOOHOOHOOHOO]
name = "YOHOOHOOHOOHOO"
flavorText = "Fly away, glum blue sea"
textOnly = true
weight = 100
links = [
{ url = "https://libgen.is/", text = "Library Genesis" },
{ url = "https://sci-hub.se/", text = "sci-hub" },
{ url = "https://archive.org", text = "Internet Archive" },
{ url = "https://annas-archive.se/", text = "Anna's Archive" },
{ url = "https://archive.softwareheritage.org", text = "Software Heritage" },
]
icon.iconset = "material-design-icons"
icon.name = "skull-crossbones"

View File

@ -0,0 +1,22 @@
system: "base16"
name: "Bark on a tree"
author: "Gabriel Arazas (https://foodogsquared.one)"
description: "Rusty theme resembling forestry inspired from Nord theme."
variant: "dark"
palette:
base00: "2b221f"
base01: "412c26"
base02: "5c362c"
base03: "a45b43"
base04: "e1bcb2"
base05: "f5ecea"
base06: "fefefe"
base07: "eb8a65"
base08: "d03e68"
base09: "df937a"
base0A: "afa644"
base0B: "85b26e"
base0C: "eb914a"
base0D: "c67f62"
base0E: "8b7ab9"
base0F: "7f3F83"

View File

@ -0,0 +1,22 @@
system: "base16"
name: "Albino bark on a tree"
author: "Gabriel Arazas (https://foodogsquared.one)"
description: "Bright rusty theme resembling forestry inspired from Nord theme."
variant: "light"
palette:
base00: "f0f0f0"
base01: "e1e3e2"
base02: "dacec7"
base03: "9d5c4c"
base04: "54352c"
base05: "392c26"
base06: "2b220f"
base07: "cb6d48"
base08: "b52b52"
base09: "d56f17"
base0A: "b0a52e"
base0B: "5c963e"
base0C: "e46403"
base0D: "954c2f"
base0E: "6751a5"
base0F: "55195a"

View File

@ -0,0 +1,5 @@
{ pkgs ? import <nixpkgs> {
overlays = [ (import ../../../../../overlays).default ];
} }:
pkgs.callPackage ./package.nix { }

View File

@ -0,0 +1,9 @@
module foodogsquared.one/nixos-homepage
go 1.22.5
require (
github.com/Templarian/MaterialDesign v0.0.0-20240619144146-ce55b68ba730 // indirect
github.com/foo-dogsquared/hugo-mod-simple-icons v0.0.0-20240829051824-890465b5b17e // indirect
github.com/simple-icons/simple-icons v0.0.0-20240828075807-7197fd28e247 // indirect
)

View File

@ -0,0 +1,6 @@
github.com/Templarian/MaterialDesign v0.0.0-20240619144146-ce55b68ba730 h1:x7myofnw5/5o02a3XMH0IKqGF1uTVdP7TSxEPiX3zKE=
github.com/Templarian/MaterialDesign v0.0.0-20240619144146-ce55b68ba730/go.mod h1:ERpxhfm8YCuNFFEBv+hLM4M4VOrfV5g/mpVMNEfj0MQ=
github.com/foo-dogsquared/hugo-mod-simple-icons v0.0.0-20240829051824-890465b5b17e h1:h4Abw0MZnXP2hFavjEEcXY+lCPJtNejp6CXntXwW8fA=
github.com/foo-dogsquared/hugo-mod-simple-icons v0.0.0-20240829051824-890465b5b17e/go.mod h1:rcVWEdpC9uuXK5ydiewUfaEcoKIZv+l91hphiKrxVq4=
github.com/simple-icons/simple-icons v0.0.0-20240828075807-7197fd28e247 h1:eKjM/xegyBg3XIb+p55bnnB6bD32e0GbCA/1/9vq8aY=
github.com/simple-icons/simple-icons v0.0.0-20240828075807-7197fd28e247/go.mod h1:oOgUUt8yVYOso/wEBi2ojfZP2MU/xxiNccIpaE+jCvE=

View File

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode | default " en" }}">
<head>
{{ partial "head.html" . -}}
</head>
<body>
<div id="links">
{{ range $key, $value := sort (index $.Site.Data (slice "foodogsquared-homepage" "links")) "weight" }}
{{- $name := default $key $value.name -}}
<section
id="section-{{ $name }}"
{{ with $value.grid }}
style="{{ with .column }}grid-column: span {{ . }};{{ end }}{{ with .row }}grid-row: span {{ . }};{{ end }}"
{{ end }}
>
{{ with $value.icon }}
<div class="nav-icon">{{ partial "icon.html" . }}</div>
{{ end }}
<div class="nav-header">{{ $name }}</div>
{{ with $value.flavorText }}
<div class="flavor-text">{{ . }}</div>
{{ end }}
<hr />
<nav>
{{ range $link := $value.links }}
<a href="{{ safeURL $link.url }}">{{ $link.text }}</a>
{{ end }}
</nav>
</section>
{{ end }}
</div>
</body>
</html>

View File

@ -0,0 +1,11 @@
{{ hugo.Generator }}
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="referrer" content="no-referrer" />
{{ $site := resources.Get "scss/main.scss" | resources.ToCSS }}
{{ $themes := resources.Get "templates/theme.scss" | resources.ExecuteAsTemplate "css/themes.css" . | resources.ToCSS }}
{{ $stylesheets := slice | append $site $themes | resources.Concat "css/main.css" }}
<link rel="stylesheet" href="{{ $stylesheets.RelPermalink }}" />
<title>{{ .Site.Title }}</title>

View File

@ -0,0 +1,13 @@
{{- /*
A partial for easily using icons from Simple Icons set.
*/ -}}
{{ if eq .iconset "simple-icons" }}
{{- $res := resources.ExecuteAsTemplate (printf "svg/brands/%s.svg" .name)
(dict "id" .name
"name" .name)
(resources.Get "templates/simple-icon.svg") }}
{{ $res.Content | safeHTML }}
{{ else if eq .iconset "material-design-icons" }}
{{- $res := resources.Get (printf "svg/material-design-icons/%s.svg" .name) }}
{{ $res.Content | safeHTML }}
{{ end }}

View File

@ -0,0 +1,22 @@
{
buildHugoSite,
lib,
}:
buildHugoSite {
pname = "foodogsquared-hm-startpage";
version = "0.3.0";
src = lib.cleanSource ./.;
vendorHash = "sha256-Mi61QK1yKWIneZ+i79fpJqP9ew5r5vnv7ptr9YGq0Uk=";
preBuild = ''
install -Dm0644 ${../tinted-theming/base16/bark-on-a-tree.yaml} ./data/foodogsquared-homepage/themes/_dark.yaml
install -Dm0644 ${../tinted-theming/base16/albino-bark-on-a-tree.yaml} ./data/foodogsquared-homepage/themes/_light.yaml
'';
meta = with lib; {
description = "foodogsquared's homepage";
license = licenses.gpl3Only;
};
}

View File

@ -0,0 +1,14 @@
{ pkgs ? import <nixpkgs> {
overlays = [ (import ../../../../../overlays).default ];
} }:
let
site = pkgs.callPackage ./package.nix { };
in
pkgs.mkShell {
inputsFrom = [ site ];
packages = with pkgs; [
treefmt
npins
];
}

View File

@ -8,16 +8,19 @@
./programs/doom-emacs.nix
./programs/email.nix
./programs/git.nix
./programs/jujutsu.nix
./programs/keys.nix
./programs/nixvim
./programs/research.nix
./programs/custom-homepage.nix
./programs/shell.nix
./programs/terminal-multiplexer.nix
./programs/vs-code.nix
./services/backup
./setups/desktop.nix
./setups/development.nix
./setups/fonts.nix
./setups/music.nix
./setups/research.nix
];
}

View File

@ -6,7 +6,7 @@ let
projectsDir = config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR;
dotfiles = "${projectsDir}/dotfiles";
dotfiles = "${projectsDir}/packages/dotfiles";
dotfiles' = config.lib.file.mkOutOfStoreSymlink config.home.mutableFile."${dotfiles}".path;
getDotfiles = path: "${dotfiles'}/${path}";
in

View File

@ -10,6 +10,8 @@ in
firefox.enable = lib.mkEnableOption "foo-dogsquared's Firefox setup";
brave.enable = lib.mkEnableOption "foo-dogsquared's Brave setup";
misc.enable = lib.mkEnableOption "foo-dogsquared's miscellaneous browsers setup";
plugins.firenvim.enable = lib.mkEnableOption "setting up Firenvim";
};
config = lib.mkMerge [
@ -110,6 +112,7 @@ in
] ++ (with pkgs.firefox-addons; [
get-rss-feed-url
google-container
microsoft-container
regretsreporter
simple-translate
sourcegraph-for-firefox
@ -128,6 +131,8 @@ in
# Some quality of lifes.
"browser.search.widget.inNavBar" = true;
"browser.search.openintab" = true;
"browser.startup.homepage" =
lib.mkIf userCfg.programs.custom-homepage.enable "file://${userCfg.programs.custom-homepage.finalPackage}/index.html";
# Some privacy settings...
"privacy.donottrackheader.enabled" = true;
@ -195,7 +200,19 @@ in
};
# Configuring Tridactyl.
xdg.configFile.tridactyl.source = ../../config/tridactyl;
xdg.configFile."tridactyl/tridactylrc".source = pkgs.concatTextFile {
name = "tridactyl-config";
files = [
../../config/tridactyl/tridactylrc
(pkgs.writeTextFile {
name = "tridactyl-nix-generated";
text = ''
set newtab file://${userCfg.programs.custom-homepage.finalPackage}/index.html
'';
})
];
};
# Configuring Bleachbit for Firefox cleaning.
services.bleachbit.cleaners = [
@ -215,7 +232,7 @@ in
(lib.mkIf cfg.misc.enable {
home.packages = with pkgs; [
google-chrome
nyxt
#nyxt
];
services.bleachbit.cleaners = [
@ -229,5 +246,25 @@ in
"google_chrome.vacuum"
];
})
(lib.mkIf cfg.plugins.firenvim.enable
(let
supportedBrowsers = [
"brave"
"chromium"
"google-chrome"
"vivaldi"
];
enableSupportedBrowser = acc: name: acc // {
programs.${name}.extensions = [
{ id = "egpjdkipkomnmjhjmdamaniclmdlobbo"; }
];
};
in
lib.foldl' enableSupportedBrowser { } supportedBrowsers // {
programs.firefox.profiles.personal.extensions = with pkgs.nur.repos.rycee.firefox-addons; [
firenvim
];
}))
];
}

View File

@ -0,0 +1,122 @@
{ config, lib, pkgs, ... }:
let
userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.custom-homepage;
settingsFormat = pkgs.formats.toml { };
themesSettingsFormat = pkgs.formats.yaml { };
in
{
options.users.foo-dogsquared.programs.custom-homepage = {
enable = lib.mkEnableOption "addition of custom homepage";
sections = lib.mkOption {
type = with lib.types; attrsOf settingsFormat.type;
description = ''
List of additional sections with their settings to be configured
alongside the hardcoded sections.
'';
default = { };
example = lib.literalExpression ''
{
services = {
name = "Local services";
flavorText = "for the local productivity";
textOnly = true;
links = lib.singleton {
url = "localhost:''${builtins.toString config.services.mopidy.settings.port}";
text = "Music streaming server";
};
};
}
'';
};
themes = lib.mkOption {
type = with lib.types; attrsOf path;
description = ''
Set of [Tinted Theming Base16
palettes](https://github.com/tinted-theming) to be exported to the
homepage.
::: {.note}
As such, they are assumed to be all YAML files.
:::
'';
default = { };
example = lib.literalExpression ''
{
_dark = ./files/base16/bark-on-a-tree.yml;
_light = ./files/base16/albino-bark-on-a-tree.yml;
catpuccin-mocha = (pkgs.formats.yaml { }).generate "catpuccin-mocha-base16" {
system = "base16";
name = "Catppuccin Mocha";
author = "https://github.com/catppuccin/catppuccin";
variant = "dark";
palette = {
base00 = "1e1e2e";
base01 = "181825";
base02 = "313244";
base03 = "45475a";
base04 = "585b70";
base05 = "cdd6f4";
base06 = "f5e0dc";
base07 = "b4befe";
base08 = "f38ba8";
base09 = "fab387";
base0A = "f9e2af";
base0B = "a6e3a1";
base0C = "94e2d5";
base0D = "89b4fa";
base0E = "cba6f7";
base0F = "f2cdcd";
};
};
}
'';
};
package = lib.mkOption {
type = lib.types.package;
description = ''
The package derivation of the website.
'';
default = pkgs.callPackage ../../files/homepage/package.nix { };
};
finalPackage = lib.mkOption {
type = lib.types.package;
description = ''
Output derivation containing the website with all of its modifications.
'';
readOnly = true;
};
};
config = {
users.foo-dogsquared.programs.custom-homepage.finalPackage =
let
data = lib.mapAttrs (n: v:
settingsFormat.generate "fds-homepage-section-${n}" v) cfg.sections;
installDataDir = lib.foldlAttrs (acc: n: v: ''
${acc}
install -Dm0644 ${v} './data/foodogsquared-homepage/links/${n}.toml'
'') "" data;
installThemes = lib.foldlAttrs (acc: n: v: ''
${acc}
install -Dm0644 ${v} './data/foodogsquared-homepage/themes/${n}}.yaml
'') "" cfg.themes;
in
cfg.package.overrideAttrs (prevAttrs: {
preBuild = (prevAttrs.preBuild or "") + ''
${installDataDir}
${installThemes}
'';
});
};
}

View File

@ -71,10 +71,19 @@ in
socketActivation.enable = true;
};
# Add org-protocol support.
xdg.desktopEntries.org-protocol = {
name = "Org protocol";
exec = "emacsclient %u";
icon = "emacs-icon";
mimeType = [ "x-scheme-handler/org-protocol" ];
};
xdg.mimeApps.defaultApplications = {
"application/json" = [ "emacs.desktop" ];
"text/org" = [ "emacs.desktop" ];
"text/plain" = [ "emacs.desktop" ];
"x-scheme-handler/org-protocol" = [ "org-protocol.desktop" ];
};
};
}

View File

@ -68,6 +68,7 @@ in
(lib.mkIf cfg.thunderbird.enable {
programs.thunderbird = {
enable = true;
package = pkgs.thunderbird-foodogsquared;
profiles.personal = {
isDefault = true;
settings = {

View File

@ -45,6 +45,8 @@ in
"https://git.savannah.nongnu.org/git/".insteadOf = [ "sv:" "savannah:" ];
};
pull.rebase = "interactive";
status = {
showPatch = true;
showStash = true;

View File

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
let
userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.jujutsu;
in
{
options.users.foo-dogsquared.programs.jujutsu.enable =
lib.mkEnableOption "foo-dogsquared's Jujutsu configuration";
config = lib.mkIf cfg.enable {
programs.jujutsu = {
enable = true;
settings = {
user.name = config.accounts.email.accounts.personal.realName;
user.email = config.accounts.email.accounts.personal.address;
ui.diff-editor = "diffedit3";
"merge-tools.diffoscope" = {
merge-args = [ "$left" "$right" ];
program = lib.getExe' pkgs.diffoscope "diffoscope";
};
"merge-tools.diffedit3" = {
merge-args = [ "$left" "$right" "$output" ];
program = lib.getExe' pkgs.diffedit3 "diffedit3";
};
};
};
};
}

View File

@ -29,5 +29,5 @@
# Enable a bunch of pre-configured configurations.
plugins.dap.extensions.dap-go.enable = true;
plugins.dap.extensions.dap-python.enable = true;
plugins.rustaceanvim.enable = true;
plugins.rustaceanvim.enable = false;
}

View File

@ -2,6 +2,7 @@
{
plugins.lsp.enable = true;
plugins.lsp.inlayHints = true;
# Enable all of the LSP servers that I'll likely use.
plugins.lsp.servers = {
@ -11,14 +12,14 @@
cssls.enable = true; # For CSS.
denols.enable = true; # For Deno runtime.
dockerls.enable = true; # For Dockerfiles.
emmet_ls.enable = true; # For emmet support.
emmet-ls.enable = true; # For emmet support.
eslint.enable = true; # For JavaScript.
html.enable = true; # For HTML.
jsonls.enable = true; # There's one for JSON?
lemminx.enable = true; # And for XML?
ltex.enable = true; # And for LanguageTool, too?
lua-ls.enable = true; # For Lua.
nil_ls.enable = true; # For Nix.
nixd.enable = true; # For Nix.
nushell.enable = true; # For Nushell.
pyright.enable = true; # For Python.

View File

@ -1,4 +1,8 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, hmConfig, ... }:
let
userConfig = hmConfig.users.foo-dogsquared;
in
{
extraPlugins = builtins.map
(path:
@ -12,7 +16,15 @@
]);
# Light your browser on fire, bebe.
plugins.firenvim.enable = true;
plugins.firenvim = {
enable = userConfig.programs.browsers.plugins.firenvim.enable;
settings = {
localSettings.".*" = {
selector = "textarea";
content = "text";
};
};
};
plugins.legendary-nvim = {
enable = true;

View File

@ -2,7 +2,7 @@
{
# The main star of the show.
plugins.neorg.enable = true;
plugins.neorg.enable = false;
# Set it up, set it up, set it up.
plugins.neorg.extraOptions = {

View File

@ -9,8 +9,9 @@ in
lib.mkEnableOption "foo-dogsquared's Visual Studio Code setup";
config = lib.mkIf cfg.enable {
suites.editors.vscode.enable = true;
programs.vscode = {
extensions = with pkgs; [
extensions = with pkgs.vscode-extensions; [
# Additional language support.
bbenoist.nix
graphql.vscode-graphql

View File

@ -0,0 +1,127 @@
{ config, lib, foodogsquaredLib, pkgs, ... }@attrs:
let
userCfg = config.users.foo-dogsquared;
cfg = userCfg.services.backup;
pathPrefix = "borg-backup";
getPath = path:
config.sops.secrets."${pathPrefix}/${path}".path;
isFilesystemSet = setupName:
attrs.nixosConfig.suites.filesystem.setups.${setupName}.enable or false;
hetznerBoxesUser = "u332477";
hetznerBoxesServer = "${hetznerBoxesUser}.your-storagebox.de";
borgmaticCommonConfig = module: lib.mkMerge [
module
{
archive_name_format = lib.mkDefault "{fqdn}-home-manager-personal-{now}";
patterns = lib.mkBefore [
"R ${config.home.homeDirectory}"
"! ${config.xdg.dataHome}"
"! ${config.xdg.cacheHome}"
"- ${config.xdg.configHome}"
"- ${config.xdg.userDirs.download}"
"+ ${config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}"
"+ ${config.xdg.userDirs.documents}"
"+ ${config.xdg.userDirs.music}"
"+ ${config.xdg.userDirs.pictures}"
"+ ${config.xdg.userDirs.templates}"
"+ ${config.xdg.userDirs.videos}"
];
exclude_if_present = [
".nobackup"
".exclude.bak"
];
exclude_patterns = [
"node_modules/"
"*.pyc"
"result*/"
"*/.vim*.tmp"
"target/"
];
store_config_files = true;
# Most of these retention settings are meant to have overlaps in the
# periodic backups.
keep_hourly = 48;
keep_daily = 14;
keep_weekly = 8;
keep_monthly = 12;
keep_yearly = 4;
check_last = 4;
}
];
checkRemovableMountScript = pkgs.writeShellScript "check-for-removable-storage" ''
{ findmnt "$(dirname "$1")" > /dev/null && [ -d "$1" ]; } || exit 75
'';
in
{
options.users.foo-dogsquared.services.backup.enable =
lib.mkEnableOption "preferred backup service";
config = lib.mkIf cfg.enable {
sops.secrets = foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml (
foodogsquaredLib.sops-nix.attachSopsPathPrefix pathPrefix {
"repos/remote-hetzner-boxes-personal/password" = { };
"repos/local-external-hdd-personal/password" = { };
"repos/local-archive-personal/password" = { };
});
programs.borgmatic.enable = true;
programs.borgmatic.backups = lib.mkMerge [
{
remote-hetzner-boxes-personal = {
initService.enable = true;
initService.startAt = "04:30";
settings = borgmaticCommonConfig {
encryption_passcommand = "cat ${getPath "repos/remote-hetzner-boxes-personal/password"}";
repositories = lib.singleton {
path = "ssh://${hetznerBoxesUser}@${hetznerBoxesServer}:23/./borg/users/${config.home.username}";
label = "remote-hetzner-boxes";
};
};
};
}
(lib.mkIf (isFilesystemSet "external-hdd") {
local-external-hdd-personal = {
initService.enable = true;
initService.startAt = "04:30";
settings = let
removablePath = "${attrs.nixosConfig.state.paths.external-hdd}/Backups";
in borgmaticCommonConfig {
encryption_passcommand = "cat ${getPath "repos/local-external-hdd-personal/password"}";
repositories = lib.singleton {
path = removablePath;
label = "local-external-hdd";
};
before_backup = lib.singleton "${checkRemovableMountScript} ${removablePath}";
};
};
})
(lib.mkIf (isFilesystemSet "archive") {
local-archive-personal = {
initService.enable = true;
initService.startAt = "04:30";
settings = let
removablePath = "${attrs.nixosConfig.state.paths.archive}/Backups";
in borgmaticCommonConfig {
encryption_passcommand = "cat ${getPath "repos/local-archive-personal/password"}";
repositories = lib.singleton {
path = removablePath;
label = "local-archive";
};
before_backup = lib.singleton "${checkRemovableMountScript} ${removablePath}";
};
};
})
];
};
}

View File

@ -0,0 +1,27 @@
repos:
remote-hetzner-boxes-personal:
password: ENC[AES256_GCM,data:VAwukJ6oP0ZuYQGEdS3JVyGHIIUKhcK3Z3bSfoLdwWVP+SU1078YLjusWg==,iv:wMiWIEZknA0c+OFdI+3+yw0Y9WXkqTWOpkn0FnXjYxI=,tag:VKFvr8Ik+eVaMajJPbn09g==,type:str]
local-external-hdd-personal:
password: ENC[AES256_GCM,data:o5zV5Q+Bg+hXVtb7w+IE6mMSFG0GKbsl9Y5GZR2yiHTmUdvH2r7p3CoDFJAV1Us=,iv:HxtXlYOyV1kDhzBPBjNDGwH1ciYbQtcnTZzrgwiSjLw=,tag:ApoenU3Tmg1nltJgNCTlkg==,type:str]
local-archive-personal:
password: ENC[AES256_GCM,data:01UTj28FJegt2USisJ7YPk8zjzUcVhg6VdWzmNJrbJHqzKwA90B1eH6hL4Q2BPQC1tRks2MxPQ==,iv:ScV3wpC2pp3ZCRqmVhPy4R3QMpOd4yEl3h9DwimKi1I=,tag:y8XuQ5vBM0rzmDMD/NKjZw==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age17he74we2sm7q7ufv6x26n83hs42v6gkj984m6kwf9xtjduyccqmqtpv37q
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCOTB1YzlhMWdXNnl2L0l6
dllncG9uN0lzNUtJdmh3SjdzSEhZd001Q0FnCkFDZ2lYb2ZWZi9vTG5OditUOE50
U08yZGZCaEkzU0pNcFI1WDEwNTlqdHcKLS0tIHRWdEVuM2VqaGYrclllMHJFazls
dGgwbzdJd0xCOHh1eFBTMTkwbnFIOTAKBUjwZqUsUM8qRvRtg0KHm8VNddGPRwJG
4EwQfN16XVASb44X03c1wKlP4Pdch3Vkxvxo/UzawuZS92TRbZkQVA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-09-07T06:24:59Z"
mac: ENC[AES256_GCM,data:Yf1vU6+oQR1Ao+1haKxKvLmYkjPFr9RnzlOk8wrMs+bHwkpO979rz/PsOhvVGoJMas4fHiIsnpsx3efSf9Kg5UrGb40pJ/uZTWGr9LpeMczD7WyqK/3l9XSbIWAzRqZ6lp5JEBqLqmbwPHOVBI64bakHmQLNklNIGMYVd+hk5gw=,iv:rh3qSSbc2Sv6VottndPLr/bqAnEc+tjxVvQ7MEu0IqI=,tag:nSrREELrPM8mgar5A7tBpA==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.9.0

View File

@ -10,6 +10,8 @@ in
lib.mkEnableOption "a set of usual desktop productivity services";
config = lib.mkIf cfg.enable {
state.ports.activitywatch.value = 5600;
# Install all of the desktop stuff.
suites.desktop = {
enable = true;
@ -29,6 +31,7 @@ in
# Self-inflicted telemetry.
services.activitywatch = {
enable = true;
settings.server.port = config.state.ports.activitywatch.value;
watchers = {
aw-watcher-afk.package = pkgs.activitywatch;
aw-watcher-window.package = pkgs.activitywatch;
@ -60,7 +63,7 @@ in
topdirs = "~/Downloads ~/Documents ~/library";
"skippedNames+" =
let
inherit (config.state) ignoreDirectories;
inherit (config.state.paths) ignoreDirectories;
in
lib.concatStringsSep " " ignoreDirectories;
@ -73,5 +76,10 @@ in
};
};
};
users.foo-dogsquared.programs.custom-homepage.sections.services.links = lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.activitywatch.value}";
text = "Telemetry server";
};
};
}

View File

@ -10,7 +10,7 @@ in
config = lib.mkIf cfg.enable (lib.mkMerge [
{
state.ignoreDirectories = [
state.paths.ignoreDirectories = [
"node_modules" # For Node projects.
"result" # For Nix builds.
"target" # For Rust builds.
@ -19,6 +19,7 @@ in
users.foo-dogsquared.programs = {
shell.enable = lib.mkDefault true;
git.enable = lib.mkDefault true;
jujutsu.enable = lib.mkDefault true;
keys.gpg.enable = true;
keys.ssh.enable = true;
terminal-multiplexer.enable = lib.mkDefault true;
@ -42,6 +43,7 @@ in
regex-cli # Save some face of confusion for yourself.
dt # Get that functional gawk.
recode # Convert between different encodings.
go-migrate # Go potential migraines.
];
}

View File

@ -1,12 +1,12 @@
{ config, lib, pkgs, ... }@attrs:
{ config, lib, pkgs, foodogsquaredLib, ... }@attrs:
let
inherit (foodogsquaredLib.trivial) unitsToInt;
userCfg = config.users.foo-dogsquared;
cfg = userCfg.setups.music;
ytdlpAudio = pkgs.writeScriptBin "yt-dlp-audio" ''
${pkgs.yt-dlp}/bin/yt-dlp --config-location "${../../config/yt-dlp/audio.conf}" $@
'';
isFilesystemSet = setupName:
attrs.nixosConfig.suites.filesystem.setups.${setupName}.enable or false;
musicDir = config.xdg.userDirs.music;
playlistsDir = "${musicDir}/playlists";
@ -15,16 +15,25 @@ in
options.users.foo-dogsquared.setups.music = {
enable = lib.mkEnableOption "foo-dogsquared's music setup";
mpd.enable = lib.mkEnableOption "foo-dogsquared's MPD server setup";
spotify.enable = lib.mkEnableOption "music streaming setup with Spotify";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
home.packages = with pkgs; [
songrec # SHAZAM!
ytdlpAudio # My custom script for downloading music with yt-dlp.
picard # Graphical beets.
];
wrapper-manager.packages.music-setup = {
wrappers.yt-dlp-audio = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--config-location" ../../config/yt-dlp/audio.conf
];
};
};
# Enable the desktop audio profile for extra auditorial goodies.
suites.desktop.audio = {
enable = lib.mkDefault true;
@ -92,9 +101,49 @@ in
"vlc.memory_dump"
"vlc.mru"
];
# Set every music-related services from the encompassing NixOS
# configuration.
users.foo-dogsquared.programs.custom-homepage.sections = lib.mkMerge [
(lib.mkIf (attrs.nixosConfig.services.gonic.enable or false) (let
subsonicLink = {
url = "http://localhost:${builtins.toString attrs.nixosConfig.state.ports.gonic.value}";
text = "Jukebox server";
};
in {
services.links = lib.singleton subsonicLink;
music.links = lib.mkBefore [ (subsonicLink // { text = "Subsonic music server"; }) ];
}))
];
}
(lib.mkIf cfg.spotify.enable {
home.packages = with pkgs; [ spotify ];
state.ports.spotifyd.value = attrs.nixosConfig.services.spotifyd.value or 9009;
services.mopidy.extensionPackages = [ pkgs.mopidy-spotify ];
})
(lib.mkIf (cfg.spotify.enable && !(attrs.nixosConfig.services.spotifyd.enable or false)) {
services.spotifyd = {
enable = true;
settings.global = {
use_mpris = true;
device_name = "My laptop";
bitrate = 320;
device_type = "computer";
zeroconf_port = config.state.ports.spotifyd.value;
cache_path = "${config.xdg.cacheHome}/spotifyd";
max_cache_size = unitsToInt { size = 4; prefix = "G"; };
};
};
})
(lib.mkIf cfg.mpd.enable {
state.ports.mopidy.value = 6680;
services.mopidy = {
enable = true;
extensionPackages = with pkgs; [
@ -110,7 +159,7 @@ in
settings = {
http = {
hostname = "127.0.0.1";
port = 6680;
port = config.state.ports.mopidy.value;
default_app = "iris";
};
@ -120,10 +169,10 @@ in
"$XDG_MUSIC_DIR|Music"
"~/library/music|Library"
]
++ lib.optional (attrs?nixosConfig.suites.filesystem.setups.external-hdd.enable)
"/mnt/external-storage/Music|External storage"
++ lib.optional (attrs?nixosConfig.suites.filesystem.setups.archive.enable)
"/mnt/archives/Music|Archive";
++ lib.optional (isFilesystemSet "external-hdd")
"${attrs.nixosConfig.state.paths.external-hdd}/Music|External storage"
++ lib.optional (isFilesystemSet "archive")
"${attrs.nixosConfig.state.paths.archive}/Music|Archive";
};
internetarchive = {
@ -154,6 +203,17 @@ in
enable = true;
mpdMusicDir = musicDir;
};
# Set this to the custom homepage.
users.foo-dogsquared.programs.custom-homepage.sections = let
mopidyLink = {
url = "http://localhost:${builtins.toString config.state.ports.mopidy.value}";
text = "Music streaming server";
};
in {
services.links = lib.singleton mopidyLink;
music.links = lib.mkBefore [ (mopidyLink // { text = "Mopidy server"; }) ];
};
})
]);
}

View File

@ -2,14 +2,16 @@
let
userCfg = config.users.foo-dogsquared;
cfg = userCfg.programs.research;
cfg = userCfg.setups.research;
in
{
options.users.foo-dogsquared.programs.research.enable =
options.users.foo-dogsquared.setups.research.enable =
lib.mkEnableOption "foo-dogsquared's usual toolbelt for research";
config = lib.mkIf cfg.enable (lib.mkMerge [
{
state.ports.syncthing.value = 8384;
home.packages = with pkgs; [
anki # Rise, rinse, and repeat.
#archivebox # The ultimate archiving solution created by a pirate!
@ -18,6 +20,7 @@ in
gallery-dl # More potential for your image collection.
internetarchive # All of the potential vintage collection of questionable materials at your fingertips.
kiwix # Offline reader for your fanon wiki.
localsend # Local network syncing.
monolith # Archive webpages into a single file.
qbittorrent # The pirate's toolkit for downloading Linux ISOs.
sherlock # Make a profile of your *target*.
@ -26,20 +29,35 @@ in
zotero # It's actually good at archiving despite not being a researcher myself.
];
services.syncthing.enable = true;
services.syncthing = {
enable = true;
extraOptions = [
"--gui-address=http://localhost:${builtins.toString config.state.ports.syncthing.value}"
];
};
xdg.mimeApps.defaultApplications = {
"application/vnd.anki" = [ "anki.desktop" ];
};
users.foo-dogsquared.programs.custom-homepage.sections.services.links =
lib.singleton {
url = "http://localhost:${builtins.toString config.state.ports.syncthing.value}";
text = "Local sync server";
};
}
(lib.mkIf userCfg.programs.shell.enable {
programs.atuin.settings.history_filter = [
"^curl"
"^wget"
"^monolith"
"^sherlock"
"^yt-dlp"
"^yt-dl"
"^gallery-dl"
"^archivebox"
"^fanficfare"
];
})
]);

View File

@ -1,27 +0,0 @@
davfs2-credentials: ENC[AES256_GCM,data:pl0rlf8q5/QKp/N7QiYHz/Ol8Lu6QSwIWUTYkkZ0zKO4uhWubICZyJu3Yc4bsn19DCEA7ch8wZ+zHVU8YgMHyesc5OeB5FBjmGCFEqmlM0QwCY3lhy1LirBhqzUf4/x0vIIrgO4d2fI=,iv:H2IYE2cHLzaZ/ni+t0BaSAcdHAmE2PCBlq93R6qQBhY=,tag:DewKYU/tvgtXH3gmcp6TCQ==,type:str]
sops:
shamir_threshold: 2
key_groups:
- hc_vault: []
age:
- recipient: age1say65zc678yc03tx4zexp20c9gvskvwrm4390j4x2jkepn97duhq9ptuj9
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBmN3FtZ3hTRVdDbDFTbTZt
ZHRKZ1lDUlU0c042RXRqRXFZbUhibnFnb0JrCkZnTDAyZ2xZYXZML0E2Nmg0Mk13
d1dWa0t0ZHdGZ0xPMHVhc241QzFmSFkKLS0tIGZLSW5NZlNlOXVOQ1d5dzJZZGcy
MmZMcjlmYUQybVU2UVpTOWh2a3p2N1UKtAer0EZBUwgftHd5ITbzy/X8VaeMfH1O
RG0uA9kZOOXkW8yFu23VvUjp0F+SQhQoxKde4qXLbpIMS30juOHYlE8=
-----END AGE ENCRYPTED FILE-----
- hc_vault: []
age: []
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age: []
lastmodified: "2023-07-28T15:02:44Z"
mac: ENC[AES256_GCM,data:RI4HgCcLAK/0kS3FOQUJ4AvjGWwziJYvj4ymjWscujsPqQVqhCf35wIoTJ9Wa7Fb6gMM+5ws6LgUj0W3Evu56qi5ej022kyWbO4opOopJGXhZzUzUkX3w2rayDpCu0M9H3EM0AGUvqj8dScFV7GhEFKFeGJ0re9U7ZFXLCfanRs=,iv:lMRuV1/UiIJ3ftK48AGgo6uVdIyWJO9YcbSy57xOC+0=,tag:9RdYy95TwZmhHzNDQMnA6w==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.7.3

View File

@ -1,4 +1,4 @@
{ lib, config, pkgs, foodogsquaredModulesPath, ... }:
{ lib, config, pkgs, foodogsquaredLib, foodogsquaredModulesPath, ... }:
# Since this will be exported as an installer ISO, you'll have to keep in mind
# about the added imports from nixos-generators. In this case, it simply adds
@ -23,9 +23,10 @@
system.stateVersion = "23.11";
}
(lib.mkIf (config.formatAttr == "isoImage") {
(lib.mkIf (foodogsquaredLib.nixos.isFormat config "isoImage") {
isoImage = {
isoBaseName = config.networking.hostName;
edition = "minimal";
squashfsCompression = "zstd -Xcompression-level 11";

View File

@ -32,9 +32,11 @@
# Use my desktop environment configuration without the apps just to make the
# closure size smaller.
workflows.workflows.a-happy-gnome = {
enable = true;
extraApps = [ ];
workflows = {
enable = [ "a-happy-gnome" ];
workflows.a-happy-gnome = {
extraApps = lib.mkForce [ ];
};
};
# Install the web browser of course. What would be a graphical installer
@ -62,10 +64,10 @@
}
(lib.mkIf
(foodogsquaredLib.isFormat "graphicalIsoImage") {
(foodogsquaredLib.nixos.isFormat config "isoImage") {
isoImage = {
isoBaseName = config.networking.hostName;
edition = "A Happy GNOME";
edition = "a-happy-gnome";
squashfsCompression = "zstd -Xcompression-level 12";
};

View File

@ -26,6 +26,13 @@
};
};
state.paths = {
cacheDir = "/var/cache";
dataDir = "/var/lib";
logDir = "/var/log";
runtimeDir = "/run";
};
# Enable the display manager of choice.
services.xserver.displayManager.gdm.enable = true;

View File

@ -20,4 +20,12 @@
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
boot.initrd.services.udev.rules = ''
KERNELS=="input0", SUBSYSTEMS=="input", ATTRS{id/product}=="0001", ATTRS{id/vendor}=="0001", ATTRS{id/version}=="ab83", ENV{LIBINPUT_IGNORE_DEVICE}="1"
'';
services.udev.extraRules = ''
KERNELS=="input0", SUBSYSTEMS=="input", ATTRS{id/product}=="0001", ATTRS{id/vendor}=="0001", ATTRS{id/version}=="ab83", ENV{LIBINPUT_IGNORE_DEVICE}="1"
'';
}

View File

@ -19,14 +19,10 @@ in
browsing = true;
drivers = with pkgs; [
gutenprint
hplip
splix
];
};
# Make your CPU more useful.
services.auto-cpufreq.enable = true;
# Extend the life of an SSD.
services.fstrim.enable = true;
};

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, foodogsquaredLib, ... }:
let
hostCfg = config.hosts.ni;
@ -7,6 +7,17 @@ in
{
options.hosts.ni.networking = {
enable = lib.mkEnableOption "networking setup";
enableCommonSetup = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to enable opening TCP ports and configuring network-related
settings typically used for easy networking with clients.
'';
example = false;
};
setup = lib.mkOption {
type = lib.types.enum [ "networkd" "networkmanager" ];
description = ''
@ -19,7 +30,14 @@ in
risk.
:::
'';
default = "networkmanager";
default =
if config.networking.useNetworkd
then "networkd"
else "networkmanager";
defaultText = ''
When networkd is enabled, `networkd`, otherwise `networkmanager` as the
general fallback value.
'';
example = "networkd";
};
};
@ -139,5 +157,27 @@ in
interfaces = [ "enp1s0" "wlp2s0" ];
};
})
(lib.mkIf cfg.enableCommonSetup {
state.ports = {
http = {
value = 80;
protocols = [ "tcp" ];
openFirewall = true;
};
https = {
value = 443;
protocols = [ "tcp" ];
openFirewall = true;
};
# This is for user-specific services that would need to be exposed to
# the local network.
userland = {
value = foodogsquaredLib.nixos.makeRange 20000 30000;
openFirewall = true;
};
};
})
]);
}

View File

@ -1,7 +1,7 @@
patterns:
home: ENC[AES256_GCM,data:8wCxREEfMlZseot2UuN2JmOaoaWVbO++q21/WRIDu8Z2emC5ii93mY5Kl1CdgtgoXOWSF+HWmQB7g7pbilTDykKA0wue3UnGjxR9ST2uyJaFFpytAIDpOi/wV5zNEI76kg+Ly8N6LjVkLUhTF1qB9fhwGcFzxdFkSUlY2CTWloYGmABY+H3v8vgWbGy+MgKgw7FmzjmqJGpYosi1tqkNctOCDi8ExZG9slD60JYIrIstxmTWqPp2HpzHojeW5cSevTjNx0YY7JZQzOtog4a4AD7Ztrj7nhdS0qfeS7r6RjZrGpkC3d+nUPtEoqwH37xp+G3KvpiQTnVl4qwVBIezUWNPnXJ/eL4lySiue+0qhKVCdaG3/EaObP4vIOUv/8C1N7JVYlhq/Fqmgfukee3v33xjWWKxvN/IrxgKyzOT4a0YTuLYqIj4JaHu5O3lziFDYTuFtKPvIpj0MCbfB+NccE23BuPR6Dgj2mY5V2Gwjwi7R5NMd2I=,iv:aekk7RIqluAAB5+owNECPjZc6LhnBGBsN6eCTAoLklA=,tag:nvNepYWZLgNZUNylkeSBIQ==,type:str]
keys: ENC[AES256_GCM,data:xxuamNHPWLpQyERawROxaRdUek6HoDypPK9zw9WGRJthk+7vtCWhyZLLndz0j0ST0H5mU9L9rwDJ4GiyKvPgAyk4iP4=,iv:FclOzefSaDDc+VXq/EMdKX95GfzInPvdKdaBqkNTQRI=,tag:p/0upm4ef/ESx0m9MUPROg==,type:str]
root: ENC[AES256_GCM,data:mrQjyFN6g17dVQ3fGZ8pZ5pcQjgdTTCFrRH7iH/wfRgtXGQ2QCWsQeHes/8b/49gNxQTMYjUuoG66L9HMNS6OQU5gu8jaDXLQdXj2q8pZmOnEA0n1gKv7h6aB3F/NAJuEvTeN93cALraQshpxA2bhb8+icc67lZVWM2c7sNqr9Le6VdPn86wL6uWqmaMH1oIsVqogWHGr+Of1Yc6HB9gdfbI,iv:89L4Rd824Qg5b8OxMoYS4i4XcY0jcCTivDctPCGKxJo=,tag:vQz0M4D5utmR48zEHKLhIg==,type:str]
root: ENC[AES256_GCM,data:MAwmT4t6GA9bK0lPKk/Qkv+keavU2VpVfmKaNqZ+7dLXJjEoEXi6LImbTlAL3bsn1RUPtb1yRWmdcD9wETOjOm7SuufG/HtxI1sJpZnmkUPJV+2I1ll5krEWp1/M1vQHNTgQ2gbJU99riORN4W0EDOeQEg2vMvzALRYW5LRrL/InDqfqzbqUSodb0Uwnt5IL9yQEJIOrIaqxeVRA9zLA6m9ri5dkYIk70hg7QyzDEGA1pzsp81odE6wHAP6yhg==,iv:Kiq7uDRVFwLSOFoEU4xOhsvmSMivO/5fQUc96zmzmD0=,tag:FCHnoIoNpMxsS2gacda/tw==,type:str]
repos:
archives:
password: ENC[AES256_GCM,data:FuPW5dgbt20+eOT4ulV653amUocILnSgc2sBYaeusXw=,iv:WZJYpYdWQzs8G23P4Zflhlxe/H1tShPvMjmFEiLHl4A=,tag:lZUC9JBIwhcEiBpPajaKUw==,type:str]
@ -25,8 +25,8 @@ sops:
emJQY1B4UHQvVDJxQlVlUjZXcW5hV2MKAqRYMFGWoXALeUeDoFCYFvCT8pIIRGk4
xMZwLHvRWuZW+15DYGrfrA9+DOS6SZYEYQeApMFVWUdYMU/Xn6KZig==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-04-24T13:05:10Z"
mac: ENC[AES256_GCM,data:tFWcvgXTkz39GuHsRqQioWGfppmODVKvtoOJIth/B52QduspHkK8wMzWDbeBdtA9EaUkL1vv9BOs9G8e42cFBsDH8WWcJsv5L9E3Vciq4n3ihe4wkEIebe//UPGDRwvXXyJAGn14WVROigFYGj7f7tBXfNFaHyEtYm279ta3Qtw=,iv:AksshYcfgoaNiQYNSIy5yfO1rQDysqayKNnvRR60Tl8=,tag:DhxMJ0o7XoY/UP/UXQtSxQ==,type:str]
lastmodified: "2024-06-19T04:49:56Z"
mac: ENC[AES256_GCM,data:d/PpeuvmhHLNivielvfuSfUIQWuSYPd/CJrnuSWoWQxorZG9V7g3UnqMmb7mfISLj3HpC0Xgo1R/wV03hdaRoT2/JwG0Gl4ya9FJiO5jKiwkKVC5cFPvh26aRWTG9/qCzkymL+GC2vyqsvsYTXkq42Ef43tUmxGoFDGsbHzoAlw=,iv:LFIvVqBi4pQEhleaWdcfQI4jGzFksTlRXMgFfHbaaTM=,tag:fsNrZ4h0YmPhCP1XyD9LiQ==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View File

@ -9,12 +9,17 @@
"required": true,
"properties": {
"extraArgs": {
"$comment": "Extra arguments to be passed to the associated service.",
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"downloadPath": {
"$comment": "Job-specific download path of the associated service.",
"type": "string"
},
"subscriptions": {
"$comment": "While it is easy to think this could be an object, some exports and applications allow the data to have the same name but points to different URLs. For example, NewPipe has support for multiple services other than YouTube which the same creator could have accounts on multiple platforms. Overriding it would be troublesome in case I want to follow the same creator on multiple platforms.",
"type": "array",
@ -28,11 +33,16 @@
"type": "string"
}
},
"required": [ "name", "url" ]
"required": [
"name",
"url"
]
}
}
},
"required": [ "subscriptions" ]
"required": [
"subscriptions"
]
}
}
}

View File

@ -29,8 +29,7 @@ in
# Write the subtitle file with the preferred languages.
"--write-subs"
"--sub-langs"
"en.*,ja,ko,zh.*,fr,pt.*"
"--sub-langs" "en.*,ja,ko,zh.*,fr,pt.*"
# Write the description in a separate file.
"--write-description"
@ -44,15 +43,12 @@ in
"(webm,mkv,mp4)[height<=?1280]"
# Prefer MKV whenever possible for video formats.
"--merge-output-format"
"mkv"
"--merge-output-format" "mkv"
# Don't download any videos that are originally live streams.
"--match-filters"
"!was_live"
"--match-filters" "!was_live"
"--audio-quality"
"1"
"--audio-quality" "1"
# Not much error since it will always fail.
"--no-abort-on-error"
@ -60,9 +56,17 @@ in
"--ignore-no-formats-error"
];
ytdlpArchiveVariant = pkgs.writeScriptBin "yt-dlp-archive-variant" ''
${pkgs.yt-dlp}/bin/yt-dlp ${lib.escapeShellArgs ytdlpArgs} $@
'';
galleryDlArgs = [
# Write metadata to separate JSON files.
"--write-metadata"
# The config file that contains the secrets for various services.
# We're putting as a separate config file instead of configuring it
# in the service properly since secrets decrypted by sops-nix cannot
# be read in Nix.
"--config"
"${config.sops.secrets."${pathPrefix}/secrets-config".path}"
];
# Given an attribute set of jobs that contains a list of objects with
# their names and URL, create an attrset suitable for declaring the
@ -93,25 +97,27 @@ in
lib.listToAttrs jobsList;
in
{
environment.systemPackages = [ ytdlpArchiveVariant ];
sops.secrets = foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml
(lib.attachSopsPathPrefix pathPrefix {
"secrets-config" = { };
});
# This is to make an exception for Archivebox.
nixpkgs.config.permittedInsecurePackages = [
"python3.12-django-3.1.14"
];
suites.filesystem.setups.archive.enable = true;
services.yt-dlp = {
enable = true;
archivePath = "${mountName}/yt-dlp-service";
downloadPath = "${mountName}/yt-dlp-service";
# This is applied on all jobs. It is best to be minimal as much as
# possible for this.
extraArgs = ytdlpArgs ++ [
# Make a global list of successfully downloaded videos as a cache for yt-dlp.
"--download-archive"
"${config.services.yt-dlp.archivePath}/videos"
"--download-archive" "videos"
];
jobs = mkJobs {
@ -148,22 +154,12 @@ in
services.gallery-dl = {
enable = true;
archivePath = "${mountName}/gallery-dl-service";
downloadPath = "${mountName}/gallery-dl-service";
extraArgs = [
extraArgs = galleryDlArgs ++ [
# Record all downloaded files in an archive file.
"--download-archive"
"${config.services.gallery-dl.archivePath}/photos"
# Write metadata to separate JSON files.
"--write-metadata"
# The config file that contains the secrets for various services.
# We're putting as a separate config file instead of configuring it
# in the service properly since secrets decrypted by sops-nix cannot
# be read in Nix.
"--config"
"${config.sops.secrets."${pathPrefix}/secrets-config".path}"
"${config.services.gallery-dl.downloadPath}/photos"
];
settings.extractor = {
@ -203,6 +199,18 @@ in
};
};
};
wrapper-manager.packages.download-media-variants = {
wrappers."yt-dlp-${pathPrefix}" = {
arg0 = lib.getExe' config.services.yt-dlp.package "yt-dlp";
prependArgs = ytdlpArgs;
};
wrappers."gallery-dl-${pathPrefix}" = {
arg0 = lib.getExe' config.services.gallery-dl.package "gallery-dl";
prependArgs = galleryDlArgs;
};
};
}
);
}

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, foodogsquaredLib, ... }:
let
hostCfg = config.hosts.ni;
@ -9,18 +9,31 @@ in
lib.mkEnableOption "music streaming and organizing setup";
config = lib.mkIf cfg.enable {
state.ports = rec {
gonic = {
value = 4747;
protocols = [ "tcp" ];
openFirewall = true;
};
uxplay = {
value = 10001;
openFirewall = true;
};
uxplayClients = {
value = foodogsquaredLib.nixos.makeRange' uxplay.value 10;
openFirewall = true;
};
};
# My portable music streaming server.
services.gonic = {
enable = true;
settings = rec {
listen-addr = "localhost:4747";
listen-addr = "localhost:${builtins.toString config.state.ports.gonic.value}";
cache-path = "/var/cache/gonic";
music-path =
[
"/srv/Music"
]
++ lib.optionals config.suites.filesystem.setups.external-hdd.enable [
"/mnt/external-storage/Music"
];
podcast-path = "${cache-path}/podcasts";
playlists-path = "${cache-path}/playlists";
@ -31,5 +44,14 @@ in
scan-at-start-enabled = true;
};
};
# My AirPlay mirroring server.
services.uxplay = {
enable = true;
extraArgs = [
"-p" (builtins.toString config.state.ports.uxplay.value)
"-reset" "30"
];
};
};
}

View File

@ -2,23 +2,39 @@
# Manual edits may be lost in future updates.
provider "registry.opentofu.org/hetznercloud/hcloud" {
version = "1.40.0"
constraints = "1.40.0"
version = "1.48.1"
constraints = "1.48.1"
hashes = [
"h1:73wGxI4xen4QdT5D1HBhcn1Ll1itFu1b6r4ggflG2OM=",
"zh:0451768ebac9c01b2cc9b3fa63014baa6d1d92e4b5cda9f98a15c320eabc62bd",
"zh:399a3c8fd13e69d8ac836ff5cb3e49eaa13f8d588390862d3c84e5221b85a5ec",
"zh:3f1e2310eaf0945e8df20e841437119b4f1a4fbcbf5c8ef9f66d086a6206df2e",
"zh:5088bd924089c49717fd90fd4893df6caccf978b53bdad79762383c519987290",
"zh:50c178c74bc5aaba5f5d5a0fd51257136b6f2cc0b44bc02b0603f656daad8ee7",
"zh:6a25d234eef37ca727bf20aebeb6a2d3cabbc6338b5e53e98aed222def4b1c86",
"zh:7489d6b14b49916d7181e444880ad1f3914606beda0b7c21485e969ba43f84eb",
"zh:8ded3bfeb885a61a6895e400d1476d15500f2a1a67da440ddd4b1ee2fad0407d",
"zh:b34e3430d48c48edbd49064e500e84765ce03d97c01d855db71c738e1928b97d",
"zh:c36241fc84663e90fd693a74773a22a459c55edae71141f13aba58a267cb09ab",
"zh:c5add5e07edf1876486f4ecfa103f3e500040b4801b8cdf68a91224d3bc6c636",
"zh:ebced845b6be85ca6cf3435eec84514146a48ab6438c700f2e48b7e86d89ff37",
"zh:f543dce13d3c28bf1327452a3922acda70742fc53fefe9628666391f448de99e",
"zh:fa1e04522a1fdf8383f93ec5ffd18424abe99a5ce4a1a8af7e4cd28fce43bb1a",
"h1:fa9fxdSV9DG+HDcXyRbcGfb6Dk94SBP3TamHb1yOYiI=",
"zh:086cce10cb005f25f85183c59e639d6675e91e919934c80f660ca1cc4b9bc09b",
"zh:111d185707168b90c7ed3d245b522b2bd508f0bd4275496a1acdc9c0adaa85f2",
"zh:1acba3f30150282d283c46cd7ce25e9afb8b027fd2f594d41de9131d25a42b27",
"zh:1f8858aa81f93d52550502a11c7ea4e9370316ab098f6b75a09ffe75da6129ee",
"zh:20e01e6e6f99f57b3c1ef2a9de5d617c0139d3f3934eeb5e6c5976ae8b831a48",
"zh:2a8489a586a7bdadc42bbc9e3cb7b9deaefdf8020e3f2caba2678877d5d64d52",
"zh:31d8017529b0429bc9e873ec5d358ab9b75af2ba0ae24f21abcd4d09f36b7ee9",
"zh:407b4d7f1407e7e4a51b6f4dcdb0c7fbf81f2f1e25a7275f34054009419125a2",
"zh:42cf7cf867d199054713d4e6060e4b578eff16f0f537e9aaa5fd990c3eab8bc6",
"zh:460ac856ff952c5d41525949b93cfb7ee642f900594eff965494f11999d7496b",
"zh:d09e527d23f62564c82bc24e286cf2cb8cb0ed6cdc6f4c66adf2145cfa62adac",
"zh:d465356710444ac70dea4883252efc429b73e79fc6dc94f075662b838476680e",
"zh:d476c8eca307e30a20eed54c0735b062a6f3066b4ac63eebecd38ab8f40c16f4",
"zh:e0e9b2f6d5e28dbd01fa1ec3147aa88062d6223c5146532a3dcd1d3bb827e1e9",
]
}
provider "registry.opentofu.org/timohirt/hetznerdns" {
version = "2.2.0"
constraints = "2.2.0"
hashes = [
"h1:HyskQAglrOueur79gSCBgx9MNDOs0tz39aNYQiFgxz8=",
"zh:5bb0ab9f62be3ed92070235e507f3c290491d51391ef4edcc70df53b65a83019",
"zh:5ccdfac7284f5515ac3cff748336b77f21c64760e429e811a1eeefa8ebb86e12",
"zh:687c35665139ae37c291e99085be2e38071f6b355c4e1e8957c5a6a3bcdf9caf",
"zh:6de27f0d0d1513b3a4b7e81923b4a8506c52759bd466e2b4f8156997b0478931",
"zh:85770a9199a4c2d16ca41538d7a0f7a7bfc060678104a1faac19213e6f0a800c",
"zh:a5ff723774a9ccfb27d5766c5e6713537f74dd94496048c89c5d64dba597e59e",
"zh:bf9ab76fd37cb8aebb6868d73cbe8c08cee36fc25224cc1ef5949efa3c34b06c",
"zh:db998fe3bdcd4902e99fa470bb3f355883170cf4c711c8da0b5f1f4510f1be41",
]
}

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, foodogsquaredLib, foodogsquaredModulesPath, ... }:
{ config, lib, pkgs, foodogsquaredLib, foodogsquaredUtils, foodogsquaredModulesPath, ... }:
{
imports = [
@ -8,8 +8,8 @@
./modules/profiles/hetzner-cloud-cx21.nix
# The users for this host.
(foodogsquaredLib.getUser "nixos" "admin")
(foodogsquaredLib.getUser "nixos" "plover")
(foodogsquaredUtils.getUser "nixos" "admin")
(foodogsquaredUtils.getUser "nixos" "plover")
"${foodogsquaredModulesPath}/profiles/headless.nix"
"${foodogsquaredModulesPath}/profiles/hardened.nix"
@ -32,11 +32,43 @@
fail2ban.enable = true;
# The self-hosted services.
atuin.enable = true;
gitea.enable = true;
grafana.enable = true;
vaultwarden.enable = true;
wireguard.enable = true;
};
# We're using our own VPN configuration for this one.
suites.vpn.enable = true;
state.network = {
ipv4 = lib.mkDefault "65.109.224.213";
ipv6 = lib.mkDefault "2a01:4f9:c012:607a::1";
interfaces = {
lan = {
ipv4 = "10.0.0.2";
ipv6 = "";
};
};
secondaryNameservers = [
# ns1.first-ns.de
"213.239.242.238"
"2a01:4f8:0:a101::a:1"
# robotns2.second-ns.de
"213.133.105.6"
"2a01:4f8:d0a:2004::2"
# robotns3.second-ns.com
"193.47.99.3"
"2001:67c:192c::add:a3"
];
};
state.paths = {
dataDir = "/var/lib";
cacheDir = "/var/cache";
logDir = "/var/log";
runtimeDir = "/run";
};
# Offline SSH!?!
@ -61,7 +93,7 @@
email = "admin+acme@foodogsquared.one";
dnsProvider = "rfc2136";
dnsResolver = "1.1.1.1";
credentialsFile = config.sops.secrets."lego/env".path;
credentialsFile = config.sops.secrets."lego/env".path or "/var/lib/secrets/acme.env";
};
# Enable generating new DH params.

View File

@ -1,47 +1,59 @@
{ config, lib, ... }:
{ disk ? "/dev/sda", ... }:
{
disko.devices = {
disk.sda = {
device = [ "/dev/sda" ];
disk.primary = {
device = disk;
type = "disk";
content = {
type = "gpt";
partitions = [
{
name = "boot";
partitions = {
boot = {
start = "0";
end = "1MiB";
part-type = "primary";
flags = [ "bios_grub" ];
}
type = "EF02";
};
{
name = "ESP";
# You can't really have a btrfs-layered boot so this'll have to do.
ESP = {
priority = 1;
start = "1MiB";
end = "256MiB";
bootable = true;
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
format = "vfat";
};
flags = [ "esp" ];
}
};
{
name = "root";
root = {
start = "256MiB";
end = "100%";
part-type = "primary";
bootable = true;
type = "8300";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = [
{
"/root" = {
mountOptions = [ "compress=zstd" ];
mountpoint = "/";
};
"/home" = {
mountOptions = [ "compress=zstd" ];
mountpoint = "/home";
};
"/nix" = {
mountOptions = [ "compress=zstd" "noatime" "noacl" ];
mountpoint = "/nix";
};
}
];
};
}
];
};
};
};
};
};

View File

@ -1,6 +0,0 @@
#cloud-config
runcmd:
- curl https://raw.githubusercontent.com/elitak/nixos-infect/e6c879494717cf3a3a54deb0d8630133127f810b/nixos-infect | NIX_CHANNEL=nixos-unstable bash 2>&1 | tee /tmp/infect.log
- e2label /dev/sda1 nixos
- fatlabel /dev/sda15 boot

View File

@ -1 +0,0 @@
MBqt2HPZFGRkIXjv5sIPhGjDytGCWC3K9uTHIa7Xtlc=

View File

@ -1 +0,0 @@
zXYsuKGj0F/MJmTyHyTj3EIzMnrof7FzK/tx3w/xTEk=

View File

@ -2,14 +2,33 @@ variable "hcloud_token" {
sensitive = true
}
variable "hcloud_dns_token" {
sensitive = true
}
provider "hcloud" {
token = var.hcloud_token
}
provider "hetznerdns" {
apitoken = var.hcloud_dns_token
}
resource "hetznerdns_zone" "main" {
name = "foodogsquared.one"
ttl = 3600
}
resource "hetznerdns_primary_server" "main" {
address = hcloud_server.plover.ipv4_address
port = 53
zone_id = hetznerdns_zone.main.id
}
resource "hcloud_server" "plover" {
name = "plover"
image = "debian-12"
server_type = "cx21"
server_type = "cx22"
location = "hel1"
datacenter = "hel1-dc2"
@ -18,8 +37,6 @@ resource "hcloud_server" "plover" {
delete_protection = true
rebuild_protection = true
user_data = file("${path.module}/files/hcloud/hcloud-user-data.yml")
public_net {
ipv4_enabled = true
ipv6_enabled = true
@ -27,11 +44,7 @@ resource "hcloud_server" "plover" {
network {
network_id = hcloud_network.plover.id
ip = "172.27.0.1"
alias_ips = [
"172.27.0.2",
"172.27.0.3"
]
ip = "10.0.0.1"
}
depends_on = [
@ -46,12 +59,13 @@ resource "hcloud_ssh_key" "foodogsquared" {
resource "hcloud_network" "plover" {
name = "plover"
ip_range = "172.16.0.0/12"
ip_range = "10.0.0.0/8"
delete_protection = true
}
resource "hcloud_network_subnet" "plover-subnet" {
network_id = hcloud_network.plover.id
type = "cloud"
network_zone = "eu-central"
ip_range = "172.27.0.0/16"
ip_range = "10.0.0.0/12"
}

View File

@ -11,7 +11,7 @@
./services/database.nix
# The primary DNS server that is completely hidden.
./services/dns-server.nix
./services/dns-server
# The single-sign on setup.
./services/idm.nix
@ -22,9 +22,6 @@
# The firewall of choice.
./services/firewall.nix
# The VPN setup of choice.
./services/wireguard.nix
# The rest of the self-hosted applications.
./services/atuin.nix
./services/fail2ban.nix

View File

@ -9,69 +9,6 @@ rec {
# The thing is generated using a ULA generator.
privateIPv6Prefix = "fd89:c181:8016";
# These blocks should be used sparingly with how wide these blocks cover.
# Plus, they shouldn't be treated as subnets.
clientNetworks = [
"172.24.0.0/13"
"10.128.0.0/9"
"fd00::/8"
];
serverNetworks = [
"172.16.0.0/13"
"10.0.0.0/9"
"fc00::/8"
];
interfaces =
let
ploverInternalNetworkGateway = "172.16.0.1";
ipv6Gateway = "fe80::1";
in
{
# This is the public-facing interface. Any interface name with a prime
# symbol means it's a public-facing interface.
wan = {
ifname = "ens3";
# The gateways for the public addresses are retrieved from the following
# pages:
#
# * https://docs.hetzner.com/cloud/networks/faq/#are-any-ip-addresses-reserved
# * https://docs.hetzner.com/robot/dedicated-server/ip/additional-ip-adresses/#gateway
IPv4 = {
address = "65.109.224.213";
gateway = "172.31.1.1";
};
IPv6 = {
address = "2a01:4f9:c012:607a::1";
gateway = ipv6Gateway;
};
};
lan = {
ifname = "ens10";
IPv4 = {
address = "172.27.0.1";
gateway = ploverInternalNetworkGateway;
};
IPv6 = {
address = "${privateIPv6Prefix}::1";
gateway = ipv6Gateway;
};
};
wireguard0 = {
ifname = "wireguard0";
IPv4 = {
address = "172.28.0.1";
gateway = ploverInternalNetworkGateway;
};
IPv6 = {
address = "${wireguardIPv6Prefix}::1";
gateway = ipv6Gateway;
};
};
};
# Wireguard-related things.
wireguardPort = 51820;
@ -80,36 +17,4 @@ rec {
# This IPv6 network prefix should have /64 for the entire Wireguard network.
wireguardIPv6Prefix = "${privateIPv6Prefix}:ffff";
# These are all fixed IP addresses. However, they should be assigned in /16
# and /64 for IPv4 and IPv6 block respectively.
wireguardPeers = {
server = with interfaces.wireguard0; {
IPv4 = IPv4.address;
IPv6 = IPv6.address;
};
desktop = {
IPv4 = "${wireguardIPv4Prefix}.2";
IPv6 = "${wireguardIPv6Prefix}::2";
};
phone = {
IPv4 = "${wireguardIPv4Prefix}.3";
IPv6 = "${wireguardIPv6Prefix}::3";
};
};
secondaryNameServers = {
"ns1.first-ns.de." = {
IPv4 = [ "213.239.242.238" ];
IPv6 = [ "2a01:4f8:0:a101::a:1" ];
};
"robotns2.second-ns.de." = {
IPv4 = [ "213.133.105.6" ];
IPv6 = [ "2a01:4f8:d0a:2004::2" ];
};
"robotns3.second-ns.com." = {
IPv4 = [ "193.47.99.3" ];
IPv6 = [ "2001:67c:192c::add:a3" ];
};
};
}

View File

@ -14,38 +14,20 @@ in
config = lib.mkIf cfg.enable (lib.mkMerge [
{
state.ports.postgresql.value = 5432;
services.postgresql = {
enable = true;
package = pkgs.postgresql_16;
enableTCPIP = true;
# Create per-user schema as documented from Usage Patterns. This is to make
# use of the secure schema usage pattern they encouraged to do.
#
# Now, you just have to keep in mind about applications making use of them.
# Most of them should have the setting to set the schema to be used. If
# not, then screw them (or just file an issue and politely ask for the
# feature).
initialScript =
let
# This will be run once anyways so it is acceptable to create users
# "forcibly".
perUserSchemas = lib.lists.map
(user: ''
CREATE USER ${user.name};
CREATE SCHEMA AUTHORIZATION ${user.name};
'')
config.services.postgresql.ensureUsers;
in
pkgs.writeText "plover-initial-postgresql-script" ''
${lib.concatStringsSep "\n" perUserSchemas}
'';
settings =
let
credsDir = path: "/run/credentials/postgresql.service/${path}";
in
{
port = config.state.ports.postgresql.value;
# Still doing the secure schema usage pattern.
search_path = ''"$user"'';

View File

@ -8,29 +8,23 @@ let
cfg = hostCfg.services.dns-server;
inherit (config.networking) domain fqdn;
inherit (import ../hardware/networks.nix) interfaces clientNetworks serverNetworks secondaryNameServers;
secondaryNameServersIPs = lib.foldl'
(total: addresses: total ++ addresses.IPv4 ++ addresses.IPv6)
[ ]
(lib.attrValues secondaryNameServers);
domainZone = pkgs.substituteAll {
src = ../../config/dns/${domain}.zone;
ploverWANIPv4 = interfaces.wan.IPv4.address;
ploverWANIPv6 = interfaces.wan.IPv6.address;
zonesDir = "/etc/bind/zones";
getZoneFile = domain: "${zonesDir}/${domain}.zone";
zonefile = pkgs.substituteAll {
src = ../setups/dns/zones/${domain}.zone;
ploverWANIPv4 = config.state.network.ipv4;
ploverWANIPv6 = config.state.network.ipv6;
};
fqdnZone = pkgs.substituteAll {
src = ../../config/dns/${fqdn}.zone;
ploverLANIPv4 = interfaces.lan.IPv4.address;
ploverLANIPv6 = interfaces.lan.IPv6.address;
src = ../setups/dns/zones/${fqdn}.zone;
ploverWANIPv4 = config.state.network.ipv4;
ploverWANIPv6 = config.state.network.ipv6;
};
zonesDir = "/etc/bind/zones";
zoneFile = domain: "${zonesDir}/${domain}.zone";
dnsSubdomain = "ns1.${domain}";
dnsOverHTTPSPort = 8443;
in
{
options.hosts.plover.services.dns-server.enable =
@ -38,6 +32,12 @@ in
config = lib.mkIf cfg.enable (lib.mkMerge [
{
state.ports = {
dns.value = 53;
dnsOverHTTPS.value = 8443;
dnsOverTLS.value = 853;
};
sops.secrets =
let
dnsFileAttribute = {
@ -46,10 +46,7 @@ in
mode = "0400";
};
in
foodogsquaredLib.sops-nix.getSecrets ../../secrets/secrets.yaml {
"dns/${domain}/mailbox-security-key" = dnsFileAttribute;
"dns/${domain}/mailbox-security-key-record" = dnsFileAttribute;
"dns/${domain}/keybase-verification-key" = dnsFileAttribute;
foodogsquaredLib.sops-nix.getSecrets ./secrets.yaml {
"dns/${domain}/rfc2136-key" = dnsFileAttribute // {
reloadUnits = [ "bind.service" ];
};
@ -69,16 +66,18 @@ in
listenOn = [
"127.0.0.1"
interfaces.lan.IPv4.address
interfaces.wan.IPv4.address
config.state.network.ipv4
];
listenOnIpv6 = [
"::1"
interfaces.lan.IPv6.address
interfaces.wan.IPv6.address
config.state.network.ipv6
];
extraConfig = ''
include "${config.state.paths.dataDir}/dns/*-dnskeys.conf";
'';
# Welp, since the template is pretty limited, we'll have to go with our
# own. This is partially based from the NixOS Bind module except without
# the template for filling in zones since we use views.
@ -110,7 +109,7 @@ in
endpoints { "/dns-query"; };
};
acl trusted { ${lib.concatStringsSep "; " (clientNetworks ++ serverNetworks)}; localhost; };
acl trusted { ${lib.concatStringsSep "; " [ "10.0.0.0/8" ]}; localhost; };
acl cachenetworks { ${lib.concatMapStrings (entry: " ${entry}; ") cfg.cacheNetworks} };
acl badnetworks { ${lib.concatMapStrings (entry: " ${entry}; ") cfg.blockedNetworks} };
@ -124,7 +123,8 @@ in
listen-on-v6 tls ${dnsSubdomain} { ${listenInterfacesIpv6} };
# DNS-over-HTTPS.
https-port ${builtins.toString dnsOverHTTPSPort};
tls-port ${builtins.toString config.state.ports.dnsOverTLS.value};
https-port ${builtins.toString config.state.ports.dnsOverHTTPS.value};
listen-on tls ${dnsSubdomain} http ${dnsSubdomain} { ${listenInterfaces} };
listen-on-v6 tls ${dnsSubdomain} http ${dnsSubdomain} { ${listenInterfacesIpv6} };
@ -147,14 +147,14 @@ in
zone "${fqdn}" {
type primary;
file "${zoneFile fqdn}";
file "${getZoneFile fqdn}";
};
zone "${domain}" {
type primary;
file "${zoneFile domain}";
allow-transfer { ${lib.concatStringsSep "; " secondaryNameServersIPs}; };
file "${getZoneFile domain}";
allow-transfer { ${lib.concatStringsSep "; " config.state.network.secondaryNameservers}; };
update-policy {
grant rfc2136key.${domain}. zonesub TXT;
};
@ -182,22 +182,15 @@ in
path = with pkgs; [ replace-secret ];
preStart =
let
domainZone' = zoneFile domain;
fqdnZone' = zoneFile fqdn;
secretPath = path: config.sops.secrets."dns/${path}".path;
rndc = lib.getExe' config.services.bind.package "rndc";
domainZone' = getZoneFile domain;
fqdnZone' = getZoneFile fqdn;
in
lib.mkAfter ''
# Install the domain zone.
{
install -Dm0600 '${domainZone}' '${domainZone'}'
replace-secret '#mailboxSecurityKey#' '${secretPath "${domain}/mailbox-security-key"}' '${domainZone'}'
replace-secret '#mailboxSecurityKeyRecord#' '${secretPath "${domain}/mailbox-security-key-record"}' '${domainZone'}'
#${rndc} sync "${domain}" IN external
}
[ -f ${lib.escapeShellArg domainZone'} ] && install -Dm0600 ${zonefile} ${lib.escapeShellArg domainZone'}
# Install the internal DNS zones.
install -Dm0600 '${fqdnZone}' '${fqdnZone'}'
[ -f ${lib.escapeShellArg fqdnZone'} ] && install -Dm0600 '${fqdnZone}' ${lib.escapeShellArg fqdnZone'}
'';
serviceConfig = {
@ -287,6 +280,23 @@ in
security.dhparams.params.bind.bits = 4096;
}
(lib.mkIf hostCfg.setups.monitoring.enable {
state.ports.bindStatistics.value = 9423;
services.bind.extraConfig = ''
statistics-channels {
inet 127.0.0.1 port ${builtins.toString config.state.ports.bindStatistics.value} allow { 127.0.0.1; };
};
'';
services.prometheus.exporters = {
bind = {
enable = true;
bindURI = "http://127.0.0.1/${builtins.toString config.state.ports.bindStatistics.value}";
};
};
})
(lib.mkIf hostCfg.services.reverse-proxy.enable {
# Making this with nginx.
services.nginx.upstreams.local-dns = {
@ -294,7 +304,7 @@ in
zone dns 64k;
'';
servers = {
"127.0.0.1:${builtins.toString dnsOverHTTPSPort}" = { };
"127.0.0.1:${builtins.toString config.state.ports.dnsOverHTTPS.value}" = { };
};
};
@ -329,23 +339,19 @@ in
proxy_pass dns_servers;
}
'';
})
# Set up the firewall. Take note the ports with the transport layer being
# accepted in Bind.
(lib.mkIf hostCfg.services.firewall.enable {
networking.firewall =
let
ports = [
53 # DNS
853 # DNS-over-TLS/DNS-over-QUIC
];
in
{
allowedUDPPorts = ports;
allowedTCPPorts = ports;
};
networking.firewall = {
allowedUDPPorts = [ config.state.ports.dns.value ];
allowedTCPPorts = with config.state.ports; [
dns.value
dnsOverHTTPS.value
dnsOverTLS.value
];
};
})
# Add the following to be backed up.

View File

@ -0,0 +1,23 @@
dns:
foodogsquared.one:
rfc2136-key: ENC[AES256_GCM,data:wrYDf+kxNmRnEQdSyqNPtJCHHTnmoSUfZd+zgOKOxGJuggOKVLKinyQTqbHNlBr8Ww3mQSxJQHuUmlUlmBFadWD6jli/89V3g3Yf8Dfmp04dZqxxyeVf4tAfZPYxhvMYv3b3Vf8iwPVo+6wLp/sUjISj32zsUNqXv62Z,iv:HYWW6kCUrBfE9tK3TbocVgFNgemz4lMSrwXork7EYtQ=,tag:f40LfresTPzzBojGrRuS7g==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age1yftkhugwrdnlpl45lthrhvvk720zza2nd085sxvjcxg2guavz3kquktplx
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSArNXRmbXB6YWJxa0w1R3Rh
ZzVjMHNtdStETXkraEhrbVVIQWtRT1FEbWcwCiszSmFTR2s4RUI1SlJWL3RMTHN2
a1Qva1Z5TC9PU3hSd2xHczdaZkdnelEKLS0tIE1kQ2FhV3hOY3lHbEx1SUlLSi9X
NHY2MWtSZEtKUkdJa1dnT0VhQWN1dUUKbi24Rv2vAT5teHt9dKltJyKjLpLDuYDw
SxoVKJ6zgEnkwhByAQwHKwwd6fSgPicl2b0kNGUJrooHlwHEUqsDMw==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-09-19T13:08:29Z"
mac: ENC[AES256_GCM,data:K7u79dy6X9UtX/nlAuFLUgeU01j12BzGdibdDMmuCc0GEE6+SsByDxf9t1CK1eOlUyJZr1978cjvaYLR3DAv7gTnicBT4r0T6UM6qF0uD4OvlFAKOPz9oUf972NIjAHE2OO4gTHUbOPtIjFGrZSHXmFzQIbG8QAmNmKTPTGF2Fo=,iv:HFsc7i4CtbZCYEAdhbb7tt5D0xDj54oU7DkSDUAmcLY=,tag:m055t7fHlIUUvVKs39LhOA==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.9.0

View File

@ -4,7 +4,7 @@ $TTL 12h
$ORIGIN foodogsquared.one.
@ 3600 IN SOA ns1 hostmaster (
2023100801 ; serial number
2024091701 ; serial number
1h ; refresh
15m ; update retry
3w ; expiry
@ -15,29 +15,22 @@ $ORIGIN foodogsquared.one.
3600 IN NS robotns3.second-ns.com.
; Setting up the mail-related DNS entries.
; For future references, please the see the following document at
; https://kb.mailbox.org/en/private/e-mail-article/using-e-mail-addresses-of-your-domain
@ IN MX 10 mxext1.mailbox.org.
IN MX 10 mxext2.mailbox.org.
IN MX 20 mxext3.mailbox.org.
IN TXT v=spf1 include:mailbox.org ~all
; https://mxroutedocs.com/
@ IN MX 10 heracles.mxrouting.net.
IN MX 20 heracles-relay.mxrouting.net.
IN TXT "v=spf1 include:mxlogin.com -all"
; Protect the validity of my emails sent by me!!!!
x._domainkey 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyLlrgdsO4jLncMoGAowlE14oB9R2ESxNLRBtkzc24LOPJ1CwEIE+5AHZd+ZRMwiD7fdXcyCH7/E1BRXWT+TtLnKnBgf5I0z6EbPqiPPb6nmpDWrbZzA2mdKetAKz0kFJC8oYK7lQF7Bdh57y/HWksoH6yjl1E88m8tEQ/thlyABGjqzV+txgmc1BryFu23KasqI2c4We/KgvsoSSAaUHkjpAMCuJck/P0G9mJWyTHrnZN2gCotyenLBZew0BIbiA2XYp6dQW4sU+MawfZ0E1KA0lem0SRYCB+sGD248uj4xVo9sIiCVyO9EQXy/YCZTeuTQHf1+QeFzI82vIrlv63QIDAQAB"
; Protect my domain email from spoofing.
_dmarc 400 IN TXT "v=DMARC1;p=none;rua=mailto:postmaster@foodogsquared.one;ruf=mailto:admin@foodogsquared.one"
; Keybase verification key.
@ 3600 IN TXT #keybaseVerificationKey#
; This is something that is needed for mailbox.org to verify it is indeed in my
; domain.
#mailboxSecurityKey# 3600 IN TXT #mailboxSecurityKeyRecord#
; Protect the validity of my emails sent by me!!!!
MBO0001._domainkey IN CNAME MBO0001._domainkey.mailbox.org.
MBO0002._domainkey IN CNAME MBO0002._domainkey.mailbox.org.
MBO0003._domainkey IN CNAME MBO0003._domainkey.mailbox.org.
MBO0004._domainkey IN CNAME MBO0004._domainkey.mailbox.org.
; Protect my domain email from spoofing.
_dmarc 400 IN TXT v=DMARC1;p=none;rua=mailto:postmaster@foodogsquared.one;ruf=mailto:admin@foodogsquared.one
; This will make PGP clients find my public key for the email.
_hkps._tcp IN SRV 1 1 443 pgp.mailbox.org.

View File

@ -20,11 +20,7 @@ in
overalljails = true;
};
extraPackages = with pkgs; [ ipset ];
ignoreIP = [
# VPN clients.
"${interfaces.wireguard0.IPv4.address}/13"
"${interfaces.wireguard0.IPv6.address}/64"
];
ignoreIP = [ "10.0.0.0/8" ];
# We're going to be unforgiving with this one since we only have key
# authentication and password authentication is disabled anyways.

View File

@ -5,7 +5,7 @@ let
cfg = hostCfg.services.idm;
authDomain = "auth.${config.networking.domain}";
port = 9443;
port = config.state.ports.kanidm.value;
certsDir = config.security.acme.certs."${authDomain}".directory;
@ -16,6 +16,7 @@ in
config = lib.mkIf cfg.enable (lib.mkMerge [
{
state.ports.kanidm.value = 9443;
hosts.plover.services.vouch-proxy.enable = lib.mkDefault true;
services.kanidm = {

View File

@ -4,7 +4,6 @@ let
hostCfg = config.hosts.plover;
cfg = hostCfg.services.monitoring;
bindStatsPort = 8053;
prometheusExports = config.services.prometheus.exporters;
in
{
@ -17,14 +16,6 @@ in
enable = true;
exporters = {
bind = {
enable = true;
bindURI = "http://127.0.0.1/${builtins.toString bindStatsPort}";
};
nginx.enable = true;
nginxlog.enable = true;
node = {
enable = true;
enabledCollectors = [ "systemd" ];
@ -40,14 +31,6 @@ in
}
];
};
# Requiring this for Prometheus being able to monitor my services.
services.nginx.statusPage = true;
services.bind.extraConfig = ''
statistics-channels {
inet 127.0.0.1 port ${builtins.toString bindStatsPort} allow { 127.0.0.1; };
};
'';
}
]);
}

View File

@ -83,5 +83,15 @@ in
nginx-bad-request.settings = { enabled = true; };
};
})
(lib.mkIf hostCfg.services.monitoring.enable {
# Requiring this for Prometheus being able to monitor my services.
services.nginx.statusPage = true;
services.prometheus.exporters = {
nginx.enable = true;
nginxlog.enable = true;
};
})
]);
}

View File

@ -1,117 +0,0 @@
{ config, lib, pkgs, foodogsquaredLib, ... }:
# Take note this service is heavily based on the hardware networking setup of
# this host so better stay focused on the hardware configuration on this host.
let
hostCfg = config.hosts.plover;
cfg = hostCfg.services.wireguard;
inherit (import ../hardware/networks.nix) interfaces wireguardPort wireguardPeers;
wireguardIFName = interfaces.wireguard0.ifname;
desktopPeerAddresses = with wireguardPeers.desktop; [ "${IPv4}/32" "${IPv6}/128" ];
phonePeerAddresses = with wireguardPeers.phone; [ "${IPv4}/32" "${IPv6}/128" ];
in
{
options.hosts.plover.services.wireguard.enable =
lib.mkEnableOption "Wireguard VPN setup";
config = lib.mkIf cfg.enable (lib.mkMerge [
{
environment.systemPackages = [ pkgs.wireguard-tools ];
sops.secrets =
let
systemdNetworkdPermission = {
group = config.users.users.systemd-network.group;
reloadUnits = [ "systemd-networkd.service" ];
mode = "0640";
};
in
foodogsquaredLib.sops-nix.getSecrets ../../secrets/secrets.yaml {
"wireguard/private-key" = systemdNetworkdPermission;
"wireguard/preshared-keys/ni" = systemdNetworkdPermission;
"wireguard/preshared-keys/phone" = systemdNetworkdPermission;
};
# Since we're using systemd-networkd to configure interfaces, we can control
# how each interface can handle things such as IP masquerading so no need for
# modifying sysctl settings like 'ipv4.ip_forward' or similar.
systemd.network = {
wait-online.ignoredInterfaces = [ wireguardIFName ];
netdevs."99-${wireguardIFName}" = {
netdevConfig = {
Name = wireguardIFName;
Kind = "wireguard";
};
wireguardConfig = {
PrivateKeyFile = config.sops.secrets."wireguard/private-key".path;
ListenPort = wireguardPort;
};
wireguardPeers = [
# Desktop workstation.
{
wireguardPeerConfig = {
PublicKey = lib.readFile ../../../ni/files/wireguard/wireguard-public-key-ni;
PresharedKeyFile = config.sops.secrets."wireguard/preshared-keys/ni".path;
AllowedIPs = lib.concatStringsSep "," desktopPeerAddresses;
};
}
# Phone.
{
wireguardPeerConfig = {
PublicKey = lib.readFile ../../files/wireguard/wireguard-public-key-phone;
PresharedKeyFile = config.sops.secrets."wireguard/preshared-keys/phone".path;
AllowedIPs = lib.concatStringsSep "," phonePeerAddresses;
};
}
];
};
networks."99-${wireguardIFName}" = with interfaces.wireguard0; {
matchConfig.Name = ifname;
address = [
"${IPv4.address}/14"
"${IPv6.address}/64"
];
routes = [
{ routeConfig.Gateway = IPv4.gateway; }
];
};
};
}
(lib.mkIf hostCfg.services.firewall.enable {
networking.firewall = {
# Allow the UDP traffic for the Wireguard service.
allowedUDPPorts = [ wireguardPort ];
# IP forwarding for specific interfaces.
filterForward = true;
extraForwardRules = ''
iifname ${wireguardIFName} accept comment "IP forward from Wireguard interface to LAN"
'';
};
networking.nftables.ruleset = ''
table ip wireguard-${wireguardIFName} {
chain prerouting {
type nat hook prerouting priority filter; policy accept;
}
chain postrouting {
type nat hook postrouting priority srcnat; policy accept;
iifname ${wireguardIFName} snat to ${interfaces.lan.IPv4.address} comment "Make packets from Wireguard interface appear as coming from the LAN interface"
}
}
'';
})
]);
}

View File

@ -2,7 +2,12 @@ terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "1.40.0"
version = "1.48.1"
}
hetznerdns = {
source = "timohirt/hetznerdns"
version = "2.2.0"
}
}
}

View File

@ -1,10 +1,11 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, helpers, ... }:
{
imports = [ ./modules ];
config = {
nixvimConfigs.fiesta.setups = {
devenvs.enable = true;
snippets.enable = true;
ui.enable = true;
completion.enable = true;
@ -41,8 +42,7 @@
{
mode = "n";
key = "<leader>bd";
action = "vim.cmd.bdelete";
lua = true;
action = helpers.mkRaw "vim.cmd.bdelete";
options.desc = "Delete current buffer";
}
];

View File

@ -3,6 +3,7 @@
./setups/completion.nix
./setups/debugging.nix
./setups/desktop-utils.nix
./setups/devenvs.nix
./setups/fuzzy-finder.nix
./setups/lsp.nix
./setups/note-taking.nix

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, helpers, ... }:
let
nixvimCfg = config.nixvimConfigs.fiesta;
@ -14,7 +14,10 @@ in
plugins.dap.extensions.dap-virtual-text.enable = true;
plugins.debugprint = {
enable = true;
settings.ignore_treesitter = false;
settings = {
variable_below_alwaysprompt = null;
variable_above_alwaysprompt = null;
};
};
keymaps =
@ -24,24 +27,23 @@ in
{
mode = "n";
key = "${bindingPrefix}${binding}";
lua = true;
} // settings;
in
lib.mapAttrsToList mkDAPBinding
{
"b" = {
options.desc = "Toggle breakpoint";
action = "require('dap').toggle_breakpoint";
action = helpers.mkRaw "require('dap').toggle_breakpoint";
};
"B" = {
options.desc = "Set breakpoint";
action = "require('dap').set_breakpoint";
action = helpers.mkRaw "require('dap').set_breakpoint";
};
"Bp" = {
options.desc = "Set breakpoint with log message";
action = ''
action = helpers.mkRaw ''
function()
require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: '))
end
@ -50,92 +52,92 @@ in
"n" = {
options.desc = "Continue";
action = "require('dap').continue";
action = helpers.mkRaw "require('dap').continue";
};
# You know, like a comma is supposed to do. I got nothing on this one
# but this is the best choice for now.
"," = {
options.desc = "Pause";
action = "require('dap').pause";
action = helpers.mkRaw "require('dap').pause";
};
"d" = {
options.desc = "Terminate";
action = "require('dap').terminate";
action = helpers.mkRaw "require('dap').terminate";
};
"l" = {
options.desc = "Step over";
action = "require('dap').step_over";
action = helpers.mkRaw "require('dap').step_over";
};
"j" = {
options.desc = "Step into";
action = "require('dap').step_into";
action = helpers.mkRaw "require('dap').step_into";
};
"J" = {
options.desc = "Go up";
action = "require('dap').up";
action = helpers.mkRaw "require('dap').up";
};
"k" = {
options.desc = "Step out";
action = "require('dap').step_out";
action = helpers.mkRaw "require('dap').step_out";
};
"K" = {
options.desc = "Go down";
action = "require('dap').down";
action = helpers.mkRaw "require('dap').down";
};
"rs" = {
options.desc = "Restart session";
action = "require('dap').restart";
action = helpers.mkRaw "require('dap').restart";
};
"rr" = {
options.desc = "Open debugging REPL";
action = "require('dap').repl.open";
action = helpers.mkRaw "require('dap').repl.open";
};
"rl" = {
options.desc = "Run last configuration";
action = "require('dap').run_last";
action = helpers.mkRaw "require('dap').run_last";
};
"ph" = {
options.desc = "View the value under the cursor";
action = "require('dap.ui.widgets').hover";
action = helpers.mkRaw "require('dap.ui.widgets').hover";
mode = [ "n" "v" ];
};
"pp" = {
options.desc = "See value in preview window";
action = "require('dap.ui.widgets').preview";
action = helpers.mkRaw "require('dap.ui.widgets').preview";
mode = [ "n" "v" ];
};
}
++ lib.mapAttrsToList mkDAPBinding {
"<F5>" = {
options.desc = "Continue";
action = "require('dap').continue";
action = helpers.mkRaw "require('dap').continue";
};
"<F10>" = {
options.desc = "Step over";
action = "require('dap').step_over";
action = helpers.mkRaw "require('dap').step_over";
};
"<F11>" = {
options.desc = "Step into";
action = "require('dap').step_into";
action = helpers.mkRaw "require('dap').step_into";
};
"<F12>" = {
options.desc = "Step out";
action = "require('dap').step_out";
action = helpers.mkRaw "require('dap').step_out";
};
};
};

View File

@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
let
nixvimCfg = config.nixvimConfigs.fiesta;
cfg = nixvimCfg.setups.devenvs;
in
{
options.nixvimConfigs.fiesta.setups.devenvs.enable =
lib.mkEnableOption "integration for typical devenvs";
config = lib.mkIf cfg.enable {
plugins.direnv.enable = true;
plugins.nvim-remote-containers.enable = true;
};
}

View File

@ -1,4 +1,4 @@
{ config, lib, ... }:
{ config, lib, helpers, ... }:
let
nixvimCfg = config.nixvimConfigs.fiesta;
@ -31,26 +31,23 @@ in
lib.mapAttrsToList mkTelescopeKeymap ({
"A" = {
options.desc = "Resume from last use";
action = "require('telescope.builtin').resume";
lua = true;
action = helpers.mkRaw "require('telescope.builtin').resume";
};
"b" = {
options.desc = "List buffers";
action = "require('telescope.builtin').buffers";
lua = true;
action = helpers.mkRaw "require('telescope.builtin').buffers";
};
"f" = {
options.desc = "Find files";
action = ''
action = helpers.mkRaw ''
function()
require('telescope.builtin').find_files { hidden = true }
end
'';
lua = true;
};
"F" = {
options.desc = "Find files in current directory";
action = ''
action = helpers.mkRaw ''
function()
require('telescope.builtin').find_files {
cwd = require('telescope.utils').buffer_dir(),
@ -58,34 +55,28 @@ in
}
end
'';
lua = true;
};
"g" = {
options.desc = "Find files tracked by Git";
action = "require('telescope.builtin').git_files";
lua = true;
action = helpers.mkRaw "require('telescope.builtin').git_files";
};
"G" = {
options.desc = "Live grep for the whole project";
action = "require('telescope.builtin').live_grep";
lua = true;
action = helpers.mkRaw "require('telescope.builtin').live_grep";
};
"h" = {
options.desc = "Find section from help tags";
action = "require('telescope.builtin').help_tags";
lua = true;
action = helpers.mkRaw "require('telescope.builtin').help_tags";
};
"m" = {
options.desc = "Find manpage entries";
action = "require('telescope.builtin').man_pages";
lua = true;
action = helpers.mkRaw "require('telescope.builtin').man_pages";
};
}
// lib.optionalAttrs nixvimCfg.setups.treesitter.enable {
"t" = {
options.desc = "List symbols from treesitter queries";
action = "require('telescope.builtin').treesitter";
lua = true;
action = helpers.mkRaw "require('telescope.builtin').treesitter";
};
});
};

View File

@ -15,7 +15,10 @@ in
};
config = lib.mkIf cfg.enable {
plugins.lsp.enable = true;
plugins.lsp = {
enable = true;
inlayHints = true;
};
# Keymaps for moving around in the buffer.
plugins.lsp.keymaps.lspBuf = {

Some files were not shown because too many files have changed in this diff Show More