From d42a484f064ac7881a181d41417721fd88ce85c5 Mon Sep 17 00:00:00 2001 From: Paul-Henri Froidmont Date: Mon, 30 Nov 2020 11:55:57 +0100 Subject: [PATCH] Use NixOs on Ingenico laptop --- configs/home/full.nix | 2 - .../ingenico-laptop-ubuntu/configuration.nix | 73 ++++++++ .../fonts.conf | 0 hosts/ingenico-laptop/configuration.nix | 176 +++++++++++------- .../hardware-configuration.nix | 31 +++ 5 files changed, 217 insertions(+), 65 deletions(-) create mode 100644 hosts/ingenico-laptop-ubuntu/configuration.nix rename hosts/{ingenico-laptop => ingenico-laptop-ubuntu}/fonts.conf (100%) create mode 100644 hosts/ingenico-laptop/hardware-configuration.nix diff --git a/configs/home/full.nix b/configs/home/full.nix index 111743d..cd680e4 100644 --- a/configs/home/full.nix +++ b/configs/home/full.nix @@ -11,6 +11,4 @@ home.packages = with pkgs; [ i3lock ]; - - picom.enable = true; } diff --git a/hosts/ingenico-laptop-ubuntu/configuration.nix b/hosts/ingenico-laptop-ubuntu/configuration.nix new file mode 100644 index 0000000..5e6d24a --- /dev/null +++ b/hosts/ingenico-laptop-ubuntu/configuration.nix @@ -0,0 +1,73 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ../../configs/home/ubuntu-full.nix + ]; + + programs.home-manager.enable = true; + home.username = "froidmpa"; + home.homeDirectory = "/home/froidmpa"; + + services = { + network-manager-applet.enable = true; + blueman-applet.enable = true; + grobi = { + enable = true; + executeAfter = ["${pkgs.systemd}/bin/systemctl --user restart stalonetray" "${pkgs.feh}/bin/feh --bg-fill ~/.wallpaper.png"]; + rules = [ + { + name = "Work HDMI"; + outputs_connected = [ "HDMI-1" ]; + configure_single = "HDMI-1"; + primary = true; + atomic = true; + } + { + name = "Work USBC"; + outputs_connected = [ "DP-1" ]; + configure_single = "DP-1"; + primary = true; + atomic = true; + } + { + name = "Fallback"; + configure_single = "eDP-1"; + } + ]; + }; + gpg-agent = { + enable = true; + enableSshSupport = true; + #pinentryFlavor = "tty"; + }; + }; + programs = { + git = { + enable = true; + userName = "Paul-Henri Froidmont"; + userEmail = "paul-henri.froidmont@ingenico.com"; + signing = { + key = "589ECB6FAA8FF1F40E579C9E1479473F99393013"; + signByDefault = true; + }; + }; + gpg.enable = true; + }; + fonts.fontconfig.enable = true; + home = { + sessionVariables = { + QT_XCB_GL_INTEGRATION = "none"; # Fix "Could not initialize GLX" segfault + LOCALE_ARCHIVE_2_11 = "$(nix-build --no-out-link \"\" -A glibcLocales)/lib/locale/locale-archive"; + LOCALE_ARCHIVE_2_27 = "$(nix-build --no-out-link \"\" -A glibcLocales)/lib/locale/locale-archive"; + LOCALE_ARCHIVE = "/usr/bin/locale"; + }; + file = { + ".config/fontconfig/fonts.conf" = { + source = ./fonts.conf; + }; + }; + }; + + home.stateVersion = "20.09"; +} + diff --git a/hosts/ingenico-laptop/fonts.conf b/hosts/ingenico-laptop-ubuntu/fonts.conf similarity index 100% rename from hosts/ingenico-laptop/fonts.conf rename to hosts/ingenico-laptop-ubuntu/fonts.conf diff --git a/hosts/ingenico-laptop/configuration.nix b/hosts/ingenico-laptop/configuration.nix index 5e6d24a..4660cdf 100644 --- a/hosts/ingenico-laptop/configuration.nix +++ b/hosts/ingenico-laptop/configuration.nix @@ -1,73 +1,123 @@ { config, lib, pkgs, ... }: { imports = [ - ../../configs/home/ubuntu-full.nix + + ./hardware-configuration.nix + ../../configs/system.nix + ../../configs/network.nix + ../../configs/virtualisation.nix ]; - programs.home-manager.enable = true; - home.username = "froidmpa"; - home.homeDirectory = "/home/froidmpa"; - - services = { - network-manager-applet.enable = true; - blueman-applet.enable = true; - grobi = { - enable = true; - executeAfter = ["${pkgs.systemd}/bin/systemctl --user restart stalonetray" "${pkgs.feh}/bin/feh --bg-fill ~/.wallpaper.png"]; - rules = [ - { - name = "Work HDMI"; - outputs_connected = [ "HDMI-1" ]; - configure_single = "HDMI-1"; - primary = true; - atomic = true; - } - { - name = "Work USBC"; - outputs_connected = [ "DP-1" ]; - configure_single = "DP-1"; - primary = true; - atomic = true; - } - { - name = "Fallback"; - configure_single = "eDP-1"; - } - ]; - }; - gpg-agent = { - enable = true; - enableSshSupport = true; - #pinentryFlavor = "tty"; - }; - }; - programs = { - git = { - enable = true; - userName = "Paul-Henri Froidmont"; - userEmail = "paul-henri.froidmont@ingenico.com"; - signing = { - key = "589ECB6FAA8FF1F40E579C9E1479473F99393013"; - signByDefault = true; - }; - }; - gpg.enable = true; - }; - fonts.fontconfig.enable = true; - home = { - sessionVariables = { - QT_XCB_GL_INTEGRATION = "none"; # Fix "Could not initialize GLX" segfault - LOCALE_ARCHIVE_2_11 = "$(nix-build --no-out-link \"\" -A glibcLocales)/lib/locale/locale-archive"; - LOCALE_ARCHIVE_2_27 = "$(nix-build --no-out-link \"\" -A glibcLocales)/lib/locale/locale-archive"; - LOCALE_ARCHIVE = "/usr/bin/locale"; - }; - file = { - ".config/fontconfig/fonts.conf" = { - source = ./fonts.conf; - }; + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.luks.devices = { + crypted = { + device = "/dev/disk/by-uuid/50f8d5be-eabc-4b80-a36f-b8e5646c4fc1"; + preLVM = true; }; }; - home.stateVersion = "20.09"; + networking = { + hostName = "enix016"; + networkmanager.enable = true; + }; + + networking.interfaces.wlp59s0.useDHCP = true; + + console = { + font = "Lat2-Terminus16"; + keyMap = "fr"; + }; + + i18n = { + defaultLocale = "en_US.UTF-8"; + }; + + time.timeZone = "Europe/Amsterdam"; + + environment.etc."openfortivpn/config" = { + text = '' + host = devsslvpn.global.ingenico.com + port = 443 + trusted-cert = e09de6da3902e58b9061f28e13d33088d929f3451367d21f1721a0ed6361a883 + trusted-cert = 33069b6d904330b3fde5c002ca4964b7f413003665e78963d73098fe5f6f7c05 + trusted-cert = 599dba9bee8a920836b68ca5603a11ceee5ec0450201c7a7651f5575d6bbcd3a + set-dns = 0 + set-routes = 1 + insecure-ssl = 0 + cipher-list = HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4 + ''; + }; + + hardware.bluetooth = { + enable = true; + # Enable A2DP Sink + extraConfig = " + [General] + Enable=Source,Sink,Media,Socket + "; + }; + hardware.pulseaudio = { + enable = true; + + # Use full build to have Bluetooth support + package = pkgs.pulseaudioFull; + }; + + home-manager.users.froidmpa = {pkgs, config, ...}: { + imports = [ + ../../configs/home/full.nix + ]; + services = { + network-manager-applet.enable = true; + blueman-applet.enable = true; + grobi = { + enable = true; + executeAfter = ["${pkgs.systemd}/bin/systemctl --user restart stalonetray" "${pkgs.feh}/bin/feh --bg-fill ~/.wallpaper.png"]; + rules = [ + { + name = "Work HDMI"; + outputs_connected = [ "HDMI-1" ]; + configure_single = "HDMI-1"; + primary = true; + atomic = true; + } + { + name = "Work USBC"; + outputs_connected = [ "DP-1" ]; + configure_single = "DP-1"; + primary = true; + atomic = true; + } + { + name = "Fallback"; + configure_single = "eDP-1"; + } + ]; + }; + gpg-agent = { + enable = true; + enableSshSupport = true; + #pinentryFlavor = "tty"; + }; + }; + + programs = { + git = { + enable = true; + userName = "Paul-Henri Froidmont"; + userEmail = "paul-henri.froidmont@ingenico.com"; + signing = { + key = "589ECB6FAA8FF1F40E579C9E1479473F99393013"; + signByDefault = true; + }; + }; + gpg.enable = true; + }; + }; + # Enable touchpad support. + services.xserver.libinput.enable = true; + + system.stateVersion = "20.09"; } diff --git a/hosts/ingenico-laptop/hardware-configuration.nix b/hosts/ingenico-laptop/hardware-configuration.nix new file mode 100644 index 0000000..504905b --- /dev/null +++ b/hosts/ingenico-laptop/hardware-configuration.nix @@ -0,0 +1,31 @@ +# 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" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/13d0d334-9ab2-4a09-adb2-857fe62582d9"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4A68-AF52"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/9078e48a-7481-4a9f-92e6-a1f222f58ef5"; } + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +}