diff options
| author | seth <[email protected]> | 2024-05-10 21:18:35 -0400 |
|---|---|---|
| committer | seth <[email protected]> | 2024-05-10 21:30:32 -0400 |
| commit | 292a7d201f86d0af8b744896418208e975ba47a8 (patch) | |
| tree | 6e7f78777db7881292b5ef2194e41dde048646d5 | |
| parent | 1ec692c24c5b3345e6d7fe1445f2a51b1e322f03 (diff) | |
systems: deploy-rs -> nixinate for 12343894th time
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | flake.lock | 47 | ||||
| -rw-r--r-- | flake.nix | 14 | ||||
| -rw-r--r-- | justfile | 16 | ||||
| -rw-r--r-- | lib/default.nix | 44 | ||||
| -rw-r--r-- | lib/deploy.nix | 39 | ||||
| -rw-r--r-- | lib/nginx.nix | 2 | ||||
| -rw-r--r-- | modules/flake/configurations.nix | 1 | ||||
| -rw-r--r-- | systems/atlas/default.nix | 14 | ||||
| -rw-r--r-- | systems/default.nix | 12 |
10 files changed, 62 insertions, 129 deletions
@@ -33,7 +33,7 @@ there are some amazing tools i use to make/manage this flake that i would highly - [home-manager](https://github.com/nix-community/home-manager) - [agenix](https://github.com/ryantm/agenix) - [garnix](https://garnix.io) -- [deploy-rs](https://github.com/serokell/deploy-rs) +- [nixinate](https://github.com/MatthewCroughan/nixinate) - [flake-parts](https://github.com/hercules-ci/flake-parts) - [terranix](https://github.com/terranix/terranix) - [lanzaboote](https://github.com/nix-community/lanzaboote) @@ -109,31 +109,6 @@ "type": "github" } }, - "deploy": { - "inputs": { - "flake-compat": [], - "nixpkgs": [ - "nixpkgs" - ], - "utils": [ - "lanzaboote", - "flake-utils" - ] - }, - "locked": { - "lastModified": 1711973905, - "narHash": "sha256-UFKME/N1pbUtn+2Aqnk+agUt8CekbpuqwzljivfIme8=", - "owner": "serokell", - "repo": "deploy-rs", - "rev": "88b3059b020da69cbe16526b8d639bd5e0b51c8b", - "type": "github" - }, - "original": { - "owner": "serokell", - "repo": "deploy-rs", - "type": "github" - } - }, "fenix": { "inputs": { "nixpkgs": [ @@ -343,6 +318,26 @@ "type": "github" } }, + "nixinate": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708891350, + "narHash": "sha256-VOQrKK7Df/IVuNki+NshVuGkTa/Tw0GigPjWcZff6kk=", + "owner": "MatthewCroughan", + "repo": "nixinate", + "rev": "452f33c60df5b72ad0858f5f2cf224bdf1f17746", + "type": "github" + }, + "original": { + "owner": "MatthewCroughan", + "repo": "nixinate", + "type": "github" + } + }, "nixos-wsl": { "inputs": { "flake-compat": [], @@ -440,7 +435,6 @@ "arkenfox": "arkenfox", "catppuccin": "catppuccin", "darwin": "darwin", - "deploy": "deploy", "firefox-addons": "firefox-addons", "flake-checks": "flake-checks", "flake-parts": "flake-parts", @@ -449,6 +443,7 @@ "krunner-nix": "krunner-nix", "lanzaboote": "lanzaboote", "nix-index-database": "nix-index-database", + "nixinate": "nixinate", "nixos-wsl": "nixos-wsl", "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable", @@ -70,15 +70,6 @@ catppuccin.url = "github:catppuccin/nix"; - deploy = { - url = "github:serokell/deploy-rs"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-compat.follows = ""; - utils.follows = "lanzaboote/flake-utils"; - }; - }; - firefox-addons = { url = "sourcehut:~rycee/nur-expressions?dir=pkgs/firefox-addons"; inputs = { @@ -114,6 +105,11 @@ }; }; + nixinate = { + url = "github:MatthewCroughan/nixinate"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-index-database = { url = "github:nix-community/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; @@ -16,6 +16,8 @@ default: rebuild subcmd *extraArgs="": {{ rebuild }} {{ subcmd }} {{ rebuildArgs }} --flake . {{ extraArgs }} +boot *extraArgs="": (rebuild "boot" extraArgs) + build *extraArgs="": (rebuild "build" extraArgs) dry-run *extraArgs="": (rebuild "dry-run" extraArgs) @@ -48,18 +50,8 @@ update-input input: --commit-lock-file \ --commit-lockfile-summary "flake: update {{ input }}" -deploy system *args="": - nix run \ - --inputs-from . \ - 'nixpkgs#deploy-rs' -- \ - '.#{{ system }}' \ - {{ args }} - -deploy-all *args="": - nix run \ - --inputs-from . \ - 'nixpkgs#deploy-rs' -- \ - {{ args }} +deploy system: + nix run '.#{{ system }}' clean: rm -rf \ diff --git a/lib/default.nix b/lib/default.nix index 9a67a2e..92ae0f0 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,32 +1,14 @@ -{ - lib, - inputs, - ... -}: { - flake.lib = - (lib.extend (final: prev: let - readDir' = dir: - prev.filterAttrs (name: ( - prev.const (name != "default.nix") - )) (builtins.readDir dir); - in { - my = - prev.recursiveUpdate - ( - prev.mapAttrs' (name: ( - prev.const ( - prev.nameValuePair - (prev.removeSuffix ".nix" name) - (import ./${name} { - lib = final; - inherit inputs; - }) - ) - )) (readDir' ./.) - ) - { - inherit readDir'; - }; - })) - .my; +{lib, ...}: let + fnsFrom = files: + builtins.listToAttrs ( + map (file: { + name = lib.removeSuffix ".nix" (baseNameOf file); + value = import file lib; + }) + files + ); +in { + flake.lib = fnsFrom [ + ./nginx.nix + ]; } diff --git a/lib/deploy.nix b/lib/deploy.nix deleted file mode 100644 index fa15dc6..0000000 --- a/lib/deploy.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ - lib, - inputs, - ... -}: let - inherit (inputs) self; - configurations = self.nixosConfigurations // self.darwinConfigurations; - - getDeploy = pkgs: - (pkgs.appendOverlays [ - inputs.deploy.overlay - (_: prev: { - deploy-rs = { - inherit (pkgs) deploy-rs; - inherit (prev.deploy-rs) lib; - }; - }) - ]) - .deploy-rs; - - toType = system: - { - "Linux" = "nixos"; - "Darwin" = "darwin"; - } - .${system}; - - toDeployNode = hostname: system: { - sshUser = "root"; - inherit hostname; - profiles.system.path = let - deploy = getDeploy system.pkgs; - type = toType system.pkgs.stdenv.hostPlatform.uname.system; - in - deploy.lib.activate.${type} system; - }; -in { - mapNodes = targets: lib.mapAttrs toDeployNode (lib.getAttrs targets configurations); -} diff --git a/lib/nginx.nix b/lib/nginx.nix index 1b1c951..bcf3332 100644 --- a/lib/nginx.nix +++ b/lib/nginx.nix @@ -1,4 +1,4 @@ -{lib, ...}: { +lib: { mkProxy = endpoint: port: { "${endpoint}" = { proxyPass = "http://localhost:${toString port}"; diff --git a/modules/flake/configurations.nix b/modules/flake/configurations.nix index 210f23e..312adcf 100644 --- a/modules/flake/configurations.nix +++ b/modules/flake/configurations.nix @@ -158,7 +158,6 @@ in { # i don't like prefixing so much with `flake` imports = [ - (mkAliasOptionModule ["deploy"] ["flake" "deploy"]) (mkAliasOptionModule ["nixosModules"] ["flake" "nixosModules"]) (mkAliasOptionModule ["darwinModules"] ["flake" "darwinModules"]) (mkAliasOptionModule ["homeModules"] ["flake" "homeModules"]) diff --git a/systems/atlas/default.nix b/systems/atlas/default.nix index 9f2f6b0..df55b62 100644 --- a/systems/atlas/default.nix +++ b/systems/atlas/default.nix @@ -1,4 +1,8 @@ -{modulesPath, ...}: { +{ + config, + modulesPath, + ... +}: { imports = [ (modulesPath + "/profiles/minimal.nix") ./hardware-configuration.nix @@ -7,6 +11,14 @@ ./teawiebot.nix ]; + _module.args.nixinate = { + host = config.networking.hostName; + sshUser = "root"; + buildOn = "remote"; + substituteOnTarget = true; + hermetic = false; + }; + archetypes.server.enable = true; base.networking.enable = false; diff --git a/systems/default.nix b/systems/default.nix index 441628f..c608e9c 100644 --- a/systems/default.nix +++ b/systems/default.nix @@ -9,14 +9,6 @@ }; }; - deploy = { - remoteBuild = true; - fastConnection = false; - nodes = self.lib.deploy.mapNodes [ - "atlas" - ]; - }; - nixosConfigurations = let stable = inputs.nixpkgs-stable.lib.nixosSystem; in { @@ -33,4 +25,8 @@ system = "aarch64-linux"; }; }; + + perSystem = {system, ...}: { + apps = (inputs.nixinate.nixinate.${system} self).nixinate; + }; } |
