From 112c101c7308ddd710d0936ad8d1c010ae0dfb28 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 29 Nov 2024 07:10:07 +0100 Subject: refactor: make configuration.nix main entry point --- nixos/configuration.nix | 1 + nixos/rebuild | 4 ++-- nixos/root.nix | 34 ---------------------------------- nixos/sanix.nix | 29 +++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 36 deletions(-) delete mode 100644 nixos/root.nix create mode 100644 nixos/sanix.nix diff --git a/nixos/configuration.nix b/nixos/configuration.nix index c887c72..7d785ab 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -5,6 +5,7 @@ { imports = [ ./hardware-configuration.nix + ./sanix.nix ]; # Bootloader. diff --git a/nixos/rebuild b/nixos/rebuild index 2ee7d76..98101c1 100755 --- a/nixos/rebuild +++ b/nixos/rebuild @@ -3,8 +3,8 @@ set -euo pipefail # nix-instantiate --eval has no raw mode yet nixpkgsPath=$(nix-instantiate --eval --read-write-mode nixpkgs/path.nix | tr -d \") -# Get the ./root.nix relative to this script -configPath=$(realpath -- "$(dirname -- "${BASH_SOURCE[0]}")/root.nix") +# Get the ./configuration.nix relative to this script +configPath=$(realpath -- "$(dirname -- "${BASH_SOURCE[0]}")/configuration.nix") # nixos-rebuild always reads Nixpkgs from the NIX_PATH, # so we need to set it explicitly to our pinned version diff --git a/nixos/root.nix b/nixos/root.nix deleted file mode 100644 index b23e091..0000000 --- a/nixos/root.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ lib, pkgs, config, ... }: { - imports = [ - # Import your main configuration - ./configuration.nix - ]; - - environment.systemPackages = with pkgs; [ - # We're using niv to manage the systems Nixpkgs version, install it globally for ease - niv - ]; - - # Use the Nixpkgs config and overlays from the local files for this NixOS build - nixpkgs = { - config = import ./nixpkgs/config.nix; - overlays = import ./nixpkgs/overlays.nix; - }; - - # Makes commands default to the same Nixpkgs, config, overlays and NixOS configuration - nix.nixPath = [ - "nixpkgs=${pkgs.path}" - "nixos-config=${toString ./root.nix}" - "nixpkgs-overlays=${toString ./nixpkgs/overlays.nix}" - ]; - environment.variables.NIXPKGS_CONFIG = lib.mkForce (toString ./nixpkgs/config.nix); - - # Remove the stateful nix-channel command - environment.extraSetup = '' - rm --force $out/bin/nix-channel - ''; - - # This option is broken when set false, prevent people from setting it to false - # And we implement the important bit above ourselves - nix.channel.enable = true; -} diff --git a/nixos/sanix.nix b/nixos/sanix.nix new file mode 100644 index 0000000..4895127 --- /dev/null +++ b/nixos/sanix.nix @@ -0,0 +1,29 @@ +{ lib, pkgs, config, ... }: { + environment.systemPackages = with pkgs; [ + # We're using niv to manage the systems Nixpkgs version, install it globally for ease + niv + ]; + + # Use the Nixpkgs config and overlays from the local files for this NixOS build + nixpkgs = { + config = import ./nixpkgs/config.nix; + overlays = import ./nixpkgs/overlays.nix; + }; + + # Makes commands default to the same Nixpkgs, config, overlays and NixOS configuration + nix.nixPath = [ + "nixpkgs=${pkgs.path}" + "nixos-config=${toString }" + "nixpkgs-overlays=${toString ./nixpkgs/overlays.nix}" + ]; + environment.variables.NIXPKGS_CONFIG = lib.mkForce (toString ./nixpkgs/config.nix); + + # Remove the stateful nix-channel command + environment.extraSetup = '' + rm --force $out/bin/nix-channel + ''; + + # This option is broken when set false, prevent people from setting it to false + # And we implement the important bit above ourselves + nix.channel.enable = true; +} -- cgit v1.2.3