From 1945dbbdda5215a2d4528506bbf9617f160e3324 Mon Sep 17 00:00:00 2001 From: Matthew Bessette Date: Thu, 25 Jul 2024 22:09:33 -0400 Subject: [PATCH] Refactoring --- _hosts/argon/configuration.nix | 63 +++++++++++++-------------- _hosts/bromine/configuration.nix | 75 ++++++++++++++------------------ home-manager-modules/vscode.nix | 4 +- nixos-modules/main-user.nix | 5 ++- 4 files changed, 69 insertions(+), 78 deletions(-) diff --git a/_hosts/argon/configuration.nix b/_hosts/argon/configuration.nix index ffe86cc..3291ccb 100644 --- a/_hosts/argon/configuration.nix +++ b/_hosts/argon/configuration.nix @@ -7,6 +7,14 @@ ../../nixos-modules ]; + # 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.11"; # Did you read the comment? + # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -83,10 +91,14 @@ # packages = with pkgs; []; # }; - main-user.enable = true; - main-user.userName = "mbessette"; + ########### + # MUTABLE # + ########### - _1password.enable = true; + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; home-manager = { extraSpecialArgs = { inherit inputs; inherit system; }; @@ -94,46 +106,31 @@ users.mbessette = import ./home.nix; }; - programs.zsh.enable = true; - - # Allow unfree packages - nixpkgs.config.allowUnfree = true; - - nix.settings.experimental-features = [ "nix-command" "flakes" ]; - # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ vim nodejs_22 - # wget ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; + ################## + # CUSTOM MODULES # + ################## - # List services that you want to enable: + main-user.enable = true; + main-user.userName = "mbessette"; - # Enable the OpenSSH daemon. - # services.openssh.enable = true; + _1password.enable = true; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; + ############ + # PROGRAMS # + ############ - # 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.11"; # Did you read the comment? + programs.zsh.enable = true; + ############ + # SERVICES # + ############ + + # ... } diff --git a/_hosts/bromine/configuration.nix b/_hosts/bromine/configuration.nix index 8de8ecc..84f66cb 100644 --- a/_hosts/bromine/configuration.nix +++ b/_hosts/bromine/configuration.nix @@ -1,15 +1,19 @@ -# 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, inputs, pkgs, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - inputs.vscode-server.nixosModules.default - ]; + imports = [ + ./hardware-configuration.nix + ../../nixos-modules + inputs.vscode-server.nixosModules.default + ]; + + # 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.11"; # Did you read the comment? # Bootloader. boot.loader.systemd-boot.enable = true; @@ -49,17 +53,9 @@ xkbVariant = ""; }; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.mbessette = { - isNormalUser = true; - description = "Matthew Bessette"; - extraGroups = [ "networkmanager" "wheel" ]; - packages = with pkgs; []; - - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxwgo35pdtk5dJKYBNLk723yvxmaJzN87KW3L2U82nY5HTYkMP6eoLN2S71RRN0deSE9//1xE3Pj1RXUates5Bq42csEa0s791VEC3zWdTlYeVaHbGgyRIOtNv6s5celwvqYZkMERbvbz/7cmTbOuQf5bdvopS7tofzj83s5iwOO8pmayavZ/xWSOfau07z0Sj2KuJSjqGkLtFD9P4o9BeNc3ZxghaMidZtpUNgSq/n06aph+dZOCLQpAQlQPIxqowGX/gQSailYId0SfAtuTesFvdgi9xkokia2erxv0RVbnblSZuucYoNdEm/sAX3bMxG9mLGxpyeIRfZjNynhzQh6jk4xLNsNszWVhmh49nrBADwmjXS6vO/QT8aaByKwJNmkPZxRMOquy18bZeEOl+Qya/Ui0g9diL3c6Mqmz4SwrWiROo70nFiInEMPAl/sXZSfpWsiFsAqqV2WyFKTNBzIM+XYE8wZf5h8thh8YuE3uGduR86u9HH7IU+fNCPR0=" - ]; - }; + ########### + # MUTABLE # + ########### # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -72,15 +68,22 @@ vim ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; + ################## + # CUSTOM MODULES # + ################## - # List services that you want to enable: + main-user.enable = true; + main-user.userName = "mbessette"; + + ############ + # PROGRAMS # + ############ + + programs.zsh.enable = true; + + ############ + # SERVICES # + ############ # Enable the OpenSSH daemon. services.openssh = { @@ -88,19 +91,5 @@ }; services.vscode-server.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # 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.11"; # Did you read the comment? - + virtualisation.docker.enable = true; } diff --git a/home-manager-modules/vscode.nix b/home-manager-modules/vscode.nix index dd7f66a..dae9fe0 100644 --- a/home-manager-modules/vscode.nix +++ b/home-manager-modules/vscode.nix @@ -11,7 +11,7 @@ in config.programs.vscode = lib.mkIf cfg.enable { enable = true; - # package = pkgs.vscodium; + extensions = with pkgs.vscode-extensions; [ bbenoist.nix # rokoroku.vscode-theme-darcula @@ -23,6 +23,8 @@ in userSettings = { editor.tabSize = 2; + terminal.integrated.defaultProfile.linux = "zsh"; + terminal.integrated.defaultProfile.osx = "zsh"; }; }; } diff --git a/nixos-modules/main-user.nix b/nixos-modules/main-user.nix index 3aeab52..4236a60 100644 --- a/nixos-modules/main-user.nix +++ b/nixos-modules/main-user.nix @@ -18,8 +18,11 @@ in initialPassword = "12345"; description = "main user"; shell = pkgs.zsh; - extraGroups = [ "networkmanager" "wheel" ]; + extraGroups = [ "networkmanager" "wheel" "docker"]; packages = with pkgs; []; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxwgo35pdtk5dJKYBNLk723yvxmaJzN87KW3L2U82nY5HTYkMP6eoLN2S71RRN0deSE9//1xE3Pj1RXUates5Bq42csEa0s791VEC3zWdTlYeVaHbGgyRIOtNv6s5celwvqYZkMERbvbz/7cmTbOuQf5bdvopS7tofzj83s5iwOO8pmayavZ/xWSOfau07z0Sj2KuJSjqGkLtFD9P4o9BeNc3ZxghaMidZtpUNgSq/n06aph+dZOCLQpAQlQPIxqowGX/gQSailYId0SfAtuTesFvdgi9xkokia2erxv0RVbnblSZuucYoNdEm/sAX3bMxG9mLGxpyeIRfZjNynhzQh6jk4xLNsNszWVhmh49nrBADwmjXS6vO/QT8aaByKwJNmkPZxRMOquy18bZeEOl+Qya/Ui0g9diL3c6Mqmz4SwrWiROo70nFiInEMPAl/sXZSfpWsiFsAqqV2WyFKTNBzIM+XYE8wZf5h8thh8YuE3uGduR86u9HH7IU+fNCPR0=" + ]; }; }; }