From bb9b25dac2df1c2d5ee966d194595787155b5679 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 4 Apr 2018 22:18:28 +0200 Subject: Work on odin --- installer.nix | 34 ++++++++++++++++++++++++++ odin.nix | 55 ++++++++++++++++++++++++++++++++++++++++++ odin/hw.nix | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 installer.nix create mode 100644 odin.nix create mode 100644 odin/hw.nix diff --git a/installer.nix b/installer.nix new file mode 100644 index 00000000..3bdca7ab --- /dev/null +++ b/installer.nix @@ -0,0 +1,34 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + + + ]; + + boot.kernelPackages = pkgs.linuxPackages_latest; + + systemd.services.sshd.wantedBy = lib.mkForce [ "multi-user.target" ]; + + environment.systemPackages = with pkgs; [ + mosh + tmux + zsh + pythonPackages.magic-wormhole + ]; + + networking = { + hostName = ""; + + firewall = { + enable = true; + allowPing = true; + allowedTCPPorts = [ 22 # ssh + ]; + allowedUDPPortRanges = [ { from = 60000; to = 61000; } # mosh + ]; + }; + }; + + i18n.consoleKeyMap = "dvp"; +} diff --git a/odin.nix b/odin.nix new file mode 100644 index 00000000..21054dbc --- /dev/null +++ b/odin.nix @@ -0,0 +1,55 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./odin/hw.nix + ]; + + # Use the GRUB 2 boot loader. + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + # Define on which hard drive you want to install Grub. + boot.loader.grub.device = "/dev/disk/by-id/ata-MKNSSDCR60GB_MK130619AS1031770"; + + networking.hostName = "odin"; # Define your hostname. + + # Select internationalisation properties. + i18n = { + consoleKeyMap = "dvp"; + defaultLocale = "en_US.UTF-8"; + }; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + environment.systemPackages = with pkgs; [ + pythonPackages.magic-wormhole + tmux + mosh + ]; + + programs.zsh.enable = true; + + services.openssh.enable = true; + + networking.firewall = { + enable = true; + allowPing = true; + allowedTCPPorts = [ 22 # ssh + ]; + allowedUDPPortRanges = [ { from = 60000; to = 61000; } # mosh + ]; + }; + + # This value determines the NixOS release with which your system is to be + # compatible, in order to avoid breaking some software such as database + # servers. You should change this only after NixOS release notes say you + # should. + system.stateVersion = "18.09"; # Did you read the comment? + +} diff --git a/odin/hw.nix b/odin/hw.nix new file mode 100644 index 00000000..07518dbc --- /dev/null +++ b/odin/hw.nix @@ -0,0 +1,76 @@ +# 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, ... }: + +{ + imports = + [ + ]; + + boot.initrd = { + availableKernelModules = [ "uhci_hcd" "ehci_pci" "ata_piix" "xhci_pci" "ahci" "pata_marvell" "nvme" "firewire_ohci" "usb_storage" "usbhid" "sd_mod" ]; + luks.devices = { + raid6 = { + device = "/dev/disk/by-uuid/1a552384-4f74-40bf-a5cf-961ea24c339e"; + }; + ssd-raid1 = { + device = "/dev/disk/by-uuid/f348a104-4774-47b3-a241-b7eaca0080e3"; + }; + ssd-nvme = { + device = "/dev/disk/by-uuid/fdd3f054-edee-42d5-aa82-08e3477014f3"; + allowDiscards = true; + }; + }; + + mdadmConf = '' + ARRAY /dev/md/isaac:raid6 metadata=1.2 name=isaac:raid6 UUID=42f7a827:e1c05dfe:7e7977dc:ccf1a569 + ARRAY /dev/md1 metadata=1.2 name=localhost:ssd-raid1 UUID=f2e398f9:e2d4d8ce:b1811e05:584bf759 + ARRAY /dev/md0 metadata=1.2 name=localhost:boot UUID=a56bdcef:a622dd3a:c6af3832:591a8bb3 + ''; + }; + + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/8dea04a6-4485-4cd2-bab5-d23321a11df9"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/f6b49ce4-536c-4470-ad22-2af5c2b53d61"; + fsType = "ext4"; + }; + + fileSystems."/srv/hlidskjalf" = + { device = "/dev/disk/by-uuid/e796f44c-2b0b-40a8-af22-90beb898d25e"; + fsType = "ext4"; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/e4737a9e-2a25-4247-936d-c0c4bad82970"; + fsType = "ext4"; + }; + + fileSystems."/srv/media" = + { device = "/dev/disk/by-uuid/09959dcd-e8ca-4958-89b2-993cc79fe8f7"; + fsType = "ext4"; + }; + + fileSystems."/srv/mail" = + { device = "/dev/disk/by-uuid/d43c25b5-2c0f-4ac9-9f0b-de93c33442a1"; + fsType = "ext4"; + }; + + fileSystems."/nix/store" = + { device = "/dev/disk/by-uuid/b36a581c-e38c-4c25-9073-18a313cce286"; + fsType = "xfs"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/a27e368d-e1ed-41e5-8bcb-6e5865670532"; } + ]; + + nix.maxJobs = lib.mkDefault 8; +} -- cgit v1.2.3