summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
l---------.pre-commit-config.yaml2
-rw-r--r--README.org4
-rw-r--r--flake.nix59
3 files changed, 53 insertions, 12 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index b1255dc..a38d569 120000
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1 +1 @@
-/nix/store/dpkk5c7lx4hrkczwjpzi0qzzkr5i1j8k-pre-commit-config.json \ No newline at end of file
+/nix/store/6fvxyam5cy48j363m8r1xf8jddkrsg5s-pre-commit-config.json \ No newline at end of file
diff --git a/README.org b/README.org
index d22f987..4f6e6ba 100644
--- a/README.org
+++ b/README.org
@@ -16,9 +16,9 @@ as well as writing a lot of things with a literate config. To see more, see my
** So, where is this website of yours located?
https://ret2pop.net, it is the road to enlightenment.
* Wait, so where are your dotfiles?
-To use my dotfiles, download the [[file:robots.txt][ISO image]] (link broken temporarily) for the installer. Note that you can validate the ISO image with the checksum provided:
+To use my dotfiles, download the [[file:installer.iso][ISO image]] for the installer. Note that you can validate the ISO image with the [[file:./installer.iso.sha256][checksum provided]]:
#+begin_src bash
- sha256sum -c nix-installer.iso.sha256
+ sha256sum -c installer.iso.sha256
#+end_src
with the ISO in the same directory. This install installs a certain commit hash of my monorepo. Flash the image, log into the installer, and run:
#+begin_src bash
diff --git a/flake.nix b/flake.nix
index 603c15a..de232f7 100644
--- a/flake.nix
+++ b/flake.nix
@@ -21,6 +21,22 @@
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
+ emacsPackages = import "${nixmacs}/modules/home/emacs-packages.nix";
+ ci-emacs = pkgs.emacs-nox.pkgs.withPackages emacsPackages;
+ specialArgs = { monorepoSelf = self; };
+
+ installer = nixmacs.nixosConfigurations.installer.extendModules {
+ inherit specialArgs;
+ };
+
+ spontaneity = nixmacs.nixosConfigurations.spontaneity.extendModules {
+ inherit specialArgs;
+ };
+
+ installer-iso = installer.config.system.build.isoImage;
+
+ spontaneityHost = spontaneity.config.monorepo.vars.orgHost;
+ spontaneityUser = spontaneity.config.monorepo.vars.userName;
pre-commit-check = git-hooks.lib.${system}.run {
src = ./.;
@@ -67,14 +83,39 @@ if [ "$BRANCH" = "main" ] && [ ! -f "$GIT_DIR/MERGE_HEAD" ]; then
fi
''}";
};
+
+ deploy-spontaneity = {
+ enable = true;
+ name = "Deploy to Spontaneity VPS";
+ description = "Automatically deploys the NixOS configuration to the VPS on push to main";
+ stages = [ "pre-push" ];
+ pass_filenames = false;
+ always_run = true;
+ entry = "${pkgs.writeShellScript "deploy-spontaneity-hook" ''
+BRANCH=$(git branch --show-current)
+
+if [ "$BRANCH" != "main" ]; then
+ exit 0
+fi
+echo "Pushing to main detected. Deploying to ${spontaneityHost}..."
+nixos-rebuild switch --flake .#spontaneity --target-host ${spontaneityUser}@${spontaneityHost}
+if [ $? -eq 0 ]; then
+ echo "Deployment successful!"
+else
+ echo "Deployment failed. Aborting."
+ exit 1
+fi
+ ''}";
+ };
};
};
- emacsPackages = import "${nixmacs}/modules/home/emacs-packages.nix";
- ci-emacs = pkgs.emacs-nox.pkgs.withPackages emacsPackages;
website = pkgs.stdenv.mkDerivation {
name = "org-publish-website";
src = pkgs.lib.cleanSource ./.;
+ nativeBuildInputs = [
+ installer-iso
+ ];
buildInputs = [
ci-emacs
pkgs.git
@@ -95,6 +136,7 @@ fi
})
];
+
buildPhase = ''
export HOME=$TMPDIR/fake-home
mkdir -p $HOME/.emacs.d
@@ -169,17 +211,16 @@ ${publish-org-roam-ui.packages.${system}.default}/bin/build-org-roam-graph \
installPhase = ''
mkdir -p $out
cp -r $HOME/website_html/. $out/
+cp ${installer-iso}/iso/*.iso $out/installer.iso
+cd $out
+sha256sum installer.iso > installer.iso.sha256
'';
};
in
{
nixosConfigurations = {
- installer = nixmacs.nixosConfigurations.installer.extendModules {
- specialArgs = { monorepoSelf = self; };
- };
- spontaneity = nixmacs.nixosConfigurations.spontaneity.extendModules {
- specialArgs = { monorepoSelf = self; };
- };
+ inherit installer;
+ inherit spontaneity;
};
checks."${system}" = {
@@ -188,7 +229,7 @@ cp -r $HOME/website_html/. $out/
packages."${system}" = {
website = website;
- installer = self.nixosConfigurations.installer.config.system.build.isoImage;
+ installer = installer-iso;
spontaneity = self.nixosConfigurations.spontaneity.config.system.build.toplevel;
};