From 18e9b4a009a5de26bc29f3ff88afc642d4cc691e Mon Sep 17 00:00:00 2001 From: hensoko Date: Sat, 13 Aug 2022 20:35:43 +0000 Subject: [PATCH] feature/restructure-core-profile (#109) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hendrik Sokolowski Reviewed-on: https://git.b12f.io/pub-solar/os/pulls/109 Reviewed-by: Benjamin Bädorf Reviewed-by: teutat3s --- flake.nix | 5 +- modules/x-os/boot.nix | 6 +++ modules/x-os/default.nix | 3 ++ modules/x-os/fonts.nix | 12 +++++ modules/x-os/nix.nix | 25 ++++++++++ modules/x-os/services.nix | 13 +++++ profiles/core/default.nix | 56 ---------------------- profiles/core/starship.toml | 95 ------------------------------------- profiles/dram/default.nix | 5 ++ 9 files changed, 66 insertions(+), 154 deletions(-) create mode 100644 modules/x-os/fonts.nix create mode 100644 modules/x-os/nix.nix create mode 100644 modules/x-os/services.nix delete mode 100644 profiles/core/starship.toml create mode 100644 profiles/dram/default.nix diff --git a/flake.nix b/flake.nix index f18df6df..7d43b67c 100644 --- a/flake.nix +++ b/flake.nix @@ -120,7 +120,7 @@ suites = with profiles; rec { base = [ core users.pub-solar users.root ]; iso = base ++ [ base-user graphical pub-solar-iso ]; - pubsolaros = [ core full-install base-user users.root ]; + pubsolaros = [ core dram full-install base-user users.root ]; anonymous = [ pubsolaros users.pub-solar ]; }; }; @@ -145,6 +145,5 @@ homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; deploy.nodes = digga.lib.mkDeployNodes self.nixosConfigurations { }; - } - ; + }; } diff --git a/modules/x-os/boot.nix b/modules/x-os/boot.nix index 0ee29b84..dd788d26 100644 --- a/modules/x-os/boot.nix +++ b/modules/x-os/boot.nix @@ -28,5 +28,11 @@ in }; boot.loader.systemd-boot.enable = true; + + # Use latest LTS linux kernel by default + boot.kernelPackages = pkgs.linuxPackages_5_15; + + # Support ntfs drives + boot.supportedFilesystems = [ "ntfs" ]; }; } diff --git a/modules/x-os/default.nix b/modules/x-os/default.nix index 6276bf5f..0fd734f3 100644 --- a/modules/x-os/default.nix +++ b/modules/x-os/default.nix @@ -1,7 +1,10 @@ { ... }: { imports = [ ./boot.nix + ./fonts.nix ./i18n.nix ./networking.nix + ./nix.nix + ./services.nix ]; } diff --git a/modules/x-os/fonts.nix b/modules/x-os/fonts.nix new file mode 100644 index 00000000..979ffc68 --- /dev/null +++ b/modules/x-os/fonts.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: + +{ + fonts = { + fonts = with pkgs; [ powerline-fonts dejavu_fonts ]; + fontconfig.defaultFonts = { + monospace = [ "DejaVu Sans Mono for Powerline" ]; + sansSerif = [ "DejaVu Sans" ]; + }; + }; +} + diff --git a/modules/x-os/nix.nix b/modules/x-os/nix.nix new file mode 100644 index 00000000..56b677da --- /dev/null +++ b/modules/x-os/nix.nix @@ -0,0 +1,25 @@ +{ config, pkgs, lib, inputs, ... }: + +{ + nix = { + # Improve nix store disk usage + autoOptimiseStore = true; + gc.automatic = true; + optimise.automatic = true; + # Prevents impurities in builds + useSandbox = true; + # give root and @wheel special privileges with nix + trustedUsers = [ "root" "@wheel" ]; + # This is just a representation of the nix default + systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; + # Generally useful nix option defaults + extraOptions = '' + min-free = 536870912 + keep-outputs = true + keep-derivations = true + fallback = true + # used by nix-dram + default-flake = flake:nixpkgs + ''; + }; +} diff --git a/modules/x-os/services.nix b/modules/x-os/services.nix new file mode 100644 index 00000000..98a058a3 --- /dev/null +++ b/modules/x-os/services.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: + +{ + + # For rage encryption, all hosts need a ssh key pair + services.openssh = { + enable = true; + openFirewall = lib.mkDefault false; + }; + + # Service that makes Out of Memory Killer more effective + services.earlyoom.enable = true; +} diff --git a/profiles/core/default.nix b/profiles/core/default.nix index f3136372..b35fb673 100644 --- a/profiles/core/default.nix +++ b/profiles/core/default.nix @@ -11,11 +11,7 @@ in pub-solar.crypto.enable = true; pub-solar.devops.enable = true; - # This is just a representation of the nix default - nix.systemFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; - environment = { - systemPackages = with pkgs; [ # Core unix utility packages coreutils-full @@ -75,57 +71,5 @@ in neofetch ]; }; - - fonts = { - fonts = with pkgs; [ powerline-fonts dejavu_fonts ]; - - fontconfig.defaultFonts = { - - monospace = [ "DejaVu Sans Mono for Powerline" ]; - - sansSerif = [ "DejaVu Sans" ]; - - }; - }; - - nix = { - # use nix-dram, a patched nix command, see: https://github.com/dramforever/nix-dram - package = inputs.nix-dram.packages.${pkgs.system}.nix-dram; - - # Improve nix store disk usage - autoOptimiseStore = true; - gc.automatic = true; - optimise.automatic = true; - - # Prevents impurities in builds - useSandbox = true; - - # give root and @wheel special privileges with nix - trustedUsers = [ "root" "@wheel" ]; - - # Generally useful nix option defaults - extraOptions = '' - min-free = 536870912 - keep-outputs = true - keep-derivations = true - fallback = true - # used by nix-dram - default-flake = flake:nixpkgs - ''; - }; - - # For rage encryption, all hosts need a ssh key pair - services.openssh = { - enable = true; - openFirewall = lib.mkDefault false; - }; - - # Service that makes Out of Memory Killer more effective - services.earlyoom.enable = true; - - # Use latest LTS linux kernel by default - boot.kernelPackages = pkgs.linuxPackages_5_15; - - boot.supportedFilesystems = [ "ntfs" ]; }; } diff --git a/profiles/core/starship.toml b/profiles/core/starship.toml deleted file mode 100644 index 6ed366b5..00000000 --- a/profiles/core/starship.toml +++ /dev/null @@ -1,95 +0,0 @@ -[aws] -symbol = " " - -[character] -success_symbol = "[❯](bold purple)" -vicmd_symbol = "[❮](bold purple)" - -[battery] -full_symbol = "" -charging_symbol = "" -discharging_symbol = "" - -[conda] -symbol = " " - -[directory] -style = "cyan" -read_only = " 🔒" - -[docker] -symbol = " " - -[elixir] -symbol = " " - -[elm] -symbol = " " - -[git_branch] -format = "[$symbol$branch]($style) " -symbol = " " -style = "bold dimmed white" - -[git_status] -format = '([「$all_status$ahead_behind」]($style) )' -conflicted = "⚠️" -ahead = "⟫${count} " -behind = "⟪${count}" -diverged = "🔀 " -untracked = "📁 " -stashed = "↪ " -modified = "𝚫 " -staged = "✔ " -renamed = "⇆ " -deleted = "✘ " -style = "bold bright-white" - -[golang] -symbol = " " - -[haskell] -symbol = " " - -[hg_branch] -symbol = " " - -[java] -symbol = " " - -[julia] -symbol = " " - -[memory_usage] -symbol = " " -disabled = false - -[nim] -symbol = " " - -[nix_shell] -format = '[$symbol$state]($style) ' -symbol = " " -pure_msg = "λ" -impure_msg = "⎔" - -[nodejs] -symbol = " " - -[package] -symbol = " " - -[php] -symbol = " " - -[python] -symbol = " " - -[ruby] -symbol = " " - -[rust] -symbol = " " - -[status] -disabled = false diff --git a/profiles/dram/default.nix b/profiles/dram/default.nix new file mode 100644 index 00000000..0b7fc3ee --- /dev/null +++ b/profiles/dram/default.nix @@ -0,0 +1,5 @@ +{ self, config, lib, pkgs, inputs, ... }: + +{ + nix.package = inputs.nix-dram.packages.${pkgs.system}.nix-dram; +}