From bea16d065239681ab69e44a2ef8074c3e3d3893d Mon Sep 17 00:00:00 2001 From: root Date: Tue, 16 Aug 2022 14:20:36 +0200 Subject: [PATCH] intial setup of durian --- flake.lock | 41 +++++--- flake.nix | 9 +- hosts/durian/configuration.nix | 127 ++++++++++++++++++++++++ hosts/durian/hardware-configuration.nix | 64 ++++++++++++ modules/base.nix | 6 +- 5 files changed, 229 insertions(+), 18 deletions(-) mode change 100755 => 100644 flake.lock create mode 100644 hosts/durian/configuration.nix create mode 100644 hosts/durian/hardware-configuration.nix diff --git a/flake.lock b/flake.lock old mode 100755 new mode 100644 index e3b78ea..d9194a0 --- a/flake.lock +++ b/flake.lock @@ -40,11 +40,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1649586198, - "narHash": "sha256-mG0dlqTwYUw4qJcwK1ByqOb07kM9+1jENe3w6dTf9aU=", + "lastModified": 1652098803, + "narHash": "sha256-aE+dL4ggSkRBHKkFZDdqvIhI2KYzZwr0T3K1HXoy9bw=", "owner": "fsr", "repo": "infoscreen", - "rev": "73215980cf5465f660d4237389ca92a33c035f1a", + "rev": "60e8a4734aff58a59a8338064bebddb85a714eca", "type": "github" }, "original": { @@ -69,18 +69,34 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs-22_05": { "locked": { - "lastModified": 1646258393, - "narHash": "sha256-mKDoCi5Baqainjf0Nx6oTPhaxKQdj4P17XTdhTtXGRA=", + "lastModified": 1659228671, + "narHash": "sha256-fraIjyAthUgoeDUF14tFeszKFPqaGnlc2qxczHbAmec=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ed02c2ba0384b2800db41333045a6fb781f12aac", + "rev": "a26a6f4529878fbfe5f1f287dcdff4a287c58def", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-21.11", + "ref": "release-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1660215038, + "narHash": "sha256-tqMyd5QB4MZh59wMHXqpro4hkKjz9ubQxkxFSuCuBGE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "45c9736ed69800a6ff2164fb4538c9e40dad25d6", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05", "repo": "nixpkgs", "type": "github" } @@ -96,14 +112,15 @@ "inputs": { "nixpkgs": [ "nixpkgs" - ] + ], + "nixpkgs-22_05": "nixpkgs-22_05" }, "locked": { - "lastModified": 1645891244, - "narHash": "sha256-Pu3a97Zn0PpWi/prTyD9TulCmxyeVnlqofor+yScRD8=", + "lastModified": 1659441021, + "narHash": "sha256-J2C83bo1mHcdfzxk8S3rE8iqNZM2AlPUGqftdhbm5Zk=", "owner": "Mic92", "repo": "sops-nix", - "rev": "afb0d686dced029ea720c466f693c12ebfd4107b", + "rev": "34ee98b8c2ca153a23a63c1841a0a067313856d5", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ce97986..f352a84 100755 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = github:NixOS/nixpkgs/nixos-21.11; + nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05; sops-nix.url = github:Mic92/sops-nix; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; @@ -51,6 +51,13 @@ } ]; }; + durian = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./hosts/durian/configuration.nix + ./modules/base.nix + ]; + }; }; }; } diff --git a/hosts/durian/configuration.nix b/hosts/durian/configuration.nix new file mode 100644 index 0000000..c66efd8 --- /dev/null +++ b/hosts/durian/configuration.nix @@ -0,0 +1,127 @@ +# 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. + ./hardware-configuration.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages; + boot.loader.efi.canTouchEfiVariables = true; + boot.supportedFilesystems = [ "zfs" ]; + boot.zfs.devNodes = "/dev/"; + networking.hostId = "a41d87fc"; + + networking.interfaces.enp65s0f0np0 = { + useDHCP = false; + ipv4.addresses = [ + { + address = "141.30.30.169"; + prefixLength = 25; + } + ]; + }; + networking.defaultGateway = "141.30.30.129"; + networking.nameservers = [ "141.30.1.1" ]; + + networking.hostName = "durian"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Select internationalisation properties. + # i18n.defaultLocale = "en_US.UTF-8"; + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # useXkbConfig = true; # use xkbOptions in tty. + # }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + + + + # Configure keymap in X11 + # services.xserver.layout = "us"; + # services.xserver.xkbOptions = { + # "eurosign:e"; + # "caps:escape" # map caps to escape. + # }; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + # Enable sound. + # sound.enable = true; + # hardware.pulseaudio.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.jane = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # packages = with pkgs; [ + # firefox + # thunderbird + # ]; + # }; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + wget + git + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + services.openssh.permitRootLogin = "yes"; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.05"; # Did you read the comment? +} + diff --git a/hosts/durian/hardware-configuration.nix b/hosts/durian/hardware-configuration.nix new file mode 100644 index 0000000..3ab4310 --- /dev/null +++ b/hosts/durian/hardware-configuration.nix @@ -0,0 +1,64 @@ +# 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 = [ "megaraid_sas" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "rpool/nixos/root"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/home" = + { device = "rpool/nixos/home"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/var/lib" = + { device = "rpool/nixos/var/lib"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/var/log" = + { device = "rpool/nixos/var/log"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/7FE6-F583"; + fsType = "vfat"; + }; + + fileSystems."/nix" = + { device = "rpool/nixos/nix"; + fsType = "zfs"; + options = [ "zfsutil" ]; + }; + + swapDevices = [ ]; + + # 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.eno8303.useDHCP = lib.mkDefault true; + # networking.interfaces.eno8403.useDHCP = lib.mkDefault true; + # networking.interfaces.enp65s0f0np0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp65s0f1np1.useDHCP = lib.mkDefault true; + + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/base.nix b/modules/base.nix index 27c329f..c1db554 100755 --- a/modules/base.nix +++ b/modules/base.nix @@ -1,7 +1,4 @@ -{ pkgs, config, ... }: - -{ - +{ pkgs, config, ... }: { nix = { package = pkgs.nixUnstable; # or versioned attributes like nix_2_4 extraOptions = '' @@ -43,7 +40,6 @@ time.timeZone = "Europe/Berlin"; # basic shell & editor - programs.fish.enable = true; programs.vim.defaultEditor = true; # List packages installed in system profile. To search, run: