From 7b591ba470b22bba6553c78bfb4dad2654dca8eb Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sun, 18 May 2025 15:46:39 +0800 Subject: [PATCH] feat(flake.nix): add impermanence module to flake --- flake.lock | 16 ++++++++++++++++ flake.nix | 4 +++- modules/nixos/hardware/default.nix | 1 + modules/nixos/hardware/networking.nix | 10 ++++++++++ modules/nixos/system/default.nix | 1 + systems/x86_64-linux/nemesis/default.nix | 10 +--------- 6 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 modules/nixos/hardware/networking.nix diff --git a/flake.lock b/flake.lock index 23476ee..97d79b9 100644 --- a/flake.lock +++ b/flake.lock @@ -73,6 +73,21 @@ "type": "github" } }, + "impermanence": { + "locked": { + "lastModified": 1737831083, + "narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1747327360, @@ -92,6 +107,7 @@ "root": { "inputs": { "disko": "disko", + "impermanence": "impermanence", "nixpkgs": "nixpkgs", "snowfall-lib": "snowfall-lib" } diff --git a/flake.nix b/flake.nix index d8f2c11..2eb85aa 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,7 @@ disko.inputs.nixpkgs.follows = "nixpkgs"; snowfall-lib.url = "github:snowfallorg/lib"; snowfall-lib.inputs.nixpkgs.follows = "nixpkgs"; + impermanence.url = "github:nix-community/impermanence"; }; outputs = inputs: @@ -13,7 +14,8 @@ src = ./.; snowfall.namespace = "pantheon"; systems.modules.nixos = with inputs; [ - inputs.disko.nixosModules.disko + disko.nixosModules.disko + impermanence.nixosModules.impermanence ]; }; } diff --git a/modules/nixos/hardware/default.nix b/modules/nixos/hardware/default.nix index 961a605..5743df3 100644 --- a/modules/nixos/hardware/default.nix +++ b/modules/nixos/hardware/default.nix @@ -5,6 +5,7 @@ ./nvidia.nix ./audio.nix ./cpu.nix + ./networking.nix ]; options.hardware = { diff --git a/modules/nixos/hardware/networking.nix b/modules/nixos/hardware/networking.nix new file mode 100644 index 0000000..8ef7679 --- /dev/null +++ b/modules/nixos/hardware/networking.nix @@ -0,0 +1,10 @@ +{ config, lib, ... }: +{ + config = lib.mkMerge [ + { + networking.useDHCP = lib.mkDefault true; + networking.hostName = config.system.hostname; + networking.networkmanager.enable = true; + } + ]; +} diff --git a/modules/nixos/system/default.nix b/modules/nixos/system/default.nix index a762a7b..be676e6 100644 --- a/modules/nixos/system/default.nix +++ b/modules/nixos/system/default.nix @@ -8,6 +8,7 @@ ]; options.system = { + hostname = lib.pantheon.mkStrOption; mainUser = lib.pantheon.mkStrOption; bootloader = lib.pantheon.mkStrOption; }; diff --git a/systems/x86_64-linux/nemesis/default.nix b/systems/x86_64-linux/nemesis/default.nix index 2e97738..e08223d 100644 --- a/systems/x86_64-linux/nemesis/default.nix +++ b/systems/x86_64-linux/nemesis/default.nix @@ -1,5 +1,6 @@ { config, lib, pkgs, ... }: { + system.hostname = "nemesis"; system.mainUser = "rafiq"; system.bootloader = "systemd-boot"; hardware.drives.btrfs = { @@ -10,15 +11,6 @@ hardware.platform = "amd"; hardware.gpu = "nvidia"; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - - - - networking.useDHCP = lib.mkDefault true; - networking.hostName = "nemesis"; # Define your hostname. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - - }