commit b94111bc5a8cce6b41401cb65ea47120134a6f06 Author: Matthew Bessette Date: Thu Jul 25 16:56:48 2024 -0400 Initial commit diff --git a/_hosts/argon/configuration.nix b/_hosts/argon/configuration.nix new file mode 100644 index 0000000..825c213 --- /dev/null +++ b/_hosts/argon/configuration.nix @@ -0,0 +1,138 @@ +{ config, pkgs, inputs, nix, system, ... }: + +{ + imports = [ + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ../../nixos-modules + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + boot.initrd.luks.devices."luks-e9ee8166-a569-4bfc-9ada-fb2b718d9ad5".device = "/dev/disk/by-uuid/e9ee8166-a569-4bfc-9ada-fb2b718d9ad5"; + networking.hostName = "nixos"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "America/New_York"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the KDE Plasma Desktop Environment. + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + + # Configure keymap in X11 + services.xserver = { + layout = "us"; + xkbVariant = ""; + }; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # 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; []; + # }; + + main-user.enable = true; + main-user.userName = "mbessette"; + + _1password.enable = true; + + home-manager = { + extraSpecialArgs = { inherit inputs; inherit system; }; + backupFileExtension = "backup"; + 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 + # 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; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.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? + +} diff --git a/_hosts/argon/hardware-configuration.nix b/_hosts/argon/hardware-configuration.nix new file mode 100644 index 0000000..6b3720d --- /dev/null +++ b/_hosts/argon/hardware-configuration.nix @@ -0,0 +1,42 @@ +# 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" "thunderbolt" "nvme" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/1647a4ac-27a4-4410-bf17-58f3ea762251"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-82108119-4645-4508-8f48-466041adbb60".device = "/dev/disk/by-uuid/82108119-4645-4508-8f48-466041adbb60"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/69FE-9A31"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/18cdfd30-cb27-4096-a6e4-ff1fcdc09b55"; } + ]; + + # 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.wlp166s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/_hosts/argon/home.nix b/_hosts/argon/home.nix new file mode 100644 index 0000000..77d4e1f --- /dev/null +++ b/_hosts/argon/home.nix @@ -0,0 +1,86 @@ +{ config, pkgs, inputs, ... }: + +let + agentPath = "~/.1password/agent.sock"; +in +{ + imports = [ + ../../home-manager-modules + ]; + + firefox.enable = true; + vscode.enable = true; + zsh.enable = true; + + home.username = "mbessette"; + home.homeDirectory = "/home/mbessette"; + home.stateVersion = "24.05"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + signal-desktop + ]; + + # 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 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. These will be explicitly sourced when using a + # shell provided by Home Manager. If you don't want to manage your shell + # through Home Manager then you have to manually source 'hm-session-vars.sh' + # located at either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/mbessette/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + EDITOR = "vim"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + programs.git = { + enable = true; + userEmail = "blade30912@gmail.com"; + userName = "Matthew Bessette"; + }; + + programs.ssh = { + enable = true; + extraConfig = '' + Host * + IdentityAgent ${agentPath} + ''; + }; + + nixpkgs = { + config.allowUnfreePredicate = pkg: + builtins.elem (pkgs.lib.getName pkg) [ + "1password-gui" + "1password" + "vscode" + "vscode-extension-ms-vsliveshare-vsliveshare" + "onepassword-password-manager" + ]; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..1fd63a7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,104 @@ +{ + "nodes": { + "firefox-addons": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "dir": "pkgs/firefox-addons", + "lastModified": 1721463311, + "narHash": "sha256-zmvqafJogm5DJ8+2v/kE9Oj8AGzK7IBOdMSIPZyKuNk=", + "owner": "rycee", + "repo": "nur-expressions", + "rev": "863eb5594f8c375d1ddaa2cea84a819c5197dd76", + "type": "gitlab" + }, + "original": { + "dir": "pkgs/firefox-addons", + "owner": "rycee", + "repo": "nur-expressions", + "type": "gitlab" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1629284811, + "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721534365, + "narHash": "sha256-XpZOkaSJKdOsz1wU6JfO59Rx2fqtcarQ0y6ndIOKNpI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "635563f245309ef5320f80c7ebcb89b2398d2949", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1721413321, + "narHash": "sha256-0GdiQScDceUrVGbxYpV819LHesK3szHOhJ09e6sgES4=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "ab165a8a6cd12781d76fe9cbccb9e975d0fb634f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1721379653, + "narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "firefox-addons": "firefox-addons", + "home-manager": "home-manager", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..11bb69e --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + firefox-addons = { + url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, nixos-hardware, ... }@inputs: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfree = true; + }; + }; + in { + # Framework - argon + nixosConfigurations.argon = nixpkgs.lib.nixosSystem { + + specialArgs = { inherit system; inherit inputs; }; + + modules = [ + nixos-hardware.nixosModules.framework-12th-gen-intel + ./_hosts/argon/configuration.nix + ./nixos-modules + ]; + }; + + homeManagerModules.default = ./nixos-modules/home-manager; + }; +} diff --git a/home-manager-modules/default.nix b/home-manager-modules/default.nix new file mode 100644 index 0000000..7542724 --- /dev/null +++ b/home-manager-modules/default.nix @@ -0,0 +1,7 @@ +{ + imports = [ + ./firefox.nix + ./vscode.nix + ./zsh.nix + ]; +} \ No newline at end of file diff --git a/home-manager-modules/firefox.nix b/home-manager-modules/firefox.nix new file mode 100644 index 0000000..d87c9b9 --- /dev/null +++ b/home-manager-modules/firefox.nix @@ -0,0 +1,30 @@ +{ config, lib, inputs, pkgs, ... }: + +let + cfg = config.firefox; + ext = inputs.firefox-addons.packages.${pkgs.system}; +in +{ + options = { + firefox.enable = lib.mkEnableOption "enable firefox module"; + }; + + config.programs.firefox = lib.mkIf cfg.enable { + enable = true; + profiles.default = { + + bookmarks = [ + { + name = "Wikipedia"; + tags = ["wiki"]; + url = "https://en.wikipedia.org"; + } + ]; + + extensions = [ + # ext."1password-x-password-manager" + ext.ublock-origin + ]; + }; + }; +} diff --git a/home-manager-modules/vscode.nix b/home-manager-modules/vscode.nix new file mode 100644 index 0000000..e254968 --- /dev/null +++ b/home-manager-modules/vscode.nix @@ -0,0 +1,27 @@ +{ config, lib, nixpkgs, pkgs, ... }: + +let + cfg = config.vscode; +in +{ + + options = { + vscode.enable = lib.mkEnableOption "enable vscode module"; + }; + + config.programs.vscode = lib.mkIf cfg.enable { + enable = true; + # package = pkgs.vscodium; + extensions = with pkgs.vscode-extensions; [ + bbenoist.nix + # rokoroku.vscode-theme-darcula + eamodio.gitlens + oderwat.indent-rainbow + ms-vsliveshare.vsliveshare + ]; + + userSettings = { + editor.tabSize = 2; + }; + }; +} diff --git a/home-manager-modules/zsh.nix b/home-manager-modules/zsh.nix new file mode 100644 index 0000000..972699b --- /dev/null +++ b/home-manager-modules/zsh.nix @@ -0,0 +1,19 @@ +{ config, lib, ... }: + +let + cfg = config.zsh; +in +{ + options = { + zsh.enable = lib.mkEnableOption "enable zsh module"; + }; + + config.programs.zsh = lib.mkIf cfg.enable { + enable = true; + # ohMyZsh.enable = true; + # ohMyZsh.theme = "robbyrussell"; + # ohMyZsh.plugins = [ + # "git" + # ]; + }; +} diff --git a/nixos-modules/1password.nix b/nixos-modules/1password.nix new file mode 100644 index 0000000..1d7430b --- /dev/null +++ b/nixos-modules/1password.nix @@ -0,0 +1,19 @@ +{ config, lib, ... }: + +let + cfg = config._1password; +in +{ + options = { + _1password.enable = lib.mkEnableOption "enable _1password module"; + }; + + config.programs._1password = lib.mkIf cfg.enable { + enable = true; + }; + + config.programs._1password-gui = lib.mkIf cfg.enable { + enable = true; + polkitPolicyOwners = [ "mbessette" ]; + }; +} diff --git a/nixos-modules/default.nix b/nixos-modules/default.nix new file mode 100644 index 0000000..f83009a --- /dev/null +++ b/nixos-modules/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./1password.nix + ./main-user.nix + ]; +} diff --git a/nixos-modules/main-user.nix b/nixos-modules/main-user.nix new file mode 100644 index 0000000..3aeab52 --- /dev/null +++ b/nixos-modules/main-user.nix @@ -0,0 +1,25 @@ +{ lib, config, pkgs, ... }: + +let + cfg = config.main-user; +in +{ + options = { + main-user.enable = lib.mkEnableOption "enable user module"; + main-user.userName = lib.mkOption { + default = "mbessette"; + description = "username"; + }; + }; + + config = lib.mkIf cfg.enable { + users.users.${cfg.userName} = { + isNormalUser = true; + initialPassword = "12345"; + description = "main user"; + shell = pkgs.zsh; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + }; +}