From cbd98189e2d5bcf1140da920774c33eaceb27b37 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 23 Jul 2021 18:47:53 +0200 Subject: [PATCH] zephyrus: init host --- flake.nix | 20 +++++++ hosts/zephyrus/default.nix | 63 +++++++++++++++++++++++ hosts/zephyrus/hardware-configuration.nix | 44 ++++++++++++++++ hosts/zephyrus/home.nix | 26 ++++++++++ zephyrus.nix | 28 ++++++++++ 5 files changed, 181 insertions(+) create mode 100644 hosts/zephyrus/default.nix create mode 100644 hosts/zephyrus/hardware-configuration.nix create mode 100644 hosts/zephyrus/home.nix create mode 100644 zephyrus.nix diff --git a/flake.nix b/flake.nix index 22b50a4..3176f82 100644 --- a/flake.nix +++ b/flake.nix @@ -118,6 +118,26 @@ ]; }; + zephyrus = nixpkgs.lib.nixosSystem rec { + inherit system; + modules = [ + ./zephyrus.nix + + home-manager.nixosModule + self.nixosModules.home + + { + nixpkgs.overlays = [ + inputs.emacs-overlay.overlay + + (self: super: { + steam = self.unstable.steam; + }) + ] ++ shared_overlays; + } + ]; + }; + }; } // inputs.flake-utils.lib.eachDefaultSystem (system: { packages = diff --git a/hosts/zephyrus/default.nix b/hosts/zephyrus/default.nix new file mode 100644 index 0000000..1f55c38 --- /dev/null +++ b/hosts/zephyrus/default.nix @@ -0,0 +1,63 @@ +# 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, lib, pkgs, ... }: +let + secrets = config.my.secrets; +in +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ./home.nix + ]; + + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + services.btrfs = { + autoScrub = { + enable = true; + fileSystems = [ "/" ]; + }; + }; + + networking.hostName = "zephyrus"; # Define your hostname. + networking.domain = "alarsyo.net"; + + # Set your time zone. + time.timeZone = "Europe/Paris"; + + # The global useDHCP flag is deprecated, therefore explicitly set to false here. + # Per-interface useDHCP will be mandatory in the future, so this generated config + # replicates the default behaviour. + networking.interfaces.enp0s31f6.useDHCP = true; + networking.interfaces.wlp0s20f3.useDHCP = true; + + # List services that you want to enable: + my.services = { + tailscale.enable = true; + + pipewire.enable = true; + }; + + services = { + xserver = { + enable = true; + windowManager.i3.enable = true; + layout = "fr"; + xkbVariant = "us"; + libinput.enable = true; + }; + }; + my.displayManager.sddm.enable = true; + + hardware.bluetooth = { + enable = true; + powerOnBoot = false; + }; +} diff --git a/hosts/zephyrus/hardware-configuration.nix b/hosts/zephyrus/hardware-configuration.nix new file mode 100644 index 0000000..6808322 --- /dev/null +++ b/hosts/zephyrus/hardware-configuration.nix @@ -0,0 +1,44 @@ +# 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" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/6395cef1-c30b-450a-917c-cfb3c0380642"; + fsType = "btrfs"; + options = [ "subvol=@" "compress=zstd" "noatime" ]; + }; + + boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/c59e7067-e33c-474c-9b8e-96d0e8f59297"; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/6395cef1-c30b-450a-917c-cfb3c0380642"; + fsType = "btrfs"; + options = [ "subvol=@home" "compress=zstd" "noatime" ]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-uuid/6395cef1-c30b-450a-917c-cfb3c0380642"; + fsType = "btrfs"; + options = [ "subvol=@nix" "compress=zstd" "noatime" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D9DA-F46C"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/hosts/zephyrus/home.nix b/hosts/zephyrus/home.nix new file mode 100644 index 0000000..08f11ad --- /dev/null +++ b/hosts/zephyrus/home.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ... }: +{ + home-manager.users.alarsyo = { + # Keyboard settings & i3 settings + my.home.x.enable = true; + my.home.x.cursor.enable = true; + my.home.alacritty.enable = true; + my.home.emacs.enable = true; + my.home.tmux.enable = true; + my.home.starship.enable = false; + my.home.fish.enable = true; + + my.theme = config.home-manager.users.alarsyo.my.themes.solarizedLight; + + home.packages = with pkgs; [ + # some websites only work there :( + chromium + + # dev + rustup + + unstable.beancount + unstable.fava + ]; + }; +} diff --git a/zephyrus.nix b/zephyrus.nix new file mode 100644 index 0000000..45f0074 --- /dev/null +++ b/zephyrus.nix @@ -0,0 +1,28 @@ +{ ... }: +{ + imports = [ + # Default configuration + ./base + ./base/gui-programs.nix + + # Module definitions + ./modules + + # Service definitions + ./services + + # Configuration secrets + ./secrets + + # Host-specific config + ./hosts/zephyrus + ]; + + # 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 = "21.05"; # Did you read the comment? +}