mirror of
https://github.com/RGBCube/ncc
synced 2025-07-30 11:37:44 +00:00
Rewrite everythin
This commit is contained in:
parent
a36664a390
commit
7e281a3470
35 changed files with 277 additions and 281 deletions
11
.gitignore
vendored
11
.gitignore
vendored
|
@ -2,16 +2,19 @@
|
|||
|
||||
!machines/
|
||||
!machines/asus/
|
||||
!machines/asus/discord/
|
||||
!machines/asus/docker/
|
||||
!machines/asus/firefox/
|
||||
!machines/asus/git/
|
||||
!machines/asus/intellij/
|
||||
!machines/asus/libreoffice/
|
||||
!machines/asus/neovim/
|
||||
!machines/asus/neovim/nvchad/
|
||||
!machines/asus/networkmanager/
|
||||
!machines/asus/nixpkgs/
|
||||
!machines/asus/nushell/
|
||||
!machines/asus/openttd/
|
||||
!machines/asus/pipewire/
|
||||
!machines/asus/users/
|
||||
!machines/asus/system/
|
||||
!machines/asus/qbittorrent/
|
||||
!machines/asus/wine/
|
||||
!machines/asus/xserver/
|
||||
|
||||
!flake.lock
|
||||
|
|
62
flake.nix
62
flake.nix
|
@ -25,18 +25,21 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = { nixpkgs, home-manager, fenix, ... }:
|
||||
outputs = { nixpkgs, home-manager, fenix, ... }: let
|
||||
machines = [
|
||||
./machines/asus
|
||||
];
|
||||
|
||||
with {
|
||||
importConfiguration = configDirectory:
|
||||
with {
|
||||
hostName = builtins.baseNameOf configDirectory;
|
||||
hostPlatform = import (configDirectory + "/platform.nix");
|
||||
nixosSystem = arguments: modules: nixpkgs.lib.nixosSystem {
|
||||
specialArgs = arguments;
|
||||
modules = modules;
|
||||
};
|
||||
|
||||
{
|
||||
nixosConfigurations.${hostName} = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
importConfiguration = configurationDirectory: let
|
||||
hostName = builtins.baseNameOf configurationDirectory;
|
||||
hostPlatform = import configurationDirectory + "/platform.nix";
|
||||
in {
|
||||
nixosConfigurations.${hostName} = nixosSystem {
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
|
@ -48,9 +51,31 @@
|
|||
];
|
||||
};
|
||||
|
||||
# Helper function for DRY.
|
||||
homeManagerConfiguration = userName: attrs: {
|
||||
home-manager.users.${userName} = attrs;
|
||||
# Helper functions for readability & DRY.
|
||||
systemConfiguration = attributes: attributes;
|
||||
|
||||
homeConfiguration = userName: attributes: systemConfiguration {
|
||||
home-manager.users.${userName} = attributes;
|
||||
};
|
||||
|
||||
imports = importPaths: systemConfiguration {
|
||||
imports = importPaths;
|
||||
};
|
||||
|
||||
packages = packages: systemConfiguration {
|
||||
environment.systemPackages = packages;
|
||||
};
|
||||
|
||||
fonts = fonts: systemConfiguration {
|
||||
fonts.fonts = packages;
|
||||
};
|
||||
|
||||
enabled = attributes: attributes // {
|
||||
enabled = true;
|
||||
};
|
||||
|
||||
normalUser = attributes: attributes // {
|
||||
isNormalUser = true;
|
||||
};
|
||||
|
||||
# Q: Can't we just do supply a relative path "./foo" ?
|
||||
|
@ -64,10 +89,8 @@
|
|||
# with the working directory, then changed back after the build.
|
||||
# And yes, this is a major hack.
|
||||
projectPath = "@pwd@";
|
||||
};
|
||||
|
||||
modules = [
|
||||
configDirectory
|
||||
} [
|
||||
configurationDirectory
|
||||
home-manager.nixosModules.home-manager
|
||||
|
||||
{
|
||||
|
@ -84,10 +107,5 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
builtins.foldl' nixpkgs.lib.recursiveUpdate {} (builtins.map importConfiguration [
|
||||
./machines/asus
|
||||
]);
|
||||
in builtins.foldl' nixpkgs.lib.recursiveUpdate {} (builtins.map importConfiguration machines);
|
||||
}
|
||||
|
|
|
@ -1,24 +1,36 @@
|
|||
{ homeManagerConfiguration, ... }:
|
||||
{ systemConfiguration, homeConfiguration, imports, ... }:
|
||||
|
||||
{
|
||||
system.stateVersion = "22.11";
|
||||
|
||||
imports = [
|
||||
(imports [
|
||||
./discord
|
||||
./docker
|
||||
./firefox
|
||||
./git
|
||||
./intellij
|
||||
./libreoffice
|
||||
./neovim
|
||||
./networkmanager
|
||||
./nixpkgs
|
||||
./nushell
|
||||
./openttd
|
||||
./pipewire
|
||||
./system
|
||||
./users
|
||||
./qbittorrent
|
||||
./wine
|
||||
./xserver
|
||||
];
|
||||
}
|
||||
|
||||
./fonts.nix
|
||||
./hardware.nix
|
||||
./localisation.nix
|
||||
./packages.nix
|
||||
./user.nix
|
||||
])
|
||||
|
||||
//
|
||||
|
||||
(homeManagerConfiguration "nixos" {
|
||||
(systemConfiguration {
|
||||
system.stateVersion = "22.11";
|
||||
})
|
||||
|
||||
//
|
||||
|
||||
(homeConfiguration "nixos" {
|
||||
home.stateVersion = "22.11";
|
||||
})
|
||||
|
|
5
machines/asus/discord/default.nix
Normal file
5
machines/asus/discord/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ pkgs, packages, ... }:
|
||||
|
||||
with pkgs; packages [
|
||||
discord
|
||||
]
|
|
@ -1,5 +1,5 @@
|
|||
{ ... }:
|
||||
{ systemConfiguration, enabled, ... }:
|
||||
|
||||
{
|
||||
virtualisation.docker.enable = true;
|
||||
systemConfiguration {
|
||||
virtualisation.docker = enabled {};
|
||||
}
|
||||
|
|
5
machines/asus/firefox/default.nix
Normal file
5
machines/asus/firefox/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ systemConfiguration, enabled, ... }:
|
||||
|
||||
systemConfiguration {
|
||||
programs.firefox = enabled {};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
pkgs: with pkgs; []
|
||||
{ pkgs, fonts, ... }:
|
||||
|
||||
++ [ # NERD FONTS
|
||||
with pkgs; fonts [
|
||||
(nerdfonts.override {
|
||||
fonts = [
|
||||
"JetBrainsMono"
|
|
@ -1,8 +1,7 @@
|
|||
{ homeManagerConfiguration, ... }:
|
||||
{ homeConfiguration, enabled, ... }:
|
||||
|
||||
homeManagerConfiguration "nixos" {
|
||||
programs.git.enable = true;
|
||||
programs.git = {
|
||||
homeConfiguration "nixos" {
|
||||
programs.git = enabled {
|
||||
userName = "RGBCube";
|
||||
userEmail = "RGBCube@users.noreply.github.com";
|
||||
|
||||
|
|
40
machines/asus/hardware.nix
Normal file
40
machines/asus/hardware.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ systemConfiguration, ... }:
|
||||
|
||||
systemConfiguration {
|
||||
powerManagement.cpuFreqGovernor = "performance";
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"ahci"
|
||||
"sd_mod"
|
||||
"sr_mod"
|
||||
"usb_storage"
|
||||
"usbhid"
|
||||
"xhci_pci"
|
||||
];
|
||||
|
||||
boot.kernelModules = [
|
||||
"kvm-intel"
|
||||
];
|
||||
|
||||
boot.loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
efi.efiSysMountPoint = "/boot/efi";
|
||||
};
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/d0e4626c-507e-484a-9ecc-94817d889083";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot/efi" = {
|
||||
device = "/dev/disk/by-uuid/A467-98D1";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/dev/disk/by-uuid/10bfe7d8-1daf-4c65-a5a6-cf3c9a085478";
|
||||
}
|
||||
];
|
||||
}
|
5
machines/asus/intellij/default.nix
Normal file
5
machines/asus/intellij/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ pkgs, packages, ... }:
|
||||
|
||||
with pkgs.jetbrains; packages [
|
||||
idea-ultimate
|
||||
]
|
7
machines/asus/libreoffice/default.nix
Normal file
7
machines/asus/libreoffice/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ pkgs, packages, ... }:
|
||||
|
||||
with pkgs; packages [
|
||||
libreoffice
|
||||
hunspellDicts.en_US
|
||||
hunspellDicts.en_GB-ize
|
||||
]
|
|
@ -1,6 +1,6 @@
|
|||
{ ... }:
|
||||
{ systemConfiguration, ... }:
|
||||
|
||||
{
|
||||
systemConfiguration {
|
||||
services.xserver.layout = "tr";
|
||||
console.keyMap = "trq";
|
||||
|
|
@ -1,23 +1,21 @@
|
|||
{ pkgs, lib, homeManagerConfiguration, projectPath, ... }:
|
||||
{ lib, pkgs, systemConfiguration, homeConfiguration, packages, enabled, projectPath, ... }:
|
||||
|
||||
{
|
||||
# Nuking nano out of orbit.
|
||||
(systemConfiguration {
|
||||
environment.defaultPackages = [];
|
||||
programs.nano.syntaxHighlight = false;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
neovim-qt
|
||||
];
|
||||
}
|
||||
})
|
||||
|
||||
//
|
||||
|
||||
(homeManagerConfiguration "nixos" ({ config, ... }: {
|
||||
programs.neovim.enable = true;
|
||||
programs.neovim = {
|
||||
# Does not work with Nushell for some reason, I just set it manually.
|
||||
# defaultEditor = true;
|
||||
(with pkgs; packages [
|
||||
neovim-qt
|
||||
])
|
||||
|
||||
//
|
||||
|
||||
(homeConfiguration "nixos" ({ config, ... }: {
|
||||
programs.neovim = enabled {
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 3dd0fa6c5b0933d9a395e2492de69c151831c66e
|
|
@ -1,5 +1,5 @@
|
|||
{ ... }:
|
||||
{ systemConfiguration, enabled, ... }:
|
||||
|
||||
{
|
||||
networking.networkmanager.enable = true;
|
||||
systemConfiguration {
|
||||
networking.networkmanager = enabled {};
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.systemPackages = import ./packages.nix pkgs;
|
||||
fonts.fonts = import ./fonts.nix pkgs;
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
pkgs: with pkgs; []
|
||||
|
||||
++ [ # APPLICATIONS
|
||||
firefox
|
||||
discord
|
||||
qbittorrent
|
||||
]
|
||||
|
||||
++ [ # DEVELOPMENT TOOLS
|
||||
bat
|
||||
]
|
||||
|
||||
++ [ # EDITORS
|
||||
jetbrains.idea-ultimate
|
||||
]
|
||||
|
||||
++ [ # EMULATION
|
||||
wine
|
||||
]
|
||||
|
||||
++ [ # FIRMWARE
|
||||
linux-firmware
|
||||
]
|
||||
|
||||
++ [ # GAMES
|
||||
openttd
|
||||
]
|
||||
|
||||
++ [ # LIBREOFFICE
|
||||
libreoffice
|
||||
hunspellDicts.en_US
|
||||
hunspellDicts.en_GB-ize
|
||||
]
|
||||
|
||||
++ [ # MISCELLANEOUS
|
||||
htop
|
||||
neofetch
|
||||
]
|
||||
|
||||
++ [ # PLASMA THEMES
|
||||
lightly-qt
|
||||
]
|
||||
|
||||
++ [ # COMPILERS & TOOLING
|
||||
gcc
|
||||
go
|
||||
(fenix.complete.withComponents [
|
||||
"rustc"
|
||||
"rust-src"
|
||||
"cargo"
|
||||
"rustfmt"
|
||||
"clippy"
|
||||
])
|
||||
]
|
||||
|
||||
++ [ # PYTHON
|
||||
(python311.withPackages (pkgs: with pkgs; [
|
||||
pip
|
||||
requests
|
||||
]))
|
||||
virtualenv
|
||||
poetry
|
||||
]
|
|
@ -1,16 +1,22 @@
|
|||
{ homeManagerConfiguration, ... }:
|
||||
{ pkgs, systemConfiguration, homeConfiguration, enabled, ... }:
|
||||
|
||||
homeManagerConfiguration "nixos" {
|
||||
programs.starship.enable = true;
|
||||
programs.starship.settings.character = {
|
||||
(systemConfiguration {
|
||||
users.defaultUserShell = pkgs.nushell;
|
||||
})
|
||||
|
||||
//
|
||||
|
||||
(homeConfiguration "nixos" {
|
||||
programs.starship = enabled {
|
||||
settings.character = {
|
||||
success_symbol = "";
|
||||
error_symbol = "";
|
||||
};
|
||||
};
|
||||
|
||||
programs.nushell.enable = true;
|
||||
programs.nushell = {
|
||||
configFile.source = ./config.nu;
|
||||
envFile.source = ./env.nu;
|
||||
programs.nushell = enabled {
|
||||
configFile.source = ./configuration.nu;
|
||||
envFile.source = ./environment.nu;
|
||||
|
||||
environmentVariables = {
|
||||
EDITOR = "nvim";
|
||||
|
@ -35,4 +41,4 @@ homeManagerConfiguration "nixos" {
|
|||
p = "python3";
|
||||
};
|
||||
};
|
||||
}
|
||||
})
|
||||
|
|
5
machines/asus/openttd/default.nix
Normal file
5
machines/asus/openttd/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ pkgs, packages, ... }:
|
||||
|
||||
with pkgs; packages [
|
||||
openttd
|
||||
]
|
27
machines/asus/packages.nix
Normal file
27
machines/asus/packages.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ pkgs, packages, ... }:
|
||||
|
||||
with pkgs; packages [
|
||||
bat
|
||||
htop
|
||||
neofetch
|
||||
|
||||
lightly-qt
|
||||
|
||||
gcc
|
||||
go
|
||||
|
||||
(fenix.complete.withComponents [
|
||||
"rustc"
|
||||
"rust-src"
|
||||
"cargo"
|
||||
"rustfmt"
|
||||
"clippy"
|
||||
])
|
||||
|
||||
(python311.withPackages (pkgs: with pkgs; [
|
||||
pip
|
||||
requests
|
||||
]))
|
||||
virtualenv
|
||||
poetry
|
||||
]
|
|
@ -1,14 +1,14 @@
|
|||
{ ... }:
|
||||
{ systemConfiguration, enabled, ... }:
|
||||
|
||||
{
|
||||
sound.enable = true;
|
||||
services.pipewire.enable = true;
|
||||
services.pipewire = {
|
||||
pulse.enable = true;
|
||||
systemConfiguration {
|
||||
security.rtkit = enabled {};
|
||||
sound = enabled {};
|
||||
|
||||
alsa.enable = true;
|
||||
alsa.support32Bit = true;
|
||||
services.pipewire = enabled {
|
||||
pulse = enabled {};
|
||||
|
||||
alsa = enabled {
|
||||
support32Bit = true;
|
||||
};
|
||||
};
|
||||
|
||||
security.rtkit.enable = true; # Needed for PulseAudio.
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
"x86_64-linux"
|
5
machines/asus/qbittorrent/default.nix
Normal file
5
machines/asus/qbittorrent/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ pkgs, packages, ... }:
|
||||
|
||||
with pkgs; packages [
|
||||
qbittorrent
|
||||
]
|
|
@ -1,5 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
hardware.bluetooth.enable = true;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
boot.initrd.availableKernelModules = [
|
||||
"ahci"
|
||||
"sd_mod"
|
||||
"sr_mod"
|
||||
"usb_storage"
|
||||
"usbhid"
|
||||
"xhci_pci"
|
||||
];
|
||||
|
||||
boot.kernelModules = [
|
||||
"kvm-intel"
|
||||
];
|
||||
|
||||
boot.loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
efi.efiSysMountPoint = "/boot/efi";
|
||||
};
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./bluetooth.nix
|
||||
./boot.nix
|
||||
./filesystem.nix
|
||||
./localisation.nix
|
||||
./performance.nix
|
||||
];
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/d0e4626c-507e-484a-9ecc-94817d889083";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot/efi" = {
|
||||
device = "/dev/disk/by-uuid/A467-98D1";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/dev/disk/by-uuid/10bfe7d8-1daf-4c65-a5a6-cf3c9a085478";
|
||||
}
|
||||
];
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
powerManagement.cpuFreqGovernor = "performance";
|
||||
}
|
|
@ -1,9 +1,8 @@
|
|||
{ ... }:
|
||||
{ systemConfiguration, normalUser, ... }:
|
||||
|
||||
{
|
||||
users.users.nixos = {
|
||||
systemConfiguration {
|
||||
users.users.nixos = normalUser {
|
||||
description = "NixOS";
|
||||
isNormalUser = true;
|
||||
|
||||
extraGroups = [
|
||||
"wheel"
|
|
@ -1,9 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
users.defaultUserShell = pkgs.nushell;
|
||||
|
||||
imports = [
|
||||
./nixos.nix
|
||||
];
|
||||
}
|
5
machines/asus/wine/default.nix
Normal file
5
machines/asus/wine/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{ pkgs, packages, ... }:
|
||||
|
||||
with pkgs; packages [
|
||||
wine
|
||||
]
|
|
@ -1,9 +1,8 @@
|
|||
{ ... }:
|
||||
{ systemConfiguration, enabled, ... }:
|
||||
|
||||
{
|
||||
services.xserver.enable = true;
|
||||
services.xserver = {
|
||||
displayManager.sddm.enable = true;
|
||||
desktopManager.plasma5.enable = true;
|
||||
systemConfiguration {
|
||||
services.xserver = enabled {
|
||||
displayManager.sddm = enabled {};
|
||||
desktopManager.plasma5 = enabled {};
|
||||
};
|
||||
}
|
||||
|
|
10
rebuild.sh
10
rebuild.sh
|
@ -1,11 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [[ $1 == "--help" || $1 == "-h" ]]; then
|
||||
echo "Usage: rebuild.sh [-h | --help] [-c | --clean-garbage] [machine]"
|
||||
if [[ $1 == "-h" || $1 == "--help" ]]; then
|
||||
echo "Usage: $0 [-h | --help] [-c | --clean-garbage] [machine]"
|
||||
exit
|
||||
fi
|
||||
|
||||
sudo true
|
||||
fi<
|
||||
|
||||
if [[ -n $1 ]]; then
|
||||
if [[ $1 != "-c" && $1 != "--clean-garbage" ]]; then
|
||||
|
@ -19,6 +17,8 @@ else
|
|||
read -p "What machine would you want to build? [$(ls --format=commas machines)]: " machine
|
||||
fi
|
||||
|
||||
sudo true
|
||||
|
||||
sed -ie "s|@pwd@|$PWD|g" flake.nix
|
||||
|
||||
sudo nixos-rebuild switch --impure --flake .#$machine
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue