diff options
author | Linnnus <[email protected]> | 2025-01-18 13:14:31 +0100 |
---|---|---|
committer | Linnnus <[email protected]> | 2025-01-18 13:14:31 +0100 |
commit | f5fc33abb93e058b943e5ef0dc8c8a3c02255804 (patch) | |
tree | 4457684b5ea69d493ea4af5db59195d637e62c9d | |
parent | e92e5baa7b23c696241bc0d7cfa6d952ca8578d4 (diff) |
Move NixOS-specific options from shared/{nixos-and-darwin => nixos}
-rw-r--r-- | hosts/ahmed/configuration.nix | 4 | ||||
-rw-r--r-- | hosts/ahmed/torrenting/default.nix | 2 | ||||
-rw-r--r-- | hosts/omar/configuration.nix | 4 | ||||
-rw-r--r-- | shared/nixos-and-darwin/common-nix-settings/default.nix | 78 | ||||
-rw-r--r-- | shared/nixos-and-darwin/common-shell-settings/default.nix | 80 | ||||
-rw-r--r-- | shared/nixos/common-nix-settings/default.nix | 10 | ||||
-rw-r--r-- | shared/nixos/common-shell-settings/default.nix | 14 |
7 files changed, 98 insertions, 94 deletions
diff --git a/hosts/ahmed/configuration.nix b/hosts/ahmed/configuration.nix index 4bb5c50..692203d 100644 --- a/hosts/ahmed/configuration.nix +++ b/hosts/ahmed/configuration.nix @@ -9,8 +9,8 @@ ./hardware-configuration.nix ../../shared/nixos/cloudflare-proxy - ../../shared/nixos-and-darwin/common-nix-settings - ../../shared/nixos-and-darwin/common-shell-settings + ../../shared/nixos/common-nix-settings + ../../shared/nixos/common-shell-settings ../../shared/nixos-and-darwin/common-hm-settings ./git.linus.onl diff --git a/hosts/ahmed/torrenting/default.nix b/hosts/ahmed/torrenting/default.nix index 666c894..c61d719 100644 --- a/hosts/ahmed/torrenting/default.nix +++ b/hosts/ahmed/torrenting/default.nix @@ -22,7 +22,7 @@ Preferences = { # Configure credentials. This should be safe to keep here, since the password is hashed. "WebUI\\Username" = "linus"; - "WebUI\\Password_PBKDF2" = "@ByteArray(KCBHD0C70+/50xW/zkIUiw==:WY6phmLjJza//fD6w6fXwqzLCYIQjFMRQ3hlqYVIRcKVNHh1fYjMHlI1aBPciJtDdBABq3/D2hOuhQpAt3oUXQ==)"; + "WebUI\\Password_PBKDF2" = "@ByteArray(KCBHD0C70+/50xW/zkIUiw==:WY6phmLjJza//fD6w6fXwqzLCYIQjFMRQ3hlqYVIRcKVNHh1fYjMHlI1aBPciJtDdBABq3/D2hOuhQpAt3oUXQ==)"; }; }; }; diff --git a/hosts/omar/configuration.nix b/hosts/omar/configuration.nix index 2e0a146..55b5040 100644 --- a/hosts/omar/configuration.nix +++ b/hosts/omar/configuration.nix @@ -8,8 +8,8 @@ # Include the results of the hardware scan. ./hardware-configuration.nix - ../../shared/nixos-and-darwin/common-nix-settings - ../../shared/nixos-and-darwin/common-shell-settings + ../../shared/nixos/common-nix-settings + ../../shared/nixos/common-shell-settings ../../shared/nixos-and-darwin/common-hm-settings ../../shared/nixos/zfs-impermenance ../../shared/nixos/persist-ssh-host-keys diff --git a/shared/nixos-and-darwin/common-nix-settings/default.nix b/shared/nixos-and-darwin/common-nix-settings/default.nix index 92e14f3..3681946 100644 --- a/shared/nixos-and-darwin/common-nix-settings/default.nix +++ b/shared/nixos-and-darwin/common-nix-settings/default.nix @@ -1,8 +1,5 @@ # This module sets common settings related to Nix such as enabling flakes and -# using overlays everywhere.. -# -# NOTE: This lives under `shared/nixos-and-darwin`. The configuration in here -# should be compatible with both nixos and nix-darwin!! +# using overlays everywhere. { pkgs, lib, @@ -10,50 +7,43 @@ flakeInputs, flakeOutputs, ... -}: -lib.mkMerge [ - { - # Enable de facto stable features. - nix.settings.experimental-features = ["nix-command" "flakes"]; +}: { + # Enable de facto stable features. + nix.settings.experimental-features = ["nix-command" "flakes"]; - nixpkgs.overlays = [ - # Use local overlays. - flakeOutputs.overlays.additions - flakeOutputs.overlays.modifications + nixpkgs.overlays = [ + # Use local overlays. + flakeOutputs.overlays.additions + flakeOutputs.overlays.modifications - # Add unstable nixpkgs. - (final: prev: {unstable = flakeInputs.nixpkgs-unstable.legacyPackages.${pkgs.system};}) - ]; + # Add unstable nixpkgs. + (final: prev: {unstable = flakeInputs.nixpkgs-unstable.legacyPackages.${pkgs.system};}) + ]; - # I'm not *that* vegan. - nixpkgs.config.allowUnfree = true; + # I'm not *that* vegan. + nixpkgs.config.allowUnfree = true; - # This will add each flake input as a registry - # To make nix3 commands consistent with your flake - nix.registry = lib.mapAttrs (_: value: {flake = value;}) flakeInputs; + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = lib.mapAttrs (_: value: {flake = value;}) flakeInputs; - nix.nixPath = - [ - # Use overlays from this repo for building system configuration as well as system-wide. - # See: https://nixos.wiki/wiki/Overlays#Using_nixpkgs.overlays_from_configuration.nix_as_.3Cnixpkgs-overlays.3E_in_your_NIX_PATH - "nixpkgs-overlays=${flakeInputs.self}/overlays/compat.nix" - ] - # This will additionally add out inputs to the system's legacy channels - # Making legacy nix commands consistent as well, awesome! - ++ lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + nix.nixPath = + [ + # Use overlays from this repo for building system configuration as well as system-wide. + # See: https://nixos.wiki/wiki/Overlays#Using_nixpkgs.overlays_from_configuration.nix_as_.3Cnixpkgs-overlays.3E_in_your_NIX_PATH + "nixpkgs-overlays=${flakeInputs.self}/overlays/compat.nix" + ] + # This will additionally add out inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + ++ lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; - # Add shell-utilities which are only relevant if Nix is enabled. - environment.systemPackages = with pkgs; [ - # For running programs easily. - nix-index # Also includes nix-locate - flakeInputs.comma.packages.${system}.default + # Add shell-utilities which are only relevant if Nix is enabled. + environment.systemPackages = with pkgs; [ + # For running programs easily. + nix-index # Also includes nix-locate + flakeInputs.comma.packages.${system}.default - # For editing secrets. - flakeInputs.agenix.packages.${system}.default - ]; - } - (lib.mkIf pkgs.stdenv.isLinux { - # There is not nix-darwin equivalent to this NixOS option. - nix.enable = true; - }) -] + # For editing secrets. + flakeInputs.agenix.packages.${system}.default + ]; +} diff --git a/shared/nixos-and-darwin/common-shell-settings/default.nix b/shared/nixos-and-darwin/common-shell-settings/default.nix index 1fcb05e..982296d 100644 --- a/shared/nixos-and-darwin/common-shell-settings/default.nix +++ b/shared/nixos-and-darwin/common-shell-settings/default.nix @@ -3,52 +3,42 @@ # # NOTE: This lives under `shared/nixos-and-darwin`. The configuration in here # should be compatible with both nixos and nix-darwin!! +{pkgs, ...}: { + # Set ZSH as the shell. + # https://nixos.wiki/wiki/Command_Shell#Changing_default_shelltrue + programs.zsh.enable = true; + environment.shells = [pkgs.zsh]; -{pkgs, lib, ...}: + # Very basic system administration tools. + environment.systemPackages = with pkgs; [ + curl + jq + moreutils + neovim + tree + ]; -lib.mkMerge [ - { - # Set ZSH as the shell. - # https://nixos.wiki/wiki/Command_Shell#Changing_default_shelltrue - programs.zsh.enable = true; - environment.shells = [pkgs.zsh]; + # Aliases that are burned into my muscle memory. + environment.shellAliases = { + "mv" = "mv -i"; + "rm" = "rm -i"; + "cp" = "cp -i"; + "ls" = "ls -F -G -A --color=auto"; + "grep" = "grep --color=auto"; + "file" = "file --no-dereference"; + "tree" = "tree --dirsfirst --gitignore"; - # Very basic system administration tools. - environment.systemPackages = with pkgs; [ - curl - jq - moreutils - neovim - tree - ]; + # See: https://github.com/NixOS/nix/issues/5858 + "nix" = "nix --print-build-logs"; - # Aliases that are burned into my muscle memory. - environment.shellAliases = { - "mv" = "mv -i"; - "rm" = "rm -i"; - "cp" = "cp -i"; - "ls" = "ls -F -G -A --color=auto"; - "grep" = "grep --color=auto"; - "file" = "file --no-dereference"; - "tree" = "tree --dirsfirst --gitignore"; - - # See: https://github.com/NixOS/nix/issues/5858 - "nix" = "nix --print-build-logs"; - - ".." = "cd ../"; - "..." = "cd ../../"; - "...." = "cd ../../../"; - "....." = "cd ../../../../"; - "......" = "cd ../../../../../"; - "......." = "cd ../../../../../../"; - "........" = "cd ../../../../../../../"; - "........." = "cd ../../../../../../../../"; - ".........." = "cd ../../../../../../../../../"; - }; - } - (lib.mkIf pkgs.stdenv.isLinux { - # There is not nix-darwin equivalent to this NixOS option. - # The default shell on MacOS is already ZSH. - users.defaultUserShell = pkgs.zsh; - }) -] + ".." = "cd ../"; + "..." = "cd ../../"; + "...." = "cd ../../../"; + "....." = "cd ../../../../"; + "......" = "cd ../../../../../"; + "......." = "cd ../../../../../../"; + "........" = "cd ../../../../../../../"; + "........." = "cd ../../../../../../../../"; + ".........." = "cd ../../../../../../../../../"; + }; +} diff --git a/shared/nixos/common-nix-settings/default.nix b/shared/nixos/common-nix-settings/default.nix new file mode 100644 index 0000000..a5e4fda --- /dev/null +++ b/shared/nixos/common-nix-settings/default.nix @@ -0,0 +1,10 @@ +# This module sets common settings related to Nix. Most of the logic is shared +# between NixOS and Darwin, and is found in `shared/nixos-and-darwin/common-nix-options/`. +{ + imports = [ + ../../nixos-and-darwin/common-nix-settings + ]; + + # There is not nix-darwin equivalent to this NixOS option. + nix.enable = true; +} diff --git a/shared/nixos/common-shell-settings/default.nix b/shared/nixos/common-shell-settings/default.nix new file mode 100644 index 0000000..ce3b52e --- /dev/null +++ b/shared/nixos/common-shell-settings/default.nix @@ -0,0 +1,14 @@ +# This module sets options to ensure a consistent Baseline Shell Experince™ +# across the entire fleet. +# +# Most of the heavy lifting is done in `shared/nixos-and-darwin/common-shell-settings`. +# This module is limited to NixOS-specific settings. +{pkgs, ...}: { + imports = [ + ../../nixos-and-darwin/common-shell-settings + ]; + + # There is not nix-darwin equivalent to this NixOS option. + # The default shell on MacOS is already ZSH. + users.defaultUserShell = pkgs.zsh; +} |