From c5a5cf14ba513cd68e1e773aff9d5c5de3765071 Mon Sep 17 00:00:00 2001 From: oddlama Date: Thu, 5 Jan 2023 02:42:46 +0100 Subject: [PATCH] feat: add odroid-h3 host "ward" --- flake.lock | 54 ++++++++++++++++++++-------------------- hosts/ward/default.nix | 46 ++++++++++++++++++++++++++++++++++ hosts/ward/fs.nix | 16 ++++++++++++ hosts/ward/net.nix | 22 ++++++++++++++++ modules/core/default.nix | 3 ++- nix/checks.nix | 46 +++++++++++++++++----------------- nix/dev-shell.nix | 2 +- nix/hosts.nix | 6 +++++ users/myuser/default.nix | 14 +++++------ 9 files changed, 150 insertions(+), 59 deletions(-) create mode 100644 hosts/ward/default.nix create mode 100644 hosts/ward/fs.nix create mode 100644 hosts/ward/net.nix diff --git a/flake.lock b/flake.lock index d727206..919ae8b 100644 --- a/flake.lock +++ b/flake.lock @@ -34,11 +34,11 @@ ] }, "locked": { - "lastModified": 1668797197, - "narHash": "sha256-0w6iD3GSSQbIeSFVDzAAQZB+hDq670ZTms3d9XI+BtM=", + "lastModified": 1672327199, + "narHash": "sha256-pFlngSHXKBhAmbaKZ4FYtu57LLunG+vWdL7a5vw1RvQ=", "owner": "serokell", "repo": "deploy-rs", - "rev": "2a3c5f70eee04a465aa534d8bd4fcc9bb3c4a8ce", + "rev": "a5619f5660a00f58c2b7c16d89058e92327ac9b8", "type": "github" }, "original": { @@ -109,11 +109,11 @@ ] }, "locked": { - "lastModified": 1670970889, - "narHash": "sha256-TWJo3/X3Q3r+HeX16QN4FE6ddBpGtAboymSEF+4Nnc0=", + "lastModified": 1672780900, + "narHash": "sha256-DxuSn6BdkZapIbg76xzYx1KhVPEZeBexMkt1q/sMVPA=", "owner": "nix-community", "repo": "home-manager", - "rev": "e412025fffdcd6219ddd21c65d9a1b90005ce508", + "rev": "54245e1820caabd8a0b53ce4d47e4d0fefe04cd4", "type": "github" }, "original": { @@ -139,11 +139,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1670959777, - "narHash": "sha256-9nQJWL7S77YZERxairPLFO6TUuF1RgQmdZO6dKRCHz4=", + "lastModified": 1672644464, + "narHash": "sha256-RYlvRMcQNT7FDoDkViijQBHg9g+blsB+U6AvL/gAsPI=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "0fbf27af51a7c9bc68a168fdcd63513c4f100b15", + "rev": "ca29e25c39b8e117d4d76a81f1e229824a9b3a26", "type": "github" }, "original": { @@ -154,11 +154,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1670929434, - "narHash": "sha256-n5UBO6XBV4h3TB7FYu2yAuNQMEYOrQyKeODUwKe06ow=", + "lastModified": 1672617983, + "narHash": "sha256-68WDiCBs631mbDDk4UAKdGURKcsfW6hjb7wgudTAe5o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1710ed1f6f8ceb75cf7d1cf55ee0cc21760e1c7a", + "rev": "0fc9fca9c8d43edd79d33fea0dd8409d7c4580f4", "type": "github" }, "original": { @@ -170,11 +170,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1668984258, - "narHash": "sha256-0gDMJ2T3qf58xgcSbYoXiRGUkPWmKyr5C3vcathWhKs=", + "lastModified": 1671271954, + "narHash": "sha256-cSvu+bnvN08sOlTBWbBrKaBHQZq8mvk8bgpt0ZJ2Snc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cf63ade6f74bbc9d2a017290f1b2e33e8fbfa70a", + "rev": "d513b448cc2a6da2c8803e3c197c9fc7e67b19e3", "type": "github" }, "original": { @@ -199,11 +199,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1671014608, - "narHash": "sha256-YLb4l6K6sD9xXBJ9GKQ98fBMrpENAadm2RQCfpC3794=", + "lastModified": 1672734157, + "narHash": "sha256-uwUBnv0bN1SO4QVIo8KUx/jxRYCy7cW8kzZa+Qsrw9k=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "047f96a4e11f58e17be51e57f431cf88bcb28a29", + "rev": "d0ce0a861260493c6c21f16f59d25076f73cb931", "type": "github" }, "original": { @@ -224,11 +224,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1667808611, - "narHash": "sha256-HHxTosiswFFS5PHLalpa3OKKl3R9BdgMk7pY4tjX2HU=", + "lastModified": 1672569413, + "narHash": "sha256-WedPMfZ3rPTkxMrvvpMjYaZntlbfilJly9Vaf2fGuAI=", "owner": "yaxitech", "repo": "ragenix", - "rev": "f34618bd9e93edab1f0d62fc3619af7d2d8e5a0c", + "rev": "2cc694606c3eec2ce073892f8ea13d5f3def8217", "type": "github" }, "original": { @@ -263,11 +263,11 @@ ] }, "locked": { - "lastModified": 1667271616, - "narHash": "sha256-qR43NUFFoKfDRro3M1SarTYVfTn8WvWznGJX5eNCNZw=", + "lastModified": 1672453260, + "narHash": "sha256-ruR2xo30Vn7kY2hAgg2Z2xrCvNePxck6mgR5a8u+zow=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "3cbe6891588e1efad2491f87a54be26aeed1fac0", + "rev": "176b6fd3dd3d7cea8d22ab1131364a050228d94c", "type": "github" }, "original": { @@ -278,11 +278,11 @@ }, "templates": { "locked": { - "lastModified": 1669413554, - "narHash": "sha256-ljlMaTVs/aiygN0MtVWmLL8cJ0btX6GxST6D8klCb6o=", + "lastModified": 1671651249, + "narHash": "sha256-IUXfgNkYxISUWqdWtJ0sGjSmpv9d5EVho7HCEElgBAM=", "owner": "NixOS", "repo": "templates", - "rev": "dfd2a90b1507f2eaedb2f9f4798f728f0006ad30", + "rev": "2d6dcce2f3898090c8eda16a16abdff8a80e8ebf", "type": "github" }, "original": { diff --git a/hosts/ward/default.nix b/hosts/ward/default.nix new file mode 100644 index 0000000..0b70239 --- /dev/null +++ b/hosts/ward/default.nix @@ -0,0 +1,46 @@ +{ + nixos-hardware, + pkgs, + ... +}: { + imports = [ + nixos-hardware.common-cpu-intel + nixos-hardware.common-pc-ssd + + ../../modules/core + + ../../modules/efi.nix + ../../modules/zfs.nix + + ../../users/root + + ./fs.nix + ./net.nix + ]; + + boot = { + initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci"]; + kernelModules = ["kvm-intel"]; + tmpOnTmpfs = true; + }; + + console = { + font = "ter-v28n"; + keyMap = "de-latin1-nodeadkeys"; + packages = with pkgs; [terminus_font]; + }; + + environment.systemPackages = with pkgs; [wireguard-tools powertop]; + + hardware = { + enableRedistributableFirmware = true; + enableAllFirmware = true; + }; + + powerManagement.cpuFreqGovernor = "powersave"; + + services = { + fwupd.enable = true; + smartd.enable = true; + }; +} diff --git a/hosts/ward/fs.nix b/hosts/ward/fs.nix new file mode 100644 index 0000000..8453acf --- /dev/null +++ b/hosts/ward/fs.nix @@ -0,0 +1,16 @@ +{ + fileSystems = { + "/" = { + device = "rpool/root/nixos"; + fsType = "zfs"; + options = ["zfsutil" "X-mount.mkdir"]; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/10E6-553F"; + fsType = "vfat"; + }; + }; + + swapDevices = []; +} diff --git a/hosts/ward/net.nix b/hosts/ward/net.nix new file mode 100644 index 0000000..9da4728 --- /dev/null +++ b/hosts/ward/net.nix @@ -0,0 +1,22 @@ +{ + networking = { + hostId = "49ce3b71"; + hostName = "ward"; + wireless.iwd.enable = true; + }; + + systemd.network.networks = { + enp1s0 = { + DHCP = "yes"; + matchConfig.MACAddress = "00:00:00:00:00:00"; + dhcpV4Config.RouteMetric = 10; + dhcpV6Config.RouteMetric = 10; + }; + enp2s0 = { + DHCP = "yes"; + matchConfig.MACAddress = "00:00:00:00:00:00"; + dhcpV4Config.RouteMetric = 10; + dhcpV6Config.RouteMetric = 10; + }; + }; +} diff --git a/modules/core/default.nix b/modules/core/default.nix index bdaea38..a43a259 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -39,7 +39,8 @@ in { useNetworkd = true; wireguard.enable = true; dhcpcd.enable = false; - firewall.enable = false; + nftables.enable = true; + firewall.enable = true; }; nix.nixPath = [ diff --git a/nix/checks.nix b/nix/checks.nix index eebc486..ca41ec1 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -12,33 +12,33 @@ with self.pkgs.${system}; hooks = { actionlint.enable = true; luacheck.enable = true; - nix-linter.enable = true; + #nix-linter.enable = true; alejandra.enable = true; statix.enable = true; stylua.enable = true; }; - settings.nix-linter.checks = [ - "DIYInherit" - "EmptyInherit" - "EmptyLet" - "EtaReduce" - "LetInInheritRecset" - "ListLiteralConcat" - "NegateAtom" - "SequentialLet" - "SetLiteralUpdate" - "UnfortunateArgName" - "UnneededRec" - "UnusedArg" - "UnusedLetBind" - "UpdateEmptySet" - "BetaReduction" - "EmptyVariadicParamSet" - "UnneededAntiquote" - "no-FreeLetInFunc" - "no-AlphabeticalArgs" - "no-AlphabeticalBindings" - ]; + #settings.nix-linter.checks = [ + # "DIYInherit" + # "EmptyInherit" + # "EmptyLet" + # "EtaReduce" + # "LetInInheritRecset" + # "ListLiteralConcat" + # "NegateAtom" + # "SequentialLet" + # "SetLiteralUpdate" + # "UnfortunateArgName" + # "UnneededRec" + # "UnusedArg" + # "UnusedLetBind" + # "UpdateEmptySet" + # "BetaReduction" + # "EmptyVariadicParamSet" + # "UnneededAntiquote" + # "no-FreeLetInFunc" + # "no-AlphabeticalArgs" + # "no-AlphabeticalBindings" + #]; }; } // (deploy-rs.lib.deployChecks self.deploy) diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix index 063cda6..e25740c 100644 --- a/nix/dev-shell.nix +++ b/nix/dev-shell.nix @@ -8,7 +8,7 @@ with self.pkgs.${system}; cachix deploy-rs.deploy-rs nix-build-uncached - nix-linter + #nix-linter alejandra ragenix rnix-lsp diff --git a/nix/hosts.nix b/nix/hosts.nix index a0c8902..0152b18 100644 --- a/nix/hosts.nix +++ b/nix/hosts.nix @@ -6,6 +6,12 @@ let hostPlatform = "x86_64-linux"; remoteBuild = true; }; + ward = { + type = "nixos"; + hostname = "ward"; + hostPlatform = "x86_64-linux"; + remoteBuild = true; + }; }; inherit (builtins) attrNames concatMap listToAttrs; diff --git a/users/myuser/default.nix b/users/myuser/default.nix index fe6df42..4d084fc 100644 --- a/users/myuser/default.nix +++ b/users/myuser/default.nix @@ -31,12 +31,12 @@ with lib; { # ./graphical/i3 ]; - home = { - username = config.users.users.myuser.name; - uid = config.users.users.myuser.uid; - shellAliases = { - p = "cd ~/projects"; - }; - }; + home = { + username = config.users.users.myuser.name; + inherit (config.users.users.myuser) uid; + shellAliases = { + p = "cd ~/projects"; + }; + }; }; }