From f1551db7359e1aa401b886c13aabffe492865e39 Mon Sep 17 00:00:00 2001 From: LUCAZEAU Alexandre Date: Mon, 23 Oct 2023 09:43:50 +0200 Subject: [PATCH] ADD : d2nix new config FIX : archive old d2nix conf --- hosts/{d2nix => d2nix-archives}/README.md | 0 .../home-manager/colorschemes/nord.theme | 0 .../home-manager/configs/i3config | 0 .../home-manager/configs/init.el | 0 .../home-manager/configs/starship.toml | 0 .../home-manager/dunst.nix | 0 .../home-manager/emacs.nix | 0 .../home-manager/git.nix | 0 .../home-manager/gnupg.nix | 0 .../home-manager/himalaya.nix | 0 hosts/d2nix-archives/home-manager/home.nix | 25 +++ .../home-manager/i3status.nix | 0 .../home-manager/mails.nix | 0 .../home-manager/nixpkgs | 0 .../home-manager/packages.nix | 0 .../home-manager/terminalrc | 0 .../home-manager/variables.nix | 0 hosts/d2nix-archives/nixos/configuration.nix | 127 ++++++++++++ .../nixos/hardware-configuration.nix | 47 +++++ hosts/{d2nix => d2nix-archives}/nixos/modules | 0 .../nixos/network.nix | 0 hosts/d2nix-archives/nixos/services.nix | 50 +++++ hosts/d2nix/home-manager/firefox.nix | 84 ++++++++ hosts/d2nix/home-manager/home.nix | 84 ++++++-- hosts/d2nix/nixos/configuration.nix | 180 +++++++++++------- hosts/d2nix/nixos/extra_hw.nix | 33 ++++ hosts/d2nix/nixos/hardware-configuration.nix | 32 ++-- hosts/d2nix/nixos/laptop.nix | 7 + hosts/d2nix/nixos/services.nix | 64 ++++--- 29 files changed, 605 insertions(+), 128 deletions(-) rename hosts/{d2nix => d2nix-archives}/README.md (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/colorschemes/nord.theme (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/configs/i3config (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/configs/init.el (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/configs/starship.toml (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/dunst.nix (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/emacs.nix (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/git.nix (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/gnupg.nix (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/himalaya.nix (100%) create mode 100644 hosts/d2nix-archives/home-manager/home.nix rename hosts/{d2nix => d2nix-archives}/home-manager/i3status.nix (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/mails.nix (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/nixpkgs (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/packages.nix (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/terminalrc (100%) rename hosts/{d2nix => d2nix-archives}/home-manager/variables.nix (100%) create mode 100644 hosts/d2nix-archives/nixos/configuration.nix create mode 100644 hosts/d2nix-archives/nixos/hardware-configuration.nix rename hosts/{d2nix => d2nix-archives}/nixos/modules (100%) rename hosts/{d2nix => d2nix-archives}/nixos/network.nix (100%) create mode 100644 hosts/d2nix-archives/nixos/services.nix create mode 100644 hosts/d2nix/home-manager/firefox.nix create mode 100644 hosts/d2nix/nixos/extra_hw.nix create mode 100644 hosts/d2nix/nixos/laptop.nix diff --git a/hosts/d2nix/README.md b/hosts/d2nix-archives/README.md similarity index 100% rename from hosts/d2nix/README.md rename to hosts/d2nix-archives/README.md diff --git a/hosts/d2nix/home-manager/colorschemes/nord.theme b/hosts/d2nix-archives/home-manager/colorschemes/nord.theme similarity index 100% rename from hosts/d2nix/home-manager/colorschemes/nord.theme rename to hosts/d2nix-archives/home-manager/colorschemes/nord.theme diff --git a/hosts/d2nix/home-manager/configs/i3config b/hosts/d2nix-archives/home-manager/configs/i3config similarity index 100% rename from hosts/d2nix/home-manager/configs/i3config rename to hosts/d2nix-archives/home-manager/configs/i3config diff --git a/hosts/d2nix/home-manager/configs/init.el b/hosts/d2nix-archives/home-manager/configs/init.el similarity index 100% rename from hosts/d2nix/home-manager/configs/init.el rename to hosts/d2nix-archives/home-manager/configs/init.el diff --git a/hosts/d2nix/home-manager/configs/starship.toml b/hosts/d2nix-archives/home-manager/configs/starship.toml similarity index 100% rename from hosts/d2nix/home-manager/configs/starship.toml rename to hosts/d2nix-archives/home-manager/configs/starship.toml diff --git a/hosts/d2nix/home-manager/dunst.nix b/hosts/d2nix-archives/home-manager/dunst.nix similarity index 100% rename from hosts/d2nix/home-manager/dunst.nix rename to hosts/d2nix-archives/home-manager/dunst.nix diff --git a/hosts/d2nix/home-manager/emacs.nix b/hosts/d2nix-archives/home-manager/emacs.nix similarity index 100% rename from hosts/d2nix/home-manager/emacs.nix rename to hosts/d2nix-archives/home-manager/emacs.nix diff --git a/hosts/d2nix/home-manager/git.nix b/hosts/d2nix-archives/home-manager/git.nix similarity index 100% rename from hosts/d2nix/home-manager/git.nix rename to hosts/d2nix-archives/home-manager/git.nix diff --git a/hosts/d2nix/home-manager/gnupg.nix b/hosts/d2nix-archives/home-manager/gnupg.nix similarity index 100% rename from hosts/d2nix/home-manager/gnupg.nix rename to hosts/d2nix-archives/home-manager/gnupg.nix diff --git a/hosts/d2nix/home-manager/himalaya.nix b/hosts/d2nix-archives/home-manager/himalaya.nix similarity index 100% rename from hosts/d2nix/home-manager/himalaya.nix rename to hosts/d2nix-archives/home-manager/himalaya.nix diff --git a/hosts/d2nix-archives/home-manager/home.nix b/hosts/d2nix-archives/home-manager/home.nix new file mode 100644 index 0000000..2fc9a9c --- /dev/null +++ b/hosts/d2nix-archives/home-manager/home.nix @@ -0,0 +1,25 @@ +{ pkgs, config, ... }: { + imports = [ + ./packages.nix + ./gnupg.nix + ./git.nix + ./variables.nix + ./i3status.nix + ./dunst.nix +# ./himalaya.nix + ./mails.nix + ../../../modules/tmux.nix + ../../../modules/emacs.nix + ../../../modules/neovim.nix + ]; + home.stateVersion = "23.05"; + home.username = "alexandre"; + home.homeDirectory = "/home/alexandre"; + home.keyboard = { + layout = "fr"; + variant = "bepo"; + }; + xdg.configFile = { + "i3/config".source = ./configs/i3config; + }; +} diff --git a/hosts/d2nix/home-manager/i3status.nix b/hosts/d2nix-archives/home-manager/i3status.nix similarity index 100% rename from hosts/d2nix/home-manager/i3status.nix rename to hosts/d2nix-archives/home-manager/i3status.nix diff --git a/hosts/d2nix/home-manager/mails.nix b/hosts/d2nix-archives/home-manager/mails.nix similarity index 100% rename from hosts/d2nix/home-manager/mails.nix rename to hosts/d2nix-archives/home-manager/mails.nix diff --git a/hosts/d2nix/home-manager/nixpkgs b/hosts/d2nix-archives/home-manager/nixpkgs similarity index 100% rename from hosts/d2nix/home-manager/nixpkgs rename to hosts/d2nix-archives/home-manager/nixpkgs diff --git a/hosts/d2nix/home-manager/packages.nix b/hosts/d2nix-archives/home-manager/packages.nix similarity index 100% rename from hosts/d2nix/home-manager/packages.nix rename to hosts/d2nix-archives/home-manager/packages.nix diff --git a/hosts/d2nix/home-manager/terminalrc b/hosts/d2nix-archives/home-manager/terminalrc similarity index 100% rename from hosts/d2nix/home-manager/terminalrc rename to hosts/d2nix-archives/home-manager/terminalrc diff --git a/hosts/d2nix/home-manager/variables.nix b/hosts/d2nix-archives/home-manager/variables.nix similarity index 100% rename from hosts/d2nix/home-manager/variables.nix rename to hosts/d2nix-archives/home-manager/variables.nix diff --git a/hosts/d2nix-archives/nixos/configuration.nix b/hosts/d2nix-archives/nixos/configuration.nix new file mode 100644 index 0000000..0c30d46 --- /dev/null +++ b/hosts/d2nix-archives/nixos/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, lib, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + + ./hardware-configuration.nix + ./services.nix + ./network.nix + modules/common.nix + modules/smtp.nix + modules/redshift.nix +# modules/starship.nix + modules/syncthing.nix +# modules/powermanagement.nix + + ]; + + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + plymouth.enable = true; + tmp.cleanOnBoot = true; + kernelParams = [ "i915.enable_fbc=1" ]; + }; + boot.initrd.luks.fido2Support = true; + boot.initrd.luks.devices."/dev/sda2".device = "/dev/sda2"; + boot.initrd.luks.devices."/dev/sda2".fido2.credential = "a67d17616bf2568727498dffa95205df943383ab3a2f9798606532d5791a155a37dd52dae2262619c1da2be7562ec9dd94888c71a9326fea70dfe16214b5ea8ec0143b010000"; + + hardware = { + # Enable microcode updates for Intel CPU + cpu.intel.updateMicrocode = true; + # Enable Kernel same-page merging + ksm.enable = true; + # Enable all the firmware + enableAllFirmware = true; + # Enable all the firmware with a license allowing redistribution. (i.e. free firmware and firmware-linux-nonfree) + enableRedistributableFirmware = true; + # Enable OpenGL drivers + opengl.enable = true; + opengl.extraPackages = with pkgs; [ + vaapiIntel + vaapiVdpau + libvdpau-va-gl + ]; + pulseaudio = { + enable = true; + }; + }; + + # Set your time zone. + time.timeZone = "Europe/Paris"; + + nixpkgs.config.allowUnfree = true; + + i18n.defaultLocale = "fr_FR.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "fr"; + }; + + fonts = { + fontDir.enable = true; + enableGhostscriptFonts = true; + fonts = with pkgs; [ + corefonts + vistafonts + inconsolata + terminus_font + proggyfonts + dejavu_fonts + font-awesome + nerdfonts + source-code-pro + source-sans-pro + source-serif-pro + ]; + }; + + programs = { + fish.enable = true; + fish.interactiveShellInit = '' + set -gx EDITOR nvim + ''; + ssh = { + setXAuthLocation = true; + forwardX11 = true; + }; + dconf.enable=true; + }; + programs.thunar.enable = true; + + programs.thunar.plugins = with pkgs.xfce; [ + thunar-archive-plugin + thunar-volman +]; + # Enable sound. + sound.enable = true; + + system.stateVersion = "23.05"; # Did you read the comment? + users = { + groups.ntp = {}; + defaultUserShell = "/run/current-system/sw/bin/fish"; + extraUsers.alexandre = { + isNormalUser = true; + home = "/home/alexandre"; + description = "alexandre"; + extraGroups = [ "wheel" "networkmanager" "docker" "libvirtd" "scanner" "plocate" "lp" ]; +# hashedPassword = "$6$7m77oPQxa$W9YnRLo1X2eqztBHwpoH8diHGkBno5O39AMyL9Qm8y8I6uW63H2Nwx4p239OG5zhOxA8J1lZvHTQ3hKPSP9mT/"; + }; + }; + + environment.systemPackages = with pkgs; [ + google-fonts + gnome.adwaita-icon-theme + networkmanagerapplet + ]; + + environment.variables.EDITOR = "nvim"; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; +} + diff --git a/hosts/d2nix-archives/nixos/hardware-configuration.nix b/hosts/d2nix-archives/nixos/hardware-configuration.nix new file mode 100644 index 0000000..0fb075e --- /dev/null +++ b/hosts/d2nix-archives/nixos/hardware-configuration.nix @@ -0,0 +1,47 @@ +# 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" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/b670bb55-7e29-4477-8f58-118c42598f40"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/0BEC-722D"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/d52b6afe-cb3f-4e92-8e4b-5394a0bef647"; } + ]; + + # 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.enp0s31f6.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + boot.initrd.luks.devices = { + "partitions" = { + device = "/dev/sda2"; + preLVM = true; # You may want to set this to false if you need to start a network service first + }; + }; +} diff --git a/hosts/d2nix/nixos/modules b/hosts/d2nix-archives/nixos/modules similarity index 100% rename from hosts/d2nix/nixos/modules rename to hosts/d2nix-archives/nixos/modules diff --git a/hosts/d2nix/nixos/network.nix b/hosts/d2nix-archives/nixos/network.nix similarity index 100% rename from hosts/d2nix/nixos/network.nix rename to hosts/d2nix-archives/nixos/network.nix diff --git a/hosts/d2nix-archives/nixos/services.nix b/hosts/d2nix-archives/nixos/services.nix new file mode 100644 index 0000000..e419786 --- /dev/null +++ b/hosts/d2nix-archives/nixos/services.nix @@ -0,0 +1,50 @@ +{ config, pkgs, ... }: + +{ + services = { + avahi = { + enable = true; + openFirewall = true; + }; + printing.enable = true; + clamav = { + daemon.enable = true; + updater.enable = true; + }; + locate = { + enable = true; + locate = pkgs.plocate; + interval = "hourly"; + localuser = null; + }; + redshift = { + enable = true; + brightness = { + # Note the string values below. + day = "1"; + night = "1"; + }; + temperature = { + day = 5500; + night = 3700; + }; + }; + geoclue2.appConfig.redshift.isAllowed = true; + automatic-timezoned.enable = true; + xserver = { + enable = true; + autorun = true; + windowManager.i3.enable = true; + displayManager.defaultSession = "none+i3"; + layout = "fr"; + xkbOptions = "eurosign:e"; + }; + openssh = { + enable = true; + settings.PermitRootLogin = "no"; + }; + ntp.enable = true; + tlp.enable = true; + fstrim.enable = true; + }; +} diff --git a/hosts/d2nix/home-manager/firefox.nix b/hosts/d2nix/home-manager/firefox.nix new file mode 100644 index 0000000..33b3c1b --- /dev/null +++ b/hosts/d2nix/home-manager/firefox.nix @@ -0,0 +1,84 @@ +{ config, pkgs, theme, ... }: +{ + + programs.firefox = { + enable = true; + package = pkgs.wrapFirefox pkgs.firefox-unwrapped { + extraPolicies = { + CaptivePortal = false; + DisableFirefoxStudies = true; + DisablePocket = true; + DisableTelemetry = true; + DisableFirefoxAccounts = false; + NoDefaultBookmarks = true; + OfferToSaveLogins = true; + OfferToSaveLoginsDefault = true; + PasswordManagerEnabled = true; + FirefoxHome = { + Search = true; + Pocket = false; + Snippets = false; + TopSites = false; + Highlights = false; + }; + UserMessaging = { + ExtensionRecommendations = false; + SkipOnboarding = true; + }; + }; + }; + profiles = { + alexandre = { + id = 0; + name = "alexandre"; + search = { + force = true; + default = "Google"; + engines = { + "Nix Packages" = { + urls = [{ + template = "https://search.nixos.org/packages"; + params = [ + { name = "type"; value = "packages"; } + { name = "query"; value = "{searchTerms}"; } + ]; + }]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = [ "@np" ]; + }; + "NixOS Wiki" = { + urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}"; }]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; + definedAliases = [ "@nw" ]; + }; + "Wikipedia (en)".metaData.alias = "@wiki"; + "Google".metaData.hidden = false; + "Amazon.com".metaData.hidden = true; + "Bing".metaData.hidden = true; + "eBay".metaData.hidden = true; + }; + }; + + extensions = with pkgs.nur.repos.rycee.firefox-addons; [ + ublock-origin + privacy-badger + keepassxc-browser + clearurls + decentraleyes + floccus + languagetool + disconnect + ]; + settings = { + "general.smoothScroll" = true; + }; + # extraConfig = '' + # user_pref("full-screen-api.ignore-widgets", true); + # user_pref("media.ffmpeg.vaapi.enabled", true); + # user_pref("media.rdd-vpx.enabled", true); + # ''; + }; + }; + }; +} diff --git a/hosts/d2nix/home-manager/home.nix b/hosts/d2nix/home-manager/home.nix index 2fc9a9c..6c453ea 100644 --- a/hosts/d2nix/home-manager/home.nix +++ b/hosts/d2nix/home-manager/home.nix @@ -1,25 +1,73 @@ -{ pkgs, config, ... }: { +{ config, pkgs, ... }: + +{ imports = [ - ./packages.nix - ./gnupg.nix - ./git.nix - ./variables.nix - ./i3status.nix - ./dunst.nix -# ./himalaya.nix - ./mails.nix - ../../../modules/tmux.nix - ../../../modules/emacs.nix - ../../../modules/neovim.nix + ./firefox.nix ]; - home.stateVersion = "23.05"; + # Home Manager needs a bit of information about you and the paths it should + # manage. home.username = "alexandre"; home.homeDirectory = "/home/alexandre"; - home.keyboard = { - layout = "fr"; - variant = "bepo"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "23.05"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; }; - xdg.configFile = { - "i3/config".source = ./configs/i3config; + + # You can also manage environment variables but you will have to manually + # source + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/alexandre/etc/profile.d/hm-session-vars.sh + # + # if you don't want to manage your shell through Home Manager. + home.sessionVariables = { + # EDITOR = "emacs"; }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; } diff --git a/hosts/d2nix/nixos/configuration.nix b/hosts/d2nix/nixos/configuration.nix index 0c30d46..5c82ea4 100644 --- a/hosts/d2nix/nixos/configuration.nix +++ b/hosts/d2nix/nixos/configuration.nix @@ -1,74 +1,48 @@ # 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’). +# and in the NixOS manual (accessible by running `nixos-help`). -{ config, lib, pkgs, ... }: +{ config, pkgs, ... }: { imports = [ # Include the results of the hardware scan. - ./hardware-configuration.nix ./services.nix - ./network.nix - modules/common.nix - modules/smtp.nix - modules/redshift.nix -# modules/starship.nix - modules/syncthing.nix -# modules/powermanagement.nix - + ./extra_hw.nix ]; boot = { loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; + loader.grub.efiSupport = true; + loader.grub.efiInstallAsRemovable = true; + loader.grub.device = "nodev"; plymouth.enable = true; - tmp.cleanOnBoot = true; + tmp.cleanOnBoot = true ; kernelParams = [ "i915.enable_fbc=1" ]; }; - boot.initrd.luks.fido2Support = true; - boot.initrd.luks.devices."/dev/sda2".device = "/dev/sda2"; - boot.initrd.luks.devices."/dev/sda2".fido2.credential = "a67d17616bf2568727498dffa95205df943383ab3a2f9798606532d5791a155a37dd52dae2262619c1da2be7562ec9dd94888c71a9326fea70dfe16214b5ea8ec0143b010000"; - hardware = { - # Enable microcode updates for Intel CPU - cpu.intel.updateMicrocode = true; - # Enable Kernel same-page merging - ksm.enable = true; - # Enable all the firmware - enableAllFirmware = true; - # Enable all the firmware with a license allowing redistribution. (i.e. free firmware and firmware-linux-nonfree) - enableRedistributableFirmware = true; - # Enable OpenGL drivers - opengl.enable = true; - opengl.extraPackages = with pkgs; [ - vaapiIntel - vaapiVdpau - libvdpau-va-gl - ]; - pulseaudio = { - enable = true; - }; + networking = { + hostName = "d2nix"; # Define your hostname. + networkmanager.enable = true; + firewall.enable = true; }; # Set your time zone. time.timeZone = "Europe/Paris"; - nixpkgs.config.allowUnfree = true; - i18n.defaultLocale = "fr_FR.UTF-8"; console = { font = "Lat2-Terminus16"; keyMap = "fr"; }; - fonts = { fontDir.enable = true; enableGhostscriptFonts = true; fonts = with pkgs; [ corefonts vistafonts + powerline-fonts inconsolata terminus_font proggyfonts @@ -78,30 +52,15 @@ source-code-pro source-sans-pro source-serif-pro + iosevka + roboto-mono + fira-code ]; }; - programs = { - fish.enable = true; - fish.interactiveShellInit = '' - set -gx EDITOR nvim - ''; - ssh = { - setXAuthLocation = true; - forwardX11 = true; - }; - dconf.enable=true; - }; - programs.thunar.enable = true; + #sound.enable = true; - programs.thunar.plugins = with pkgs.xfce; [ - thunar-archive-plugin - thunar-volman -]; - # Enable sound. - sound.enable = true; - - system.stateVersion = "23.05"; # Did you read the comment? + # Define a user account. Don't forget to set a password with ‘passwd’. users = { groups.ntp = {}; defaultUserShell = "/run/current-system/sw/bin/fish"; @@ -110,18 +69,109 @@ home = "/home/alexandre"; description = "alexandre"; extraGroups = [ "wheel" "networkmanager" "docker" "libvirtd" "scanner" "plocate" "lp" ]; -# hashedPassword = "$6$7m77oPQxa$W9YnRLo1X2eqztBHwpoH8diHGkBno5O39AMyL9Qm8y8I6uW63H2Nwx4p239OG5zhOxA8J1lZvHTQ3hKPSP9mT/"; + packages = with pkgs; [ + firefox + gitAndTools.gitFull + ]; + }; + extraUsers.oem = { + isNormalUser = true; + home = "/home/oem"; + description = "oem"; + extraGroups = [ "wheel" "networkmanager" ]; }; }; - environment.systemPackages = with pkgs; [ - google-fonts - gnome.adwaita-icon-theme - networkmanagerapplet + environment.variables = { + EDITOR = "nvim"; + BROWSER = "firefox"; + LESS = "--quit-if-one-screen --RAW-CONTROL-CHARS"; + TERMINAL = "xfce4-terminal"; + PRIVATE_BROWSER = "firefox -private"; + }; + + security = { + rtkit.enable = true; # for pipewire + apparmor.enable = true; + pam = { + u2f = { + enable = true; + control = "requisite"; + }; + services = { + login.u2fAuth = true; + lightdm.u2fAuth = true; + gdm.u2fAuth = true; + }; + }; + }; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + nixpkgs.config = { + allowUnfree = true; + }; + + nix.settings.auto-optimise-store = true; + nix.gc = { + automatic = true; + dates = "weekly"; + persistent = true; + options = "--delete-older-than 10d"; + }; + + + programs = { + htop = { + enable = true; + settings.show_cpu_temperature = 1; + }; + fish = { + enable = true; + interactiveShellInit = '' + set -gx EDITOR nvim + ''; + shellAliases = { + ll = "ls -l"; + ls = "lsd"; + cat = "bat"; + sysrs = "sudo nixos-rebuild switch"; + sysup = "sudo nixos-rebuild switch --upgrade"; + sysclean = "sudo nix-collect-garbage -d; and sudo nix-store --optimise"; +# nvim = "nvim -u ~/.config/nvim/init.lua"; + }; + }; + }; + environment.systemPackages = with pkgs; [ + neovim + bat + lsd + pam_u2f + gsmartcontrol + lm_sensors ]; - environment.variables.EDITOR = "nvim"; + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + + # 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 = "23.05"; # Did you read the comment? + + nixpkgs.config.packageOverrides = pkgs: { + nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { + inherit pkgs; + }; + }; } diff --git a/hosts/d2nix/nixos/extra_hw.nix b/hosts/d2nix/nixos/extra_hw.nix new file mode 100644 index 0000000..43a4ce3 --- /dev/null +++ b/hosts/d2nix/nixos/extra_hw.nix @@ -0,0 +1,33 @@ +{ config, pkgs, ... }: +{ + hardware = { + cpu.intel.updateMicrocode = true; + enableAllFirmware = true; + pulseaudio.enable = false; + bluetooth = { + enable = true; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; + }; + logitech = { + wireless.enable = true; + wireless.enableGraphical = true; + }; + opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + vaapiVdpau + libvdpau-va-gl + ]; + }; + }; + # Video acceleration + nixpkgs.config.packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + }; +} diff --git a/hosts/d2nix/nixos/hardware-configuration.nix b/hosts/d2nix/nixos/hardware-configuration.nix index 0fb075e..87652bb 100644 --- a/hosts/d2nix/nixos/hardware-configuration.nix +++ b/hosts/d2nix/nixos/hardware-configuration.nix @@ -8,40 +8,42 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; - boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "sr_mod" "vfat" "nls_cp437" "nls_iso8859-1" ]; + boot.initrd.kernelModules = [ "dm-snapshot" "coretemp" ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/b670bb55-7e29-4477-8f58-118c42598f40"; + { device = "/dev/disk/by-uuid/8eea016d-9dd3-4149-8e5c-014d7d90695f"; fsType = "ext4"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/0BEC-722D"; - fsType = "vfat"; - }; + { device = "/dev/disk/by-uuid/0382-3D00"; + fsType = "vfat"; + }; swapDevices = - [ { device = "/dev/disk/by-uuid/d52b6afe-cb3f-4e92-8e4b-5394a0bef647"; } + [ { device = "/dev/disk/by-uuid/1ffd2601-020f-4635-923b-4053676070d7"; } ]; - +# boot.initrd.luks.yubikeySupport = true; + boot.initrd.luks.devices = { + "partitions" = { + device = "/dev/sda2"; + preLVM = true; + crypttabExtraOpts = ["fido2-device=auto"]; + }; + }; + boot.initrd.systemd.enable = true; # 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.enp0s31f6.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp0s20f0u10.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - - boot.initrd.luks.devices = { - "partitions" = { - device = "/dev/sda2"; - preLVM = true; # You may want to set this to false if you need to start a network service first - }; - }; } diff --git a/hosts/d2nix/nixos/laptop.nix b/hosts/d2nix/nixos/laptop.nix new file mode 100644 index 0000000..6bb29f2 --- /dev/null +++ b/hosts/d2nix/nixos/laptop.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: +{ + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + +} diff --git a/hosts/d2nix/nixos/services.nix b/hosts/d2nix/nixos/services.nix index e419786..ce9a993 100644 --- a/hosts/d2nix/nixos/services.nix +++ b/hosts/d2nix/nixos/services.nix @@ -1,50 +1,54 @@ { config, pkgs, ... }: - { services = { avahi = { enable = true; openFirewall = true; }; - printing.enable = true; + clamav = { daemon.enable = true; updater.enable = true; }; + + ntp = { + enable = true; + }; + + thermald = { + enable = true; + }; + + fstrim = { + enable = true; + }; + locate = { - enable = true; - locate = pkgs.plocate; - interval = "hourly"; - localuser = null; - }; - redshift = { - enable = true; - brightness = { - # Note the string values below. - day = "1"; - night = "1"; - }; - temperature = { - day = 5500; - night = 3700; + enable = true; + locate = pkgs.plocate; + interval = "hourly"; + localuser = null; }; + + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; }; - geoclue2.appConfig.redshift.isAllowed = true; - automatic-timezoned.enable = true; + + # Enable the X11 windowing system. xserver = { enable = true; - autorun = true; - windowManager.i3.enable = true; - displayManager.defaultSession = "none+i3"; + # Configure keymap in X11 layout = "fr"; - xkbOptions = "eurosign:e"; + xkbOptions = "eurosign:e,caps:escape"; + # Enable the GNOME Desktop Environment. + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; }; - openssh = { - enable = true; - settings.PermitRootLogin = "no"; - }; - ntp.enable = true; - tlp.enable = true; - fstrim.enable = true; + udev.extraRules = '' + ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", ENV{ID_MODEL_ID}=="0407", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/alexandre/.Xauthority" RUN+="${pkgs.sudo}/bin/sudo -u alexandre ${pkgs.xdg-utils}/bin/xdg-screensaver lock" + ''; }; }