diff --git a/README.rst b/README.rst index b7d2737..d0db2b9 100644 --- a/README.rst +++ b/README.rst @@ -1,10 +1,10 @@ JFDIC Ops ========= -NixOps_ deployment configuration for `JFDI Collective`_ services. +Colmena_ deployment configuration for `JFDI Collective`_ services. The canonical home for this repo is https://source.jfdic.org/jfdic/jfdic-ops -.. _NixOps: https://nixos.org/nixops +.. _Colmena: https://colmena.cli.rs/ .. _JFDI Collective: https://jfdic.org/ diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..bfce7af --- /dev/null +++ b/default.nix @@ -0,0 +1,19 @@ +{ + sources ? import ./nix/sources.nix, + system ? builtins.currentSystem, + crossSystem ? null, + config ? {}, + alejandraUnstable ? (import sources.nixpkgsUnstable {}).alejandra, +} @ args: +with import ./nix args; { + shell = mkShell { + buildInputs = [ + alejandraUnstable # The Uncompromising Nix Code Formatter + colmena + niv + treefmt # one CLI to format the code tree + ]; + NIX_PATH = "nixpkgs=${sources.nixpkgs}"; + NIXOPS_DEPLOYMENT = "${globals.deploymentName}"; + }; +} diff --git a/flake.lock b/flake.lock index 7e85e9d..53eb01d 100644 --- a/flake.lock +++ b/flake.lock @@ -32,6 +32,42 @@ "ref": "consensus", "type": "git", "url": "https://source.jfdic.org/JFDIC/jfdic-web/" + "colmena": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs", + "stable": "stable", + "utils": "utils" + }, + "locked": { + "lastModified": 1651093858, + "narHash": "sha256-aGpMiY9pS2616AfAVWA87tULKatDYF2kCKxwYstK8V0=", + "owner": "zhaofengli", + "repo": "colmena", + "rev": "fbefc48d8951347b30ef87e223be6075769810ff", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "v0.3.0", + "repo": "colmena", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" } }, "lowdown-src": { @@ -53,7 +89,7 @@ "nix": { "inputs": { "lowdown-src": "lowdown-src", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixpkgs-regression": "nixpkgs-regression" }, "locked": { @@ -71,38 +107,18 @@ "type": "github" } }, - "nixops": { - "inputs": { - "nixpkgs": "nixpkgs_2", - "utils": "utils" - }, - "locked": { - "lastModified": 1657388807, - "narHash": "sha256-MtTM5KUHIDqnY254chIOp00EmsbYsXR3mXrnbbY4wg0=", - "owner": "NixOS", - "repo": "nixops", - "rev": "dcafae5258773dc0fbdd31b425f1ad3fb59173fe", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "master", - "repo": "nixops", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1657693803, - "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", + "lastModified": 1656372800, + "narHash": "sha256-1u9SDLXvKix/QejNb2sY2J2QZXnbe/14MnLtn+ln9j0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", + "rev": "020c74014b9e2fa905bb4059c979965816cd9118", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-22.05-small", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -141,16 +157,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1656753965, - "narHash": "sha256-BCrB3l0qpJokOnIVc3g2lHiGhnjUi0MoXiw6t1o8H1E=", + "lastModified": 1657693803, + "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0ea7a8f1b939d74e5df8af9a8f7342097cdf69eb", + "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixos-22.05-small", "repo": "nixpkgs", "type": "github" } @@ -192,8 +208,8 @@ "inputs": { "hakyll-skeleton": "hakyll-skeleton", "jfdic-web": "jfdic-web", + "colmena": "colmena", "nix": "nix", - "nixops": "nixops", "nixpkgs": "nixpkgs_3", "nixpkgsUnstable": "nixpkgsUnstable", "resrok-web": "resrok-web", @@ -201,13 +217,29 @@ "voc-web": "voc-web" } }, + "stable": { + "locked": { + "lastModified": 1656782578, + "narHash": "sha256-1eMCBEqJplPotTo/SZ/t5HU6Sf2I8qKlZi9MX7jv9fw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "573603b7fdb9feb0eb8efc16ee18a015c667ab1b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.11", + "repo": "nixpkgs", + "type": "github" + } + }, "utils": { "locked": { - "lastModified": 1634851050, - "narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=", + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "c91f3de5adaf1de973b797ef7485e441a65b8935", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1cc7159..060246f 100644 --- a/flake.nix +++ b/flake.nix @@ -15,14 +15,14 @@ url = git+https://source.jfdic.org/resrok/resrok-web/?ref=consensus; }; nix.url = "github:NixOS/nix/?ref=2.10.3"; - nixops.url = github:NixOS/nixops/?ref=master; - nixpkgs.url = github:NixOS/nixpkgs/?ref=nixos-22.11; + nixpkgs.url = github:NixOS/nixpkgs/?ref=nixos-22.05; nixpkgsUnstable.url = github:NixOS/nixpkgs/?ref=nixos-unstable; utils.url = "github:numtide/flake-utils"; voc-web = { flake = false; url = git+https://source.jfdic.org/voc/voc-web/?ref=consensus; }; + colmena.url = github:zhaofengli/colmena/?ref=v0.3.0; }; outputs = {...} @ args: import ./outputs.nix args; diff --git a/nixos/configurations.nix b/nixos/configurations.nix new file mode 100644 index 0000000..aadc46d --- /dev/null +++ b/nixos/configurations.nix @@ -0,0 +1,30 @@ +{ + self, + nixpkgs, + inputs, + nix, + ... +}: let + nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem; + customModules = import ../modules/modules-list.nix; + baseModules = [ + # make flake inputs accessiable in NixOS + {_module.args.inputs = inputs;} + { + imports = [ + ({pkgs, ...}: { + nix.nixPath = [ + "nixpkgs=${pkgs.path}" + ]; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + documentation.info.enable = false; + }) + ]; + } + ]; + defaultModules = baseModules ++ customModules; +in { + toscano = import ./hosts/toscano.nix; +} diff --git a/outputs.nix b/outputs.nix index d3be2f7..736c0af 100644 --- a/outputs.nix +++ b/outputs.nix @@ -2,8 +2,8 @@ self, hakyll-skeleton, jfdic-web, + colmena, nix, - nixops, nixpkgs, nixpkgsUnstable, resrok-web, @@ -12,15 +12,14 @@ ... } @ inputs: (utils.lib.eachDefaultSystem (system: let - pkgs = - nixpkgs.legacyPackages."${system}"; + pkgs = nixpkgs.legacyPackages."${system}"; in { devShell = pkgs.callPackage ./shell.nix { + inherit (colmena.packages."${pkgs.system}") colmena; inherit (nix.packages."${pkgs.system}") nix; inherit (nixpkgsUnstable.legacyPackages."${pkgs.system}") alejandra; - nixops = nixops.defaultPackage."${pkgs.system}"; }; })) // { @@ -39,5 +38,19 @@ in { imports = [./profiles/host_common.nix]; }; toscano = import ./hosts/toscano.nix; + colmena = { + meta = { + description = "jfdic-ops deployment"; + name = "jfdic-ops"; + nixpkgs = import nixpkgs { + system = "x86_64-linux"; + overlays = []; + }; + }; + nixosConfigurations = import ./nixos/configurations.nix (inputs + // { + inherit inputs; + }); + }; }; } diff --git a/shell.nix b/shell.nix index a6c2c48..0ba0b4e 100644 --- a/shell.nix +++ b/shell.nix @@ -2,15 +2,15 @@ pkgs ? import {}, alejandra, mkShell, - nixops, + colmena, nix, }: with pkgs; mkShell { buildInputs = [ alejandra # The Uncompromising Nix Code Formatter - nixops - nix + colmena # simple, stateless NixOS deployment tool + nix # Powerful package manager, makes packaging reliable & reproducible tea # Gitea official CLI client treefmt # one CLI to format the code tree ];