From d8e794f865ab691a4e673b8cca29e7c3067bf601 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 16 Apr 2021 21:33:48 +0200 Subject: [PATCH] boreal: initial setup --- base/gui-programs.nix | 13 +++++ base/nix.nix | 2 + base/programs.nix | 1 + base/users.nix | 1 + boreal.nix | 26 ++++++++++ flake.nix | 7 +++ hosts/boreal/default.nix | 60 ++++++++++++++++++++++++ hosts/boreal/hardware-configuration.nix | 29 ++++++++++++ secrets/wireguard.nix | Bin 627 -> 804 bytes 9 files changed, 139 insertions(+) create mode 100644 base/gui-programs.nix create mode 100644 boreal.nix create mode 100644 hosts/boreal/default.nix create mode 100644 hosts/boreal/hardware-configuration.nix diff --git a/base/gui-programs.nix b/base/gui-programs.nix new file mode 100644 index 0000000..40aabd7 --- /dev/null +++ b/base/gui-programs.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + firefox + flameshot + alacritty + slack + discord + ]; + + networking.networkmanager.enable = true; + programs.nm-applet.enable = true; +} diff --git a/base/nix.nix b/base/nix.nix index fe539b1..825843f 100644 --- a/base/nix.nix +++ b/base/nix.nix @@ -1,5 +1,7 @@ { pkgs, ... }: { + nixpkgs.config.allowUnfree = true; + nix = { package = pkgs.nixUnstable; extraOptions = '' diff --git a/base/programs.nix b/base/programs.nix index 514026c..a893cde 100644 --- a/base/programs.nix +++ b/base/programs.nix @@ -23,6 +23,7 @@ environment.systemPackages = with pkgs; [ # shell usage bat + fd ripgrep wget diff --git a/base/users.nix b/base/users.nix index 9eaf453..318a4ec 100644 --- a/base/users.nix +++ b/base/users.nix @@ -12,6 +12,7 @@ in isNormalUser = true; extraGroups = [ "media" + "networkmanager" "wheel" # Enable ‘sudo’ for the user. ]; shell = pkgs.fish; diff --git a/boreal.nix b/boreal.nix new file mode 100644 index 0000000..174e1d9 --- /dev/null +++ b/boreal.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + imports = [ + # Default configuration + ./base + ./base/gui-programs.nix + + # Service definitions + ./services + + # Configuration secrets + ./secrets + + # Host-specific config + ./hosts/boreal + ]; + + # 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 = "20.09"; # Did you read the comment? +} diff --git a/flake.nix b/flake.nix index 4b9a432..9c774b2 100644 --- a/flake.nix +++ b/flake.nix @@ -30,5 +30,12 @@ } ]; }; + nixosConfigurations.boreal = nixpkgs-unstable.lib.nixosSystem rec { + system = "x86_64-linux"; + modules = + [ + ./boreal.nix + ]; + }; }; } diff --git a/hosts/boreal/default.nix b/hosts/boreal/default.nix new file mode 100644 index 0000000..6b11686 --- /dev/null +++ b/hosts/boreal/default.nix @@ -0,0 +1,60 @@ +# 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 + ]; + + # 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 = "boreal"; # 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.enp7s0.useDHCP = true; + networking.interfaces.wlp3s0.useDHCP = true; + + # List services that you want to enable: + my.services = { + }; + + services = { + openssh = { + enable = true; + permitRootLogin = "no"; + passwordAuthentication = false; + }; + + xserver = { + enable = true; + videoDrivers = [ "nouveau" ]; + windowManager.i3.enable = true; + layout = "fr"; + xkbVariant = "us"; + }; + }; + + sound.enable = true; + hardware.pulseaudio.enable = true; +} diff --git a/hosts/boreal/hardware-configuration.nix b/hosts/boreal/hardware-configuration.nix new file mode 100644 index 0000000..0caffca --- /dev/null +++ b/hosts/boreal/hardware-configuration.nix @@ -0,0 +1,29 @@ +# 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" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/1a942915-c1ae-4058-b99d-09d12d40dbd3"; + fsType = "btrfs"; + options = [ "subvol=nixos" "compress=zstd" "noatime" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/17C7-368D"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + +} diff --git a/secrets/wireguard.nix b/secrets/wireguard.nix index 7becb9686815c9c3b49d2f7a290142c429f88b36..3a19c0574538b092f51f8d4a56fd1e7ca937d541 100644 GIT binary patch literal 804 zcmV+<1Ka!nM@dveQdv+`0B+|5#1-Yk$R3Sz_=9W zbq>I%OvTf|#`EL}9_Ptz2u5EQD_Puzu^K>1E|u2RbDc1kTAv44`u{bSgn{3p0oAwLFEe zzM^!@1#iOMU{o#@l)0^5;c%6H;iG3B3ZQZLed(e2V4>79p{2!%gJhz)3;Jc{D}w!h z(pm8-nH~O-m33YCMEyZ`jX>)G*D|}VvodqDxn@aUm5?;uh&ze#B3PjQ9dUdYiD_g= z2btAB3s@@{E2%9J@l12ApPs2zut0KQpX~KMh1Wy z;%{93wpqum2~cN_1?qaLtPvhbtVBNVMcKjEtUd{gLlaLCGT|Ia25iG29%kUWVt5|$ z0=`Z9Z}Q?=vFYsb!Tr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