From 76fbe957a7e0b94d0a7ed47dd5424b35676db407 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Fri, 26 Jan 2024 21:18:05 +0100 Subject: [PATCH] igor: Prepare configuration of igor --- flake.lock | 21 ++++++++++++ flake.nix | 9 +++++ hosts/igor/default.nix | 65 +++++++++++++++++++++++++++++++++++++ hosts/igor/disko-config.nix | 49 ++++++++++++++++++++++++++++ 4 files changed, 144 insertions(+) create mode 100644 hosts/igor/default.nix create mode 100644 hosts/igor/disko-config.nix diff --git a/flake.lock b/flake.lock index 7609277..bddcdd6 100644 --- a/flake.lock +++ b/flake.lock @@ -60,6 +60,26 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1706302763, + "narHash": "sha256-Le1wk75qlzOSfzDk8vqYxSdoEyr/ORIbMhziltVNGYw=", + "owner": "nix-community", + "repo": "disko", + "rev": "f7424625dc1f2e4eceac3009cbd1203d566feebc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "emacs": { "inputs": { "flake-utils": "flake-utils", @@ -424,6 +444,7 @@ "root": { "inputs": { "agenix": "agenix", + "disko": "disko", "emacs": "emacs", "home-manager": "home-manager_2", "home-manager-unstable": "home-manager-unstable", diff --git a/flake.nix b/flake.nix index 63069cd..aea3c4a 100644 --- a/flake.nix +++ b/flake.nix @@ -40,6 +40,9 @@ url = "github:ryantm/agenix"; inputs.nixpkgs.follows = "nixpkgs"; }; + + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { home-manager, nixpkgs, nixpkgs-unstable, ... }@inputs: { @@ -75,6 +78,12 @@ }; homeConfigurations = import ./outputs/homeConfigurations inputs; + nixosConfigurations."igor" = nixpkgs-unstable.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ ./hosts/igor ]; + }; + nixOnDroidConfigurations.default = with inputs; nix-on-droid.lib.nixOnDroidConfiguration { modules = [ diff --git a/hosts/igor/default.nix b/hosts/igor/default.nix new file mode 100644 index 0000000..02d17e9 --- /dev/null +++ b/hosts/igor/default.nix @@ -0,0 +1,65 @@ +{ config, inputs, lib, pkgs, ... }: + +{ + imports = [ + inputs.disko.nixosModules.disko + ../../modules/security.nix + ../../modules/nix-config.nix + ../../modules/iohk.nix + ../../modules/timezone.nix + ../../modules/keybase.nix + ../../modules/ssh.nix + ./disko-config.nix + ]; + + networking = let extIface = "ens3"; + in { + hostName = "igor"; + domain = "failco.de"; + wireless.enable = false; + useDHCP = false; + enableIPv6 = false; + interfaces.${extIface} = { + ipv4.addresses = [{ + address = "192.168.0.2"; + prefixLength = 24; + }]; + }; + defaultGateway = "192.168.0.1"; + nameservers = [ "1.1.1.1" "8.8.8.8" ]; + firewall = { + allowedTCPPorts = [ 22 80 443 ]; + allowedUDPPorts = [ ]; + }; + }; + + security.sudo = { + enable = true; + execWheelOnly = true; + }; + + # Select internationalization properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "dvorak"; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.me = { + isNormalUser = true; + extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + shell = pkgs.zsh; + }; + + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + }; + + programs.zsh.enable = true; + + system.stateVersion = "23.11"; +} diff --git a/hosts/igor/disko-config.nix b/hosts/igor/disko-config.nix new file mode 100644 index 0000000..cd3c4aa --- /dev/null +++ b/hosts/igor/disko-config.nix @@ -0,0 +1,49 @@ +{ + disko.devices = { + disk.main = { + type = "disk"; + device = "/dev/mmcblk0"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + name = "ESP"; + start = "1M"; + end = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + + subvolumes = { + "/rootfs" = { mountpoint = "/"; }; + "/home" = { + mountOptions = [ "compress=zstd" ]; + mountpoint = "/home"; + }; + "/nix" = { + mountOptions = [ "compress=zstd" "noatime" ]; + mountpoint = "/nix"; + }; + "/swap" = { + mountpoint = "/.swapvol"; + swap = { swapfile.size = "2G"; }; + }; + }; + }; + }; + }; + }; + }; + }; +}