From 38243e15832b9567b35924e354b5a48bd57aea1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Mon, 2 Oct 2023 11:55:24 +0200 Subject: [PATCH] refactor: start refactoring hosts dir --- hosts/PubSolarOS.nix | 21 ----------------- hosts/bootstrap.nix | 54 -------------------------------------------- hosts/default.nix | 30 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 75 deletions(-) delete mode 100644 hosts/PubSolarOS.nix delete mode 100644 hosts/bootstrap.nix create mode 100644 hosts/default.nix diff --git a/hosts/PubSolarOS.nix b/hosts/PubSolarOS.nix deleted file mode 100644 index da0375cd..00000000 --- a/hosts/PubSolarOS.nix +++ /dev/null @@ -1,21 +0,0 @@ -{suites, ...}: { - ### root password is empty by default ### - ### default password: pub-solar, optional: add your SSH keys - imports = - suites.iso; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.networkmanager.enable = true; - - fileSystems."/" = {device = "/dev/disk/by-label/nixos";}; - - # 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 = "22.05"; # Did you read the comment? -} diff --git a/hosts/bootstrap.nix b/hosts/bootstrap.nix deleted file mode 100644 index c71f03cc..00000000 --- a/hosts/bootstrap.nix +++ /dev/null @@ -1,54 +0,0 @@ -{ - config, - lib, - pkgs, - profiles, - ... -}: -with lib; let - # Gets hostname of host to be bundled inside iso - # Copied from https://github.com/divnix/digga/blob/30ffa0b02272dc56c94fd3c7d8a5a0f07ca197bf/modules/bootstrap-iso.nix#L3-L11 - getFqdn = config: let - net = config.networking; - fqdn = - if (net ? domain) && (net.domain != null) - then "${net.hostName}.${net.domain}" - else net.hostName; - in - fqdn; -in { - # build with: `nix build ".#nixosConfigurations.bootstrap.config.system.build.isoImage"` - imports = [ - # profiles.networking - profiles.users.root # make sure to configure ssh keys - profiles.users.pub-solar - profiles.base-user - profiles.graphical - profiles.pub-solar-iso - ]; - - config = { - boot.loader.systemd-boot.enable = true; - - # will be overridden by the bootstrapIso instrumentation - fileSystems."/" = {device = "/dev/disk/by-label/nixos";}; - - system.nixos.label = "PubSolarOS-" + config.system.nixos.version; - - # mkForce because a similar transformation gets double applied otherwise - # https://github.com/divnix/digga/blob/30ffa0b02272dc56c94fd3c7d8a5a0f07ca197bf/modules/bootstrap-iso.nix#L17 - # https://github.com/NixOS/nixpkgs/blob/aecd4d8349b94f9bd5718c74a5b789f233f67326/nixos/modules/installer/cd-dvd/installation-cd-base.nix#L21-L22 - isoImage = { - isoBaseName = mkForce (getFqdn config); - isoName = mkForce "${config.system.nixos.label}-${config.isoImage.isoBaseName}-${pkgs.stdenv.hostPlatform.system}.iso"; - }; - - # 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 = "21.05"; # Did you read the comment? - }; -} diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 00000000..3783823e --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,30 @@ +{ + # Configuration common to all Linux systems + flake = { + nixosModules = { + # NixOS modules that are known to work on nix-darwin. + common.imports = [ + ./nix.nix + ./caches + ]; + + my-home = { + users.users.${config.people.myself}.isNormalUser = true; + home-manager.users.${config.people.myself} = { + imports = [ + self.homeModules.common-linux + ]; + }; + }; + + default.imports = [ + self.nixosModules.home-manager + self.nixosModules.my-home + self.nixosModules.common + ./self-ide.nix + ./ssh-authorize.nix + ./current-location.nix + ]; + }; + }; +}