From 5b62192a522c6a0aaaaa39e9874f785188d07eeb Mon Sep 17 00:00:00 2001 From: Florian Schmitt Date: Tue, 18 Apr 2023 14:48:52 +0300 Subject: [PATCH] feat(homemanager+extras) : wip home-manager and nixos conf --- machines/MacBookPro12.1-configuration.nix | 11 +--- modules/desktop.nix | 2 + modules/home-config.nix | 73 +++++++++++++++++++---- modules/nixos.nix | 18 ++++++ 4 files changed, 86 insertions(+), 18 deletions(-) create mode 100644 modules/nixos.nix diff --git a/machines/MacBookPro12.1-configuration.nix b/machines/MacBookPro12.1-configuration.nix index 974d469..9f3a679 100644 --- a/machines/MacBookPro12.1-configuration.nix +++ b/machines/MacBookPro12.1-configuration.nix @@ -13,6 +13,7 @@ "hid_apple.fnmode=1" "hid_apple.swap_fn_leftctrl=1" ]; + boot.kernel.sysctl = { "vm.swappiness" = 10;}; # Bootloader. boot.loader.systemd-boot.enable = true; @@ -67,18 +68,12 @@ ../modules/console.nix ../modules/desktop.nix ../modules/fonts.nix + ../modules/home-config.nix ../modules/laptop.nix ../modules/local-dev.nix + ../modules/nixos.nix ]; - # Define a user account. Don't forget to set a password with ’passwd’. - users.users.mrflos = { - isNormalUser = true; - description = "mrflos"; - extraGroups = [ "docker" "lxd" "libvirtd" "networkmanager" "wheel" ]; - shell = pkgs.zsh; - }; - # 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 diff --git a/modules/desktop.nix b/modules/desktop.nix index b087bd0..e300ee6 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -53,6 +53,7 @@ in "pejkokffkapolfffcgbmdmhdelanoaih" # Unsplash instant "cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin "gfapcejdoghpoidkfodoiiffaaibpaem" # Dracula theme + "jbbplnpkjmmeebjpijfedlgcdilocofh" # wave a11y ]; extraOpts = { @@ -86,6 +87,7 @@ in jnoortheen.nix-ide dracula-theme.theme-dracula ms-vscode-remote.remote-ssh + gruntfuggly.todo-tree ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ { name = "remote-ssh-edit"; diff --git a/modules/home-config.nix b/modules/home-config.nix index bda8f7a..fe8af94 100644 --- a/modules/home-config.nix +++ b/modules/home-config.nix @@ -1,19 +1,72 @@ # Inject the right home-manager config for the machine. -{ config, depot, pkgs, ... }: +{ config, pkgs, lib, ... }: +# TODO can we automate the installation of home-manager ? +# sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-22.11.tar.gz home-manager { - users.users.tazjin = { - isNormalUser = true; - createHome = true; - extraGroups = [ "wheel" "networkmanager" "video" "adbusers" ]; - uid = 1000; - shell = pkgs.fish; - initialHashedPassword = "$2b$05$1eBPdoIgan/C/L8JFqIHBuVscQyTKw1L/4VBlzlLvLBEf6CXS3EW6"; + imports = [ + + ]; + + # Let Home Manager install and manage itself. + #programs.home-manager.enable = true; + + home-manager.users.mrflos = { pkgs, ... }: { + home.stateVersion = "22.11"; + + accounts.email.accounts = { + "mrflos@chmok.net" = { + realName = "Florian Schmitt"; + userName = "mrflos@chmok.net"; + address = "mrflos@chmok.net"; + + primary = true; + thunderbird = { + enable = true; + }; + imap = { + host = "mail.gandi.net"; + port = 143; + tls.useStartTls = true; + }; + + smtp = { + host = "mail.gandi.net"; + port = 587; + tls.useStartTls = true; + }; + }; + }; + + # programs.git = { + # enable = true; + # userName = "Florian Schmitt"; + # userEmail = "mrflos@gmail.com"; + # extraConfig = { + # pull.rebase = true; + # init.defaultBranch = "main"; + # }; + # }; + + programs.thunderbird = { + enable = true; + profiles.default = { + isDefault = true; + }; + }; }; - nix.settings.trusted-users = [ "tazjin" ]; + users.users.mrflos = { + isNormalUser = true; + description = "mrflos"; + createHome = true; + extraGroups = [ "docker" "libvirtd" "lxd" "networkmanager" "wheel" ]; + uid = 1000; + shell = pkgs.zsh; + }; + + nix.settings.trusted-users = [ "mrflos" ]; home-manager.useGlobalPkgs = true; - home-manager.users.tazjin = depot.users.tazjin.home."${config.networking.hostName}"; } diff --git a/modules/nixos.nix b/modules/nixos.nix new file mode 100644 index 0000000..ad72533 --- /dev/null +++ b/modules/nixos.nix @@ -0,0 +1,18 @@ +{ + # Auto system update + system.autoUpgrade = { + enable = true; + }; + + # Automatic Garbage Collection + nix.gc = { + automatic = true; + dates = "daily"; + options = "--delete-older-than 7d"; + }; + + # TODO : find what is installing this + nixpkgs.config.permittedInsecurePackages = [ + "electron-21.4.0" + ]; +} \ No newline at end of file