From 823be3c82ce010a51c577ab7f1580817861c2e61 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Wed, 13 Sep 2023 23:40:50 +0200 Subject: [PATCH] Add edison --- base.nix | 1 + flake.nix | 13 +++++ hosts/edison/configuration.nix | 69 +++++++++++++++++++++++++ hosts/edison/hardware-configuration.nix | 41 +++++++++++++++ 4 files changed, 124 insertions(+) create mode 100644 hosts/edison/configuration.nix create mode 100644 hosts/edison/hardware-configuration.nix diff --git a/base.nix b/base.nix index a716f60..fa002b0 100644 --- a/base.nix +++ b/base.nix @@ -42,6 +42,7 @@ environment.systemPackages = with pkgs; [ bat bottom + exa git gnugrep gnutar diff --git a/flake.nix b/flake.nix index d7c0cf8..f2079c6 100644 --- a/flake.nix +++ b/flake.nix @@ -47,6 +47,19 @@ matrix-synapse-next.nixosModules.synapse ]; }; + edison = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + # Overlays-module makes "pkgs.unstable" available in configuration.nix + ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) + + ./hosts/edison/configuration.nix + sops-nix.nixosModules.sops + ]; + }; chapel = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { diff --git a/hosts/edison/configuration.nix b/hosts/edison/configuration.nix new file mode 100644 index 0000000..f2bad7e --- /dev/null +++ b/hosts/edison/configuration.nix @@ -0,0 +1,69 @@ +{ config, pkgs, ... }: + +{ + imports = + [ + ../../base.nix + ../../common/metrics-exporters.nix + ./hardware-configuration.nix + ]; + + networking = { + hostName = "edison"; + defaultGateway = "192.168.10.1"; + nameservers = [ "192.168.11.100" "1.1.1.1" ]; + interfaces.eno1.ipv4 = { + addresses = [ + { address = "192.168.10.170"; prefixLength = 24; } + ]; + }; + hostId = "8f84a235"; + }; + + # sops.defaultSopsFile = ../../secrets/edison/edison.yaml; + + environment.variables = { EDITOR = "vim"; }; + environment.systemPackages = with pkgs; [ + ((vim_configurable.override { }).customize{ + name = "vim"; + vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { + start = [ vim-nix vim-lastplace vim-commentary ]; + opt = []; + }; + vimrcConfig.customRC = '' + " your custom vimrc + set number + set relativenumber + set nu rnu + set signcolumn=number + + set hlsearch + set smartcase + set incsearch + + set autoindent + set expandtab + set shiftwidth=2 + set tabstop=2 + set smartindent + set smarttab + + set ruler + + set undolevels=1000 + + set nocompatible + set backspace=indent,eol,start + " Turn on syntax highlighting by default + syntax on + " ... + ''; + } + ) + ]; + + networking.firewall.allowedTCPPorts = [ 22 ]; + + system.stateVersion = "23.05"; +} + diff --git a/hosts/edison/hardware-configuration.nix b/hosts/edison/hardware-configuration.nix new file mode 100644 index 0000000..3302c68 --- /dev/null +++ b/hosts/edison/hardware-configuration.nix @@ -0,0 +1,41 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/14b254e1-d94f-4b9b-a910-7fcf7e33af46"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/A197-7913"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/d56040a0-3009-4899-95fa-1b82e60e32e4"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}