From f0ba2200e86c34e2db56ab43bf5f98311f45f549 Mon Sep 17 00:00:00 2001 From: BuyMyMojo Date: Tue, 1 Apr 2025 08:11:24 +1100 Subject: [PATCH] Start working on universal.nix for all hosts --- nixos/configuration.nix | 50 +----------------------------------- nixos/flake.nix | 22 ++++++++++++++++ nixos/universal.nix | 56 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 49 deletions(-) create mode 100644 nixos/universal.nix diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 2c0cc86..ccc13c3 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -1,7 +1,3 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { config, pkgs, @@ -11,19 +7,7 @@ ... }: -# let -# berkeley-mono-typeface = pkgs.callPackage ./packages/berkeley-mono-typeface.nix; -# in - { - nixpkgs.overlays = [ - nix-your-shell.overlays.default - ]; - - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; imports = [ # Include the results of the hardware scan. @@ -51,9 +35,6 @@ # Enable networking networking.networkmanager.enable = true; - # Set your time zone. - time.timeZone = "Australia/Melbourne"; - i18n = { # Select internationalisation properties. @@ -110,15 +91,6 @@ # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; - fonts = { - fontDir.enable = true; - enableGhostscriptFonts = true; - packages = with pkgs; [ - nerdfonts - # berkeley-mono-typeface - ]; - }; - # Define a user account. Don't forget to set a password with ‘passwd’. users.users.buymymojo = { isNormalUser = true; @@ -149,14 +121,7 @@ package = pkgs.zulu23; }; - programs.firefox.enable = true; programs.thunderbird.enable = true; - programs.fish = { - enable = true; - interactiveShellInit = '' - nix-your-shell fish | source - ''; - }; programs.gpu-screen-recorder = { @@ -193,11 +158,6 @@ programs.gamescope.enable = true; programs.gamemode.enable = true; - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - programs.noisetorch.enable = true; # Allow unfree packages @@ -348,15 +308,7 @@ ]; }; - programs.bash = { - interactiveShellInit = '' - if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] - then - shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" - exec ${pkgs.fish}/bin/fish $LOGIN_OPTION - fi - ''; - }; + # environment.variables = { # }; diff --git a/nixos/flake.nix b/nixos/flake.nix index e210adc..f0a833c 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -46,11 +46,33 @@ inherit nix-your-shell; }; modules = [ + ./universal.nix ./configuration.nix ./services.nix ]; }; + nixosConfigurations.low-power-laptop = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + unstable = import unstable { + inherit system; + config.allowUnfree = true; + }; + + inherit nix-your-shell; + }; + modules = [ + ./universal.nix + ./services.nix + ]; + + }; + }; } diff --git a/nixos/universal.nix b/nixos/universal.nix new file mode 100644 index 0000000..837a185 --- /dev/null +++ b/nixos/universal.nix @@ -0,0 +1,56 @@ +{ + config, + pkgs, + unstable, + inputs, + nix-your-shell, + ... +}: + +{ + nixpkgs.overlays = [ + nix-your-shell.overlays.default + ]; + + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + # Set your time zone. + time.timeZone = "Australia/Melbourne"; + + fonts = { + fontDir.enable = true; + enableGhostscriptFonts = true; + packages = with pkgs; [ + nerdfonts + # berkeley-mono-typeface + ]; + }; + + programs.firefox.enable = true; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + programs.fish = { + enable = true; + interactiveShellInit = '' + nix-your-shell fish | source + ''; + }; + + programs.bash = { + interactiveShellInit = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + }; + +}