From e7e854d220bd12a814d981dc15a98b9e80d5fbdf Mon Sep 17 00:00:00 2001 From: Reboot-Codes Date: Tue, 18 Feb 2025 09:42:18 -0700 Subject: [PATCH] Make everything more idiosyncratic. --- README.md | 43 +++++++++++++++++--- common/home/default.nix | 5 ++- common/nixos/default-config.nix | 10 +---- common/utils/default.nix | 3 -- common/utils/nix-config.nix | 9 ++++ nixos/default.nix | 14 +++---- nixos/temp-installer-nixos/configuration.nix | 2 +- 7 files changed, 59 insertions(+), 27 deletions(-) delete mode 100644 common/utils/default.nix create mode 100644 common/utils/nix-config.nix diff --git a/README.md b/README.md index 179f795..4eb119a 100755 --- a/README.md +++ b/README.md @@ -1,15 +1,48 @@ # Reboot/Fitz uses NixOS btw. -Basically, we have a bad habit of breaking our linux installs all the damn time, so we decided to move to NixOS to make sure that we could a) roll back to not-borked configuration (this is especially useful when we fucked up FDE), or b) entirely rebuild our linux install from scratch if we need to. +Basically, we have a bad habit of breaking our linux installs all the damn time, so we decided to move to NixOS to make sure that we could a) roll back to not-borked configuration (this is especially useful when we fucked up KDE), or b) entirely rebuild our linux install from scratch if we need to (which happens concerningly often). ## Layout -This repo is designed for you to just `sudo git clone https://github.com/Reboot-Codes/dotfiles nixos` in `/etc`. Then just `nixos-rebuild switch --flake /etc/nixos/# --impure -L --show-trace`. Note: you'll have to specify the hostname when you install the first time. That's standard procedure in NixOS though, so we expect that you understand that already. +This repo is designed for you to just `sudo git clone https://github.com/Reboot-Codes/dotfiles nixos` in `/etc`. Then just `nixos-rebuild switch --flake /etc/nixos/# --impure -L --show-trace`. Note: you'll have to specify the hostname when you install the first time. That's standard procedure in NixOS though, so we expect that you understand that already. There's a lot of weird shit going on in the files to make sure that the nix package flow is... working and whatnot, but it basically is designed to be idiosyncratic once you learn where everything is defined. (Check for any `import` statements, basically.) + +We're working on a CLI to make sure that everything runs smoothly, but in the meantime, we hope you know a bit about using flakes instead of plain expressions. Or, just google with `nix flake` or something. ### Common Nix Expressions -`common` holds some utilities that we find useful to share between hosts, mostly a config for nix-alien (which we need to actually.... properly configure), and our home-manager config; which... also needs more work. DW about it! :33333 +`common` is probably what you actually want to check out since it holds the most configuration by far. (Anything that's shared between systems such as home configuration, kernel, grub theme, etc.) + +#### Home + +Home configurations are split into the common home file which makes sure that stuff like my ZSH environment, Terminal, TMUX, etc are all the same, as well as some commonly fucked up core things like using GPG for SSH auth, etc; the configs which are more machine type specific like running ARPC for Vesktop/Vencord; and then the package groups (which package groups are used depends on the configuration used when building as seen previously). + +#### NixOS + +NixOS common configurations live here and makes sure that there is (mostly) no "it works on this machine, but not this one". And mostly revolves around some linux admin best practicies and personal preference. + +#### Derivations + +This is where fully custom packages live, like the grub theme. + +#### Overlays + +Any mods to stuff in `nixpkgs` lives here, mostly enabling non-default features or adding patches. + +#### Utils + +Other random common shit like nix-alien (which is unused atm). + +### NixOS + +This contains NixOS configurations for each machine (if they happen to have NixOS installed, that is), and is mostly hardware specific stuff. Defining a new system is basically: + +1. Choose if you want to use Disko + 1. if you do: write the disko config and copy an existing configuration in the `nixos` directory, add a disko config, tell the `nixos/default.nix` file to use disko with that new configuration, and boot the install iso, clone this repo. + 2. if you don't, boot the install iso, partition, mount partitions, then generate a hardware config. Clone this repo, and copy an existing configuration from the `nixos` directory, and then move the hardware configuration to that new directory, tell the `nixos/default.nix` file about it. +2. nixos-install like normal but tell it to use this flake/repo with the hostname you REMEMBERED TO SET, RIGHT? +3. Set the root password, and the user's password too while you're in the chroot. +4. Reboot the pc! -### Hosts +### Scripts -`hosts` is separated into folders for each host, and will contain a `home.nix` for user-specific programs, and the `configuration.nix` which will also import a `hardware-configuration.nix` which is usually also in that folder. In general though, the host config in `flake.nix` will import a `default.nix` from that host's directory instead. +Utility scripts while we figure out how to make a CLI like home-manager has, mostly to build custom installation ISOs. (The nix invocation for that is weird af.) diff --git a/common/home/default.nix b/common/home/default.nix index 5701a50..8d59353 100644 --- a/common/home/default.nix +++ b/common/home/default.nix @@ -1,5 +1,8 @@ { hostConfig, pkgs, pkgs-stable, pwndbg, ... }: { home-manager.users."${hostConfig.username}" = { - imports = [ ./home.nix (./configs + "/${hostConfig.systemType}.nix") ]; + imports = [ + ./home.nix + (./configs + "/${hostConfig.systemType}.nix") + ]; }; } diff --git a/common/nixos/default-config.nix b/common/nixos/default-config.nix index 0d2ff52..01a0b14 100644 --- a/common/nixos/default-config.nix +++ b/common/nixos/default-config.nix @@ -1,6 +1,5 @@ { pkgs, pkgs-stable, config, options, home-manager, flatpaks, rust-overlay, nur, chaotic, aagl, nixGL, hostConfig, lib, specialArgs, pwndbg, ... }: { imports = [ - ../utils ../home ]; @@ -11,14 +10,7 @@ }; nixpkgs = { - config = { - allowUnfree = true; - - permittedInsecurePackages = [ - "electron-25.9.0" - "olm-3.2.16" - ]; - + config = import ../utils/nix-config.nix // { packageOverrides = pkgs: { intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; }; }; diff --git a/common/utils/default.nix b/common/utils/default.nix deleted file mode 100644 index 613714e..0000000 --- a/common/utils/default.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - # imports = [ ./nix-alien.nix ]; -} \ No newline at end of file diff --git a/common/utils/nix-config.nix b/common/utils/nix-config.nix new file mode 100644 index 0000000..dd831b0 --- /dev/null +++ b/common/utils/nix-config.nix @@ -0,0 +1,9 @@ +{ + allowUnfree = true; + + permittedInsecurePackages = [ + "electron-25.9.0" + "electron-27.3.11" + "olm-3.2.16" + ]; +} \ No newline at end of file diff --git a/nixos/default.nix b/nixos/default.nix index ce32c36..af3e5b0 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -19,16 +19,13 @@ in (nixpkgs.lib.genAttrs (builtins.attrNames hosts) (hostname: let hostConfig = hosts."${hostname}"; system = hostConfig.system; + pkgs-stable = import nixpkgs-stable { # Refer to the `system` parameter from # the outer scope recursively inherit system; - config = { - allowUnfree = true; - permittedInsecurePackages = [ - "electron-27.3.11" # Allows logseq stable. Annoying. - ]; - }; + + config = import ../common/utils/nix-config.nix; }; in nixpkgs.lib.nixosSystem rec { system = hostConfig.system; @@ -44,18 +41,19 @@ in nixpkgs.lib.nixosSystem rec { flatpaks.nixosModules.declarative-flatpak nur.modules.nixos.default chaotic.nixosModules.default - # https://github.com/ezKEa/aagl-gtk-on-nix { networking.hostName = "${hostname}"; # Define your hostname. - # AAGL stuff. + # AAGL stuff: https://github.com/ezKEa/aagl-gtk-on-nix imports = [ aagl.nixosModules.default ]; nix.settings = aagl.nixConfig; + home-manager = { useGlobalPkgs = true; useUserPackages = true; + #! IMPORTANT: Any custom package inputs **need** to be placed here as well if they should be used by home-manager! extraSpecialArgs = { inherit pkgs-stable pwndbg; }; diff --git a/nixos/temp-installer-nixos/configuration.nix b/nixos/temp-installer-nixos/configuration.nix index 9cdbfb6..81ec777 100644 --- a/nixos/temp-installer-nixos/configuration.nix +++ b/nixos/temp-installer-nixos/configuration.nix @@ -1,5 +1,5 @@ { pkgs, config, modulesPath, hostConfig, ... }: { - imports = [(modulesPath + "/installer/cd-dvd/installation-cd-base.nix")]; + imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-base.nix") ]; users.users."${hostConfig.username}".password = "password"; boot.plymouth.enable = true; -- 2.51.2