From d3b738690a59f748a51fb802cfdacf13a83581f2 Mon Sep 17 00:00:00 2001 From: Serenity-F Date: Sat, 6 Apr 2024 18:58:24 +1000 Subject: [PATCH] huge facelift time --- core/configuration.nix | 117 +++++++++++++++++++ {modules/core => core}/display.nix | 0 {modules/core/packages => core}/packages.nix | 0 core/users.nix | 75 ++++++++++++ flake.lock | 66 ++++------- flake.nix | 47 +++++--- home/home.nix | 38 ++++++ hosts/proserpina/configuration.nix | 16 ++- hosts/proserpina/hardware-configuration.nix | 2 - modules/core/audio.nix | 17 --- modules/core/default.nix | 30 ----- modules/core/packages/default.nix | 59 ---------- modules/core/services.nix | 39 ------- modules/core/user.nix | 37 ------ modules/home/default.nix | 9 -- modules/home/hyprland.nix | 45 ------- {modules/home => resources}/wallpaper.png | Bin 17 files changed, 292 insertions(+), 305 deletions(-) create mode 100644 core/configuration.nix rename {modules/core => core}/display.nix (100%) rename {modules/core/packages => core}/packages.nix (100%) create mode 100644 core/users.nix create mode 100644 home/home.nix delete mode 100644 modules/core/audio.nix delete mode 100644 modules/core/default.nix delete mode 100644 modules/core/packages/default.nix delete mode 100644 modules/core/services.nix delete mode 100644 modules/core/user.nix delete mode 100644 modules/home/default.nix delete mode 100644 modules/home/hyprland.nix rename {modules/home => resources}/wallpaper.png (100%) diff --git a/core/configuration.nix b/core/configuration.nix new file mode 100644 index 0000000..f8fbd8a --- /dev/null +++ b/core/configuration.nix @@ -0,0 +1,117 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: + +{ + imports = [ + + # home-manager + inputs.home-manager.nixosModules.home-manager + + # also split up configuration.nix and import pieces: + ./users.nix + ./packages.nix + + ]; + + security = { + rtkit.enable = true; + sudo.execWheelOnly = true; + }; + + time.timeZone = "Australia/Brisbane"; + i18n.defaultLocale = "en_GB.UTF-8"; + + nixpkgs = { + # add overlays here + overlays = [ + # to use overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # configure nixpkgs instance + config = { + allowUnfree = true; + permittedInsecurePackages = [ + "schildichat-web-1.11.30-sc.2" + "electron-25.9.0" + ]; + }; + }; + + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + cores = 0; + auto-optimise-store = true; + allowed-users = [ "@wheel" ]; + experimental-features = [ + "nix-command" + "flakes" + ]; + }; + + # services.flatpak.enable = true; + + boot.binfmt.registrations.appimage = { + wrapInterpreterInShell = false; + interpreter = "${pkgs.appimage-run}/bin/appimage-run"; + recognitionType = "magic"; + offset = 0; + mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; + magicOrExtension = ''\x7fELF....AI\x02''; + }; + + qt.style = "adwaita-dark"; + + sound.enable = true; + hardware.pulseaudio.enable = false; + services.pipewire = { + + enable = true; + jack.enable = true; + pulse.enable = true; + alsa.enable = true; + alsa.support32Bit = true; + # lowLatency.enable = true; + }; + + # disable these cuz they cause problems + # see: https://github.com/NixOS/nixpkgs/issues/180175 + systemd.services = { + networkManager-wait-online.enable = lib.mkForce false; + systemd-networkd-wait-online.enable = lib.mkForce false; + }; + + + # system.autoUpgrade = { + # enable = true; + # channel = ""; + # }; + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "23.11"; +} diff --git a/modules/core/display.nix b/core/display.nix similarity index 100% rename from modules/core/display.nix rename to core/display.nix diff --git a/modules/core/packages/packages.nix b/core/packages.nix similarity index 100% rename from modules/core/packages/packages.nix rename to core/packages.nix diff --git a/core/users.nix b/core/users.nix new file mode 100644 index 0000000..6c5a028 --- /dev/null +++ b/core/users.nix @@ -0,0 +1,75 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: + +{ + + imports = [ + inputs.home-manager.nixosModules.default + ]; + + + users.users = { + + # To add new users, copy a block for + # an existing user, and adjust to needs. + + # coffee = { + # description = "Coffee Beans"; + # isNormalUser = true; + # initialPassword = "password"; + # shell = pkgs.fish; + # extraGroups = [ + # "wheel" + # "networkmanager" + # ]; + # }; + + serenity = { + description = "Serenity Amalgam"; + isNormalUser = true; + initialPassword = "password"; + shell = pkgs.fish; + extraGroups = [ + "wheel" + "networkmanager" + ]; + }; + + }; + + + + home-manager = { + extraSpecialArgs = { inherit inputs outputs; }; + useGlobalPkgs = true; + useUserPackages = true; + users = { + + # coffee = { + # imports = [ ../home/home.nix ]; + # home = { + # username = "coffee"; + # homeDirectory = "/home/coffee"; + # stateVersion = "23.11"; + # }; + # }; + + serenity = { + imports = [ ../home/home.nix ]; + home = { + username = "serenity"; + homeDirectory = "/home/serenity"; + stateVersion = "23.11"; + }; + }; + + }; + }; + +} diff --git a/flake.lock b/flake.lock index 8af6de6..7f6fc8d 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,21 @@ "type": "github" } }, + "hardware": { + "locked": { + "lastModified": 1712324865, + "narHash": "sha256-+BatEWd4HlMeK7Ora+gYIkarjxFVCg9oKrIeybHIIX4=", + "owner": "nixos", + "repo": "nixos-hardware", + "rev": "f3b959627bca46a9f7052b8fbc464b8323e68c2c", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixos-hardware", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -90,31 +105,6 @@ "type": "github" } }, - "hyprland-plugins": { - "inputs": { - "hyprland": [ - "hyprland" - ], - "systems": [ - "hyprland-plugins", - "hyprland", - "systems" - ] - }, - "locked": { - "lastModified": 1712281995, - "narHash": "sha256-NoRAAqed5t3b3/Ebt5SW9BWh8dyKRmw9i9KjLcMdLsE=", - "owner": "hyprwm", - "repo": "hyprland-plugins", - "rev": "a7145f019254a7d953d56945c168d1bc698c35e4", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprland-plugins", - "type": "github" - } - }, "hyprland-protocols": { "inputs": { "nixpkgs": [ @@ -188,22 +178,6 @@ "type": "github" } }, - "nixos-hardware": { - "locked": { - "lastModified": 1712324865, - "narHash": "sha256-+BatEWd4HlMeK7Ora+gYIkarjxFVCg9oKrIeybHIIX4=", - "owner": "NixOS", - "repo": "nixos-hardware", - "rev": "f3b959627bca46a9f7052b8fbc464b8323e68c2c", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "master", - "repo": "nixos-hardware", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1711523803, @@ -224,24 +198,24 @@ "locked": { "lastModified": 1712163089, "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", - "owner": "NixOS", + "owner": "nixos", "repo": "nixpkgs", "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", "type": "github" }, "original": { - "id": "nixpkgs", + "owner": "nixos", "ref": "nixos-unstable", - "type": "indirect" + "repo": "nixpkgs", + "type": "github" } }, "root": { "inputs": { "disko": "disko", + "hardware": "hardware", "home-manager": "home-manager", "hyprland": "hyprland", - "hyprland-plugins": "hyprland-plugins", - "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_2" } }, diff --git a/flake.nix b/flake.nix index 774f80b..391e236 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,12 @@ { - description = "SerenityOS v0.3.2"; + description = "SerenityOS v0.3.2-1"; inputs = { - # Nixpkgs and hardware specific configs - nixpkgs.url = "nixpkgs/nixos-unstable"; - nixos-hardware.url = "github:NixOS/nixos-hardware/master"; - + # Nixpkgs + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + hardware.url = "github:nixos/nixos-hardware"; + # declarative disks disko = { url = "github:nix-community/disko"; @@ -25,31 +25,42 @@ # url = "github:hyprwm/hyprland-plugins"; # inputs.hyprland.follows = "hyprland"; # }; - + }; - outputs = { - nixpkgs, - nixos-hardware, + outputs = { + self, + hardware, disko, + nixpkgs, home-manager, hyprland, ... - }: - - { + } @ inputs: let + inherit (self) outputs; + in { + # Available through 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { - proserpina = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; + + proserpina = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + # > Our main nixos configuration files < modules = [ - ./hosts/proserpina/configuration.nix - # nixos-hardware.nixosModules.$MODEL disko.nixosModules.disko - inputs.home-manager.nixosModules.default + ./hosts/proserpina/configuration.nix ]; }; + + hades = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + # > Our main nixos configuration files < + modules = [ + disko.nixosModules.disko + ./hosts/proserpina/configuration.nix + ]; + }; + }; }; - } diff --git a/home/home.nix b/home/home.nix new file mode 100644 index 0000000..7797b7c --- /dev/null +++ b/home/home.nix @@ -0,0 +1,38 @@ +# This is your home-manager configuration file +# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) +{ + inputs, + lib, + config, + pkgs, + ... +}: { + # You can import other home-manager modules here + imports = [ + # If you want to use home-manager modules from other flakes (such as nix-colors): + # inputs.nix-colors.homeManagerModule + + # You can also split up your configuration and import pieces of it here: + # ./nvim.nix + ]; + + + # Packages: + home.packages = with pkgs; [ + + steam + + ]; + + # Programs: + programs = { + home-manager.enable = true; + + }; + + # Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "23.11"; +} diff --git a/hosts/proserpina/configuration.nix b/hosts/proserpina/configuration.nix index 0f940e3..61809a4 100644 --- a/hosts/proserpina/configuration.nix +++ b/hosts/proserpina/configuration.nix @@ -1,4 +1,4 @@ -{ inputs, outputs, config, lib, pkgs, ... }: +{ inputs, outputs, lib, config, pkgs, ... }: { imports = [ @@ -6,9 +6,9 @@ ./hardware-configuration.nix # "${builtins.fetchTarball "https://github.com/nix-community/disko/archive/master.tar.gz"}/module.nix" ./disko-config.nix - ./network-configuration.nix + # ./network-configuration.nix - ../../modules/core + ../../core/configuration.nix ]; @@ -38,6 +38,14 @@ }; }; + networking = { + hostName = "proserpina"; + wireless.enable = false; + networkmanager = { + enable = true; + }; + }; + services.fstrim.enable = true; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; @@ -72,4 +80,6 @@ }; }; + + system.stateVersion = "23.11"; } diff --git a/hosts/proserpina/hardware-configuration.nix b/hosts/proserpina/hardware-configuration.nix index 1e02223..29fd4bc 100644 --- a/hosts/proserpina/hardware-configuration.nix +++ b/hosts/proserpina/hardware-configuration.nix @@ -7,8 +7,6 @@ imports = [ (modulesPath + "/installer/scan/not-detected.nix") - # ./disko-config.sh - ./disko-config.nix ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" ]; diff --git a/modules/core/audio.nix b/modules/core/audio.nix deleted file mode 100644 index ba6ed67..0000000 --- a/modules/core/audio.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ ... }: - -{ - - sound.enable = true; - hardware.pulseaudio.enable = false; - services.pipewire = { - - enable = true; - jack.enable = true; - pulse.enable = true; - alsa.enable = true; - alsa.support32Bit = true; - lowLatency.enable = true; - }; - -} diff --git a/modules/core/default.nix b/modules/core/default.nix deleted file mode 100644 index dfbb069..0000000 --- a/modules/core/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ config, lib, pkgs, ... }: -{ - - imports = [ - ./services.nix - ./display.nix - ./user.nix - ./packages - ]; - - - # Timezone & locale - time.timeZone = "Australia/Brisbane"; - i18n.defaultLocale = "en_GB.UTF-8"; - - # security, apparently - security = { - rtkit.enable = true; - sudo.execWheelOnly = true; - }; - - # 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 = "23.11"; # Did you read the comment? - -} diff --git a/modules/core/packages/default.nix b/modules/core/packages/default.nix deleted file mode 100644 index a618b2f..0000000 --- a/modules/core/packages/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -{pkgs, config, inputs, ... }: - -{ - - imports = [ - ./packages.nix - ]; - - - nix = { - settings = { - cores = 0; - auto-optimise-store = true; - allowed-users = [ - "@wheel" - ]; - experimental-features = [ - "nix-command" - "flakes" - ]; - }; - }; - - nixpkgs = { - overlays = [ - ]; - config = { - allowUnfree = true; - permittedInsecurePackages = [ - "schildichat-web-1.11.30-sc.2" - "electron-25.9.0" - ]; - }; - }; - - - qt.style = "adwaita-dark"; - - services.flatpak.enable = true; - - boot.binfmt.registrations.appimage = { - wrapInterpreterInShell = false; - interpreter = "${pkgs.appimage-run}/bin/appimage-run"; - recognitionType = "magic"; - offset = 0; - mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff''; - magicOrExtension = ''\x7fELF....AI\x02''; - }; - - - system = { - stateVersion = "23.11"; - # autoUpgrade = { - # enable = true; - # channel = "INSERT_CHANNEL"; - # }; - }; - -} diff --git a/modules/core/services.nix b/modules/core/services.nix deleted file mode 100644 index ff45c96..0000000 --- a/modules/core/services.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ pkgs, lib, config, ... }: - -{ - - imports = [ - ]; - - - services = { - - gvfs.enable = true; - dbus.enable = true; - - avahi = { - enable = false; - nssmdns4 = false; - openFirewall = false; - }; - - locate = { - enable = false; - package = pkgs.plocate; - localuser = null; - }; - - }; - - - # disable these cuz they cause problems - # see: https://github.com/NixOS/nixpkgs/issues/180175 - systemd.services = { - networkManager-wait-online.enable = lib.mkForce false; - systemd-networkd-wait-online.enable = lib.mkForce false; - }; - - - system.stateVersion = "23.11"; - -} diff --git a/modules/core/user.nix b/modules/core/user.nix deleted file mode 100644 index d2c2af4..0000000 --- a/modules/core/user.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ pkgs, config, inputs, ... }: - -{ - - imports = [ - # ../home - inputs.home-manager.nixosModules.default - ]; - - home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - extraSpecialArgs = { inherit inputs; }; - users.serenity = { - programs.home-manager.enable = true; - imports = [ - ../home - ]; - home = { - username = "serenity"; - homeDirectory = "/home/serenity"; - stateVersion = "23.11"; - }; - }; - }; - - users.users.serenity = { - description = "Serenity Amalgam"; - isNormalUser = true; - shell = pkgs.fish; - extraGroups = [ - "wheel" - "networkmanager" - ]; - }; - -} diff --git a/modules/home/default.nix b/modules/home/default.nix deleted file mode 100644 index fbb4ca6..0000000 --- a/modules/home/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ pkgs, lib, config, inputs, ... }: - -{ - - imports = [ - ./hyprland.nix - ]; - -} diff --git a/modules/home/hyprland.nix b/modules/home/hyprland.nix deleted file mode 100644 index be4cec2..0000000 --- a/modules/home/hyprland.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ pkgs, lib, config, inputs, ... }: - - let - startupScript = pkgs.pkgs.writeShellScriptBin "start" '' - ${pkgs.waybar}/bin/waybar & - ${pkgs.swww}/bin/swww init & - - sleep 1 - - ${pkgs.swww}/bin/swww img ${./wallpaper.png} & - ''; - in -{ - - wayland.windowManager.hyprland = { - enable = true; - - plugins = [ - inputs.hyprland-plugins.packages."${pkgs.system}".borders-plus-plus - inputs.hyprland-plugins.packages."${pkgs.system}".hyprbars - ]; - - settings = { - - exec-once = ''${startupScript}/bin/start''; - - "plugin:borders-plus-plus" = { - add_borders = 1; # 0 - 9 - - # you can add up to 9 borders - "col.border_1" = "rgb(ffffff)"; - "col.border_2" = "rgb(2222ff)"; - - # -1 means "default" as in the one defined in general:border_size - border_size_1 = 10; - border_size_2 = -1; - - # makes outer edges match rounding of the parent. Turn on / off to better understand. Default = on. - natural_rounding = "yes"; - }; - - }; - }; - -} diff --git a/modules/home/wallpaper.png b/resources/wallpaper.png similarity index 100% rename from modules/home/wallpaper.png rename to resources/wallpaper.png