julm: firefox: change homepage
[julm/julm-nix.git] / hosts / patate.nix
index b0f04db69d34c21f7539f5363a8964e08cb27b81..9a75972c6442528fb0acf9f6b38085fa7053f954 100644 (file)
@@ -1,23 +1,29 @@
-{ config, pkgs, lib, inputs, hostName, ... }:
-let inherit (config.users) users; in
+{ config, pkgs, lib, ... }:
 {
 imports = [
-  ../profiles/dnscrypt-proxy2.nix
-  ../profiles/security.nix
-  ../networking/wireguard/wg-intra.nix
+  ../nixos/profiles/dnscrypt-proxy2.nix
+  ../nixos/profiles/graphical.nix
+  ../nixos/profiles/lang-fr.nix
+  ../nixos/profiles/networking.nix
+  ../nixos/profiles/printing.nix
+  ../nixos/profiles/security.nix
+  ../nixos/profiles/system.nix
+  ../nixos/profiles/wireguard/wg-intra.nix
   patate/backup.nix
   patate/hardware.nix
+  patate/wireguard.nix
 ];
 
+# Lower kernel's security for better performances
+boot.kernelParams = [ "mitigations=off" ];
+
 home-manager.users.sevy = {
   imports = [ ../homes/sevy.nix ];
-  host.hardware = ["ThinkPad" "X200"];
+  host.hardware = [ "ThinkPad" "X200" ];
 };
-systemd.services.home-manager-julm.postStart = ''
+systemd.services.home-manager-sevy.postStart = ''
   ${pkgs.nix}/bin/nix-env --delete-generations +1 --profile /nix/var/nix/profiles/per-user/sevy/home-manager
 '';
-security.lockKernelModules = false;
-users.mutableUsers = false;
 users.users.sevy = {
   isNormalUser = true;
   uid = 1000;
@@ -39,203 +45,39 @@ users.users.sevy = {
 };
 
 nix = {
-  extraOptions = ''
-  '';
-  autoOptimiseStore = true;
-  gc = {
-    automatic = true;
-    dates = "weekly";
-    options = "--delete-older-than 7d";
-  };
-  nixPath = [
-    "nixpkgs=/etc/nixpkgs"
-    "nixpkgs-overlays=/etc/nixpkgs-overlays/overlays.nix"
-  ];
-  trustedUsers = [ users.sevy.name ];
-  binaryCaches = [
-    "http://nix-localcache.losurdo.wg"
-    "ssh://nix-ssh@oignon.wg"
-  ];
-  binaryCachePublicKeys = [
-    "losurdo.sourcephile.fr-1:XGeaIE2AA2mZskSZ5bIDrfx53q+TDDWJOUEpZDX7los="
-    "oignon.sourcephile.fr:slxL7XLsGXlD1r6gvw1imL5uQntW0TTlQgGQt3LBJgQ="
-  ];
-};
-services.openssh.passwordAuthentication = false;
-
-nixpkgs.config = {
-  allowUnfree = true;
-};
-environment.etc."nixpkgs".source = pkgs.path;
-environment.etc."nixpkgs-overlays".source = inputs.self + "/nixpkgs";
-environment.systemPackages = [
-  pkgs.riseup-vpn
-];
-
-documentation.nixos.enable = true;
-time.timeZone = "Europe/Paris";
-i18n.defaultLocale = "fr_FR.UTF-8";
-console.font = "Lat2-Terminus16";
-console.keyMap = "fr";
-
-networking = {
-  hostName = hostName;
-  domain = "localdomain";
-  networkmanager = {
-    enable = true;
-    #dhcp = "dhcpcd";
-    logLevel = "INFO";
-    wifi = {
-      #backend = "iwd";
-      #backend = "wpa_supplicant";
-      powersave = false;
-    };
-  };
-  firewall = {
-    enable = true;
-    allowPing = false;
-    allowedTCPPorts = [
-      51413 # transmission-gtk
-      4662 # edonkey
+  settings = {
+    trusted-users = [ config.users.users."sevy".name ];
+    substituters = [
+      #"ssh://nix-ssh@losurdo.wg?priority=30"
+      "ssh://nix-ssh@oignon.wg?priority=10"
     ];
-    allowedUDPPorts = [
-      51413 # transmission-gtk
-      4667 # edonkey
-      4672 # edonkey
+    trusted-public-keys = map lib.readFile [
+      ../private/shared/nix/losurdo.pub
+      ../private/shared/nix/oignon.pub
     ];
   };
 };
 
-sound.enable = true;
-hardware.pulseaudio.enable = true;
-hardware.sane.enable = true;
-hardware.sane.extraBackends = [ pkgs.hplipWithPlugin ];
-
-environment.variables = {
-  EDITOR = "vim -g";
-  PAGER  = "less -R";
-  SYSTEMD_LESS = "FKMRX";
-};
-
-programs = {
-  bash = {
-    interactiveShellInit = ''
-      bind '"\e[A":history-search-backward'
-      bind '"\e[B":history-search-forward'
-
-      # Ignore duplicate commands, ignore commands starting with a space
-      export HISTCONTROL=erasedups:ignorespace
-      export HISTSIZE=42000
-      # Append to the history instead of overwriting (good for multiple connections)
-      shopt -s histappend
-
-      # Utilities
-      mkcd () { mkdir -p "$1"; cd "$1"; }
-      fan () {
-        if [ $# -gt 0 ]
-        then sudo tee /proc/acpi/ibm/fan <<<"level $1"
-        else grep '^\(level\|speed\):' /proc/acpi/ibm/fan
-        fi
-        acpi -t
-      }
-    '';
-    shellAliases = {
-      cl = "clear";
-      grep = "grep --color";
-      l  = "ls -alh";
-      ll = "ls -al";
-      ls = "ls --color=tty";
-      mem = "ps -e -orss=,user=,args= | sort -b -k1,1n";
-
-      s="sudo systemctl";
-      st="sudo systemctl status";
-      u="systemctl --user";
-      j="sudo journalctl -u";
-      jb="sudo journalctl -b";
-
-      nix-history="sudo nix-env --list-generations --profile /nix/var/nix/profiles/system";
-      mv = "mv -i";
-      sshfs = "sshfs -o ServerAliveInterval=15 -o reconnect -f";
-    };
-  };
-  dconf.enable = true;
-  mtr.enable = true;
-};
+environment.systemPackages = [
+  pkgs.riseup-vpn # Can't be installed by home-manager because it needs to install policy-kit rules
+];
 
-services.avahi = {
-  enable  = true;
-  nssmdns = true;
-  openFirewall = false;
-  publish = {
-    enable = false;
-  };
-};
-services.davfs2 = {
-  enable = true;
-  extraConfig = ''
-  '';
-};
-fileSystems."/home/sevy/mnt/ilico/severine" = {
-  device = "https://nuage.ilico.org/remote.php/dav/files/severine/";
-  fsType = "davfs";
-  options =
-    let conf = pkgs.writeText "davfs2.conf" ''
-      backup_dir /home/sevy/Documents/EnTransfert/ilico/severine
-      cache_dir /home/sevy/.cache/davfs2/ilico/severine
-    ''; in
-    [ "conf=${conf}" "user" "noexec" "nosuid" "noauto" ]; # "x-systemd.automount"
-};
-services.dbus = {
-  packages = [ pkgs.gnome3.dconf ];
-};
-services.gvfs = {
-  enable = true;
-};
-services.journald = {
-  extraConfig = ''
-    Compress=true
-    MaxRetentionSec=1month
-    Storage=persistent
-    SystemMaxUse=100M
-  '';
-};
 services.physlock = {
   enable = true;
   allowAnyUser = true;
   # NOTE: xfconf-query -c xfce4-session -p /general/LockCommand -s "physlock" --create -t string
 };
-services.printing = {
-  enable = true;
-  drivers = [
-    pkgs.gutenprint
-    pkgs.hplip
-  ];
-};
-services.udev = {
-  packages = [
-    # Allow members of the "adbusers" group to mount Android devices via MTP
-    pkgs.android-udev-rules
-  ];
-};
+
 services.xserver = {
-  enable = true;
-  layout = "fr";
-  xkbOptions = "eurosign:e";
-  libinput.enable = true;
   desktopManager = {
-    xfce = {
-      enable = true;
-      thunarPlugins = [
-        #pkgs.xfce.thunar-archive-plugin
-      ];
-    };
+    mate.enable = true;
+    xfce.enable = true;
     xterm.enable = false;
   };
   displayManager = {
-    defaultSession = "xfce";
+    defaultSession = "mate";
     autoLogin = {
-      enable = true;
-      user = users.sevy.name;
+      user = config.users.users.sevy.name;
     };
   };
 };