Skyler Grey | 1e2187f | 2023-03-03 22:45:10 +0000 | [diff] [blame] | 1 | { |
| 2 | description = "A flake to deploy and configure Clicks' NixOS server"; |
| 3 | |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 4 | # input URLs |
Skyler Grey | 915067d | 2023-12-03 13:46:53 +0000 | [diff] [blame] | 5 | inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; |
Skyler Grey | b30f5dd | 2023-09-01 21:02:44 +0000 | [diff] [blame] | 6 | inputs.nixpkgs-clicksforms.url = "github:nixos/nixpkgs/nixos-22.05"; |
Skyler Grey | 061574c | 2023-05-01 21:39:24 +0000 | [diff] [blame] | 7 | inputs.flake-utils.url = "github:numtide/flake-utils"; |
Skyler Grey | 1e2187f | 2023-03-03 22:45:10 +0000 | [diff] [blame] | 8 | inputs.deploy-rs.url = "github:serokell/deploy-rs"; |
Skyler Grey | 915067d | 2023-12-03 13:46:53 +0000 | [diff] [blame] | 9 | inputs.home-manager.url = "github:nix-community/home-manager/release-23.11"; |
Skyler Grey | a7fbaee | 2023-05-12 00:29:20 +0000 | [diff] [blame] | 10 | inputs.sops-nix.url = "github:Mic92/sops-nix"; |
Skyler Grey | a78aa67 | 2023-05-20 13:48:18 +0200 | [diff] [blame] | 11 | inputs.scalpel.url = "github:polygon/scalpel"; |
Skyler Grey | 1e2187f | 2023-03-03 22:45:10 +0000 | [diff] [blame] | 12 | |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 13 | inputs.nixpkgs-privatebin.url = "github:e1mo/nixpkgs/privatebin"; |
| 14 | inputs.nixpkgs-mongodb.url = "github:nixos/nixpkgs?rev=8dfad603247387df1df4826b8bea58efc5d012d8"; |
| 15 | |
Skyler Grey | 22428b0 | 2023-11-19 13:20:56 +0000 | [diff] [blame] | 16 | inputs.helpers.url = "git+https://git.clicks.codes/Clicks/NixHelpers"; |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 17 | |
Skyler Grey | fc04859 | 2024-03-10 13:46:17 +0000 | [diff] [blame] | 18 | inputs.frappix.url = "github:blaggacao/frappix"; |
| 19 | |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 20 | # follow settings |
Skyler Grey | fed0bb1 | 2023-05-01 21:42:03 +0000 | [diff] [blame] | 21 | inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs"; |
Skyler Grey | fed0bb1 | 2023-05-01 21:42:03 +0000 | [diff] [blame] | 22 | |
Skyler Grey | a7fbaee | 2023-05-12 00:29:20 +0000 | [diff] [blame] | 23 | inputs.sops-nix.inputs.nixpkgs.follows = "nixpkgs"; |
| 24 | |
Skyler Grey | a78aa67 | 2023-05-20 13:48:18 +0200 | [diff] [blame] | 25 | inputs.scalpel.inputs.nixpkgs.follows = "nixpkgs"; |
| 26 | inputs.scalpel.inputs.sops-nix.follows = "sops-nix"; |
| 27 | |
Skyler Grey | c5ed69c | 2023-12-23 02:25:41 +0000 | [diff] [blame] | 28 | inputs.gerrit-oauth = { |
| 29 | url = "https://gerrit-ci.gerritforge.com/job/plugin-oauth-bazel-master-master/lastBuild/artifact/bazel-bin/plugins/oauth/oauth.jar"; |
| 30 | flake = false; |
| 31 | }; |
| 32 | |
Skyler Grey | fc04859 | 2024-03-10 13:46:17 +0000 | [diff] [blame] | 33 | inputs.frappix.inputs.nixpkgs.follows = "nixpkgs"; |
| 34 | |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 35 | outputs = { self, nixpkgs, deploy-rs, home-manager, sops-nix, scalpel |
Skyler Grey | fc04859 | 2024-03-10 13:46:17 +0000 | [diff] [blame] | 36 | , nixpkgs-privatebin, frappix, ... }@inputs: |
Skyler Grey | 07584fb | 2023-05-01 21:37:13 +0000 | [diff] [blame] | 37 | let |
| 38 | system = "x86_64-linux"; |
| 39 | pkgs = import nixpkgs { |
| 40 | inherit system; |
| 41 | config.allowUnfree = true; |
Skyler Grey | fc04859 | 2024-03-10 13:46:17 +0000 | [diff] [blame] | 42 | |
| 43 | # frappix -> wkhtmltopdf |
| 44 | config.permittedInsecurePackages = ["openssl-1.1.1w"]; |
| 45 | |
Skyler Grey | 9fe6128 | 2023-08-20 21:52:48 +0000 | [diff] [blame] | 46 | overlays = [ |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 47 | (final: prev: { |
| 48 | inherit (nixpkgs-privatebin.legacyPackages.${system}) |
| 49 | privatebin pbcli; |
| 50 | }) |
Skyler Grey | fc04859 | 2024-03-10 13:46:17 +0000 | [diff] [blame] | 51 | frappix.toolsOverlay.${system} |
| 52 | frappix.pythonOverlay.${system} |
| 53 | frappix.frappeOverlay.${system} |
Skyler Grey | 9fe6128 | 2023-08-20 21:52:48 +0000 | [diff] [blame] | 54 | ]; |
Skyler Grey | 07584fb | 2023-05-01 21:37:13 +0000 | [diff] [blame] | 55 | }; |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 56 | helpers = inputs.helpers.helpers { inherit pkgs nixpkgs; }; |
| 57 | drive_paths = import ./variables/drive_paths.nix; |
| 58 | |
| 59 | a1d1 = import ./modules/a1d1 { inherit self pkgs system inputs drive_paths; }; |
| 60 | a1d2 = import ./modules/a1d2 { inherit self pkgs system inputs; drive_paths = null; }; |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 61 | in rec { |
| 62 | nixosConfigurations.clicks = let |
| 63 | base = nixpkgs.lib.nixosSystem { |
| 64 | inherit system pkgs; |
Skyler Grey | 07584fb | 2023-05-01 21:37:13 +0000 | [diff] [blame] | 65 | modules = [ |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 66 | { |
| 67 | system.stateVersion = "22.11"; |
| 68 | nix.settings.experimental-features = [ "nix-command" "flakes" ]; |
Samuel Shuert | 32d3fb5 | 2023-11-22 16:25:10 -0500 | [diff] [blame] | 69 | nix.settings.trusted-users = [ "minion" "coded" ]; |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 70 | time.timeZone = "Etc/UTC"; |
| 71 | users.mutableUsers = false; |
| 72 | |
| 73 | fileSystems."/" = {}; |
| 74 | } |
| 75 | ] |
| 76 | ++ (helpers.nixFilesIn ./modules/common) |
| 77 | ++ [ |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 78 | sops-nix.nixosModules.sops |
| 79 | "${nixpkgs-privatebin}/nixos/modules/services/web-apps/privatebin.nix" |
Skyler Grey | fc04859 | 2024-03-10 13:46:17 +0000 | [diff] [blame] | 80 | frappix.nixosModules.${system}.frappix |
Skyler Grey | 07584fb | 2023-05-01 21:37:13 +0000 | [diff] [blame] | 81 | ]; |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 82 | specialArgs = inputs // { |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 83 | base = null; |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 84 | inherit system; |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 85 | inherit helpers; |
| 86 | drive_paths = null; |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 87 | }; |
Skyler Grey | 4f3e606 | 2023-03-04 01:29:29 +0000 | [diff] [blame] | 88 | }; |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 89 | in base.extendModules { |
| 90 | modules = [ scalpel.nixosModules.scalpel ]; |
| 91 | specialArgs = { inherit base; }; |
| 92 | }; |
Skyler Grey | 07584fb | 2023-05-01 21:37:13 +0000 | [diff] [blame] | 93 | |
Skyler Grey | b3516c2 | 2023-05-24 19:17:11 +0200 | [diff] [blame] | 94 | nixosConfigurations.clicks-without-mongodb = |
| 95 | nixosConfigurations.clicks.extendModules { |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 96 | modules = [{ services.mongodb.enable = nixpkgs.lib.mkForce false; }]; |
Skyler Grey | b3516c2 | 2023-05-24 19:17:11 +0200 | [diff] [blame] | 97 | }; |
| 98 | |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 99 | nixosConfigurations.a1d1 = a1d1.config; |
| 100 | nixosConfigurations.a1d2 = a1d2.config; |
Skyler Grey | 07584fb | 2023-05-01 21:37:13 +0000 | [diff] [blame] | 101 | |
Samuel Shuert | f68685d | 2023-10-28 20:07:56 -0400 | [diff] [blame] | 102 | deploy.nodes.a1d1 = a1d1.deploy; |
| 103 | deploy.nodes.a1d2 = a1d2.deploy; |
Skyler Grey | 1e2187f | 2023-03-03 22:45:10 +0000 | [diff] [blame] | 104 | |
Skyler Grey | fe1740c | 2023-10-21 01:24:18 +0000 | [diff] [blame] | 105 | devShells.x86_64-linux.default = |
| 106 | pkgs.mkShell { packages = [ pkgs.deploy-rs ]; }; |
Skyler Grey | b30f5dd | 2023-09-01 21:02:44 +0000 | [diff] [blame] | 107 | |
Skyler Grey | 2ca6ccd | 2023-10-14 22:56:43 +0000 | [diff] [blame] | 108 | formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt; |
Skyler Grey | 1e2187f | 2023-03-03 22:45:10 +0000 | [diff] [blame] | 109 | }; |
Skyler Grey | 1e2187f | 2023-03-03 22:45:10 +0000 | [diff] [blame] | 110 | } |