From d8e794f865ab691a4e673b8cca29e7c3067bf601 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Fri, 16 Apr 2021 21:33:48 +0200 Subject: [PATCH 1/2] 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 zcmZQ@_Y83kiVO&0$a~K6WSMJY+TMVV;&CBo&pppEYuqx~{q@QMnTb_>ItO-$JTK)t zu-xb9<%7pQKjD;nelnNCEnZwZ@=n`EDF-jTsn@O+FH|+Y^x>bvjZoH$xn-%F{>pyb zoc*NOIdi7tENRcTy%`Q?MEd_uHdUH-?Q2cjHh&G*MF&{Uopk3}P;6MD zP3wkzi%QP0<{!G35TYkKW#`(shXqsX9xhIo<62PoqxR*(9|;Su7%g0Sw6i&7(N6AP zsZX_={?=cL{HQro_TR**rLjL;{yLWTI=p7QZnS&dW~1WGJJUSlr%o`r+hN`LQ7K}< zKiR?>@y^T?5B8Z??YSegCA3%S3VsYJ*_CTzvGIRSq}ke)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[PATCH 2/2] base: add git-crypt to base programs --- base/programs.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/base/programs.nix b/base/programs.nix index a893cde..90d11b6 100644 --- a/base/programs.nix +++ b/base/programs.nix @@ -29,6 +29,7 @@ # development git + git-crypt gnupg pinentry-curses vim