diff --git a/flake.nix b/flake.nix index 3d91950..9fbd0f9 100644 --- a/flake.nix +++ b/flake.nix @@ -66,6 +66,7 @@ lemp11 = nixpkgs.lib.nixosSystem { specialArgs = specialArgs // { hostname = "lemp11"; + stateVersion = "22.11"; }; modules = [ @@ -79,6 +80,7 @@ specialArgs = specialArgs // { headless = true; hostname = "nixedo"; + stateVersion = "24.11"; }; modules = [ @@ -91,6 +93,7 @@ t490 = nixpkgs.lib.nixosSystem { specialArgs = specialArgs // { hostname = "t490"; + stateVersion = "22.11"; }; modules = [ @@ -108,6 +111,7 @@ specialArgs = specialArgs // { headless = true; hostname = "PW05CH3L"; + stateVersion = "22.11"; }; modules = [ diff --git a/nix/home/opdavies/default.nix b/nix/home/opdavies/default.nix index d3bc1f8..f4b099f 100644 --- a/nix/home/opdavies/default.nix +++ b/nix/home/opdavies/default.nix @@ -13,18 +13,10 @@ let pkgs = import inputs.nixpkgs { inherit system; - config = { - allowUnfree = true; - - permittedInsecurePackages = [ - "electron-27.3.11" - ]; - }; + config.allowUnfree = true; overlays = [ outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.stable-packages ]; }; diff --git a/nix/hosts/PW05CH3L/configuration.nix b/nix/hosts/PW05CH3L/configuration.nix index 2f2c5bf..ccc0d6e 100644 --- a/nix/hosts/PW05CH3L/configuration.nix +++ b/nix/hosts/PW05CH3L/configuration.nix @@ -1,102 +1,9 @@ -{ - headless ? false, - hostname, - inputs, - outputs, - pkgs, - self, - system, - username, - ... -}: +{ inputs, ... }: { - home-manager = { - extraSpecialArgs = { - inherit - hostname - inputs - outputs - headless - self - system - username - ; - }; - useGlobalPkgs = true; - useUserPackages = true; - - users."${username}" = import "${self}/nix/home/${username}"; - }; - - nixpkgs = { - config = { - allowUnfree = true; - }; - - overlays = [ - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.stable-packages - ]; - }; - nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; - # # Enable networking - # networking.networkmanager.enable = true; - - # Set your time zone. - time.timeZone = "Europe/London"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_GB.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_GB.UTF-8"; - LC_IDENTIFICATION = "en_GB.UTF-8"; - LC_MEASUREMENT = "en_GB.UTF-8"; - LC_MONETARY = "en_GB.UTF-8"; - LC_NAME = "en_GB.UTF-8"; - LC_NUMERIC = "en_GB.UTF-8"; - LC_PAPER = "en_GB.UTF-8"; - LC_TELEPHONE = "en_GB.UTF-8"; - LC_TIME = "en_GB.UTF-8"; - }; - - # Configure console keymap - console.keyMap = "uk"; - - users.users.${username} = { - description = "Oliver Davies"; - isNormalUser = true; - - extraGroups = [ - "docker" - "media" - "networkmanager" - "wheel" - ]; - - packages = with pkgs; [ ]; - }; - - security.sudo.wheelNeedsPassword = false; - - environment.systemPackages = - with pkgs; - [ - ] - ++ pkgs.lib.optionals (!headless) [ - ]; - - system.stateVersion = "22.11"; - nix = { - extraOptions = '' - trusted-users = root ${username} - ''; - gc = { automatic = true; dates = "daily"; @@ -107,12 +14,13 @@ settings = { auto-optimise-store = true; + experimental-features = [ "nix-command" "flakes" ]; + warn-dirty = false; }; }; - } diff --git a/nix/hosts/common/default.nix b/nix/hosts/common/default.nix index fd0852f..134ae97 100644 --- a/nix/hosts/common/default.nix +++ b/nix/hosts/common/default.nix @@ -1,7 +1,13 @@ { + headless, hostname, inputs, outputs, + pkgs, + self, + stateVersion, + system, + username, ... }: @@ -10,7 +16,90 @@ inputs.home-manager.nixosModules.home-manager outputs.nixosModules.default + + ./programs.nix + ./users.nix ]; + environment.systemPackages = + with pkgs; + [ + fastfetch + mermaid-cli + mkcert + ] + ++ pkgs.lib.optionals (!headless) [ + acpi + arandr + brightnessctl + cpufrequtils + libnotify + pmutils + ffmpegthumbnailer + libreoffice + logseq + shotwell + vscode + xfce.thunar + xfce.thunar-volman + xfce.tumbler + ]; + + home-manager = { + extraSpecialArgs = { + inherit + hostname + inputs + outputs + headless + self + system + username + ; + }; + useGlobalPkgs = true; + useUserPackages = true; + + users."${username}" = import "${self}/nix/home/${username}"; + }; + + nixpkgs = { + config.allowUnfree = true; + + overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.stable-packages + ]; + }; + + nix.extraOptions = '' + trusted-users = root ${username} + ''; + networking.hostName = hostname; + + time.timeZone = "Europe/London"; + + i18n = { + defaultLocale = "en_GB.UTF-8"; + + extraLocaleSettings = { + LC_ADDRESS = "en_GB.UTF-8"; + LC_IDENTIFICATION = "en_GB.UTF-8"; + LC_MEASUREMENT = "en_GB.UTF-8"; + LC_MONETARY = "en_GB.UTF-8"; + LC_NAME = "en_GB.UTF-8"; + LC_NUMERIC = "en_GB.UTF-8"; + LC_PAPER = "en_GB.UTF-8"; + LC_TELEPHONE = "en_GB.UTF-8"; + LC_TIME = "en_GB.UTF-8"; + }; + }; + + console.keyMap = "uk"; + + security.sudo.wheelNeedsPassword = false; + + system.stateVersion = stateVersion; } diff --git a/nix/hosts/common/programs.nix b/nix/hosts/common/programs.nix new file mode 100644 index 0000000..b984595 --- /dev/null +++ b/nix/hosts/common/programs.nix @@ -0,0 +1,8 @@ +{ + programs = { + zsh = { + enable = true; + histSize = 5000; + }; + }; +} diff --git a/nix/hosts/common/users.nix b/nix/hosts/common/users.nix new file mode 100644 index 0000000..32760a5 --- /dev/null +++ b/nix/hosts/common/users.nix @@ -0,0 +1,20 @@ +{ username, ... }: + +{ + users = { + users.${username} = { + isNormalUser = true; + description = "Oliver Davies"; + + extraGroups = [ + "docker" + "networkmanager" + "wheel" + ]; + + packages = [ ]; + }; + + defaultUserShell = "/etc/profiles/per-user/${username}/bin/zsh"; + }; +} diff --git a/nix/hosts/lemp11/configuration.nix b/nix/hosts/lemp11/configuration.nix index a7be113..d042697 100644 --- a/nix/hosts/lemp11/configuration.nix +++ b/nix/hosts/lemp11/configuration.nix @@ -1,11 +1,6 @@ { - headless ? false, - hostname, inputs, - outputs, pkgs, - self, - system, username, ... }: @@ -21,38 +16,6 @@ ./hardware-configuration.nix ]; - home-manager = { - extraSpecialArgs = { - inherit - hostname - inputs - outputs - headless - self - system - username - ; - }; - useGlobalPkgs = true; - useUserPackages = true; - - users."${username}" = import "${self}/nix/home/${username}"; - }; - - nixpkgs = { - config = { - allowUnfree = true; - - permittedInsecurePackages = [ "electron-27.3.11" ]; - }; - - overlays = [ - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.stable-packages - ]; - }; - nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # Bootloader. @@ -77,34 +40,8 @@ DefaultTimeoutStopSec=10s ''; - # 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 = "Europe/London"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_GB.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_GB.UTF-8"; - LC_IDENTIFICATION = "en_GB.UTF-8"; - LC_MEASUREMENT = "en_GB.UTF-8"; - LC_MONETARY = "en_GB.UTF-8"; - LC_NAME = "en_GB.UTF-8"; - LC_NUMERIC = "en_GB.UTF-8"; - LC_PAPER = "en_GB.UTF-8"; - LC_TELEPHONE = "en_GB.UTF-8"; - LC_TIME = "en_GB.UTF-8"; - }; - - # Enable the X11 windowing system. services.xserver.enable = true; services.xserver = { @@ -117,15 +54,12 @@ desktopManager.gnome.enable = true; }; - # Configure console keymap - console.keyMap = "uk"; - services.avahi.enable = true; services.avahi.nssmdns4 = true; services.avahi.openFirewall = true; + services.printing.enable = true; - # Enable sound with pipewire. hardware.pulseaudio.enable = false; hardware.bluetooth.enable = true; @@ -146,103 +80,11 @@ pulse.enable = true; }; - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - users.users.${username} = { - isNormalUser = true; - description = "Oliver Davies"; - extraGroups = [ - "docker" - "media" - "networkmanager" - "scanner" - "wheel" - ]; - packages = [ ]; - }; - - users.groups.media = { }; - - security.sudo.wheelNeedsPassword = false; - - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = - with pkgs; - [ - caffeine-ng - cryptsetup - gtypist - fastfetch - mermaid-cli - mkcert - ttyper - yt-dlp - ytfzf - ] - ++ pkgs.lib.optionals (!headless) [ - acpi - arandr - brightnessctl - cpufrequtils - libnotify - pmutils - ffmpegthumbnailer - libreoffice - logseq - rclone - rclone-browser - shotwell - vscode - xfce.thunar - xfce.thunar-volman - xfce.tumbler - ]; - - # 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 = [ - 9003 # xdebug - ]; - # 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 = "22.11"; # Did you read the comment? - - programs.dconf.enable = true; - - programs.zsh.enable = true; - programs.zsh.histSize = 5000; - - users.defaultUserShell = "/etc/profiles/per-user/${username}/bin/zsh"; - zramSwap.enable = true; nix = { - extraOptions = '' - trusted-users = root ${username} - ''; - gc = { automatic = true; dates = "daily"; diff --git a/nix/hosts/nixedo/configuration.nix b/nix/hosts/nixedo/configuration.nix index 9ebdd5d..7895a15 100644 --- a/nix/hosts/nixedo/configuration.nix +++ b/nix/hosts/nixedo/configuration.nix @@ -2,146 +2,32 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ - headless, - hostname, - inputs, - outputs, - pkgs, - self, - system, - username, - ... -}: +{ inputs, pkgs, ... }: { imports = [ - # Include the results of the hardware scan. ./hardware-configuration.nix ]; - # home-manager.backupFileExtension - home-manager = { - backupFileExtension = "bak2"; - extraSpecialArgs = { - inherit - hostname - inputs - outputs - headless - self - system - username - ; - }; - useGlobalPkgs = true; - useUserPackages = true; - - users."${username}" = import "${self}/nix/home/${username}"; - }; - - nixpkgs = { - config = { - allowUnfree = true; - - permittedInsecurePackages = [ "electron-27.3.11" ]; - }; - - overlays = [ - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.stable-packages - ]; - }; - nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.efi.efiSysMountPoint = "/boot/efi"; + boot.loader = { + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/efi"; + }; - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + systemd-boot.enable = true; + }; - # 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 = "Europe/London"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_GB.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_GB.UTF-8"; - LC_IDENTIFICATION = "en_GB.UTF-8"; - LC_MEASUREMENT = "en_GB.UTF-8"; - LC_MONETARY = "en_GB.UTF-8"; - LC_NAME = "en_GB.UTF-8"; - LC_NUMERIC = "en_GB.UTF-8"; - LC_PAPER = "en_GB.UTF-8"; - LC_TELEPHONE = "en_GB.UTF-8"; - LC_TIME = "en_GB.UTF-8"; - }; - - # Configure keymap in X11 - services.xserver.xkb = { - layout = "gb"; - variant = ""; - }; - - # Configure console keymap - console.keyMap = "uk"; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.opdavies = { - isNormalUser = true; - description = "Oliver Davies"; - extraGroups = [ - "docker" - "media" - "networkmanager" - "wheel" - ]; - packages = with pkgs; [ - cryptsetup - ]; - }; - users.groups.media = { }; - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. - # 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 = [ 80 443 ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - system.stateVersion = "24.11"; } diff --git a/nix/hosts/t490/configuration.nix b/nix/hosts/t490/configuration.nix index bc6033a..3c228b4 100644 --- a/nix/hosts/t490/configuration.nix +++ b/nix/hosts/t490/configuration.nix @@ -1,11 +1,6 @@ { - headless ? false, - hostname, inputs, - outputs, pkgs, - self, - system, username, ... }: @@ -15,41 +10,14 @@ ./hardware-configuration.nix ]; - home-manager = { - extraSpecialArgs = { - inherit - hostname - inputs - outputs - headless - self - system - username - ; - }; - useGlobalPkgs = true; - useUserPackages = true; - - users."${username}" = import "${self}/nix/home/${username}"; - }; - nixpkgs = { config = { - allowUnfree = true; - permittedInsecurePackages = [ "electron-27.3.11" ]; }; - - overlays = [ - outputs.overlays.additions - outputs.overlays.modifications - outputs.overlays.stable-packages - ]; }; nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; - # Bootloader. boot = { loader = { systemd-boot = { @@ -70,52 +38,23 @@ DefaultTimeoutStopSec=10s ''; - # 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 = "Europe/London"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_GB.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_GB.UTF-8"; - LC_IDENTIFICATION = "en_GB.UTF-8"; - LC_MEASUREMENT = "en_GB.UTF-8"; - LC_MONETARY = "en_GB.UTF-8"; - LC_NAME = "en_GB.UTF-8"; - LC_NUMERIC = "en_GB.UTF-8"; - LC_PAPER = "en_GB.UTF-8"; - LC_TELEPHONE = "en_GB.UTF-8"; - LC_TIME = "en_GB.UTF-8"; - }; - - # Enable the X11 windowing system. - services.xserver.enable = true; - services.xserver = { + enable = true; + xkb = { layout = "gb"; variant = ""; }; }; - # Configure console keymap - console.keyMap = "uk"; - services.avahi.enable = true; services.avahi.nssmdns4 = true; services.avahi.openFirewall = true; + services.printing.enable = true; - # Enable sound with pipewire. hardware.pulseaudio.enable = false; hardware.bluetooth.enable = true; @@ -136,18 +75,9 @@ pulse.enable = true; }; - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - users.users.${username} = { - isNormalUser = true; - description = "Oliver Davies"; - extraGroups = [ - "docker" - "media" - "networkmanager" - "wheel" - ]; + extraGroups = [ "media" ]; + packages = with pkgs; [ android-tools via @@ -156,82 +86,22 @@ users.groups.media = { }; - security.sudo.wheelNeedsPassword = false; + environment.systemPackages = with pkgs; [ + gtypist + rclone + rclone-browser + ttyper + yt-dlp + ytfzf + ]; - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = - with pkgs; - [ - caffeine-ng - cryptsetup - gtypist - fastfetch - mermaid-cli - mkcert - ttyper - yt-dlp - ytfzf - ] - ++ pkgs.lib.optionals (!headless) [ - acpi - arandr - brightnessctl - cpufrequtils - libnotify - pmutils - ffmpegthumbnailer - libreoffice - logseq - rclone - rclone-browser - shotwell - vscode - xfce.thunar - xfce.thunar-volman - xfce.tumbler - ]; - - # 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 = [ - 9003 # xdebug - ]; - # 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 = "22.11"; # Did you read the comment? - programs.dconf.enable = true; - users.defaultUserShell = "/etc/profiles/per-user/${username}/bin/zsh"; - zramSwap.enable = true; nix = { - extraOptions = '' - trusted-users = root ${username} - ''; - gc = { automatic = true; dates = "daily";