commit 2776098b8c3a04983d497ffe42894b86ca67e3f8 Author: Nathan van Doorn Date: Thu Apr 18 21:39:32 2024 +0200 Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..ee4174c --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# NixOS configuration for NAS server "chopper" + +This repository is for development of the NixOS configuration of my NAS server. + +## Hardware + +This is intended to run on a RockPro64 with two 40TB HDDs as storage and a 64GB +MicroSD card as boot and OS. + +## Goals + +### Zeroth milestone + +- [ ] SSH daemon +- [ ] User who can act as a local admin + +### First milestone + +- [ ] ZFS set up on the HDDs +- [ ] Plex media server + +### Second milestone + +- [ ] Samba for easy file access from Windows +- [ ] NFS for easy file access from Linux + +### Third milestone + +- [ ] Torrent client web control interface available over LAN +- [ ] Torrent client downloads over VPN + +## Building + +To build the SD image: + +```bash +nix build .#nixosConfigurations.chopper.config.system.build.sdImage +``` + +Further instructions can be found on these pages: + +[NixOS Wiki/NixOS on ARM/PINE64 RockPro64](https://wiki.nixos.org/wiki/NixOS_on_ARM/PINE64_ROCKPro64) +[NixOS Wiki/NixOS on ARM/Installation](https://wiki.nixos.org/wiki/NixOS_on_ARM/Installation) + +## Notes + +### Building boot thing + +```bash +nix-build '' -A config.system.build.sdImage -I nixos-config=./sd-image.nix --argstr system aarch64-linux +cp result/sd-image/*.zst . +nix-shell -p zstd --run "unzstd *.zst" +sudo dd if=*.image of=/dev/sda status=progress bs=4096 +``` diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9f76641 --- /dev/null +++ b/flake.lock @@ -0,0 +1,23 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 0, + "narHash": "sha256-XD6GfVgSfWjqqWAuybkvaxS1/xrwTrh3V1dSkoYJW3Q=", + "path": "/nix/store/jjjyazlmzjls1kdpgn776iy9w345yq7l-source", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f208052 --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + outputs = { self, nixpkgs }: { + # miscellaneous stuff that's important + nixosModules.base = {lib, ...}: { + boot.swraid.enable = lib.mkForce false; + networking.hostName = "chopper"; + networking.firewall.enable = true; + system.stateVersion = "24.05"; + }; + # Configuration of individual users + nixosModules.users = {...}: { + users.users.taneb = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIV9ymP4tpq11a8wfUvn8eEEwAPvZZSPZTbASLh7YxOw nvd1234@gmail.com" + ]; + hashedPassword = "$y$j9T$MWZj8eSLcR5nrSOCemh.U/$g9PN2cQ78F8aV2ZJP5YU7xYrEZasQ70VmO5DfQLhc90"; + }; + users.mutableUsers = false; + }; + # Configuration of SSH server + nixosModules.ssh = {...}: { + services.openssh = { + enable = true; + openFirewall = true; + settings.PasswordAuthentication = false; + }; + }; + nixosConfigurations.chopper = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + (nixpkgs + "/nixos/modules/installer/sd-card/sd-image-aarch64.nix") + self.nixosModules.base + self.nixosModules.users + self.nixosModules.ssh + ]; + }; + }; +}