diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | flake.nix | 13 | ||||
-rw-r--r-- | hosts/default.nix | 16 | ||||
-rw-r--r-- | hosts/phobos/disks.nix | 4 |
4 files changed, 31 insertions, 8 deletions
diff --git a/README.md b/README.md index aa1267d..893c364 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,9 @@ nix build .#homeManagerConfigurations.HOST.activationPackage ``` home-manager switch --flake .#HOST ``` + +# ISO +## Building +``` +nix build .#nixosConfigurations.HOST.config.system.build.isoImage +``` diff --git a/flake.nix b/flake.nix index ad1ead9..de8a701 100644 --- a/flake.nix +++ b/flake.nix @@ -27,12 +27,25 @@ { nixosConfigurations = import ./hosts { isNixOS = true; + extraModules = [ ]; + isIso = false; inherit (nixpkgs) lib; inherit inputs nixpkgs home-manager; }; homeConfigurations = import ./hosts { isNixOS = false; + extraModules = [ ]; + isIso = false; + #no COde duplication here: TODO + inherit (nixpkgs) lib; + inherit inputs nixpkgs home-manager; + }; + + isoConfigurations = import ./hosts { + isNixOS = true; + extraModules = [ ]; + isIso = true; #no COde duplication here: TODO inherit (nixpkgs) lib; inherit inputs nixpkgs home-manager; diff --git a/hosts/default.nix b/hosts/default.nix index e2ea6d4..deaad5a 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,4 +1,4 @@ -{ lib, inputs, isNixOS, nixpkgs, home-manager, ... }: +{ lib, inputs, extraModules, isNixOS, isIso, nixpkgs, home-manager, ... }: let user = "baitinq"; @@ -10,18 +10,22 @@ let { hostname = "vm"; system = "x86_64-linux"; timezone = secrets.main_timezone; location = secrets.main_location; } ]; - mkHost = { hostname, system, timezone, location }: isNixOS: + mkHost = { hostname, system, timezone, location }: extraModules: isNixOS: isIso: let pkgs = import nixpkgs { inherit system; - config.allowUnfree = true; # Allow proprietary software + config = { + allowUnfree = true; + allowBroken = true; + }; overlays = [ inputs.nur.overlay (import ../packages) (import ../overlays) ]; }; - extraArgs = { inherit pkgs inputs user secrets hostname timezone location; }; + extraArgs = { inherit pkgs inputs isIso user secrets hostname timezone location; }; + extraSpecialModules = if isIso then extraModules ++ [ "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" ] else extraModules; in if isNixOS then @@ -44,7 +48,7 @@ let ]; }; } - ]; + ] ++ extraSpecialModules; } else home-manager.lib.homeManagerConfiguration @@ -62,4 +66,4 @@ in Map each element of the list applying the mkHost function to its elements and returning a set in the listToAttrs format builtins.listToAttrs on the result */ -builtins.listToAttrs (map ({ hostname, system, timezone, location }: { name = hostname; value = mkHost { inherit hostname system timezone location; } isNixOS; }) hosts) +builtins.listToAttrs (map ({ hostname, system, timezone, location }: { name = hostname; value = mkHost { inherit hostname system timezone location; } extraModules isNixOS isIso; }) hosts) diff --git a/hosts/phobos/disks.nix b/hosts/phobos/disks.nix index 9f1906e..6f005bf 100644 --- a/hosts/phobos/disks.nix +++ b/hosts/phobos/disks.nix @@ -1,4 +1,4 @@ -{ config, lib, inputs, pkgs, modulesPath, ... }: +{ config, lib, inputs, pkgs, modulesPath, isIso, ... }: { fileSystems."/" = { device = "none"; @@ -33,7 +33,7 @@ swapDevices = [ ]; - services.btrfs.autoScrub.enable = true; + services.btrfs.autoScrub.enable = if !isIso then true else false; zramSwap.enable = true; |