From 9350ff271fce5eb08a65e54061e55f5a8b890a99 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Tue, 3 Sep 2024 22:24:20 -0400 Subject: [PATCH] adhere to nixos systems --- flake.nix | 56 +++++++++++++++--------- home/atuin.nix | 7 +-- home/core.nix | 19 ++++---- home/default.nix | 39 ++++++++++------- home/direnv.nix | 6 +-- home/eza.nix | 6 +-- home/lazygit.nix | 4 +- home/neovim.nix | 6 +-- home/shell.nix | 56 ++++++++++++------------ home/starship.nix | 6 +-- modules/{system.nix => darwinSystem.nix} | 0 modules/linuxSystem.nix | 0 12 files changed, 108 insertions(+), 97 deletions(-) rename modules/{system.nix => darwinSystem.nix} (100%) create mode 100644 modules/linuxSystem.nix diff --git a/flake.nix b/flake.nix index d716560..85eda0f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,11 @@ { - description = "Wyatt's nix configuration"; - + description = "Wyatt's nix configuration suite"; inputs = { - nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin"; + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-24.05"; + # nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin"; home-manager = { url = "github:nix-community/home-manager/release-24.05"; - inputs.nixpkgs.follows = "nixpkgs-darwin"; + inputs.nixpkgs.follows = "nixpkgs"; }; darwin = { url = "github:lnl7/nix-darwin"; @@ -13,11 +13,6 @@ }; }; - # The `outputs` function will return all the build results of the flake. - # A flake can have many use cases and different types of outputs, - # parameters in `outputs` are defined in `inputs` and can be referenced by their names. - # However, `self` is an exception, this special parameter points to the `outputs` itself (self-reference) - # The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function. outputs = inputs @ { self, nixpkgs, @@ -25,37 +20,56 @@ home-manager, ... }: let - username = "wyatt"; - useremail = "wyatt@wyattjmiller.com"; - system = "aarch64-darwin"; # aarch64-darwin or x86_64-darwin - hostname = "sephiroth"; + userName = "wyatt"; + userEmail = "wyatt@wyattjmiller.com"; + # supportedSystems = ["x86_64-linux" "aarch64-darwin"]; + # system = "aarch64-darwin"; # aarch64-darwin or x86_64-darwin + # hostname = "sephiroth"; + # forAllSystems = nixpkgs.lib.genAttrs supportedSystems; specialArgs = inputs // { - inherit username useremail hostname; + inherit userName userEmail; }; in { - darwinConfigurations."${hostname}" = darwin.lib.darwinSystem { - inherit system specialArgs; + # Primary laptop - MacBook Pro (2023, M3) + darwinConfigurations."sephiroth" = darwin.lib.darwinSystem { + inherit specialArgs; + system = "aarch64-darwin"; modules = [ ./modules/nix-core.nix - ./modules/system.nix + ./modules/darwinSystem.nix ./modules/apps.nix ./modules/host-users.nix - # home manager home-manager.darwinModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.extraSpecialArgs = specialArgs; - home-manager.users.${username} = import ./home; + home-manager.users.${userName} = import ./home; } ]; }; - # nix code formatter - formatter.${system} = nixpkgs.legacyPackages.${system}.alejandra; + # Primary desktop computer + nixosConfiguration."cloud" = nixpkgs.lib.nixosSystem { + inherit specialArgs; + system = "x86_64-linux"; + modules = [ + /etc/nixos/configuration.nix + ./modules/nix-core.nix + # ./modules/linuxSystem.nix + ./modules/host-users.nix + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.${userName} = import ./home; + } + ]; + }; }; } diff --git a/home/atuin.nix b/home/atuin.nix index 16b6302..56b0dc2 100644 --- a/home/atuin.nix +++ b/home/atuin.nix @@ -1,9 +1,6 @@ -{ ... }: - -{ +{...}: { programs.atuin = { enable = true; - enableFishIntegration = true; }; -} \ No newline at end of file +} diff --git a/home/core.nix b/home/core.nix index 27d767d..8d482bd 100644 --- a/home/core.nix +++ b/home/core.nix @@ -9,15 +9,15 @@ p7zip # utils - bat # a batter cat - lazygit # a git tui that's easy to use - bottom # a better top - ripgrep # recursively searches directories for a regex pattern - jq # A lightweight and flexible command-line JSON processor - yq-go # yaml processer https://github.com/mikefarah/yq - fzf # A command-line fuzzy finder - fh # flake hub command line interface - aria2 # A lightweight multi-protocol & multi-source command-line download utility + bat + lazygit + bottom + ripgrep + jq + yq-go + fzf + fh + aria2 yt-dlp # misc @@ -41,6 +41,7 @@ nixd deadnix alejandra + statix # productivity iterm2 diff --git a/home/default.nix b/home/default.nix index 56bfdc8..7b5b3a3 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,6 +1,11 @@ -{ username, ... }: - { + pkgs, + lib, + userName, + ... +}: let + username = userName; +in { # import sub modules imports = [ ./atuin.nix @@ -15,20 +20,24 @@ # Home Manager needs a bit of information about you and the # paths it should manage. - home = { - username = username; - homeDirectory = "/Users/${username}"; + home = lib.mkMerge [ + (lib.mkIf pkgs.stdenv.isDarwin { + homeDirectory = "/Users/${username}"; + }) + (lib.mkIf pkgs.stdenv.isLinux { + homeDirectory = "/home/${username}"; + }) + ]; - # This value determines the Home Manager release that your - # configuration is compatible with. This helps avoid breakage - # when a new Home Manager release introduces backwards - # incompatible changes. - # - # You can update Home Manager without changing this value. See - # the Home Manager release notes for a list of state version - # changes in each release. - stateVersion = "24.05"; - }; + # This value determines the Home Manager release that your + # configuration is compatible with. This helps avoid breakage + # when a new Home Manager release introduces backwards + # incompatible changes. + # + # You can update Home Manager without changing this value. See + # the Home Manager release notes for a list of state version + # changes in each release. + stateVersion = "24.05"; # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/home/direnv.nix b/home/direnv.nix index 47cc53f..2cd7f1e 100644 --- a/home/direnv.nix +++ b/home/direnv.nix @@ -1,6 +1,4 @@ -{ lib, config, ... }: - -{ +{...}: { programs.direnv = { enable = true; nix-direnv.enable = true; @@ -11,4 +9,4 @@ }; }; }; -} \ No newline at end of file +} diff --git a/home/eza.nix b/home/eza.nix index 5c05761..44350e0 100644 --- a/home/eza.nix +++ b/home/eza.nix @@ -1,10 +1,8 @@ -{ lib, config, ... }: - -{ +{...}: { programs.eza = { enable = true; enableFishIntegration = true; extraOptions = [ ]; }; -} \ No newline at end of file +} diff --git a/home/lazygit.nix b/home/lazygit.nix index 4f24f47..35ea71c 100644 --- a/home/lazygit.nix +++ b/home/lazygit.nix @@ -1,6 +1,4 @@ -{ ... }: - -{ +{...}: { programs.lazygit = { enable = true; diff --git a/home/neovim.nix b/home/neovim.nix index bcf357e..1d3114c 100644 --- a/home/neovim.nix +++ b/home/neovim.nix @@ -1,9 +1,7 @@ -{ lib, config, ... }: - -{ +{...}: { programs.neovim = { enable = true; defaultEditor = true; vimAlias = true; }; -} \ No newline at end of file +} diff --git a/home/shell.nix b/home/shell.nix index 30712f7..559e7c6 100644 --- a/home/shell.nix +++ b/home/shell.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: { +{pkgs, ...}: { programs.fish = { enable = true; # initExtra = '' @@ -7,18 +7,18 @@ shellAliases = { # ls aliases - ls = "eza --color $argv"; - la = "eza -l -all --color $argv"; - ll = "eza -l --color $argv"; - lt = "eza -l --color --git $argv"; + ls = "eza --color"; + la = "eza -l -all --color"; + ll = "eza -l --color"; + lt = "eza -l --color --git"; # lazygit alias lg = "lazygit"; # cat, less, more alias - cat = "bat $argv"; - less = "bat $argv"; - more = "bat $argv"; + cat = "bat"; + less = "bat"; + more = "bat"; # top alias top = "btm"; @@ -28,28 +28,28 @@ functions = { fish_greeting = { body = '' - set memes \ - "Crazy? I was crazy once. They locked me in a room. A rubber room. A rubber room with rats. And rats make me crazy." \ - "Daddy, chill!" \ - "What the hell is even that?!" \ - "Road work ahead? Yeah, I sure hope it does!" \ - "Look at all those chickens!" \ - "I smell like beef" \ - "Say, Coloardo - I'M A GIRAFFE" \ - "I didn't get no sleep cause of y'all, y'all not gone get any sleep cause of me!" \ - "This is the dollar store, how good can it be?" \ - "That was legitness" \ - "Deez nuts" \ - "I wanna be a cowboy baby" \ - "Can I get a waffle? Can I please get a waffle?" \ - "I'm lesbian. I thought you were American." \ - "You gotta give 'em that 'hawk tuah' and spit on that thang!" \ - "We don't do that here..." + set memes \ + "Crazy? I was crazy once. They locked me in a room. A rubber room. A rubber room with rats. And rats make me crazy." \ + "Daddy, chill!" \ + "What the hell is even that?!" \ + "Road work ahead? Yeah, I sure hope it does!" \ + "Look at all those chickens!" \ + "I smell like beef" \ + "Say, Coloardo - I'M A GIRAFFE" \ + "I didn't get no sleep cause of y'all, y'all not gone get any sleep cause of me!" \ + "This is the dollar store, how good can it be?" \ + "That was legitness" \ + "Deez nuts" \ + "I wanna be a cowboy baby" \ + "Can I get a waffle? Can I please get a waffle?" \ + "I'm lesbian. I thought you were American." \ + "You gotta give 'em that 'hawk tuah' and spit on that thang!" \ + "We don't do that here..." - set choose_meme (random)"%"(count $memes) - set choose_meme $memes[(math $choose_meme"+1")] + set choose_meme (random)"%"(count $memes) + set choose_meme $memes[(math $choose_meme"+1")] - printf (set_color F90)"%s\n" $choose_meme + printf (set_color F90)"%s\n" $choose_meme ''; onEvent = "fish_greeting"; }; diff --git a/home/starship.nix b/home/starship.nix index ef02d21..70051b9 100644 --- a/home/starship.nix +++ b/home/starship.nix @@ -1,9 +1,7 @@ -{ lib, config, ... }: - -{ +{...}: { programs.starship = { enable = true; enableFishIntegration = true; - settings = { }; + settings = {}; }; } diff --git a/modules/system.nix b/modules/darwinSystem.nix similarity index 100% rename from modules/system.nix rename to modules/darwinSystem.nix diff --git a/modules/linuxSystem.nix b/modules/linuxSystem.nix new file mode 100644 index 0000000..e69de29