From 17931a7b7bd18870a1a82f5efbd22719f7277976 Mon Sep 17 00:00:00 2001 From: James Walker Date: Fri, 29 Apr 2022 14:23:10 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20messing=20around=20with=20flakes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .envrc | 2 +- .gitignore | 1 + flake.lock | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 72 +++++++++++++++++++++++++++ 4 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.envrc b/.envrc index 1d953f4..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7ad6275 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.direnv diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..41a9989 --- /dev/null +++ b/flake.lock @@ -0,0 +1,144 @@ +{ + "nodes": { + "deploy-rs": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs", + "utils": "utils" + }, + "locked": { + "lastModified": 1648475189, + "narHash": "sha256-gAGAS6IagwoUr1B0ohE3iR6sZ8hP4LSqzYLC8Mq3WGU=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "83e0c78291cd08cb827ba0d553ad9158ae5a95c3", + "type": "github" + }, + "original": { + "owner": "serokell", + "repo": "deploy-rs", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1648199409, + "narHash": "sha256-JwPKdC2PoVBkG6E+eWw3j6BMR6sL3COpYWfif7RVb8Y=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "64a525ee38886ab9028e6f61790de0832aa3ef03", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1651007090, + "narHash": "sha256-C/OoQRzTUOWEr1sd3xTKA2GudA1YG1XB3MlL6KfTchg=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "778af87a981eb2bfa3566dff8c3fb510856329ef", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1648219316, + "narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1651114127, + "narHash": "sha256-/lLC0wkMZkAdA5e1W76SnJzbhfOGDvync3VRHJMtAKk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6766fb6503ae1ebebc2a9704c162b2aef351f921", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1651007983, + "narHash": "sha256-GNay7yDPtLcRcKCNHldug85AhAvBpTtPEJWSSDYBw8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e10da1c7f542515b609f8dfbcf788f3d85b14936", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "deploy-rs": "deploy-rs", + "flake-utils": "flake-utils", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs_3" + } + }, + "utils": { + "locked": { + "lastModified": 1648297722, + "narHash": "sha256-W+qlPsiZd8F3XkzXOzAoR+mpFqzm3ekQkJNa+PIh1BQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "0f8662f1319ad6abf89b3380dd2722369fc51ade", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..d27910e --- /dev/null +++ b/flake.nix @@ -0,0 +1,72 @@ +{ + description = "walkah's little city state"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + flake-utils.url = "github:numtide/flake-utils"; + deploy-rs.url = "github:serokell/deploy-rs"; + }; + + outputs = { self, nixpkgs, deploy-rs, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + devShells.default = pkgs.mkShell { + buildInputs = [ + deploy-rs.packages.${system}.deploy-rs + pkgs.sops + ]; + }; + } + ) + // { + nixosConfigurations = { + agent = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + ./hosts/aristotle/configuration.nix + ({ config, ... }: { + networking.hostName = "agent"; + }) + ]; + }; + + form = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + ./hosts/aristotle/configuration.nix + ({ config, ... }: { + networking.hostName = "form"; + }) + ]; + }; + + }; + + deploy.nodes = { + agent = { + hostname = "agent"; + sshUser = "root"; + profiles.system = { + user = "root"; + path = deploy-rs.lib.aarch64-linux.activate.nixos + self.nixosConfigurations.agent; + }; + }; + + form = { + hostname = "form"; + sshUser = "root"; + profiles.system = { + user = "root"; + path = deploy-rs.lib.aarch64-linux.activate.nixos + self.nixosConfigurations.form; + }; + }; + }; + }; +}