From 7a356af15d6b064e4fff666ee7470e044bf6bd57 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Wed, 27 Oct 2021 15:36:16 -0400 Subject: [PATCH] Setting up basic ops --- flake.nix | 7 +- nki-personal-do/configuration.nix | 23 ++++++ nki-personal-do/flake.lock | 95 ++++++++++++++++++++++ nki-personal-do/flake.nix | 21 +++++ nki-personal-do/hardware-configuration.nix | 7 ++ 5 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 nki-personal-do/configuration.nix create mode 100644 nki-personal-do/flake.lock create mode 100644 nki-personal-do/flake.nix create mode 100644 nki-personal-do/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index 9b59530..e3c7bf5 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,7 @@ }; outputs = { self, darwin, nixpkgs, nixpkgs-unstable, home-manager }: { + # MacBook configuration: nix-darwin + home-manager darwinConfigurations."nki-macbook" = darwin.lib.darwinSystem rec { system = "aarch64-darwin"; modules = [ @@ -18,13 +19,13 @@ { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = { inherit nixpkgs-unstable; }; + home-manager.extraSpecialArgs = { inherit nixpkgs-unstable; }; home-manager.users.nki = import ./home/macbook-home.nix; } ]; inputs = { - inherit darwin nixpkgs-unstable; - nixpkgs = nixpkgs-unstable; + inherit darwin nixpkgs-unstable; + nixpkgs = nixpkgs-unstable; }; }; }; diff --git a/nki-personal-do/configuration.nix b/nki-personal-do/configuration.nix new file mode 100644 index 0000000..817a6dd --- /dev/null +++ b/nki-personal-do/configuration.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: { + imports = [ + ./hardware-configuration.nix + ./networking.nix # generated at runtime by nixos-infect + + ]; + + boot.cleanTmpDir = true; + networking.hostName = "nki-personal"; + networking.firewall.allowPing = true; + services.openssh.enable = true; + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDLr1Q+PJuDYJtBAVMSU0U2kZi4V0Z7dE+dpRxa4aEDupSlcPCwSEtcpNME1up7z0yxjcIHHkBYq0RobIaLqwEmntnZzz37jg/iiHwyZsN93jZljId1X0uykcMem4ljiqgmRg3Fs8RKj2+N1ovpIZVDOWINLJJDVJntNvwW/anSCtx27FATVdroHoiyXCwVknG6p3bHU5Nd3idRMn45kZ7Qf1J50XUhtu3ehIWI2/5nYIbi8WDnzY5vcRZEHROyTk2pv/m9rRkCTaGnUdZsv3wfxeeT3223k0mUfRfCsiPtNDGwXn66HcG2cmhrBIeDoZQe4XNkzspaaJ2+SGQfO8Zf natsukagami@gmail.com" + ]; + + environment.systemPackages = with pkgs; [ + ]; + + services.do-agent.enable = true; + + system.autoUpgrade.enable = true; + system.autoUpgrade.allowReboot = true; +} diff --git a/nki-personal-do/flake.lock b/nki-personal-do/flake.lock new file mode 100644 index 0000000..f0e68ff --- /dev/null +++ b/nki-personal-do/flake.lock @@ -0,0 +1,95 @@ +{ + "nodes": { + "deploy-rs": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs", + "utils": "utils" + }, + "locked": { + "lastModified": 1632822684, + "narHash": "sha256-lt7eayYmgsD5OQwpb1XYfHpxttn43bWo7G7hIJs+zJw=", + "owner": "Serokell", + "repo": "deploy-rs", + "rev": "9a02de4373e0ec272d08a417b269a28ac8b961b4", + "type": "github" + }, + "original": { + "owner": "Serokell", + "repo": "deploy-rs", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1627913399, + "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1632086102, + "narHash": "sha256-wVTcf0UclFS+zHtfPToB13jIO7n0U9N50MuRbPjQViE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e0ce3c683ae677cf5aab597d645520cddd13392b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1622516815, + "narHash": "sha256-ZjBd81a6J3TwtlBr3rHsZspYUwT9OdhDk+a/SgSEf7I=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "7e9b0dff974c89e070da1ad85713ff3c20b0ca97", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "21.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "deploy-rs": "deploy-rs", + "nixpkgs": "nixpkgs_2" + } + }, + "utils": { + "locked": { + "lastModified": 1631561581, + "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nki-personal-do/flake.nix b/nki-personal-do/flake.nix new file mode 100644 index 0000000..0db082a --- /dev/null +++ b/nki-personal-do/flake.nix @@ -0,0 +1,21 @@ +{ + description = "My DigitalOcean nodes flake"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/21.05"; + deploy-rs.url = "github:Serokell/deploy-rs"; + }; + outputs = { self, nixpkgs, deploy-rs } : { + # DigitalOcean node + nixosConfigurations."nki-personal" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ ./configuration.nix ]; + }; + deploy.nodes."nki-personal".profiles.system = { + user = "root"; + path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations."nki-personal"; + }; + + # This is highly advised, and will prevent many possible mistakes + checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; + }; +} diff --git a/nki-personal-do/hardware-configuration.nix b/nki-personal-do/hardware-configuration.nix new file mode 100644 index 0000000..ab775dc --- /dev/null +++ b/nki-personal-do/hardware-configuration.nix @@ -0,0 +1,7 @@ +{ modulesPath, ... }: +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + boot.loader.grub.device = "/dev/vda"; + boot.initrd.kernelModules = [ "nvme" ]; + fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; }; +}