From 1d7f318696c59e8576df5f58702b380fc76ed50b Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Fri, 11 Feb 2022 12:31:44 +0800 Subject: [PATCH] Clean up files --- .envrc | 1 + .github/workflows/iso.yml | 3 ++- README.adoc | 36 +++++++++++++++++++++++++----- hosts/README.adoc | 2 +- modules/nixos/profiles/desktop.nix | 8 ++++++- 5 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml index 20b4da85..cd6c1082 100644 --- a/.github/workflows/iso.yml +++ b/.github/workflows/iso.yml @@ -18,13 +18,14 @@ jobs: run: | nix run github:nix-community/nixos-generators/296067b9c7a172d294831dec89d86847f30a7cfc -- --flake .#bootstrap --format iso --out-link result - name: Create release + if: ${{ github.ref == "refs/heads/master" }} id: create-release uses: marvinpinto/action-automatic-releases@v1.2.1 with: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: latest prerelease: true - title: Pre-release development + title: Latest release files: result/iso/bootstrap-*.iso diff --git a/README.adoc b/README.adoc index 305b9315..4109cb63 100644 --- a/README.adoc +++ b/README.adoc @@ -9,10 +9,22 @@ Here is the result. -== Installation +== Getting started + +Hey there, fellow traveler! +You've fell into the rabbit hole we call Nix where it leads to other rabbit holes such as functional package management, reproducibility, declarative systems, and immutable operating systems. + +This is one of the many tickets to that rabbit hole, allow me to be your guide in this mark:[painful] wonderful declarative journey. +Hope to see you on the other side! + + +=== Installation Since this uses Nix flakes, you should have Nix v2.4 and above installed. +If you're going to install one of my NixOS configs, be sure to download the unstable versions from link:https://releases.nixos.org/?prefix=nixos/unstable/[their release page]. +As an additional option, you can also use link:https://github.com/foo-dogsquared/nixos-config/releases/tag/latest[my personalized NixOS installers] which is primarily intended for me configs. + This primarily uses Nix flakes so you can have a preview of what's available in my config. [source, shell] @@ -27,9 +39,7 @@ To install it, run the `nixos-install --flake github:foo-dogsquared/nixos-config TIP: If you found some error regarding something in restricted mode, you can run the installation with `--impure` flag (i.e., `nixos-install --impure --flake github:foo-dogsquared/nixos-config#ni`). - - -== What's in my flake? +=== What's in my flake? You can see the full details with `nix flake show`. As a helpful summary, here's what my flake should contain sorting from the most interesting and helpful outputs to the most boring and unnecessary. @@ -53,7 +63,6 @@ footnote:[This is more useful than my NixOS modules.] It can be used as additional modules for your own NixOS config in case you want to use mine for whatever reason. footnote:[I don't know why did I put it there but eh...] - * `templates` which contains my templates. Though, these are just templates mostly for my own purposes so it is not as useful as the other outputs. @@ -67,9 +76,22 @@ It's just there for convenience purposes. It's another unnecessary export but it's there. +=== The remote repo + +For a complete overkill, we use a CI to further the configuration abomination. +It uses GitHub workflows to enable things such as... + +* Automatically building link:./pkgs[my custom packages] and sending them to my binary cache to easily distribute it for others. +* Building my personalized NixOS installers and link:https://github.com/foo-dogsquared/nixos-config/releases[making a release out of it]. +* Testing the flake outputs (in progress lel). -== Project structure +=== Project structure + +Last and foremost, we have the project directory — the environment you'll be living in for the next year, tinkering your Nix configs. +. +It is required to be familiar with the workspace, after all. +As previously mentioned, my configuration takes a lot of cues from link:https://github.com/divnix/devos[devos] (which is unfortunately is a lot to take if you're just beginning to grok Nix as a whole). My NixOS config should look like the following: @@ -89,6 +111,8 @@ nixos-config └── README.adoc ---- +Most of the said folders are related to a flake output attribute, see <<_whats_in_my_flake>> for more details. + * link:./hosts/[`./hosts/`] contain machine-specific configuration. This usually configures like the hardware setup, timezone, and users. Host configurations are also exported in the flakes in `outputs.nixosConfigurations`. diff --git a/hosts/README.adoc b/hosts/README.adoc index a3920543..e6308cf6 100644 --- a/hosts/README.adoc +++ b/hosts/README.adoc @@ -11,7 +11,7 @@ Ideally, it should be made minimal as much as possible considering you also have The host configurations placed here most likely use the link:../modules/nixos[custom NixOS modules]. The custom modules shouldn't be imported manually from the host. -In the case for our link:../flake.nix[flake configuration], the importing of modules are already taken care of — specifically through `mkHost` from link:../lib/flake-utils[`../lib/flake-utils`] (see the linked file for the implementation). +In the case for our link:../flake.nix[flake configuration], the importing of modules are already taken care of — specifically through `mkHost` from link:../lib/flake-utils.nix[`../lib/flake-utils.nix`] (see the linked file for the implementation). It is best practice to assume the host configurations make use of the link:../modules/nixos[custom NixOS modules], link:../pkgs[custom packages], and the flake inputs. In other words, always pay attention to link:../flake.nix[`../flake.nix`]. diff --git a/modules/nixos/profiles/desktop.nix b/modules/nixos/profiles/desktop.nix index 63067d1a..a7b2c7c0 100644 --- a/modules/nixos/profiles/desktop.nix +++ b/modules/nixos/profiles/desktop.nix @@ -115,7 +115,13 @@ in { automatic = true; persistent = true; dates = "weekly"; - options = "--delete-older-than 21d"; + options = "--delete-older-than 7d"; + }; + + # Run the optimizer. + nix.optimise = { + automatic = true; + dates = [ "daily" ]; }; # Clear logs that are more than a month old weekly.