From 0357641dd065a2b9e84750274480aa46dfa9cfb7 Mon Sep 17 00:00:00 2001 From: Polen Date: Thu, 5 Jun 2025 14:23:59 -0400 Subject: [PATCH] adding the server config --- devices/server/configuration.nix | 58 +++++ devices/server/disk-config.nix | 54 +++++ flake.lock | 391 ++----------------------------- flake.nix | 26 +- 4 files changed, 145 insertions(+), 384 deletions(-) create mode 100644 devices/server/configuration.nix create mode 100644 devices/server/disk-config.nix diff --git a/devices/server/configuration.nix b/devices/server/configuration.nix new file mode 100644 index 0000000..5e41ae8 --- /dev/null +++ b/devices/server/configuration.nix @@ -0,0 +1,58 @@ +{ + config, + pkgs, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ./disk-config.nix + ]; + + boot.loader = { + systemd-boot = { + enable = true; + configurationLimit = 10; + }; + efi.canTouchEfiVariables = true; + }; + + services.openssh.enable = true; + + boot.kernelModules = ["msr"]; + + networking.hostName = "server"; + + time.timeZone = "America/Toronto"; + + users.users.polen = { + isNormalUser = true; + description = "polen"; + extraGroups = ["wheel"]; + shell = pkgs.zsh; + }; + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC6O2MJqR+P/FwRyVSz1HWYhMtIwh16ozBU71Y2vf0oNDQ6DZ5T8Bvp5/4uSJgS8lOl3qYyNy0e0zJMIyfFVJnu89ycKBEdixA4HqWOUQGiyvn1C4s740jHolOzN1xNB24PDXFz0vHcVb+G5nU/xeKeaq0vrszrkK2zctqXshw94/x3ah0m3fr5CwM4S2RY/VODOdt11fllFEvN8HGE2mQTPn5sJzwtGW20npQ5iJ7ShugPbC4D1G2JU1R7MqkvWEpq9OFVb1prTpJM+i/lcqCn3lBv8XxpKKnD3q+48eeO1geosAsG/kgUWPDildbzcSfytgj7/TCTujx2ow4ZUfS4kWUrNaXM3M99SG61rFN7zLMAv14SOSsgegmX3q0ZAwOieUhCifqIqdfFr5QjEUP11ALofYRC6567X1YrEVXZFFnZSXMKGkBKpTxx0jaTTGnFSd6F49kDlI30cKJnVUgAK5nESissdEFn3UGRSFfxmjZkYvhY5l3LqtbO3kEutJU= polen@polen-xps" + ]; + + environment.systemPackages = with pkgs; [ + neovim + htop-vim + ]; + + programs.zsh.enable = true; + + nixpkgs.config.allowUnfree = true; + nix = { + settings.experimental-features = ["nix-command" "flakes"]; + settings.trusted-users = ["polen"]; + # settings.extra-platforms = config.boot.binfmt.emulatedSystems; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 15d"; + }; + }; + + system.stateVersion = "25.05"; # Did you read the comment? +} diff --git a/devices/server/disk-config.nix b/devices/server/disk-config.nix new file mode 100644 index 0000000..8f36ed4 --- /dev/null +++ b/devices/server/disk-config.nix @@ -0,0 +1,54 @@ +{lib, ...}: { + disko.devices = { + disk.disk1 = { + device = lib.mkDefault "/dev/sda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + }; + }; + }; + }; + lvm_vg = { + pool = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%FREE"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ + "defaults" + ]; + }; + }; + }; + }; + }; + }; +} diff --git a/flake.lock b/flake.lock index 15e79dd..93a0054 100644 --- a/flake.lock +++ b/flake.lock @@ -1,41 +1,25 @@ { "nodes": { - "devshell": { + "disko": { "inputs": { "nixpkgs": [ - "nixvim", - "nixvim", "nixpkgs" ] }, "locked": { - "lastModified": 1728330715, - "narHash": "sha256-xRJ2nPOXb//u1jaBnDP56M7v5ldavjbtR6lfGqSvcKg=", - "owner": "numtide", - "repo": "devshell", - "rev": "dd6b80932022cea34a019e2bb32f6fa9e494dfef", + "lastModified": 1749089136, + "narHash": "sha256-A1UgwtAEQYd38Z6VoRAiGs4jZQczAGyP5DF3hhYUdpg=", + "owner": "nix-community", + "repo": "disko", + "rev": "a4f7deb49f7336feb6c5abaf213b374936421dbe", "type": "github" }, "original": { - "owner": "numtide", - "repo": "devshell", + "owner": "nix-community", + "repo": "disko", "type": "github" } }, - "flake-compat": { - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "revCount": 57, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -55,49 +39,9 @@ } }, "flake-parts_2": { - "inputs": { - "nixpkgs-lib": [ - "nixvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1727826117, - "narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_3": { "inputs": { "nixpkgs-lib": "nixpkgs-lib_2" }, - "locked": { - "lastModified": 1730504689, - "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "506278e768c2a08bec68eb62932193e341f55c90", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_4": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib_3" - }, "locked": { "lastModified": 1741352980, "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", @@ -116,24 +60,6 @@ "inputs": { "systems": "systems" }, - "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "inputs": { - "systems": "systems_2" - }, "locked": { "lastModified": 1731533236, "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", @@ -148,114 +74,6 @@ "type": "github" } }, - "git-hooks": { - "inputs": { - "flake-compat": [ - "nixvim", - "nixvim", - "flake-compat" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "nixvim", - "nixvim", - "nixpkgs" - ], - "nixpkgs-stable": [ - "nixvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730302582, - "narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=", - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "nixvim", - "nixvim", - "git-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730016908, - "narHash": "sha256-bFCxJco7d8IgmjfNExNz9knP8wvwbXU4s/d53KOK6U0=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "e83414058edd339148dc142a8437edb9450574c8", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "ixx": { - "inputs": { - "flake-utils": [ - "nixvim", - "nixvim", - "nuschtosSearch", - "flake-utils" - ], - "nixpkgs": [ - "nixvim", - "nixvim", - "nuschtosSearch", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1729544999, - "narHash": "sha256-YcyJLvTmN6uLEBGCvYoMLwsinblXMkoYkNLEO4WnKus=", - "owner": "NuschtOS", - "repo": "ixx", - "rev": "65c207c92befec93e22086da9456d3906a4e999c", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "ref": "v0.0.5", - "repo": "ixx", - "type": "github" - } - }, "mnw": { "locked": { "lastModified": 1742255973, @@ -317,28 +135,6 @@ "type": "github" } }, - "nix-darwin_2": { - "inputs": { - "nixpkgs": [ - "nixvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730184279, - "narHash": "sha256-6OB+WWR6gnaWiqSS28aMJypKeK7Pjc2Wm6L0MtOrTuA=", - "owner": "lnl7", - "repo": "nix-darwin", - "rev": "b379bd4d872d159e5189053ce9a4adf86d56db4b", - "type": "github" - }, - "original": { - "owner": "lnl7", - "repo": "nix-darwin", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1747728033, @@ -368,18 +164,6 @@ } }, "nixpkgs-lib_2": { - "locked": { - "lastModified": 1730504152, - "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" - } - }, - "nixpkgs-lib_3": { "locked": { "lastModified": 1740877520, "narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=", @@ -411,38 +195,6 @@ } }, "nixpkgs_3": { - "locked": { - "lastModified": 1730200266, - "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1730200266, - "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_5": { "locked": { "lastModified": 1744868846, "narHash": "sha256-5RJTdUHDmj12Qsv7XOhuospjAjATNiTMElplWnJE9Hs=", @@ -458,7 +210,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_4": { "locked": { "lastModified": 1744098102, "narHash": "sha256-tzCdyIJj9AjysC3OuKA+tMD/kDEDAF9mICPDU7ix0JA=", @@ -474,7 +226,7 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_5": { "locked": { "lastModified": 1743076231, "narHash": "sha256-yQugdVfi316qUfqzN8JMaA2vixl+45GxNm4oUfXlbgw=", @@ -490,84 +242,14 @@ "type": "github" } }, - "nixvim": { - "inputs": { - "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_3", - "nixvim": "nixvim_2" - }, - "locked": { - "lastModified": 1738848041, - "narHash": "sha256-y6WWoK4NbxnTEW5NMG7lJlPbm5Y3uxaP7CAmbtk0o2c=", - "owner": "Polensky", - "repo": "nixvim", - "rev": "6f837af4cd658b7c5094b5e1c7c58ed0ee48bd45", - "type": "github" - }, - "original": { - "owner": "Polensky", - "repo": "nixvim", - "type": "github" - } - }, - "nixvim_2": { - "inputs": { - "devshell": "devshell", - "flake-compat": "flake-compat", - "flake-parts": "flake-parts_2", - "git-hooks": "git-hooks", - "home-manager": "home-manager", - "nix-darwin": "nix-darwin_2", - "nixpkgs": "nixpkgs_4", - "nuschtosSearch": "nuschtosSearch", - "treefmt-nix": "treefmt-nix" - }, - "locked": { - "lastModified": 1730499477, - "narHash": "sha256-olt0Sx4alDxv3ko9BgbV3SsE2KQ/Tf0/Az1Fr9s2Y6U=", - "owner": "nix-community", - "repo": "nixvim", - "rev": "356896f58dde22ee16481b7c954e340dceec340d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixvim", - "type": "github" - } - }, - "nuschtosSearch": { - "inputs": { - "flake-utils": "flake-utils", - "ixx": "ixx", - "nixpkgs": [ - "nixvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730337772, - "narHash": "sha256-uTxvqDohfG85+zldO5Tf1B+fuAF8ZhMouNwG5S6OAnA=", - "owner": "NuschtOS", - "repo": "search", - "rev": "4e0a7a95a3df3333771abc4df6a656e7baf67106", - "type": "github" - }, - "original": { - "owner": "NuschtOS", - "repo": "search", - "type": "github" - } - }, "nvf": { "inputs": { - "flake-parts": "flake-parts_4", - "flake-utils": "flake-utils_2", + "flake-parts": "flake-parts_2", + "flake-utils": "flake-utils", "mnw": "mnw", "nil": "nil", - "nixpkgs": "nixpkgs_7", - "systems": "systems_3" + "nixpkgs": "nixpkgs_5", + "systems": "systems_2" }, "locked": { "lastModified": 1744192993, @@ -585,9 +267,9 @@ }, "root": { "inputs": { + "disko": "disko", "nix-darwin": "nix-darwin", "nixpkgs": "nixpkgs_2", - "nixvim": "nixvim", "sops-nix": "sops-nix", "vimix": "vimix" } @@ -617,7 +299,7 @@ }, "sops-nix": { "inputs": { - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1747603214, @@ -663,47 +345,10 @@ "type": "github" } }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nixvim", - "nixvim", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1730321837, - "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, "vimix": { "inputs": { - "flake-parts": "flake-parts_3", - "nixpkgs": "nixpkgs_6", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_4", "nvf": "nvf" }, "locked": { diff --git a/flake.nix b/flake.nix index d08c1ff..1c134be 100644 --- a/flake.nix +++ b/flake.nix @@ -4,15 +4,17 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nix-darwin.url = "github:LnL7/nix-darwin"; - nixvim.url = "github:Polensky/nixvim"; vimix.url = "github:Polensky/vimix"; sops-nix.url = "github:Mic92/sops-nix"; + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { nixpkgs, nix-darwin, sops-nix, + disko, ... } @ inputs: { nixosConfigurations = { @@ -32,6 +34,15 @@ ./modules ]; }; + server = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + system = "x86_64-linux"; + modules = [ + disko.nixosModules.disko + ./devices/server/configuration.nix + ./modules + ]; + }; pi = nixpkgs.lib.nixosSystem { specialArgs = {inherit inputs;}; system = "aarch64-linux"; @@ -52,19 +63,12 @@ }; }; darwinConfigurations = { - "Charless-MacBook-Pro" = nix-darwin.lib.darwinSystem { - modules = [./devices/macbook/configuration.nix]; - specialArgs = { - inherit inputs; - system = "x86_64-darwin"; - }; - }; "mbp-m4" = nix-darwin.lib.darwinSystem { modules = [./devices/macbook/configuration.nix]; specialArgs = { - inherit inputs; - system = "aarch64-darwin"; - }; + inherit inputs; + system = "aarch64-darwin"; + }; }; }; };