From bf19849309094568a23a0bbb4400bf4ab6e0b553 Mon Sep 17 00:00:00 2001 From: Ranomier <> Date: Sun, 4 May 2025 20:26:19 +0200 Subject: [PATCH 1/2] fix: cleanup! --- hosts/crocoite/default.nix | 16 ++-------------- hosts/game-luanti/default.nix | 23 ++++++++--------------- hosts/jitsi/default.nix | 25 +------------------------ outputs.nix | 11 +++++------ system_profiles/defaults.nix | 23 +++++++++++++++++++++++ system_profiles/mini-container.nix | 7 +++++-- system_profiles/mini.nix | 13 +++++++++---- 7 files changed, 53 insertions(+), 65 deletions(-) create mode 100644 system_profiles/defaults.nix diff --git a/hosts/crocoite/default.nix b/hosts/crocoite/default.nix index 4c9d95e..d0c05ba 100644 --- a/hosts/crocoite/default.nix +++ b/hosts/crocoite/default.nix @@ -33,22 +33,9 @@ # }) ]; - # Configure your nixpkgs instance - config = { - allowUnfree = true; - }; }; - nix = { - settings.experimental-features = ["nix-command" "flakes"]; - # https://lix.systems/ Lix is a modern, delicious implementation of the Nix package manager, - # focused on correctness, usability, and growth – - # and committed to doing right by its community. - package = pkgs.lix; - - channel.enable = false; - }; imports = [ # steam and other stuff seems to depend on perl @@ -77,7 +64,8 @@ ../../modules/wm_and_de ../../modules/pkg_mgrmnt - + + ../../system_profiles/defaults.nix # ../../tests ]; } diff --git a/hosts/game-luanti/default.nix b/hosts/game-luanti/default.nix index 4966862..2fffeb2 100644 --- a/hosts/game-luanti/default.nix +++ b/hosts/game-luanti/default.nix @@ -12,30 +12,23 @@ # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "25.05"; # Did you read the comment? - nixpkgs.config = { - # Disable if you don't want unfree packages - allowUnfree = true; - }; - nix.settings.experimental-features = ["nix-command" "flakes"]; + # Disable if you don't want unfree packages + nixpkgs.config.allowUnfree = true; + nix = { # https://lix.systems/ Lix is a modern, delicious implementation of the Nix package manager, # focused on correctness, usability, and growth – # and committed to doing right by its community. - nix.package = pkgs.lix; + package = pkgs.lix; + + settings.experimental-features = ["nix-command" "flakes"]; + }; imports = [ ./hardware-configuration.nix ../../modules/locale.nix - ../../system_profiles/mini.nix - { - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.ens18.useDHCP = lib.mkDefault true; - } + ../../system_profiles/mini-container.nix ]; } diff --git a/hosts/jitsi/default.nix b/hosts/jitsi/default.nix index 326fe5c..941205d 100644 --- a/hosts/jitsi/default.nix +++ b/hosts/jitsi/default.nix @@ -17,7 +17,6 @@ # Disable if you don't want unfree packages allowUnfree = true; }; - nix.settings.experimental-features = ["nix-command" "flakes"]; # https://lix.systems/ Lix is a modern, delicious implementation of the Nix package manager, # focused on correctness, usability, and growth – @@ -29,27 +28,5 @@ ../../modules/locale.nix - (modulesPath + "/profiles/perlless.nix") - (modulesPath + "/profiles/minimal.nix") - { - environment.defaultPackages = []; - boot.kernel.enable = false; - boot.isContainer = true; - nixpkgs.overlays = [(self: super: {})]; - } - { - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.ens18.useDHCP = lib.mkDefault true; - } - ]; - disabledModules = [ - (modulesPath + "/profiles/all-hardware.nix") - (modulesPath + "/profiles/base.nix") - # - # - ]; + ../../system_profiles/mini.nix } diff --git a/outputs.nix b/outputs.nix index e7e3299..b9332f0 100644 --- a/outputs.nix +++ b/outputs.nix @@ -1,27 +1,26 @@ inArgs: let + lib = inArgs.nixpkgs.lib; + hostHelper = import ./hostHelper.nix inArgs; + # Supported systems for your flake packages, shell, etc. systems = [ #"aarch64-linux" "x86_64-linux" ]; - # This is a function that generates an attribute by calling a function you # pass to it, with each system as an argument forAllSystems = inArgs.nixpkgs.lib.genAttrs systems; - lib = inArgs.nixpkgs.lib; - - hostHelper = import ./hostHelper.nix inArgs; - in { # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' - # to add more append // (host_helper example); nixosConfigurations = builtins.mapAttrs (hostName: hostOptions: (hostHelper hostName hostOptions)) { crocoite = {}; game-luanti = {unstable = true;}; + #jitsi = {}; }; + # Your custom packages # Accessible through 'nix build', 'nix shell', etc #packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system}); diff --git a/system_profiles/defaults.nix b/system_profiles/defaults.nix new file mode 100644 index 0000000..51652c0 --- /dev/null +++ b/system_profiles/defaults.nix @@ -0,0 +1,23 @@ +{ + lib, + pkgs, + ... +}: { + nix.settings.experimental-features = lib.mkDefault ["nix-command" "flakes"]; + + # Disable if you don't want unfree packages + nixpkgs.config.allowUnfree = lib.mkDefault true; + + nix = { + # https://lix.systems/ Lix is a modern, delicious implementation of the Nix package manager, + # focused on correctness, usability, and growth – + # and committed to doing right by its community. + package = lib.mkDefault pkgs.lix; + + channel.enable = lib.mkDefault false; + }; + + imports = [ + ../modules/locale.nix + ]; +} diff --git a/system_profiles/mini-container.nix b/system_profiles/mini-container.nix index 498bbb2..275ef92 100644 --- a/system_profiles/mini-container.nix +++ b/system_profiles/mini-container.nix @@ -1,10 +1,13 @@ { + lib, + ... +}: { imports = [ ./mini.nix { - boot.isContainer = true; - boot.kernel.enable = false; + boot.isContainer = lib.mkDefault true; + boot.kernel.enable = lib.mkDefault false; } ]; } diff --git a/system_profiles/mini.nix b/system_profiles/mini.nix index 70c1639..1df7357 100644 --- a/system_profiles/mini.nix +++ b/system_profiles/mini.nix @@ -1,4 +1,5 @@ { + lib, modulesPath, ... }: { @@ -7,10 +8,14 @@ (modulesPath + "/profiles/perlless.nix") { - boot.isContainer = true; - boot.kernel.enable = false; - environment.defaultPackages = []; - nixpkgs.overlays = [(self: super: {})]; + environment.defaultPackages = lib.mkDefault []; + nixpkgs.overlays = lib.mkDefault [(self: super: {})]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; } ]; From 14dfeec55f1a1371bf45f92722dd03a42deb8d0b Mon Sep 17 00:00:00 2001 From: Ranomier <> Date: Sun, 4 May 2025 20:52:04 +0200 Subject: [PATCH 2/2] feat: manage stateVersion through hostHelper --- hostHelper.nix | 10 ++++++++++ hosts/crocoite/default.nix | 7 ------- hosts/game-luanti/default.nix | 22 ++-------------------- hosts/jitsi/default.nix | 19 +++---------------- outputs.nix | 7 ++++--- 5 files changed, 19 insertions(+), 46 deletions(-) diff --git a/hostHelper.nix b/hostHelper.nix index 2bca73c..b096499 100644 --- a/hostHelper.nix +++ b/hostHelper.nix @@ -10,5 +10,15 @@ in modules = [ {networking.hostName = hostname;} (./hosts/${hostname}) + + { + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = hostOptions.stateVersion; # Did you read the comment? + } ]; } diff --git a/hosts/crocoite/default.nix b/hosts/crocoite/default.nix index d0c05ba..0859c5d 100644 --- a/hosts/crocoite/default.nix +++ b/hosts/crocoite/default.nix @@ -5,13 +5,6 @@ nixos-unstable, ... }: { - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.05"; # Did you read the comment? #nixpkgs.overlays = [ overlays.unstable-packages ]; nixpkgs = { diff --git a/hosts/game-luanti/default.nix b/hosts/game-luanti/default.nix index 2fffeb2..234c358 100644 --- a/hosts/game-luanti/default.nix +++ b/hosts/game-luanti/default.nix @@ -4,31 +4,13 @@ modulesPath, ... }: { - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "25.05"; # Did you read the comment? - # Disable if you don't want unfree packages - nixpkgs.config.allowUnfree = true; - - nix = { - # https://lix.systems/ Lix is a modern, delicious implementation of the Nix package manager, - # focused on correctness, usability, and growth – - # and committed to doing right by its community. - package = pkgs.lix; - - settings.experimental-features = ["nix-command" "flakes"]; - }; imports = [ ./hardware-configuration.nix - ../../modules/locale.nix - + ../../system_profiles/defaults.nix ../../system_profiles/mini-container.nix + ]; } diff --git a/hosts/jitsi/default.nix b/hosts/jitsi/default.nix index 941205d..f76da0b 100644 --- a/hosts/jitsi/default.nix +++ b/hosts/jitsi/default.nix @@ -4,29 +4,16 @@ modulesPath, ... }: { - #networking.hostName = "jitsi"; # Define your hostname. - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "24.11"; # Did you read the comment? - nixpkgs.config = { # Disable if you don't want unfree packages allowUnfree = true; }; - # https://lix.systems/ Lix is a modern, delicious implementation of the Nix package manager, - # focused on correctness, usability, and growth – - # and committed to doing right by its community. - nix.package = pkgs.lix; imports = [ ./hardware-configuration.nix - ../../modules/locale.nix - - ../../system_profiles/mini.nix + ../../system_profiles/defaults.nix + ../../system_profiles/mini-container.nix + ]; } diff --git a/outputs.nix b/outputs.nix index b9332f0..4fce707 100644 --- a/outputs.nix +++ b/outputs.nix @@ -15,9 +15,10 @@ in { # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = builtins.mapAttrs (hostName: hostOptions: (hostHelper hostName hostOptions)) { - crocoite = {}; - game-luanti = {unstable = true;}; - #jitsi = {}; + crocoite = {stateVersion = "24.05";}; + + jitsi = {stateVersion = "24.11";}; + game-luanti = {stateVersion = "25.05"; unstable = true;}; };