Updated config to be alot more robust and make sense where modularity is included

This commit is contained in:
Nathan Anderson 2024-01-15 20:11:17 -07:00
parent 3652381567
commit c4f0a374b2
67 changed files with 137 additions and 304 deletions

View File

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1702735279, "lastModified": 1705269478,
"narHash": "sha256-SztEzDOE/6bDNnWWvnRbSHPVrgewLwdSei1sxoZFejM=", "narHash": "sha256-j7Rp8Y3ckBHOlIzqe0g2+/BVce9SU/dVtn4Eb0rMuY4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e9b9ecef4295a835ab073814f100498716b05a96", "rev": "846200eb574faa2af808ed02e653c2b8ed51fd71",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,33 +20,13 @@
"type": "github" "type": "github"
} }
}, },
"nix-ld": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1701153607,
"narHash": "sha256-h+odOVyiGmEERMECoFOj5P7FPiMR8IPRzroFA4sKivg=",
"owner": "Mic92",
"repo": "nix-ld",
"rev": "bf5aa84a713c31d95b4307e442e966d6c7fd7ae7",
"type": "github"
},
"original": {
"owner": "Mic92",
"repo": "nix-ld",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1702312524, "lastModified": 1705133751,
"narHash": "sha256-gkZJRDBUCpTPBvQk25G0B7vfbpEYM5s5OZqghkjZsnE=", "narHash": "sha256-rCIsyE80jgiOU78gCWN3A0wE0tR2GI5nH6MlS+HaaSQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a9bf124c46ef298113270b1f84a164865987a91c", "rev": "9b19f5e77dd906cb52dade0b7bd280339d2a1f3d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -58,11 +38,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1702346276, "lastModified": 1705183652,
"narHash": "sha256-eAQgwIWApFQ40ipeOjVSoK4TEHVd6nbSd9fApiHIw5A=", "narHash": "sha256-rnfkyUH0x72oHfiSDhuCHDHg3gFgF+lF8zkkg5Zihsw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "cf28ee258fd5f9a52de6b9865cdb93a1f96d09b7", "rev": "428544ae95eec077c7f823b422afae5f174dee4b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -74,11 +54,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1702770334, "lastModified": 1705283909,
"narHash": "sha256-MVILxIF9ZVIk0f9w3yYZpy8auwxgey0MFzdoIFFvQNU=", "narHash": "sha256-7F2KyTB4cApsHg7oltJ1r0QFWMjWTOaS9m2IbKFhj6Y=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "1d37444620523278aa163bb9e30104f5d1152061", "rev": "375b9a949232cd1e31bd89d197a5605a17d2aeb3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -90,7 +70,6 @@
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"nix-ld": "nix-ld",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable", "nixpkgs-stable": "nixpkgs-stable",
"nur": "nur" "nur": "nur"

View File

@ -3,44 +3,24 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11"; nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
nix-ld = {
url = "github:Mic92/nix-ld";
inputs.nixpkgs.follows = "nixpkgs";
};
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# firefox-addons = {
# url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons";
# inputs.nixpkgs.follows = "nixpkgs";
# };
}; };
outputs = { self, nixpkgs, nixpkgs-stable, nix-ld, nur, home-manager, ... } @ inputs: outputs = { self, nixpkgs, nixpkgs-stable, nur, home-manager, ... } @ inputs:
let let
inherit (self) outputs; inherit (self) outputs;
system = "x86_64-linux"; system = "x86_64-linux";
userName = "nate";
fullName = "Nate Anderson";
email = "n8r@tuta.io";
hostName = "winmax";
desktop = "sway";
gaming = true;
timeZone = "America/Denver"; timeZone = "America/Denver";
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
stablePkgs = nixpkgs-stable.legacyPackages.${system}; stablePkgs = nixpkgs-stable.legacyPackages.${system};
in in
{ {
nixosConfigurations = {
nixosConfigurations = {
nixServer = nixpkgs.lib.nixosSystem { nixServer = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
@ -49,24 +29,22 @@
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
]; ];
}; };
nixDesktop = nixpkgs.lib.nixosSystem { nate = nixpkgs.lib.nixosSystem {
# Pass args to desktop configuration # Pass args to desktop configuration
specialArgs = { specialArgs = {
inherit inputs outputs userName hostName desktop timeZone gaming system; inherit inputs outputs timeZone system;
}; };
modules = [ modules = [
./nixos/desktop_configuration.nix # Setup home manager
# Setup nix-ld inputs.home-manager.nixosModules.home-manager {
# nix-ld.nixosModules.nix-ld home-manager.useGlobalPkgs = true;
# Setup home manager home-manager.useUserPackages = true;
home-manager.nixosModules.home-manager { home-manager.users.nate = import ./nate/modules/home-manager/home.nix;
home-manager.useGlobalPkgs = true; home-manager.extraSpecialArgs = {
home-manager.useUserPackages = true; inherit inputs outputs;
home-manager.users.${userName} = import ./modules/home-manager/home.nix; };
home-manager.extraSpecialArgs = { }
inherit inputs outputs userName fullName email hostName desktop gaming; ./nate/default.nix
};
}
]; ];
}; };
}; };

22
nate/default.nix Normal file
View File

@ -0,0 +1,22 @@
{ config, lib, inputs, outputs, pkgs, system, timeZone, ... }:
let
userName = "nate";
fullName = "Nate Anderson";
email = "n8r@tuta.io";
hostName = "winmax";
desktop = "sway";
gaming = true;
in
{
imports = [
./desktop-configuration.nix
./nixos/hardware-configuration.nix
];
deskCfg = {
userName = userName;
hostName = hostName;
de = desktop;
installGaming = gaming;
};
}

View File

@ -0,0 +1,81 @@
{ config, lib, inputs, outputs, pkgs, timeZone, system, ... }:
let
supportedDesktops = [ "sway" ];
supportedDesktopsStr = lib.strings.concatStringsSep ", " supportedDesktops;
deskCfg = config.deskCfg;
in
{
options.deskCfg = {
de = lib.mkOption {
default = "sway";
type = lib.types.str;
description = "Desktop Environment";
};
userName = lib.mkOption {
type = lib.types.str;
description = "Main username for system";
};
hostName = lib.mkOption {
type = lib.types.str;
description = "Hostname for system";
};
installGaming = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to install gaming software or not";
};
};
imports = [
modules/user/main_user.nix
modules/sway/sway_conf.nix
# inputs.nur.hmModules.nur
];
config = {
assertions = [
{
assertion = builtins.elem deskCfg.de supportedDesktops;
message = "Unsupported desktop environment: ${deskCfg.de}\nSupported DE's: ${supportedDesktopsStr}";
}
];
nixpkgs.overlays = [
inputs.nur.overlay
];
# Enable flakes feature
nix.settings.experimental-features = [
"nix-command" "flakes"
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = deskCfg.hostName; # Define your hostname.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
time.timeZone = timeZone;
main_user = {
enable = true;
userName = deskCfg.userName;
isDesktopUser = true;
};
swaywm = {
enable = true;
useNonFree = true;
installGaming = deskCfg.installGaming;
systemPackages = with pkgs; [
libreoffice
];
};
system.stateVersion = "23.11"; # Did you read the comment?
};
}

View File

Before

Width:  |  Height:  |  Size: 221 KiB

After

Width:  |  Height:  |  Size: 221 KiB

View File

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 150 KiB

View File

Before

Width:  |  Height:  |  Size: 218 KiB

After

Width:  |  Height:  |  Size: 218 KiB

View File

Before

Width:  |  Height:  |  Size: 772 KiB

After

Width:  |  Height:  |  Size: 772 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 344 KiB

After

Width:  |  Height:  |  Size: 344 KiB

View File

Before

Width:  |  Height:  |  Size: 591 KiB

After

Width:  |  Height:  |  Size: 591 KiB

View File

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 138 KiB

View File

@ -1,4 +1,9 @@
{ inputs, outputs, lib, config, pkgs, userName, fullName, email, hostName, desktop, gaming, ... }: { inputs, outputs, lib, config, pkgs, ... }:
let
userName = "nate";
fullName = "Nathan Anderson";
email = "n8r@tuta.io";
in
{ {
# nixpkgs.overlays = [ # nixpkgs.overlays = [
# inputs.nur.overlay # inputs.nur.overlay
@ -62,6 +67,7 @@
# Better Unix # Better Unix
# #
bat bat
broot # tree alternative
duf duf
fd fd
fzf fzf
@ -101,10 +107,6 @@
# '') # '')
]; ];
# TODO not working firefox plugins
# extensions = with inputs.firefox-addons.packages.${pkgs.system}; [ ublock-origin bitwarden ];
# Home Manager is pretty good at managing dotfiles. The primary way to manage # Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'. # plain files is through 'home.file'.
home.file."${config.xdg.configHome}" = { home.file."${config.xdg.configHome}" = {
@ -112,7 +114,7 @@
# # the Nix store. Activating the configuration will then make '~/.screenrc' a # # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy. # # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc; # ".screenrc".source = dotfiles/screenrc;
source = ../../nate/dotfiles; source = ../../dotfiles;
recursive = true; recursive = true;
# # You can also set the file content immediately. # # You can also set the file content immediately.

View File

@ -1,27 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, userName, hostName, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./sway_configuration.nix
# ../modules/user/main_user.nix
# ../modules/sway/sway_conf.nix
];
# Enable flakes feature
nix.settings.experimental-features = [
"nix-command" "flakes"
];
programs.nix-ld.enable = true;
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@ -1,61 +0,0 @@
{ config, lib, inputs, outputs, pkgs, userName, hostName, desktop, timeZone, gaming, system, ... }:
let
supportedDesktops = [ "sway" "kde" ];
supportedDesktopsStr = lib.strings.concatStringsSep ", " supportedDesktops;
in
{
assertions = [
{
assertion = builtins.elem desktop supportedDesktops;
message = "Unsupported desktop environment: ${desktop}\nSupported DE's: ${supportedDesktopsStr}";
}
];
nixpkgs.overlays = [
inputs.nur.overlay
];
imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix
../modules/user/main_user.nix
../modules/sway/sway_conf.nix
# inputs.nur.hmModules.nur
];
# Enable flakes feature
nix.settings.experimental-features = [
"nix-command" "flakes"
];
# programs.nix-ld.dev.enable = true;
# nixpkgs.config.allowUnfree = true;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = hostName; # Define your hostname.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
time.timeZone = timeZone;
main_user = {
enable = true;
userName = userName;
isDesktopUser = true;
};
swaywm = {
enable = desktop == "sway";
useNonFree = true;
installGaming = gaming;
systemPackages = with pkgs; [
libreoffice
];
};
system.stateVersion = "23.11"; # Did you read the comment?
}

View File

@ -1,141 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, inputs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./modules/user/main_user.nix
inputs.home-manager.nixosModules.default
];
# Enable flakes feature
nix.settings.experimental-features = [
"nix-command" "flakes"
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "America/Denver";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
# i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
# Enable the X11 windowing system.
# services.xserver.enable = true;
# Configure keymap in X11
# services.xserver.xkb.layout = "us";
# services.xserver.xkb.options = "eurosign:e,caps:escape";
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.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.nate = {
# initialPassword = "password";
# extraGroups = [ "wheel" ];
# isNormalUser = true;
# };
# Use main user module
main_user.enable = true;
main_user.userName = "natea";
# Sets up programs in /etc/profile instead of ~/.profile
home-manager.useUserPackages = true;
# Uses system nixpkgs instead of private, adds consistency and removes NIX_PATH dependency
home-manager.useGlobalPkgs = true;
home-manager.users.nate = { pkgs, ... }: {
programs.bash.enable = true;
home.packages = with pkgs; [
firefox
kakoune
curl
];
home.stateVersion = "23.11";
};
# 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 = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}